ic-rig 0.2.0

A lean, modular library for building LLM applications. Bring your own HTTP client.
Documentation
//! `irig` — a lean, modular library for building LLM applications.
//!
//! Designed to run anywhere, including ICP WASM canisters. There is **no**
//! bundled HTTP client; you provide one by implementing [`http::HttpClient`].
//!
//! # Crate layout
//!
//! | Module | Purpose |
//! |---|---|
//! | [`message`] | Core message types (`Message`, `ToolCall`, …) |
//! | [`completion`] | `CompletionModel` trait + request/response types |
//! | [`tool`] | `Tool` trait + type-erased `ToolSet` |
//! | [`agent`] | `Agent` + `AgentBuilder` (drives the agentic loop) |
//! | [`http`] | `HttpClient` trait — implement this for your platform |
//! | [`wasm_compat`] | `WasmCompatSend`/`WasmCompatSync` shims |
//!
//! # Quick start
//!
//! ```rust,ignore
//! use irig::{
//!     agent::Agent,
//!     completion::{CompletionModel, CompletionRequest, CompletionResponse},
//!     http::HttpClient,
//! };
//!
//! // 1. Implement HttpClient for your platform.
//! // 2. Implement CompletionModel wrapping that client.
//! // 3. Build an Agent and call .prompt().
//!
//! let agent = Agent::builder(my_model)
//!     .preamble("You are a helpful assistant.")
//!     .max_tokens(512)
//!     .build();
//!
//! let reply = agent.prompt("Hello!").await?;
//! ```

pub mod agent;
pub mod completion;
pub mod embeddings;
pub mod http;
pub mod message;
pub mod providers;
pub mod tool;
pub mod vector_store;
pub mod wasm_compat;

// Flat re-exports for convenience.
pub use agent::{Agent, AgentBuilder, AgentError};
pub use completion::{CompletionError, CompletionModel, CompletionRequest, CompletionResponse, ModelChoice, Usage};
pub use embeddings::{DistanceMetric, Embed, EmbedError, EmbeddingModel, EmbeddingsBuilder, Embedding, EmbeddingError, VectorDistance};
pub use http::{HttpClient, HttpRequest, HttpResponse};
pub use message::{AssistantContent, Message, Text, ToolCall, ToolResult, UserContent};
pub use tool::{Tool, ToolDefinition, ToolError, ToolSet};
pub use wasm_compat::{BoxFuture, WasmCompatSend, WasmCompatSync};