pub struct OllamaHttpAdapter { /* private fields */ }Expand description
HTTP adapter that routes to a local Ollama instance via /api/chat.
Implementations§
Source§impl OllamaHttpAdapter
impl OllamaHttpAdapter
Sourcepub fn new(config: OllamaConfig) -> Result<Self, LlmError>
pub fn new(config: OllamaConfig) -> Result<Self, LlmError>
Build an adapter from config.
The endpoint URL is validated immediately; returns
LlmError::InvalidRequest if the endpoint does not satisfy the
loopback-only constraint. The model reference is validated per-call
(inside LlmAdapter::complete) because the model is also present on
the request.
Trait Implementations§
Source§impl Clone for OllamaHttpAdapter
impl Clone for OllamaHttpAdapter
Source§fn clone(&self) -> OllamaHttpAdapter
fn clone(&self) -> OllamaHttpAdapter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OllamaHttpAdapter
impl Debug for OllamaHttpAdapter
Source§impl LlmAdapter for OllamaHttpAdapter
impl LlmAdapter for OllamaHttpAdapter
Source§fn stream_boxed(&self, req: LlmRequest) -> BoxStream<'_>
fn stream_boxed(&self, req: LlmRequest) -> BoxStream<'_>
Override with true Ollama streaming via newline-delimited JSON.
Uses ureq (synchronous) inside spawn_blocking. Because
spawn_blocking requires the entire blocking work to complete before
returning, all stream lines are collected into a Vec before being
yielded. This means backpressure and incremental display require the
full response to arrive first.
TODO: replace ureq with an async HTTP client (e.g. reqwest) and
drive the response body with tokio::io::AsyncBufReadExt to achieve
true line-by-line streaming without buffering the entire response.
Source§fn adapter_id(&self) -> &'static str
fn adapter_id(&self) -> &'static str
"claude",
"ollama", "replay"). Constants — implementations MUST NOT vary
this per call.Source§fn complete<'life0, 'async_trait>(
&'life0 self,
req: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete<'life0, 'async_trait>(
&'life0 self,
req: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, LlmError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
req.timeout_ms and returning LlmError::Timeout when exceeded.