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.
Lifecycle behavior is derived from the Vercel AI SDK (Apache-2.0, Copyright 2023 Vercel, Inc.), translated to Rust and modified; see NOTICE.
Structs§
- Embed
- Builder returned by
embed;.awaitruns the call. - Embed
Call EndEvent - Event after all chunks and retries of an embedding operation succeed.
- Embed
Call Start Event - Event before any provider attempt of an embedding operation.
- Embed
Many - Builder returned by
embed_many;.awaitruns the calls. - Embed
Many Result - Result of
embed_many. - Embed
Result - Result of
embed. - Embedding
Usage - Token usage of embedding calls;
Nonewhen the provider reported none.
Enums§
- Embedding
Input - Input shape of an embedding operation.
- Embedding
Output - Output shape of an embedding operation.
- Embedding
Response - Response metadata shape of an embedding operation.
Functions§
- cosine_
similarity - Cosine similarity of two vectors;
0.0when 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.