Skip to main content

Module embeddings

Module embeddings 

Source
Expand description

Provider-agnostic embedding abstractions.

Embeddings are numerical representations of text or other inputs. Rig uses EmbeddingModel to generate vectors, Embed to select which text from a Rust value should be embedded, and EmbeddingsBuilder to batch embedding requests for vector stores or retrieval workflows.

Re-exports§

pub use builder::EmbeddingsBuilder;
pub use embed::Embed;
pub use embed::EmbedError;
pub use embed::TextEmbedder;
pub use embed::to_texts;
pub use tool::ToolSchema;
pub use embedding::*;

Modules§

builder
The module defines the EmbeddingsBuilder struct which accumulates objects to be embedded and batch generates the embeddings for each object when built. Only types that implement the Embed trait can be added to the EmbeddingsBuilder.
distance
Distance and similarity helpers for embedding vectors.
embed
The module defines the Embed trait, which must be implemented for types that can be embedded by the crate::embeddings::EmbeddingsBuilder.
embedding
The module defines the EmbeddingModel trait, which represents an embedding model that can generate embeddings for documents.
tool
The module defines the ToolSchema struct, which is used to embed an object that implements crate::tool::ToolEmbedding