pub struct OllamaProvider { /* private fields */ }Expand description
Ollama provider for local models (Llama, Mistral, …).
Implementations§
Source§impl OllamaProvider
impl OllamaProvider
Sourcepub fn new() -> OllamaProvider
pub fn new() -> OllamaProvider
Construct against the default local server (http://localhost:11434).
Sourcepub fn from_env() -> OllamaProvider
pub fn from_env() -> OllamaProvider
Construct from the OLLAMA_HOST environment variable, if set.
Sourcepub fn model(self, model: impl Into<String>) -> OllamaProvider
pub fn model(self, model: impl Into<String>) -> OllamaProvider
Set the default model.
Sourcepub fn base_url(self, base_url: impl Into<String>) -> OllamaProvider
pub fn base_url(self, base_url: impl Into<String>) -> OllamaProvider
Override the base URL.
Sourcepub fn with_client(self, client: Client) -> OllamaProvider
pub fn with_client(self, client: Client) -> OllamaProvider
Provide a custom reqwest::Client.
Trait Implementations§
Source§impl Clone for OllamaProvider
impl Clone for OllamaProvider
Source§fn clone(&self) -> OllamaProvider
fn clone(&self) -> OllamaProvider
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for OllamaProvider
impl Default for OllamaProvider
Source§fn default() -> OllamaProvider
fn default() -> OllamaProvider
Returns the “default value” for a type. Read more
Source§impl LlmProvider for OllamaProvider
impl LlmProvider for OllamaProvider
Source§fn chat<'life0, 'async_trait>(
&'life0 self,
req: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse, LlmError>> + Send + 'async_trait>>where
'life0: 'async_trait,
OllamaProvider: 'async_trait,
fn chat<'life0, 'async_trait>(
&'life0 self,
req: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse, LlmError>> + Send + 'async_trait>>where
'life0: 'async_trait,
OllamaProvider: 'async_trait,
Single-shot chat completion.
Source§fn chat_stream<'life0, 'async_trait>(
&'life0 self,
req: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamDelta, LlmError>> + Send>>, LlmError>> + Send + 'async_trait>>where
'life0: 'async_trait,
OllamaProvider: 'async_trait,
fn chat_stream<'life0, 'async_trait>(
&'life0 self,
req: ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamDelta, LlmError>> + Send>>, LlmError>> + Send + 'async_trait>>where
'life0: 'async_trait,
OllamaProvider: 'async_trait,
Streaming chat completion.
Source§fn embed<'life0, 'async_trait>(
&'life0 self,
req: EmbedRequest,
) -> Pin<Box<dyn Future<Output = Result<EmbedResponse, LlmError>> + Send + 'async_trait>>where
'life0: 'async_trait,
OllamaProvider: 'async_trait,
fn embed<'life0, 'async_trait>(
&'life0 self,
req: EmbedRequest,
) -> Pin<Box<dyn Future<Output = Result<EmbedResponse, LlmError>> + Send + 'async_trait>>where
'life0: 'async_trait,
OllamaProvider: 'async_trait,
Generate embeddings.
Source§fn estimate_cost(&self, _req: &ChatRequest) -> Option<CostEstimate>
fn estimate_cost(&self, _req: &ChatRequest) -> Option<CostEstimate>
Pre-flight cost estimate (no network call).
None if unknown.Auto Trait Implementations§
impl !RefUnwindSafe for OllamaProvider
impl !UnwindSafe for OllamaProvider
impl Freeze for OllamaProvider
impl Send for OllamaProvider
impl Sync for OllamaProvider
impl Unpin for OllamaProvider
impl UnsafeUnpin for OllamaProvider
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