adding movies & web search tool
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { openai } from '../agent.js';
|
||||
import type { InterpreterOutput } from '../types/agents.js';
|
||||
import type { InterpreterOutput, MediaType } from '../types/agents.js';
|
||||
import { z } from 'zod';
|
||||
import { zodTextFormat } from 'openai/helpers/zod';
|
||||
|
||||
@@ -17,10 +17,12 @@ interface InterpreterInput {
|
||||
liked_shows: string;
|
||||
disliked_shows: string;
|
||||
themes: string;
|
||||
media_type: MediaType;
|
||||
feedback_context?: string;
|
||||
}
|
||||
|
||||
export async function runInterpreter(input: InterpreterInput): Promise<InterpreterOutput> {
|
||||
const mediaLabel = input.media_type === 'movie' ? 'movie' : 'TV show';
|
||||
const feedbackSection = input.feedback_context
|
||||
? `\n\nUser Feedback Context (incorporate into preferences):\n${input.feedback_context}`
|
||||
: '';
|
||||
@@ -30,7 +32,7 @@ export async function runInterpreter(input: InterpreterInput): Promise<Interpret
|
||||
temperature: 0.2,
|
||||
service_tier: 'flex',
|
||||
text: { format: zodTextFormat(InterpreterSchema, "preferences") },
|
||||
instructions: `You are a TV show preference interpreter. Transform raw user input into structured, normalized preferences.
|
||||
instructions: `You are a ${mediaLabel} preference interpreter. Transform raw user input into structured, normalized preferences.
|
||||
|
||||
Rules:
|
||||
- Extract implicit preferences from the main prompt
|
||||
@@ -39,8 +41,8 @@ Rules:
|
||||
- Do NOT assume anything not stated or clearly implied
|
||||
- Be specific and concrete, not vague`,
|
||||
input: `Main prompt: ${input.main_prompt}
|
||||
Liked shows: ${input.liked_shows || '(none)'}
|
||||
Disliked shows: ${input.disliked_shows || '(none)'}
|
||||
Liked ${mediaLabel}s: ${input.liked_shows || '(none)'}
|
||||
Disliked ${mediaLabel}s: ${input.disliked_shows || '(none)'}
|
||||
Themes and requirements: ${input.themes || '(none)'}${feedbackSection}`,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user