Documentation
¶
Overview ¶
Package gemini implements the Embedder interface against Google's Gemini embeddings API via go-genai (google.golang.org/genai).
Two task-hint strategies are supported:
"param" — the model accepts a `task_type` API parameter (gemini-embedding-001 and similar). Strategy: set EmbedContentConfig.TaskType to the API enum string.
"prefix" — the model expects task hints in-band as a natural-language prompt prefix (gemini-embedding-2 and similar). Strategy: prepend the documented prefix to each input text and leave Config.TaskType unset.
Strategy is selected from the model name. Defaults assume gemini-embedding-2.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Embedder ¶
type Embedder struct {
// contains filtered or unexported fields
}
Embedder is a Gemini-backed embedder.
func (*Embedder) Embed ¶
func (e *Embedder) Embed(ctx context.Context, task embed.EmbedTask, texts []string) ([][]float32, error)
Embed satisfies embed.Embedder. The task hint is mapped to the strategy chosen at construction time: a TaskType API parameter for "param" models, or a prompt prefix on each input for "prefix" models. The fake embedder ignores task entirely; here we honor it.
Inputs larger than the API's per-batch cap are split transparently.