fixing api calls
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user