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 an embedding Model 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.

use rig_core::embeddings::to_texts;

assert_eq!(to_texts(vec!["first", "second"])?, vec!["first", "second"]);

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
Batched embedding generation for documents implementing Embed.
distance
Similarity and distance of embedding vectors.
embed
Text extraction for embedding builders, including implementations for common types.
embedding
Text and image embedding models, responses, and input identifiers.
tool
Embeddable tool descriptions and serialized tool context.