1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! `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?;
//! ```
// Flat re-exports for convenience.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;