adding movies & web search tool
All checks were successful
Recommender Build and Deploy (internal) / Build Recommender Image (push) Successful in 4m0s
Recommender Build and Deploy (internal) / Deploy Recommender (internal) (push) Successful in 12s

This commit is contained in:
2026-03-26 20:35:22 -03:00
parent 6fdfc3797a
commit 1437092a42
25 changed files with 450 additions and 135 deletions

View File

@@ -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}`,
});