google

package
v0.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package google implements the Google Gemini API provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*genai.Client
	// contains filtered or unexported fields
}

Client wraps the Google Gemini API client with Fantasy for chat.

func New

func New(url, token string, timeout time.Duration) (*Client, error)

New creates a Google Gemini client with the given URL (optional), token, and response timeout.

func (*Client) Chat

func (c *Client) Chat(
	ctx context.Context,
	req request.Request,
	streamFunc stream.Func,
) (message.Message, usage.Usage, error)

Chat sends a streaming chat completion request to the Google Gemini API via Fantasy.

func (*Client) Embed

Embed generates embeddings for the given input texts.

func (*Client) Estimate

func (c *Client) Estimate(ctx context.Context, req request.Request, content string) (int, error)

Estimate tokenizes content using Google's CountTokens API. Wraps content as a single user content block and returns the exact token count. Must use c.Client.Models (not c.Models) to access the genai service field rather than Aura's Models() method. Falls back to local estimation on any error.

func (*Client) Model

func (c *Client) Model(ctx context.Context, name string) (model.Model, error)

Model returns metadata for a specific model from the Google Gemini API.

func (*Client) Models

func (c *Client) Models(ctx context.Context) (model.Models, error)

Models returns all available models from the Google Gemini API.

Jump to

Keyboard shortcuts

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