Latest Results
feat: Add Google AI provider with prompt (#5640)
This PR adds a new Google Gemini AI provider to Daft, enabling users to
leverage Google's Gemini models for text generation, multimodal
processing, and structured outputs through the
`daft.functions.ai.prompt()` API.
## Changes
**New Files:**
- `daft/ai/google/` - Complete Google provider implementation
- `__init__.py` - Module exports
- `typing.py` - Type definitions for Google provider options
- `provider.py` - `GoogleProvider` class
- `protocols/prompter.py` - `GooglePrompter` implementation
**Modified Files:**
- `pyproject.toml` - Added `google = ["google-genai"]` optional
dependency
- `daft/ai/provider.py` - Registered Google provider in the provider
registry
### Features
- **Text Generation** - Full support for text prompts using Gemini
models
- **Multimodal Inputs** - Handle images (numpy arrays, bytes, files) and
documents (text, PDF)
- **Structured Outputs** - Pydantic model support for JSON schema
outputs
- **System Messages** - Custom system instructions
- **Token Metrics** - Full metrics recording for usage tracking
- **Text File Support** - Text file content is wrapped in XML tags to
clarify prompt injection
### Testing
**Unit Tests** (10 tests):
- `tests/ai/google/test_google_provider.py` - Provider instantiation and
configuration
- `tests/ai/google/test_google_prompter.py` - Prompter functionality
with mocked API
**Integration Tests** (9 tests):
- `tests/integration/ai/test_google.py` - End-to-end testing with live
Gemini API
- Plain text generation
- Structured outputs
- Image inputs (numpy, bytes, file)
- Document processing (text, PDF)
- Image + structured output
- Mixed multimodal (image + PDF)
## Related Issues
https://github.com/Eventual-Inc/Daft/issues/5621
## Checklist
- [ ] Documented in API Docs (if applicable)
- [ ] Documented in User Guide (if applicable)
- [ ] If adding a new documentation page, doc is added to
`docs/mkdocs.yml` navigation
- [ ] Documentation builds and is formatted properly
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Active Branches
#54230%
#56190%
#56630%
© 2025 CodSpeed Technology