edgequake_sdk/resources/
models.rs1use crate::client::EdgeQuakeClient;
6use crate::error::Result;
7use crate::types::operations::*;
8
9pub struct ModelsResource<'a> {
10 pub(crate) client: &'a EdgeQuakeClient,
11}
12
13impl<'a> ModelsResource<'a> {
14 pub async fn list(&self) -> Result<ProviderCatalog> {
16 self.client.get("/api/v1/models").await
17 }
18
19 pub async fn providers_health(&self) -> Result<Vec<ProviderHealthInfo>> {
21 self.client.get("/api/v1/models/health").await
22 }
23
24 pub async fn current_provider(&self) -> Result<ProviderStatus> {
26 self.client.get("/api/v1/settings/provider/status").await
27 }
28
29 pub async fn set_provider(&self, provider: &str) -> Result<ProviderStatus> {
31 let body = serde_json::json!({ "provider": provider });
32 self.client
33 .put("/api/v1/settings/provider", Some(&body))
34 .await
35 }
36
37 pub async fn list_llm(&self) -> Result<serde_json::Value> {
39 self.client.get("/api/v1/models/llm").await
40 }
41
42 pub async fn list_embedding(&self) -> Result<serde_json::Value> {
44 self.client.get("/api/v1/models/embedding").await
45 }
46
47 pub async fn get_provider(&self, provider: &str) -> Result<serde_json::Value> {
49 self.client
50 .get(&format!("/api/v1/models/{provider}"))
51 .await
52 }
53
54 pub async fn get_model(
56 &self,
57 provider: &str,
58 model: &str,
59 ) -> Result<serde_json::Value> {
60 self.client
61 .get(&format!("/api/v1/models/{provider}/{model}"))
62 .await
63 }
64}