Skip to main content

Module embed

Module embed 

Source
Expand description

Embeddings: embed for one value, embed_many for several (split into provider calls by the model’s limits) and cosine_similarity.

Design: docs/01-architecture/11-other-modalities.md §1.

Structs§

Embed
Builder returned by embed; .await runs the call.
EmbedMany
Builder returned by embed_many; .await runs the calls.
EmbedManyResult
Result of embed_many.
EmbedResult
Result of embed.
EmbeddingUsage
Token usage of embedding calls; None when the provider reported none.

Functions§

cosine_similarity
Cosine similarity of two vectors; 0.0 when either has zero length.
embed
Embeds one value.
embed_many
Embeds several values, splitting them into provider calls by the model’s limits and running the calls concurrently when the model allows it.

Type Aliases§

Embedding
An embedding vector.