zai-rs 0.5.1

一个 Rust SDK, 用于调用 智谱AI API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use zai_rs::client::ZaiClient;
use zai_rs::knowledge::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = ZaiClient::from_env()?;
    let doc_id = std::env::args()
        .nth(1)
        .expect("usage: knowledge_document_detail <doc_id>");
    let resp = DocumentRetrieveRequest::new(doc_id)
        .send_via(&client)
        .await?;
    println!("{resp:#?}");
    Ok(())
}