changes and improvements
All checks were successful
Recommender Build and Deploy (internal) / Build Recommender Image (push) Successful in 5m40s
Recommender Build and Deploy (internal) / Deploy Recommender (internal) (push) Successful in 38s

This commit is contained in:
2026-04-01 18:31:14 -03:00
parent a73bc27356
commit 39edec4a7c
10 changed files with 114 additions and 31 deletions

View File

@@ -7,7 +7,10 @@ const CuratorSchema = z.object({
shows: z.array(z.object({
title: z.string(),
explanation: z.string(),
category: z.enum(["Definitely Like", "Might Like", "Questionable", "Will Not Like"])
category: z.enum(["Full Match", "Definitely Like", "Might Like", "Questionable", "Will Not Like"]),
genre: z.string(),
pros: z.array(z.string()).max(3),
cons: z.array(z.string()).max(3)
}))
});
@@ -20,6 +23,7 @@ export async function runCurator(
const mediaLabel = mediaType === 'movie' ? 'movie' : 'TV show';
const allShows = [
...(ranking.full_match ?? []).map((t) => ({ title: t, category: 'Full Match' as const })),
...ranking.definitely_like.map((t) => ({ title: t, category: 'Definitely Like' as const })),
...ranking.might_like.map((t) => ({ title: t, category: 'Might Like' as const })),
...ranking.questionable.map((t) => ({ title: t, category: 'Questionable' as const })),
@@ -39,19 +43,22 @@ export async function runCurator(
...serviceOptions,
...(canSearch ? { tools: [{ type: 'web_search' as const }] } : {}),
text: { format: zodTextFormat(CuratorSchema, "shows") },
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.' : ''}
instructions: `You are a ${mediaLabel} recommendation curator. For each ${mediaLabel}, write a concise explanation and surface the most useful details for the user.${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
- explanation: 1-2 sentences explaining why it was assigned to its category, referencing specific user preferences
- genre: 1-3 words capturing the most prominent genre of the title (e.g. "Crime Drama", "Sci-Fi Thriller", "Romantic Comedy")
- pros: up to 3 short bullet points about what this title does well relative to the user's taste
- cons: up to 3 short bullet points about what the user might not like based on their preferences
- 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)}
Tone: ${JSON.stringify(interpreter.tone)}
Character preferences: ${JSON.stringify(interpreter.character_preferences)}
Avoid: ${JSON.stringify(interpreter.avoid)}
Liked: ${interpreter.liked.join(', ') || '(none)'}
Themes: ${interpreter.themes.join(', ') || '(none)'}
Tone: ${interpreter.tone.join(', ') || '(none)'}
Character preferences: ${interpreter.character_preferences.join(', ') || '(none)'}
Avoid: ${interpreter.avoid.join(', ') || '(none)'}
Requirements: ${interpreter.requirements.join(', ') || '(none)'}
${mediaLabel}s to describe:
${showList}`,