google

package
v0.1.0-beta.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package google implements agent.ChatModel against the Google Gemini Generative Language API. The package uses only net/http and encoding/json.

Wire reference:

Index

Constants

View Source
const DefaultAPIVersion = "v1beta"

DefaultAPIVersion targets the v1beta surface, which is where function-calling and SSE streaming both live; the v1 surface lags.

View Source
const DefaultBaseURL = "https://generativelanguage.googleapis.com"

DefaultBaseURL is the production Generative Language API endpoint.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Provider)

Option configures a Provider during construction.

func WithAPIVersion

func WithAPIVersion(v string) Option

WithAPIVersion overrides the API version (default v1beta).

func WithBaseURL

func WithBaseURL(u string) Option

WithBaseURL overrides the API base URL.

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

WithHTTPClient overrides the HTTP client.

func WithLogger

func WithLogger(l *slog.Logger) Option

WithLogger overrides the slog.Logger.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements agent.ChatModel against the Gemini API.

func New

func New(apiKey string, opts ...Option) (*Provider, error)

New constructs a Provider authenticated with the given API key.

func (*Provider) Generate

func (p *Provider) Generate(ctx context.Context, req agent.ChatRequest) (agent.ChatResponse, error)

Generate dispatches a synchronous generateContent request.

func (*Provider) Stream

Stream dispatches a streaming streamGenerateContent request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL