Google Generative AI Provider
The Google Generative AI provider enables you to use Google’s Gemini models for text generation, vision, code execution, and more.Installation
Setup
Get your API key from Google AI Studio and set it as an environment variable:Usage
Basic Text Generation
Streaming Responses
Structured Output
Configuration
Custom Provider Instance
Provider Options
- apiKey: Your Google AI API key (defaults to
GOOGLE_GENERATIVE_AI_API_KEYenv var) - baseURL: Custom API endpoint URL
- headers: Custom headers for requests
Available Models
Gemini 2.0 Family
gemini-2.0-flash- Fast and efficientgemini-2.0-flash-exp- Experimental features
Gemini 1.5 Family
gemini-1.5-pro- Most capable modelgemini-1.5-flash- Fast and cost-effective
Advanced Features
Vision
Code Execution
Google Search Grounding
PDF Support
Embeddings
text-embedding-004(768 dimensions)
Image Generation
imagen-3.0-generate-001- Latest Imagen model
Model Capabilities
| Model | Vision | Tools | Structured Output |
|---|---|---|---|
| gemini-2.0-flash | ✓ | ✓ | ✓ |
| gemini-1.5-pro | ✓ | ✓ | ✓ |
| gemini-1.5-flash | ✓ | ✓ | ✓ |