gemini

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package gemini provides a ModelProvider adapter for Google's Gemini API. It implements the Gemini REST wire format, supporting both complete() and streaming responses, with proper token usage mapping.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Provider)

Option is a functional option for configuring a Provider.

func WithAPIKey

func WithAPIKey(key string) Option

WithAPIKey sets the API key used for authentication.

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

WithHTTPClient sets a custom HTTP client for requests.

type Provider

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

Provider implements runtime.ModelProvider for Google's Gemini API.

func New

func New(opts ...Option) *Provider

New creates a new Gemini provider with the default base URL. baseURL defaults to https://generativelanguage.googleapis.com

func NewWithBaseURL

func NewWithBaseURL(baseURL string, opts ...Option) *Provider

NewWithBaseURL creates a new Gemini provider with a custom base URL.

func (*Provider) Complete

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

Complete sends a request to the model and returns its complete response.

func (*Provider) Stream

func (p *Provider) Stream(ctx context.Context, req model.Request) (runtime.StreamReader, error)

Stream sends a request to the model and returns a StreamReader for reading chunks.

Jump to

Keyboard shortcuts

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