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

@@ -22,3 +22,19 @@ export const defaultModel = isGeneric ? (process.env.MODEL_NAME ?? 'default') :
export const miniModel = isGeneric ? (process.env.MODEL_NAME ?? 'default') : 'gpt-5.4-mini';
export const serviceOptions = isGeneric ? {} : { service_tier: 'flex' as const };
export const supportsWebSearch = !isGeneric;
export async function parseWithRetry<T>(fn: () => Promise<T>, retries = 2): Promise<T> {
let lastErr: unknown;
for (let attempt = 0; attempt <= retries; attempt++) {
try {
return await fn();
} catch (err) {
if (err instanceof SyntaxError && attempt < retries) {
lastErr = err;
continue;
}
throw err;
}
}
throw lastErr;
}