fixing api calls
All checks were successful
Recommender Build and Deploy (internal) / Build Recommender Image (push) Successful in 4m4s
Recommender Build and Deploy (internal) / Deploy Recommender (internal) (push) Successful in 10s

This commit is contained in:
2026-04-03 01:15:47 -03:00
parent 0c704cf2f6
commit a7d12acce6
6 changed files with 63 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
import { openai, defaultModel, serviceOptions } from '../agent.js';
import { openai, defaultModel, serviceOptions, parseWithRetry } from '../agent.js';
import type { InterpreterOutput, MediaType } from '../types/agents.js';
import { z } from 'zod';
import { zodTextFormat } from 'openai/helpers/zod';
@@ -28,7 +28,7 @@ export async function runInterpreter(input: InterpreterInput): Promise<Interpret
? `\n\nUser Feedback Context (incorporate into preferences):\n${input.feedback_context}`
: '';
const response = await openai.responses.parse({
const response = await parseWithRetry(() => openai.responses.parse({
model: defaultModel,
temperature: 0.2,
...serviceOptions,
@@ -46,7 +46,7 @@ Rules:
Liked ${mediaLabel}s: ${input.liked_shows || '(none)'}
Disliked ${mediaLabel}s: ${input.disliked_shows || '(none)'}
Themes and requirements: ${input.themes || '(none)'}${feedbackSection}`,
});
}));
return (response.output_parsed as InterpreterOutput) ?? {
liked: [], disliked: [], themes: [], character_preferences: [], tone: [], avoid: [], requirements: []