Documentation
¶
Overview ¶
Package google is a streaming LLM service backed by Google's Gemini API (generateContent with SSE). It consumes an LLMContextFrame and emits the response as LLM response frames, like every other jargo LLM service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// APIKey is the Gemini API key. Required.
APIKey string `validate:"required"`
// Model is the model id; empty uses a low-latency flash default.
Model string
// MaxTokens caps the response length; 0 uses a small default suited to voice.
MaxTokens int
// Temperature is the sampling temperature (0.0 to 2.0); nil omits it.
Temperature *float64
// TopP is the nucleus-sampling parameter (0.0 to 1.0); nil omits it.
TopP *float64
// TopK is the top-k sampling parameter; nil omits it.
TopK *int
// Extra sets arbitrary additional generationConfig fields not modeled above,
// applied to every request.
Extra map[string]any
}
Config configures the Gemini LLM service. The sampling controls are pointers so a deliberate zero is distinguishable from "unset"; a nil value is omitted from the request, leaving the API default.
type Service ¶
Service is a streaming Gemini LLM processor.
func (*Service) GenerateWithTools ¶
func (s *Service) GenerateWithTools(ctx context.Context, convo *frames.LLMContext, sink llm.Sink) error
GenerateWithTools streams a tool-capable completion. It emits text deltas to the sink as they arrive and reports each functionCall the model produces. The conversation's tools are sent on the request, and any tool turns already in the context are replayed as functionCall / functionResponse parts.