mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-11 22:51:00 -07:00
fix(core): set default maxAttempts in baseLLMClient (#9533)
This commit is contained in:
@@ -207,7 +207,7 @@ describe('BaseLlmClient', () => {
|
||||
await client.generateJson(defaultOptions);
|
||||
|
||||
expect(retryWithBackoff).toHaveBeenCalledWith(expect.any(Function), {
|
||||
maxAttempts: undefined,
|
||||
maxAttempts: 5,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -19,6 +19,8 @@ import { logMalformedJsonResponse } from '../telemetry/loggers.js';
|
||||
import { MalformedJsonResponseEvent } from '../telemetry/types.js';
|
||||
import { retryWithBackoff } from '../utils/retry.js';
|
||||
|
||||
const DEFAULT_MAX_ATTEMPTS = 5;
|
||||
|
||||
/**
|
||||
* Options for the generateJson utility function.
|
||||
*/
|
||||
@@ -105,7 +107,9 @@ export class BaseLlmClient {
|
||||
promptId,
|
||||
);
|
||||
|
||||
const result = await retryWithBackoff(apiCall, { maxAttempts });
|
||||
const result = await retryWithBackoff(apiCall, {
|
||||
maxAttempts: maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
||||
});
|
||||
|
||||
let text = getResponseText(result)?.trim();
|
||||
if (!text) {
|
||||
|
||||
Reference in New Issue
Block a user