feat(core): Add content-based retries for JSON generation (#9264)

This commit is contained in:
Sandy Tao
2025-09-29 12:27:15 -07:00
committed by GitHub
parent 042288e72c
commit ac4a79223a
7 changed files with 145 additions and 69 deletions

View File

@@ -137,10 +137,11 @@ describe('retryWithBackoff', () => {
const mockFn = vi.fn(async () => {
throw new NonRetryableError('Non-retryable error');
});
const shouldRetry = (error: Error) => !(error instanceof NonRetryableError);
const shouldRetryOnError = (error: Error) =>
!(error instanceof NonRetryableError);
const promise = retryWithBackoff(mockFn, {
shouldRetry,
shouldRetryOnError,
initialDelayMs: 10,
});