AI SDK Integration
Leveraging the Vercel AI SDK with Daydreams.
Built on top of the Vercel AI SDK, Daydreams seamlessly integrates with different AI providers and models. This means you can easily use any model provider compatible with the Vercel AI SDK ecosystem to power your Daydreams agents.
Configuring the Model
You specify the LLM provider and model when initializing your agent using the
model
property in the createDreams
configuration object. The value for this
property comes directly from the provider functions exported by the respective
Vercel AI SDK provider packages.
Example Usage
First, install the necessary provider package. For example, to use OpenAI models:
Then, import the provider function and pass it to createDreams
:
Other Providers
You can follow the same pattern for other providers:
- Anthropic:
- Groq:
- OpenRouter:
API Keys
Remember to set the necessary API key environment variables for your chosen
provider (e.g., OPENAI_API_KEY
, ANTHROPIC_API_KEY
, GROQ_API_KEY
,
OPENROUTER_API_KEY
). Daydreams relies on the underlying Vercel AI SDK provider
to pick up these keys.
Flexibility
This integration allows you to easily switch between different LLMs and
providers without changing your core agent logic, simply by modifying the
model
configuration and ensuring the correct provider package is installed and
API keys are set.
For a list of available providers and models, refer to the Vercel AI SDK Documentation.