Module model

Module model 

Source
Expand description

§Model Module

Contains all data models, request/response types, and API abstractions for the Zhipu AI API. This module provides type-safe representations of API entities and comprehensive support for various AI capabilities.

§Module Organization

The module is organized into several categories:

§Chat & Conversation

§Multimodal AI

§Content Safety

  • moderation - Content moderation and safety analysis

§Voice & Audio

§Core Infrastructure

§Key Features

  • Type Safety - Compile-time guarantees for API usage
  • Model Validation - Built-in data validation
  • Streaming Support - Real-time response processing
  • Multimodal Support - Text, vision, voice, and audio capabilities
  • Content Safety - Automated content moderation and risk detection
  • Tool Integration - Function calling and external tool support

§Usage Example

use zai_rs::model::*;

// Create a chat completion request
let model = GLM4_5_flash {};
let messages = TextMessage::user("Hello, how can you help me?");
let client = ChatCompletion::new(model, messages, api_key);

Re-exports§

pub use async_chat::data::AsyncChatCompletion;
pub use async_chat_get::data::AsyncChatGetRequest;
pub use chat::data::ChatCompletion;
pub use moderation::data::Moderation;
pub use stream_ext::StreamChatLikeExt;
pub use chat_base_response::TaskStatus;
pub use chat_stream_response::ChatStreamResponse;
pub use traits::SseStreamable;
pub use chat_message_types::*;
pub use chat_models::*;
pub use gen_video_async::*;
pub use tools::*;

Modules§

async_chat
async_chat_get
audio_to_speech
audio_to_text
chat
chat_base_request
Base types and structures for chat API models.
chat_base_response
Base response types for chat API models.
chat_message_types
Comprehensive chat message types for the ZAI-RS model API.
chat_models
AI Model Type Definitions
chat_stream_response
Streaming Response Types for Chat API Models
gen_image
gen_video_async
model_validate
JSON Schema Validation Module
moderation
Content Moderation Module
stream_ext
Streaming Extensions for Chat-like Endpoints
text_embedded
text_rerank
text_tokenizer
tools
Tool definitions and configurations for the model API.
traits
Core Traits for AI Model Abstractions
voice_clone
voice_delete
voice_list