Expand description
Unified AI chat client.
Wraps genai for the multi-provider mainstream (OpenAI /
Gemini / Ollama / OpenAI-compatible) and drops down to a direct
reqwest-on-Anthropic-Messages path for features genai does not
yet surface — prompt caching, extended thinking, citations.
Structured output uses schemars::JsonSchema on caller-supplied
types: the schema is sent with the request, and the response is
validated with jsonschema before deserialising.
Formerly rtb-ai in the
rust-tool-base
monorepo; renamed to rtb-chat at extraction. The authoritative
contract remains the rtb-ai v0.1 spec.
§Lint exception
Crate-level deny(unsafe_code) (not forbid) so the genai-key
shim in client can locally allow(unsafe_code) the
std::env::set_var it needs to hand the API key to genai. No
hand-rolled unsafe blocks anywhere else.
Re-exports§
pub use client::AiClient;pub use client::ChatRequest;pub use client::ChatResponse;pub use client::ChatStream;pub use client::ChatStreamEvent;pub use config::validate_base_url;pub use config::Config;pub use config::Provider;pub use error::AiError;pub use message::Citation;pub use message::ContentBlock;pub use message::Message;pub use message::Role;pub use message::Usage;pub use thinking::ThinkingMode;