Documentation
¶
Overview ¶
Package gemini provides a model.Client implementation backed by the Google Gen AI SDK. It translates loom-mcp requests into Gemini GenerateContent calls and maps responses back into the generic planner structures.
Package gemini wires Google Gemini model clients into loom-mcp planners.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements model.Client using Gemini GenerateContent calls.
func NewFromAPIKey ¶
NewFromAPIKey constructs a Gemini API client using the official Gen AI SDK.
func NewFromVertex ¶ added in v1.2.0
func NewFromVertex(ctx context.Context, opts VertexOptions) (*Client, error)
NewFromVertex constructs a Gemini client using the official Gen AI SDK's Vertex AI backend.
func (*Client) CountTokens ¶ added in v1.2.0
CountTokens implements model.TokenCounter using Gemini's native counter.
type ModelsClient ¶
type ModelsClient interface {
GenerateContent(ctx context.Context, model string, contents []*genai.Content, config *genai.GenerateContentConfig) (*genai.GenerateContentResponse, error)
}
ModelsClient captures the subset of the Gen AI SDK used by the adapter.
type Options ¶
type Options struct {
// Client is the underlying Gen AI models client.
Client ModelsClient
// DefaultModel is the model identifier used when Request.Model is empty.
DefaultModel string
// HighModel is used when Request.ModelClass is high-reasoning and
// Request.Model is empty.
HighModel string
// SmallModel is used when Request.ModelClass is small and Request.Model is
// empty.
SmallModel string
// MaxTokens is the default completion token cap when Request.MaxTokens is
// unset.
MaxTokens int
// Temperature is the default sampling temperature when Request.Temperature
// is unset.
Temperature float32
// ThinkingBudget is the default thinking-token budget when thinking is
// enabled without a per-request budget.
ThinkingBudget int
}
Options configures optional Gemini adapter behavior.
type VertexOptions ¶ added in v1.2.0
type VertexOptions struct {
// ProjectID is the Google Cloud project used for Vertex AI requests.
ProjectID string
// Location is the Google Cloud location or region used for Vertex AI
// requests.
Location string
// APIKey optionally configures API-key auth for Vertex AI. Leave empty
// to use Credentials or Application Default Credentials.
APIKey string
// Credentials optionally supplies explicit Google Cloud credentials.
Credentials *auth.Credentials
// HTTPClient optionally supplies the HTTP client used by the Gen AI SDK.
HTTPClient *http.Client
// HTTPOptions optionally overrides Gen AI SDK HTTP behavior.
HTTPOptions genai.HTTPOptions
// DefaultModel is the model identifier used when Request.Model is empty.
DefaultModel string
// HighModel is used when Request.ModelClass is high-reasoning and
// Request.Model is empty.
HighModel string
// SmallModel is used when Request.ModelClass is small and Request.Model is
// empty.
SmallModel string
// MaxTokens is the default completion token cap when Request.MaxTokens is
// unset.
MaxTokens int
// Temperature is the default sampling temperature when Request.Temperature
// is unset.
Temperature float32
// ThinkingBudget is the default thinking-token budget when thinking is
// enabled without a per-request budget.
ThinkingBudget int
}
VertexOptions configures a Vertex AI-backed Gemini adapter.