Summary
forge's runtime supports three model providers today — anthropic, openai, and bedrock. Add Google Gemini as a first-class native provider (provider: gemini), covering both Vertex AI and the Gemini Developer API.
Model this on the native AWS Bedrock Converse provider (#205), not on the openai path.
Why native (not the OpenAI-compat shim)
Gemini's native API is a distinct wire format — generateContent / streamGenerateContent with contents[].parts[], roles user/model, systemInstruction, tools:[{functionDeclarations}], and generationConfig — not chat-completions and not Responses. Google does expose an OpenAI-compatible chat/completions endpoint, but routing through it drops Gemini-native features (Google Search grounding, thinking config, safety settings). So this should be a native provider that speaks generateContent, exactly as bedrock speaks Converse.
Scope
- Provider impl —
forge-core/llm/providers/gemini.go implementing the provider interface (streaming via streamGenerateContent), translating forge's message/tool model to/from Gemini's contents/parts (roles user/model), systemInstruction, functionDeclarations, and generationConfig. Mirror bedrock.go / bedrock_eventstream.go.
- Factory + client — register
gemini in forge-core/llm/providers/factory.go; wire in forge-core/llm/client.go.
- Config + validation —
provider: gemini in forge-core/types/config.go; in forge-core/validate/forge_config.go require the Vertex fields (project + location/region) when in Vertex mode, or an API key for the Developer API — analogous to bedrock requiring aws_region.
- Auth — Vertex AI via Google ADC / service account (the google-auth chain); Gemini Developer API via API key. Support a
base_url override for routing (the ANTHROPIC_BASE_URL analog).
forge init — offer Google Gemini as a first-class provider in the TUI and non-interactively (--model-provider gemini + the Vertex project/region or API key), with a default Gemini model list.
- Tests — mirror
bedrock_test.go / responses_test.go (wire-format translation, streaming, tool calls, validation).
Acceptance
Summary
forge's runtime supports three model providers today —
anthropic,openai, andbedrock. Add Google Gemini as a first-class native provider (provider: gemini), covering both Vertex AI and the Gemini Developer API.Model this on the native AWS Bedrock Converse provider (#205), not on the
openaipath.Why native (not the OpenAI-compat shim)
Gemini's native API is a distinct wire format —
generateContent/streamGenerateContentwithcontents[].parts[], rolesuser/model,systemInstruction,tools:[{functionDeclarations}], andgenerationConfig— not chat-completions and not Responses. Google does expose an OpenAI-compatiblechat/completionsendpoint, but routing through it drops Gemini-native features (Google Search grounding, thinking config, safety settings). So this should be a native provider that speaksgenerateContent, exactly asbedrockspeaks Converse.Scope
forge-core/llm/providers/gemini.goimplementing the provider interface (streaming viastreamGenerateContent), translating forge's message/tool model to/from Gemini'scontents/parts(rolesuser/model),systemInstruction,functionDeclarations, andgenerationConfig. Mirrorbedrock.go/bedrock_eventstream.go.geminiinforge-core/llm/providers/factory.go; wire inforge-core/llm/client.go.provider: geminiinforge-core/types/config.go; inforge-core/validate/forge_config.gorequire the Vertex fields (project + location/region) when in Vertex mode, or an API key for the Developer API — analogous tobedrockrequiringaws_region.base_urloverride for routing (theANTHROPIC_BASE_URLanalog).forge init— offer Google Gemini as a first-class provider in the TUI and non-interactively (--model-provider gemini+ the Vertex project/region or API key), with a default Gemini model list.bedrock_test.go/responses_test.go(wire-format translation, streaming, tool calls, validation).Acceptance
provider: geminiruns an agent against a Gemini model (Vertex AI and Developer API), with streamingfunctionDeclarations) round-tripforge validateenforces the required Gemini/Vertex configforge initoffers Gemini as a first-class provider