zai_rs/model/
chat_models.rs

1//! # AI Model Type Definitions
2//!
3//! This module defines all available AI model types for the Zhipu AI API,
4//! along with their capabilities, message type bindings, and trait implementations.
5//!
6//! ## Model Categories
7//!
8//! ### Text Models
9//! - **GLM-4.5** - Advanced reasoning model with thinking capabilities
10//! - **GLM-4.5-Flash** - Optimized for speed and efficiency
11//! - **GLM-4.5-Air** - Lightweight model for cost-effective applications
12//! - **GLM-4.5-X** - Extended capabilities model
13//! - **GLM-4.5-AirX** - Ultra-lightweight variant
14//!
15//! ### Multimodal Models
16//! - **GLM-4.5V** - Vision-enabled model supporting images and videos
17//! - **GLM-4-Voice** - Voice-enabled model for audio interactions
18//!
19//! ## Model Capabilities
20//!
21//! | Model | Text | Vision | Voice | Thinking | Async |
22//! |-------|------|--------|--------|----------|--------|
23//! | GLM-4.5 | ✓ | ✗ | ✗ | ✓ | ✓ |
24//! | GLM-4.5-Flash | ✓ | ✗ | ✗ | ✓ | ✓ |
25//! | GLM-4.5-Air | ✓ | ✗ | ✗ | ✓ | ✓ |
26//! | GLM-4.5-X | ✓ | ✗ | ✗ | ✓ | ✓ |
27//! | GLM-4.5-AirX | ✓ | ✗ | ✗ | ✓ | ✓ |
28//! | GLM-4.5V | ✓ | ✓ | ✗ | ✗ | ✓ |
29//! | GLM-4-Voice | ✓ | ✗ | ✓ | ✗ | ✓ |
30//!
31//! ## Usage
32//!
33//! Models are used by creating instances and passing them to chat completion requests:
34//!
35//! ```rust,ignore
36//! use zai_rs::model::chat_models::*;
37//! use zai_rs::model::chat_message_types::*;
38//! use zai_rs::model::chat::data::ChatCompletion;
39//!
40//! let model = GLM4_5_flash {};
41//! let messages = TextMessage::user("Hello, how can you help me?");
42//! let client = ChatCompletion::new(model, messages, api_key);
43//! ```
44
45use super::traits::*;
46use crate::model::chat_message_types::{TextMessage, VisionMessage, VoiceMessage};
47use crate::{define_model_type, impl_message_binding, impl_model_markers};
48
49define_model_type!(GLM4_6, "glm-4.6");
50impl_message_binding!(GLM4_6, TextMessage);
51impl_model_markers!(GLM4_6: Chat, AsyncChat, ThinkEnable);
52impl ToolStreamEnable for GLM4_6 {}
53
54
55
56define_model_type!(GLM4_5, "glm-4.5");
57impl_message_binding!(GLM4_5, TextMessage);
58impl_model_markers!(GLM4_5: Chat, AsyncChat, ThinkEnable);
59
60define_model_type!(
61    #[allow(non_camel_case_types)]
62    GLM4_5_flash,
63    "glm-4.5-flash"
64);
65impl_message_binding!(GLM4_5_flash, TextMessage);
66impl_model_markers!(GLM4_5_flash: Chat, AsyncChat, ThinkEnable);
67
68define_model_type!(
69    #[allow(non_camel_case_types)]
70    GLM4_5_air,
71    "glm-4.5-air"
72);
73impl_message_binding!(GLM4_5_air, TextMessage);
74impl_model_markers!(GLM4_5_air: Chat, AsyncChat, ThinkEnable);
75
76define_model_type!(
77    #[allow(non_camel_case_types)]
78    GLM4_5_x,
79    "glm-4.5-X"
80);
81impl_message_binding!(GLM4_5_x, TextMessage);
82impl_model_markers!(GLM4_5_x: Chat, AsyncChat, ThinkEnable);
83
84define_model_type!(
85    #[allow(non_camel_case_types)]
86    GLM4_5_airx,
87    "glm-4.5-airx"
88);
89impl_message_binding!(GLM4_5_airx, TextMessage);
90impl_model_markers!(GLM4_5_airx: Chat, AsyncChat, ThinkEnable);
91
92define_model_type!(
93    #[allow(non_camel_case_types)]
94    GLM4_5v,
95    "glm-4.5v"
96);
97impl_message_binding!(GLM4_5v, VisionMessage);
98impl_model_markers!(GLM4_5v: Chat, AsyncChat);
99
100define_model_type!(
101    #[allow(non_camel_case_types)]
102    GLM4_voice,
103    "glm-4-voice"
104);
105impl_message_binding!(GLM4_voice, VoiceMessage);
106impl_model_markers!(GLM4_voice: Chat, AsyncChat);