ic-rig 0.2.0

A lean, modular library for building LLM applications. Bring your own HTTP client.
Documentation
//! Embedding API — generate vector representations of text.
//!
//! # Three-layer structure
//!
//! ```text
//! Embed trait          ← your domain types declare what text to embed
//!//! EmbeddingsBuilder    ← batches texts, calls the model, reassembles results
//!//! EmbeddingModel trait ← providers implement this (OpenAI, Gemini, …)
//! ```
//!
//! # Quick start
//!
//! ```rust,ignore
//! use irig::embeddings::{Embed, EmbeddingsBuilder, TextEmbedder, EmbedError};
//! use irig::providers::openai;
//!
//! struct Article { title: String, body: String }
//!
//! impl Embed for Article {
//!     fn embed(&self, e: &mut TextEmbedder) -> Result<(), EmbedError> {
//!         e.embed(self.title.clone());
//!         e.embed(self.body.clone());
//!         Ok(())
//!     }
//! }
//!
//! let model = openai::Client::new(http, api_key).embedding_model(openai::TEXT_EMBEDDING_3_SMALL);
//!
//! let results = EmbeddingsBuilder::new(model)
//!     .documents(articles)?
//!     .build()
//!     .await?;
//!
//! // results: Vec<(Article, Vec<Embedding>)>
//! // Each Article gets two Embeddings: one for title, one for body.
//! ```

pub mod builder;
pub mod distance;
pub mod embed;
pub mod embedding;

pub use builder::EmbeddingsBuilder;
pub use distance::{DistanceMetric, VectorDistance};
pub use embed::{Embed, EmbedError, TextEmbedder, to_texts};
pub use embedding::{Embedding, EmbeddingError, EmbeddingModel};