Documentation
¶
Overview ¶
Package google implements the Google Gemini API provider.
Index ¶
- type Client
- func (c *Client) Chat(ctx context.Context, req request.Request, streamFunc stream.Func) (message.Message, usage.Usage, error)
- func (c *Client) Embed(ctx context.Context, req embedding.Request) (embedding.Response, usage.Usage, error)
- func (c *Client) Estimate(ctx context.Context, req request.Request, content string) (int, error)
- func (c *Client) Model(ctx context.Context, name string) (model.Model, error)
- func (c *Client) Models(ctx context.Context) (model.Models, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client wraps the Google Gemini API client with Fantasy for chat.
func New ¶
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 ¶
func (c *Client) Embed(ctx context.Context, req embedding.Request) (embedding.Response, usage.Usage, error)
Embed generates embeddings for the given input texts.
func (*Client) Estimate ¶
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.