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
13
14
15
//! Retrieve one knowledge-base document.

use zai_rs::{client::ZaiClient, knowledge::DocumentGetRequest};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let doc_id = std::env::args()
        .nth(1)
        .ok_or("usage: knowledge_document_detail <document-id>")?;

    let client = ZaiClient::from_env()?;
    let resp = DocumentGetRequest::new(doc_id).send_via(&client).await?;
    println!("{resp:#?}");
    Ok(())
}