gemini

package
v0.0.0-...-bc1d99f Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package gemini implements access to Google's Gemini model.

Client implements llm.Embedder. Use NewClient to connect.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scrub

func Scrub(req *http.Request) error

Scrub is a request scrubber for use with rsc.io/httprr.

Types

type Client

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

A Client represents a connection to Gemini.

func NewClient

func NewClient(ctx context.Context, lg *slog.Logger, sdb secret.DB, hc *http.Client) (*Client, error)

NewClient returns a connection to Gemini, using the given logger and HTTP client. It expects to find a secret of the form "AIza..." or "user:AIza..." in sdb under the name "ai.google.dev".

func (*Client) EmbedDocs

func (c *Client) EmbedDocs(ctx context.Context, docs []llm.EmbedDoc) ([]llm.Vector, error)

EmbedDocs returns the vector embeddings for the docs, implementing llm.Embedder.

Jump to

Keyboard shortcuts

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