Documentation ¶
Overview ¶
Package gemini implements access to Google's Gemini model.
Client implements llm.Embedder and llm.GenerateText. Use NewClient to connect.
Index ¶
Constants ¶
const ( DefaultEmbeddingModel = "text-embedding-004" DefaultGenerativeModel = "gemini-1.5-pro" )
Variables ¶
This section is empty.
Functions ¶
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, embeddingModel, generativeModel string) (*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". The embeddingModel is the model name to use for embedding, such as text-embedding-004, and the generativeModel is the model name to use for generation, such as gemini-1.5-pro.
func (*Client) EmbedDocs ¶
EmbedDocs returns the vector embeddings for the docs, implementing llm.Embedder.
func (*Client) GenerateText ¶
GenerateText returns model's text response for the prompt parts, implementing llm.TextGenerator.