Documentation
¶
Overview ¶
Package gemini implements providers.ModelProvider against the Gemini API (streamGenerateContent with native function calling). It maps RunLore's engine- agnostic exchange (OpenAI-shaped: assistant tool_calls + separate tool messages) onto Gemini's contents/parts form: assistant turns become role "model" with functionCall parts, and tool results coalesce into one role "user" turn of functionResponse parts. Each call/response carries the originating call id, so parallel calls to the same function name correlate by id (Gemini's rule for parallel calls); when the model returns no id, correlation falls back to name.
Streaming is internal: callers see the same one-shot Complete interface, but the request uses :streamGenerateContent?alt=sse and the SSE chunks are accumulated into a single CompletionResponse. Consuming the stream avoids a flat request deadline truncating a long completion.
Index ¶
Constants ¶
const DefaultBaseURL = "https://generativelanguage.googleapis.com"
DefaultBaseURL is the public Gemini API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
clientcore.Base
}
Client is a Gemini (streamGenerateContent) model provider.
func New ¶
New builds a client. baseURL may be empty (defaults to DefaultBaseURL). maxTokens caps output tokens per request; <= 0 falls back to clientcore.DefaultMaxTokens.
func (*Client) Complete ¶
func (c *Client) Complete(ctx context.Context, req providers.CompletionRequest) (providers.CompletionResponse, error)
Complete sends a streaming streamGenerateContent request with tools and accumulates the full SSE response into a single CompletionResponse. Streaming is internal — callers see the same one-shot interface; consuming the stream avoids the flat request deadline truncating a long completion.