pub enum LlmProvider {
Ollama,
OpenAiCompatible {
api_key: String,
},
}Expand description
LLM-provider wire-shape selector. Owned by OllamaClient (the
historical name preserved post-#1066 for call-site backward
compatibility — a future rename to LlmClient is non-breaking and
tracked separately).
#1258 — api_key carries a vendor Bearer token; the manual Drop
impl below zeroizes the in-memory bytes when an LlmProvider falls
out of scope so the secret does not linger on the heap. #1262 —
the manual Debug impl redacts the api_key to <redacted> so a
stray {:?} print never leaks the secret.
Variants§
Ollama
Ollama native API: POST /api/chat, POST /api/embed. No
auth header. This is the historical pre-#1066 behavior and
remains the v0.7.0 default.
OpenAiCompatible
OpenAI-compatible API: POST /v1/chat/completions, POST /v1/embeddings. Authorization: Bearer <api_key> header.
Covers xAI Grok, OpenAI, Anthropic (via OpenAI shim), Google
Gemini, DeepSeek, Kimi, Qwen, Mistral, Groq, Together,
Cerebras, OpenRouter, Fireworks, LMStudio, vLLM, llama.cpp
server, and any other vendor following the spec.
Implementations§
Source§impl LlmProvider
impl LlmProvider
Sourcepub fn zeroize_secrets(&mut self)
pub fn zeroize_secrets(&mut self)
#1258 — zeroize the api_key buffer in place. Idempotent. The
Drop impl below delegates here so the helper is the single
source of truth for the zero-on-secret-loss contract. Tests
probe the buffer via this entry point so they observe the
post-zeroize state of a still-live allocation (probing after
the owning value is dropped is UB — the allocator’s free-list
bookkeeping stamps the first 8-16 bytes of the just-freed slot
and that’s not a zeroize defect; see #1321).
Trait Implementations§
Source§impl Clone for LlmProvider
impl Clone for LlmProvider
Source§fn clone(&self) -> LlmProvider
fn clone(&self) -> LlmProvider
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 LlmProvider
impl Debug for LlmProvider
Source§impl Drop for LlmProvider
impl Drop for LlmProvider
Source§fn drop(&mut self)
fn drop(&mut self)
#1258 — zeroize the api_key buffer on scope exit so the vendor
Bearer token does not linger on the heap after the
LlmProvider is dropped. Ollama carries no secret and is a
no-op. Delegates to LlmProvider::zeroize_secrets.
Auto Trait Implementations§
impl Freeze for LlmProvider
impl RefUnwindSafe for LlmProvider
impl Send for LlmProvider
impl Sync for LlmProvider
impl Unpin for LlmProvider
impl UnsafeUnpin for LlmProvider
impl UnwindSafe for LlmProvider
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more