gemini

package
v1.103.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 29 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertParametersToSchema

func ConvertParametersToSchema(params any) (*genai.Schema, error)

ConvertParametersToSchema converts parameters to Gemini Schema format

Types

type Client

type Client struct {
	base.Config
	// contains filtered or unexported fields
}

Client represents a Gemini client wrapper It implements the provider.Provider interface

func NewClient

func NewClient(ctx context.Context, cfg *latest.ModelConfig, env environment.Provider, opts ...options.Opt) (*Client, error)

NewClient creates a new Gemini client from the provided configuration

func (*Client) CreateChatCompletionStream

func (c *Client) CreateChatCompletionStream(
	ctx context.Context,
	messages []chat.Message,
	requestTools []tools.Tool,
) (chat.MessageStream, error)

CreateChatCompletionStream creates a streaming chat completion request

func (*Client) Rerank

func (c *Client) Rerank(ctx context.Context, query string, documents []types.Document, criteria string) ([]float64, error)

Rerank scores documents by relevance to the query using Gemini's structured output feature. It returns relevance scores in the same order as input documents.

type StreamAdapter

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

StreamAdapter adapts the Gemini streaming iterator to chat.MessageStream

func NewStreamAdapter

func NewStreamAdapter(iter func(func(*genai.GenerateContentResponse, error) bool), model string, trackUsage bool) *StreamAdapter

NewStreamAdapter constructs a StreamAdapter from Gemini's iterator

func (*StreamAdapter) Close

func (g *StreamAdapter) Close()

Close closes the stream

func (*StreamAdapter) Recv

Recv gets the next Gemini content chunk

Jump to

Keyboard shortcuts

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