new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Cookbook · all subjects

multi-modal/providers

6 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Switch multi-modal agent to other providers

The AI SDK provides a unified provider interface that allows switching between providers that support multi-modal capabilities. Change the model string in streamText: 'anthropic/claude-sonnet-4-20250514' for Anthropic, 'google/gemini-2.5-flash' for Google. Install the corresponding provider package (@ai-sdk/anthropic or @ai-sdk/google) and update the API keys in .env.local. The rest of the code remains unchanged.

Provider switching code examples

```tsx // Using Anthropic const result = streamText({ model: 'anthropic/claude-sonnet-4-20250514', messages: await convertToModelMessages(messages), }); // Using Google const result = streamText({ model: 'google/gemini-2.5-flash', messages: await convertToModelMessages(messages), }); ``` Examples showing how to switch between different multi-modal capable providers by changing only the model string.

Multi-modal provider file size and performance considerations

Different providers may have varying file size limits and performance characteristics for multi-modal processing. Check the provider documentation at /providers/ai-sdk-providers for specific details about each provider's capabilities and limitations.

PDF chat requires provider support

Chat with PDFs requires a language model provider that supports PDF processing. Supported models include Anthropic's Claude 3.7, Google's Gemini 2.5, and OpenAI's GPT-4.1. Check the provider documentation at /providers/ai-sdk-providers for current support information.

PDF file support by provider

PDF file inputs are supported by: Anthropic, OpenAI, Google Gemini, and Google Vertex AI. This feature is not available on all models and providers.

File provider references across multiple providers

When using multiple providers with file references, provider-specific IDs in file-id and image-file-id types should be specified using a Record option where the key is the provider name (e.g., 'openai' or 'anthropic'). Similarly, file-reference and image-file-reference types use providerReference which is a Record of provider names to their specific references.

Give your agent this brain