Skip to main content

agentai_core/
lib.rs

1//! # AgentAI Core
2//!
3//! Shared building blocks of the [AgentAI](https://crates.io/crates/agentai) crates.
4//!
5//! - [`message`] and [`prompt`]: the conversation types (`Message`, `Part`, `Media`,
6//!   `ToolOutput`, `Prompt`, ...), re-exported by `agentai`.
7//! - [`history`]: [`HistoryProcessor`](history::HistoryProcessor) changes the messages sent to
8//!   the model, [`HistoryPruning`](history::HistoryPruning) removes media and reasoning from
9//!   finished turns.
10//! - [`mime`]: one table of MIME types and file extensions ([`mime::extension`],
11//!   [`mime::from_path`], [`mime::with_extension`]), also behind `Media::extension` and
12//!   `Media::file_name`.
13//! - [`base64`]: [`base64::encode`] and [`base64::decode`], the encoding of `Media` bytes and
14//!   data URLs (`Media::to_url`).
15//! - [`storage`]: [`MediaStorage`](storage::MediaStorage) (`MediaRead` + `MediaSave`), a
16//!   blob storage for images and other files, with [`MemoryStorage`](storage::MemoryStorage).
17//! - HTTP: the [`HttpClient`] trait hides the HTTP stack, so crates such as `agentai-image` send
18//! their requests without depending on a particular client. [`ReqwestClient`] implements it
19//! with `reqwest`; another environment (for example WebAssembly) can provide its own.
20//!   With the `test-support` feature, `mock::MockHttp` records requests and answers with
21//!   prepared responses, for tests of providers.
22//! - [`tls`]: the TLS backend is chosen with the `rustls-ring` (default), `rustls-aws-lc` and
23//!   `native-tls` features.
24//!
25//! ## Features
26#![doc = document_features::document_features!()]
27
28#[cfg(all(
29    feature = "native-tls",
30    any(feature = "rustls-ring", feature = "rustls-aws-lc")
31))]
32compile_error!(
33    "agentai: `native-tls` cannot be combined with `rustls-ring` or `rustls-aws-lc`. \
34     To use native-tls, set `default-features = false` and enable `native-tls`."
35);
36
37pub mod base64;
38pub mod history;
39mod http;
40pub mod message;
41pub mod mime;
42pub mod prompt;
43pub mod storage;
44pub mod tls;
45
46pub use http::*;