Adds version method

This commit is contained in:
2025-12-28 13:23:14 +00:00
parent 1c431715c6
commit b2e7b7134e
4 changed files with 31 additions and 0 deletions

View File

@@ -16,6 +16,7 @@ use crate::{
ps::RunningModel,
pull::{PullRequest, PullResponse},
tags::Model,
version::VersionResponse,
},
};
@@ -33,6 +34,15 @@ impl OllamaClient {
}
}
pub async fn version(&self) -> OllamaResult<VersionResponse> {
let request_address = format!("{}/api/version", self.server_address);
Ok(reqwest::get(request_address)
.await?
.error_for_status()?
.json()
.await?)
}
/// Fetch a list of models and their details
pub async fn tags(&self) -> OllamaResult<Vec<Model>> {
let request_address = format!("{}/api/tags", self.server_address);