feat: add models list endpoint

This commit is contained in:
2026-04-09 20:51:20 +02:00
parent b429f6256b
commit 8d26907c89
9 changed files with 467 additions and 43 deletions
+1
View File
@@ -0,0 +1 @@
pub mod ollama;
+25
View File
@@ -0,0 +1,25 @@
use reqwest::Client;
use serde_json::Value;
#[derive(Clone)]
pub struct OllamaProvider {
pub client: Client,
pub base_url: String,
}
impl OllamaProvider {
pub fn new(base_url: impl Into<String>) -> Self {
Self {
client: Client::new(),
base_url: base_url.into(),
}
}
pub async fn list_models(&self) -> Result<Value, reqwest::Error> {
let url = format!("{}/api/tags", self.base_url);
let res = self.client.get(url).send().await?.json::<Value>().await?;
Ok(res)
}
}