use crate::client::EdgeQuakeClient;
use crate::error::Result;
use crate::types::operations::*;
pub struct ModelsResource<'a> {
pub(crate) client: &'a EdgeQuakeClient,
}
impl<'a> ModelsResource<'a> {
pub async fn list(&self) -> Result<ProviderCatalog> {
self.client.get("/api/v1/models").await
}
pub async fn providers_health(&self) -> Result<Vec<ProviderHealthInfo>> {
self.client.get("/api/v1/models/health").await
}
pub async fn current_provider(&self) -> Result<ProviderStatus> {
self.client.get("/api/v1/settings/provider/status").await
}
pub async fn set_provider(&self, provider: &str) -> Result<ProviderStatus> {
let body = serde_json::json!({ "provider": provider });
self.client
.put("/api/v1/settings/provider", Some(&body))
.await
}
pub async fn list_llm(&self) -> Result<serde_json::Value> {
self.client.get("/api/v1/models/llm").await
}
pub async fn list_embedding(&self) -> Result<serde_json::Value> {
self.client.get("/api/v1/models/embedding").await
}
pub async fn get_provider(&self, provider: &str) -> Result<serde_json::Value> {
self.client
.get(&format!("/api/v1/models/{provider}"))
.await
}
pub async fn get_model(
&self,
provider: &str,
model: &str,
) -> Result<serde_json::Value> {
self.client
.get(&format!("/api/v1/models/{provider}/{model}"))
.await
}
}