Expand description
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
ⓘ
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?;Re-exports§
pub use agent::Agent;pub use agent::AgentBuilder;pub use agent::AgentError;pub use completion::CompletionError;pub use completion::CompletionModel;pub use completion::CompletionRequest;pub use completion::CompletionResponse;pub use completion::ModelChoice;pub use completion::Usage;pub use embeddings::DistanceMetric;pub use embeddings::Embed;pub use embeddings::EmbedError;pub use embeddings::EmbeddingModel;pub use embeddings::EmbeddingsBuilder;pub use embeddings::Embedding;pub use embeddings::EmbeddingError;pub use embeddings::VectorDistance;pub use http::HttpClient;pub use http::HttpRequest;pub use http::HttpResponse;pub use message::AssistantContent;pub use message::Message;pub use message::Text;pub use message::ToolCall;pub use message::ToolResult;pub use message::UserContent;pub use tool::Tool;pub use tool::ToolDefinition;pub use tool::ToolError;pub use tool::ToolSet;pub use wasm_compat::BoxFuture;pub use wasm_compat::WasmCompatSend;pub use wasm_compat::WasmCompatSync;
Modules§
- agent
- High-level agent that drives the completion ↔ tool-call loop.
- completion
- Completion model trait and associated request/response types.
- embeddings
- Embedding API — generate vector representations of text.
- http
- HTTP client abstraction.
- message
- Core message types shared across all providers.
- providers
- Feature-gated provider implementations.
- tool
- Tool trait and type-erased tool dispatch.
- vector_
store - Vector search acceleration structures.
- wasm_
compat - WASM compatibility shims.