Genkit JS API reference
    Preparing search index...

    Variable retryConst

    retry: GenerateMiddleware<typeof RetryOptionsSchema> = ...

    Creates a middleware that retries requests on specific error statuses.

    const { text } = await ai.generate({
    model: googleAI.model('gemini-2.5-pro'),
    prompt: 'You are a helpful AI assistant named Walt, say hello',
    use: [
    retry({
    maxRetries: 2,
    initialDelayMs: 1000,
    backoffFactor: 2,
    }),
    ],
    });