adding buckets!
All checks were successful
Recommender Build and Deploy (internal) / Build Recommender Image (push) Successful in 5m42s
Recommender Build and Deploy (internal) / Deploy Recommender (internal) (push) Successful in 39s

This commit is contained in:
2026-03-31 16:42:16 -03:00
parent 77757ace5e
commit be2d8d70cb
2 changed files with 84 additions and 20 deletions

View File

@@ -31,7 +31,7 @@ export async function runRanking(
chunks.push(filtered.slice(i, i + CHUNK_SIZE));
}
const allBuckets: RankingOutput = {
const allTags: RankingOutput = {
definitely_like: [],
might_like: [],
questionable: [],
@@ -46,15 +46,15 @@ export async function runRanking(
temperature: 0.2,
...serviceOptions,
text: { format: zodTextFormat(RankingSchema, "ranking") },
instructions: `You are a ${mediaLabel} ranking critic. Assign each ${mediaLabel} to exactly one of four confidence buckets based on how well it matches the user's preferences.
instructions: `You are a ${mediaLabel} ranking critic. Assign each ${mediaLabel} to exactly one of four confidence tags based on how well it matches the user's preferences.
Buckets:
Tags:
- "definitely_like": Near-perfect match to all preferences
- "might_like": Strong match to most preferences
- "questionable": Partial alignment, some aspects don't match
- "will_not_like": Likely mismatch, conflicts with preferences or avoidance criteria
Every ${mediaLabel} in the input must appear in exactly one bucket. Use the title exactly as given.`,
Every ${mediaLabel} in the input must appear in exactly one tag. Use the title exactly as given.`,
input: `User preferences:
Liked ${mediaLabel}s: ${JSON.stringify(interpreter.liked)}
Themes: ${JSON.stringify(interpreter.themes)}
@@ -68,11 +68,11 @@ ${chunkTitles}`,
const chunkResult = (response.output_parsed as Partial<RankingOutput>) ?? {};
allBuckets.definitely_like.push(...(chunkResult.definitely_like ?? []));
allBuckets.might_like.push(...(chunkResult.might_like ?? []));
allBuckets.questionable.push(...(chunkResult.questionable ?? []));
allBuckets.will_not_like.push(...(chunkResult.will_not_like ?? []));
allTags.definitely_like.push(...(chunkResult.definitely_like ?? []));
allTags.might_like.push(...(chunkResult.might_like ?? []));
allTags.questionable.push(...(chunkResult.questionable ?? []));
allTags.will_not_like.push(...(chunkResult.will_not_like ?? []));
}
return allBuckets;
return allTags;
}