feat: add native Google Gemini provider and new registry entries#10
Merged
pacifio merged 1 commit intopacifio:mainfrom Apr 9, 2026
Merged
Conversation
…y entries Add a dedicated Gemini provider using Google's native generateContent API instead of the OpenAI-compatible shim. This enables proper support for Gemini-specific features like safety settings, native tool calling via functionCall/functionResponse, and systemInstruction. Also adds Cohere and SambaNova as OpenAI-compatible registry entries with auto-detect support for command-r model prefixes.
Owner
|
These seem good, thanks for the contribution @renezander030 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gemini.rs) using Google'sgenerateContentAPI instead of routing through the OpenAI-compatible shim. Supports streaming, tool calling viafunctionCall/functionResponse,systemInstruction, safety settings, and usage token tracking.ApiFormat::Googlevariant in the registry and router so the Gemini provider is selected automatically when usinggoogle/gemini-*model strings.command-r*model prefixes.Details
The existing setup routed Google Gemini through their OpenAI-compat endpoint (
/v1beta/openai), which works but limits access to native Gemini features. The new provider talks directly to thegenerateContentstreaming API, following the sameProvidertrait pattern asAnthropicandOpenAi.Provider count goes from 13 to 15 (Cohere, SambaNova). All existing tests pass plus 3 new tests for the added providers.
Test plan
cargo checkpasses with no new warningscargo test -p cersei-provider-- all 9 tests pass (6 existing + 3 new)from_model_string("google/gemini-2.0-flash")returns aGeminiprovider (requiresGOOGLE_API_KEY)from_model_string("cohere/command-r-plus")returns an OpenAI-compat provider (requiresCOHERE_API_KEY)from_model_string("command-r-plus")auto-detects CohereAddresses #3