pub struct OllamaConfig { /* private fields */ }Expand description
Ollama local or cloud configuration.
Construction is passive and does not verify a running local or cloud service.
§Examples
use providers_kit::config::{ApiKey, OllamaConfig};
let config = OllamaConfig::local();
let _config = config.with_base_url("http://127.0.0.1:11434/api".parse().unwrap())?;
Implementations§
Source§impl OllamaConfig
impl OllamaConfig
Sourcepub fn local() -> Self
pub fn local() -> Self
Creates an unauthenticated local Ollama configuration.
let config = providers_kit::config::OllamaConfig::local();
let _ = config;Sourcepub fn local_with_key(api_key: ApiKey) -> Self
pub fn local_with_key(api_key: ApiKey) -> Self
Creates an authenticated local or proxy configuration.
§Examples
use providers_kit::config::{ApiKey, OllamaConfig};
let config = OllamaConfig::local_with_key(ApiKey::new("example-key")?);
let _config = config.with_base_url("http://127.0.0.1:11434/api".parse().unwrap())?;
Sourcepub fn cloud(api_key: ApiKey) -> Self
pub fn cloud(api_key: ApiKey) -> Self
Creates an Ollama Cloud configuration.
§Examples
use providers_kit::config::{ApiKey, OllamaConfig};
let config = OllamaConfig::cloud(ApiKey::new("example-key")?);
let _config = config.with_base_url("http://127.0.0.1:11434/api".parse().unwrap())?;
Sourcepub fn with_base_url(self, base_url: Url) -> Result<Self, KitError>
pub fn with_base_url(self, base_url: Url) -> Result<Self, KitError>
Replaces the API base URL.
§Errors
Returns a configuration error unless the URL path is exactly /api. The URL is not contacted or checked for endpoint capabilities here.
§Examples
use providers_kit::config::OllamaConfig;
assert!(OllamaConfig::local().with_base_url("http://localhost:11434/".parse().unwrap()).is_err());
let _config = OllamaConfig::local().with_base_url("http://localhost:11434/api".parse().unwrap())?;
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OllamaConfig
impl RefUnwindSafe for OllamaConfig
impl Send for OllamaConfig
impl Sync for OllamaConfig
impl Unpin for OllamaConfig
impl UnsafeUnpin for OllamaConfig
impl UnwindSafe for OllamaConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more