Skip to main content

Google configuration

Package github.com/digitallysavvy/go-ai/pkg/providers/google. Create a provider with google.New(google.Config{...}). When APIKey is empty, the provider reads GOOGLE_GENERATIVE_AI_API_KEY.

The tables on this page are generated from the Go source. For usage, see the Google provider page.

Config​

FieldTypeDescription
APIKeystringAPIKey is the Google API key
BaseURLstringBaseURL is the base URL for the Google API (default: https://generativelanguage.googleapis.com)
Headersmap[string]stringHeaders are custom HTTP headers to include in requests.
NamestringName overrides the provider name returned by Provider.Name(). Defaults to "google.generative-ai".
HTTPClient*http.ClientHTTPClient overrides the HTTP client used for requests.

Model factories​

MethodReturns
LanguageModel(id)A Gemini language model.
Interactions(id), InteractionsAgent(agent), InteractionsManagedAgent(id)Language models that use the Interactions API.
EmbeddingModel(id)An embedding model.
ImageModel(id)An image generation model.
SpeechModel(id)A speech synthesis model.
TranscriptionModel(id)A transcription model.
VideoModel(id)A video generation model.
RerankingModel(id)A reranking model.
Files()The Files API client.

GoogleEmbeddingProviderOptions​

FieldTypeDescription
Parts[]EmbeddingPartParts provides additional multimodal content parts alongside the text input. Each element corresponds to a single embedding value and is appended to that value's content.parts in the API request.
Content[][]EmbeddingPartContent provides TypeScript-compatible per-value multimodal content. Each entry corresponds to the embedding value at the same index. A nil entry is text-only; a non-nil entry must contain at least one part.
OutputDimensionality*intOutputDimensionality optionally truncates the embedding vector length.
TaskTypestringTaskType maps to the Google embedding taskType request field.

GoogleSpeechModelOptions​

FieldTypeDescription
MultiSpeakerVoiceConfigmap[string]interface{}MultiSpeakerVoiceConfig configures Gemini multi-speaker TTS. When set it takes precedence over the top-level voice.

GoogleVideoModelOptions​

FieldTypeDescription
PersonGeneration*string
NegativePrompt*string
ReferenceImages[]googleVideoReferenceImageOpt

GoogleInteractionsProviderOptions​

FieldTypeDescription
PreviousInteractionIDstring
Store*bool
MediaResolutionstring
SystemInstructionstring
ResponseModalities[]string
ServiceTierstring
ThinkingLevelstring
ThinkingSummariesstring
ResponseFormat[]map[string]interface{}ResponseFormat holds raw (camelCase) response_format entries from providerOptions.google.responseFormat, e.g. {"type":"video","aspectRatio":"16:9",...}. Converted to snake_case wire entries in buildArgs.
ImageConfigmap[string]interface{}
Agentstring
AgentConfigmap[string]interface{}
Environmentinterface{}
PollingTimeoutMsint
Background*bool