adding movies & web search tool
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { openai } from '../agent.js';
|
||||
import type { InterpreterOutput, RankingOutput, CuratorOutput } from '../types/agents.js';
|
||||
import type { InterpreterOutput, RankingOutput, CuratorOutput, MediaType } from '../types/agents.js';
|
||||
import { z } from 'zod';
|
||||
import { zodTextFormat } from 'openai/helpers/zod';
|
||||
|
||||
@@ -14,7 +14,11 @@ const CuratorSchema = z.object({
|
||||
export async function runCurator(
|
||||
ranking: RankingOutput,
|
||||
interpreter: InterpreterOutput,
|
||||
mediaType: MediaType = 'tv_show',
|
||||
useWebSearch = false,
|
||||
): Promise<CuratorOutput[]> {
|
||||
const mediaLabel = mediaType === 'movie' ? 'movie' : 'TV show';
|
||||
|
||||
const allShows = [
|
||||
...ranking.definitely_like.map((t) => ({ title: t, category: 'Definitely Like' as const })),
|
||||
...ranking.might_like.map((t) => ({ title: t, category: 'Might Like' as const })),
|
||||
@@ -32,17 +36,15 @@ export async function runCurator(
|
||||
model: 'gpt-5.4',
|
||||
temperature: 0.5,
|
||||
service_tier: 'flex',
|
||||
tools: [
|
||||
{ type: 'web_search' }
|
||||
],
|
||||
...(useWebSearch ? { tools: [{ type: 'web_search' as const }] } : {}),
|
||||
text: { format: zodTextFormat(CuratorSchema, "shows") },
|
||||
instructions: `You are a TV show recommendation curator. For each show, write a concise 1-2 sentence explanation of why it was assigned to its category based on the user's preferences.
|
||||
instructions: `You are a ${mediaLabel} recommendation curator. For each ${mediaLabel}, write a concise 1-2 sentence explanation of why it was assigned to its category based on the user's preferences.${useWebSearch ? '\n\nUse web search to verify details and enrich explanations with accurate information.' : ''}
|
||||
|
||||
Rules:
|
||||
- Preserve the exact title and category as given
|
||||
- Keep explanations concise (1-2 sentences max)
|
||||
- Reference specific user preferences in the explanation
|
||||
- Be honest — explain why "Questionable" or "Will Not Like" shows got that rating`,
|
||||
- Be honest — explain why "Questionable" or "Will Not Like" ${mediaLabel}s got that rating`,
|
||||
input: `User preferences summary:
|
||||
Liked: ${JSON.stringify(interpreter.liked)}
|
||||
Themes: ${JSON.stringify(interpreter.themes)}
|
||||
@@ -50,7 +52,7 @@ Tone: ${JSON.stringify(interpreter.tone)}
|
||||
Character preferences: ${JSON.stringify(interpreter.character_preferences)}
|
||||
Avoid: ${JSON.stringify(interpreter.avoid)}
|
||||
|
||||
Shows to describe:
|
||||
${mediaLabel}s to describe:
|
||||
${showList}`,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user