zai_rs/model/mod.rs
1//! # Model Module
2//!
3//! Contains all data models, request/response types, and API abstractions for the Zhipu AI API.
4//! This module provides type-safe representations of API entities and comprehensive support
5//! for various AI capabilities.
6//!
7//! ## Module Organization
8//!
9//! The module is organized into several categories:
10//!
11//! ### Chat & Conversation
12//! - [`chat`] - Synchronous chat completion
13//! - [`async_chat`] - Asynchronous chat completion
14//! - [`async_chat_get`] - Retrieving async chat results
15//! - [`chat_message_types`] - Message types for different conversation modes
16//! - [`chat_stream_response`] - Streaming response handling
17//!
18//! ### Multimodal AI
19//! - [`audio_to_text`] - Speech recognition (ASR)
20//! - [`audio_to_speech`] - Text-to-speech synthesis (TTS)
21//! - [`gen_image`] - Image generation
22//! - [`gen_video_async`] - Video generation (async)
23//!
24//! ### Content Safety
25//! - [`moderation`] - Content moderation and safety analysis
26//!
27//! ### Voice & Audio
28//! - [`voice_clone`] - Voice cloning capabilities
29//! - [`voice_list`] - Voice management and listing
30//! - [`voice_delete`] - Voice deletion
31//!
32//! ### Core Infrastructure
33//! - [`chat_base_request`] - Base request structures
34//! - [`chat_base_response`] - Base response structures
35//! - [`chat_models`] - AI model definitions
36//! - [`tools`] - Tool calling and function definitions
37//! - [`traits`] - Core traits and abstractions
38//! - [`model_validate`] - Data validation utilities
39//! - [`stream_ext`] - Streaming extensions
40//!
41//! ## Key Features
42//!
43//! - **Type Safety** - Compile-time guarantees for API usage
44//! - **Model Validation** - Built-in data validation
45//! - **Streaming Support** - Real-time response processing
46//! - **Multimodal Support** - Text, vision, voice, and audio capabilities
47//! - **Content Safety** - Automated content moderation and risk detection
48//! - **Tool Integration** - Function calling and external tool support
49//!
50//! ## Usage Example
51//!
52//! ```rust,ignore
53//! use zai_rs::model::*;
54//!
55//! // Create a chat completion request
56//! let model = GLM4_5_flash {};
57//! let messages = TextMessage::user("Hello, how can you help me?");
58//! let client = ChatCompletion::new(model, messages, api_key);
59//! ```
60
61pub mod async_chat;
62pub mod async_chat_get;
63pub mod audio_to_speech;
64pub mod audio_to_text;
65pub mod chat;
66pub mod chat_base_request;
67pub mod chat_base_response;
68pub mod chat_message_types;
69pub mod chat_models;
70pub mod chat_stream_response;
71pub mod gen_image;
72pub mod gen_video_async;
73pub mod model_validate;
74pub mod moderation;
75pub mod stream_ext;
76pub mod text_embedded;
77pub mod text_rerank;
78pub mod text_tokenizer;
79pub mod tools;
80pub mod traits;
81pub mod voice_clone;
82pub mod voice_delete;
83pub mod voice_list;
84
85// Avoid wildcard re-exports to prevent name collisions (e.g., `data`)
86
87// Selective type re-exports for convenience
88pub use async_chat::data::AsyncChatCompletion;
89pub use async_chat_get::data::AsyncChatGetRequest;
90pub use chat::data::ChatCompletion;
91pub use moderation::data::Moderation;
92pub use stream_ext::StreamChatLikeExt;
93
94pub use chat_message_types::*;
95pub use chat_models::*;
96pub use gen_video_async::*;
97pub use tools::*;
98
99pub use chat_base_response::TaskStatus;
100pub use chat_stream_response::ChatStreamResponse;
101pub use traits::SseStreamable;