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

14
examples/version.rs Normal file
View File

@@ -0,0 +1,14 @@
use std::{env, error::Error};
use ollama_rs::OllamaClient;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
tracing_subscriber::fmt().init();
let _ = dotenvy::dotenv();
let server_address = env::var("OLLAMA_SERVER")?;
let ollama_client = OllamaClient::new(server_address);
let version_response = ollama_client.version().await?;
println!("{}", version_response.version);
Ok(())
}