Skip to main content

zai_rs/knowledge/
capacity.rs

1use super::types::KnowledgeCapacityResponse;
2use crate::client::ZaiClient;
3
4/// Knowledge capacity request (GET /llm-application/open/knowledge/capacity)
5///
6/// Credentials and transport live on the [`ZaiClient`], passed to
7/// [`send_via`](Self::send_via).
8#[derive(Default)]
9pub struct KnowledgeCapacityRequest;
10
11impl KnowledgeCapacityRequest {
12    /// Build a capacity request.
13    pub fn new() -> Self {
14        Self
15    }
16
17    /// Send via a [`ZaiClient`] and parse the typed response.
18    pub async fn send_via(
19        &self,
20        client: &ZaiClient,
21    ) -> crate::ZaiResult<KnowledgeCapacityResponse> {
22        let route = crate::client::routes::KNOWLEDGE_CAPACITY;
23        let url = client.endpoints().resolve_route(route, &[])?;
24        client
25            .send_empty::<KnowledgeCapacityResponse>(route.method(), url)
26            .await
27    }
28}