zai-rs 0.6.0

Type-safe async Rust SDK for Zhipu AI (BigModel) APIs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
//! Moderate a single text input.

use zai_rs::{client::ZaiClient, model::moderation::Moderation};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ZaiClient::from_env()?;
    let text = "这是一段需要审核的文本";
    let result = Moderation::new_text(text).send_via(&client).await?;
    println!("{result:#?}");
    Ok(())
}