gemini

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package gemini implements the llmrouter.Provider interface for Google Gemini models using the official Google Generative AI Go SDK.

Gemini requires a context during initialisation:

p, err := gemini.NewFromEnv(ctx) // reads GEMINI_API_KEY

Or with an explicit key:

p, err := gemini.New(ctx, gemini.Config{APIKey: "..."})

Supported models include gemini-2.0-flash, gemini-1.5-pro, and gemini-1.5-flash. The provider supports streaming, tool calling, and multimodal inputs (text + images + documents).

Index

Constants

This section is empty.

Variables

View Source
var DefaultModels = []string{
	"gemini-1.5-pro",
	"gemini-1.5-flash",
	"gemini-2.0-flash-exp",
	"gemini-1.0-pro",
}

DefaultModels is the list of available Gemini models

Functions

This section is empty.

Types

type Provider

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

Provider handles Google Gemini API

func New

New creates a new Gemini provider. The Gemini SDK requires a context for client construction; context.Background() is used internally so the provider lifetime is not tied to a caller's context.

func NewFromEnv

func NewFromEnv() (*Provider, error)

NewFromEnv creates a provider using the GEMINI_API_KEY environment variable

func (*Provider) Close

func (p *Provider) Close() error

Close closes the Gemini client

func (*Provider) Complete

func (p *Provider) Complete(ctx context.Context, req *llmrouter.Request) (*llmrouter.Response, error)

func (*Provider) Models

func (p *Provider) Models() []string

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) Stream

Jump to

Keyboard shortcuts

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