Documentation
¶
Index ¶
- func Enable(apiKey, modelName, actionName string) sdk.ClientOption
- func EnableWithConfig(cfg Config, actionName string) sdk.ClientOption
- func Factory(opts map[string]any) (sdk.ClientOption, error)
- func Init(ctx context.Context, globalG *genkit.Genkit, apiKey string, modelName string, ...) (string, error)
- func InitWithConfig(ctx context.Context, globalG *genkit.Genkit, cfg Config, logger core.Logger) (string, error)
- type Config
- type GoogleEmbedder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Enable ¶
func Enable(apiKey, modelName, actionName string) sdk.ClientOption
Enable returns a ClientOption that wires the Google provider. usage: client.New(..., google.Enable("key", "gemini-pro", "my_action"))
func EnableWithConfig ¶ added in v0.11.0
func EnableWithConfig(cfg Config, actionName string) sdk.ClientOption
EnableWithConfig wires the provider from a full Config — Vertex project mode, Vertex Express Mode, and endpoint overrides included. Enable(...) stays as the minimal code-first entry point.
func Factory ¶
func Factory(opts map[string]any) (sdk.ClientOption, error)
Factory implements the sdk.ProviderFactory interface for Config-driven loading.
func Init ¶
func Init(ctx context.Context, globalG *genkit.Genkit, apiKey string, modelName string, logger core.Logger) (string, error)
Init sets up the Google provider using a Proxy Pattern. It isolates the Google plugin in a local instance and registers a proxy in the global registry. logger receives a warning whenever the proxied request's GenerationConfig is dropped (see the workaround below) so the loss of Temperature/MaxOutputTokens is observable rather than silent.
Types ¶
type Config ¶ added in v0.5.0
type Config struct {
APIKey string
ModelName string
Project string // Vertex AI project (enables Vertex mode)
Location string // Vertex AI region (e.g. "us-central1", "us", "eu", "global")
APIVersion string // API version override ("v1", "v1beta"; "v1alpha" for GoogleAI)
BaseURL string // endpoint override — a proxy, a regional host, a mock
// Platform selects the backend explicitly: "googleai" (default) or
// "vertex". Set it to "vertex" WITHOUT a Project to use Vertex AI
// Express Mode: API-key auth, no project, no location, no ADC.
// Leaving it empty keeps the historical rule (Project set => Vertex).
Platform string
}
Config holds configuration for the Google AI provider.
func ConfigFromOpts ¶ added in v0.11.0
ConfigFromOpts maps provider options (mangle.yaml / WithProviderConfig) onto a Config, applying the same env fallbacks the code-first path uses.
Recognized keys: api_key, model, platform, project, location, api_version, base_url. Before this, project/location/api_version were unreachable from YAML — only code-first callers could select Vertex.
type GoogleEmbedder ¶
type GoogleEmbedder struct {
// contains filtered or unexported fields
}
func NewEmbedder ¶
NewEmbedder creates a new embedder using Google GenAI. Default model: "embedding-001" or "text-embedding-004"
func (*GoogleEmbedder) Dimension ¶
func (e *GoogleEmbedder) Dimension() int