Add Google Gemini provider support

- Add GeminiProvider with streaming and native tool calling
- Support gemini-2.5-pro, gemini-2.0-flash, gemini-1.5-pro/flash models
- Model-specific context window detection (1M-2M tokens)
- Message conversion: assistant -> model role mapping
- System messages extracted to system_instruction field
- Tool schema conversion with functionCall/functionResponse parts
- SSE streaming with JSON array buffer parsing
- 8 unit tests for conversion and parsing logic
- Register provider in g3-core and validate in g3-cli
This commit is contained in:
Dhanji R. Prasanna
2026-01-29 10:11:42 +11:00
parent fe33568ee0
commit 735e9c9312
6 changed files with 860 additions and 2 deletions

View File

@@ -138,7 +138,7 @@ pub fn load_config_with_cli_overrides(cli: &Cli) -> Result<Config> {
// Validate provider if specified
if let Some(ref provider) = cli.provider {
let valid_providers = ["anthropic", "databricks", "embedded", "openai"];
let valid_providers = ["anthropic", "databricks", "embedded", "gemini", "openai"];
let provider_type = provider.split('.').next().unwrap_or(provider);
if !valid_providers.contains(&provider_type) {
return Err(anyhow::anyhow!(