zai_rs/
lib.rs

1//! # ZAI-RS: Zhipu AI Rust SDK
2//!
3//! `zai-rs` is a type-safe Rust SDK that provides complete support for the
4//! Zhipu AI (BigModel) APIs. It offers strongly typed API clients and models
5//! for a wide range of AI capabilities including chat, image generation,
6//! speech recognition, and text-to-speech.
7//!
8//! ## Capabilities
9//!
10//! - Chat completions (text, vision, and voice)
11//! - Image generation
12//! - Speech-to-text (audio transcription)
13//! - Text-to-speech (audio synthesis)
14//! - Tool/function calling integration
15//! - File management (upload, list, content, delete)
16//! - Streaming responses via Server-Sent Events (SSE)
17//!
18//! ## Module Structure
19//!
20//! - [`client`] — HTTP client and networking
21//! - [`model`] — Data models, API request/response types
22//! - [`mod@file`] — File management features
23//! - [`batches`] — Batch processing endpoints (list batches)
24//! - [`toolkits`] — Tool calling and execution framework
25//!
26//! ## Quick Start
27//!
28//! ```rust,no_run
29//! use zai_rs::model::*;
30//! use zai_rs::client::http::*;
31//!
32//! #[tokio::main]
33//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
34//!     let model = GLM4_5_flash {};
35//!     let key = std::env::var("ZHIPU_API_KEY").unwrap();
36//!     let client = ChatCompletion::new(model, TextMessage::user("Hello"), key);
37//!     let _resp = client.post().await?;
38//!     Ok(())
39//! }
40//! ```
41//!
42//! ## Features
43//!
44//! - Type safety with compile-time checks to minimize runtime errors
45//! - Async support powered by Tokio
46//! - Streaming support for real-time responses
47//! - Tool integration for function calling and external tools
48//! - Built-in validation and error handling
49
50pub mod batches;
51pub mod client;
52pub mod file;
53pub mod knowledge;
54
55pub mod model;
56pub mod tool;
57pub mod toolkits;