Creates a middleware that falls back to a different model on specific error statuses.
const { text } = awaitai.generate({ model:googleAI.model('gemini-2.5-pro'), prompt:'You are a helpful AI assistant named Walt, say hello', use: [ fallback({ models: [googleAI.model('gemini-2.5-flash')], statuses: ['RESOURCE_EXHAUSTED'], }), ], });
Creates a middleware that falls back to a different model on specific error statuses.