pub struct CpuBackend { /* private fields */ }Expand description
CPU backend — wraps the existing v0.7.0 inference path
(embeddings::Embedder + llm::OllamaClient). This is a thin
adapter; the underlying types are unchanged.
Implementations§
Source§impl CpuBackend
impl CpuBackend
Sourcepub fn new(embedder: Arc<dyn Embed>, llm: Option<Arc<OllamaClient>>) -> Self
pub fn new(embedder: Arc<dyn Embed>, llm: Option<Arc<OllamaClient>>) -> Self
Construct a CPU backend from existing handles.
Sourcepub fn with_attested_weights(self, attested: AttestedWeights) -> Self
pub fn with_attested_weights(self, attested: AttestedWeights) -> Self
Pin an attested-weights record (issue #654). Returns a new
backend wrapping the same handles. The hash is NOT recomputed
here — the caller pre-computes it via
compute_attested_weights at model-load time so the
verify_attested_weights gate can refuse to serve from a
tampered file.
Trait Implementations§
Source§impl InferenceBackend for CpuBackend
impl InferenceBackend for CpuBackend
Source§fn embed(&self, text: &str) -> Result<Vec<f32>>
fn embed(&self, text: &str) -> Result<Vec<f32>>
Produce a single embedding vector for
text. Read moreSource§fn chat(&self, prompt: &str) -> Result<String>
fn chat(&self, prompt: &str) -> Result<String>
Generate a chat completion for
prompt. Default system prompt
is None (implementor decides); use a concrete backend’s API
for system-prompt support. Read moreSource§fn attested_weights(&self) -> Option<AttestedWeights>
fn attested_weights(&self) -> Option<AttestedWeights>
Return the loaded model’s SHA-256 + optional signature for
issue #654 supply-chain attestation.
None if the backend
has no on-disk weights to attest (e.g. a network-only client).Auto Trait Implementations§
impl !RefUnwindSafe for CpuBackend
impl !UnwindSafe for CpuBackend
impl Freeze for CpuBackend
impl Send for CpuBackend
impl Sync for CpuBackend
impl Unpin for CpuBackend
impl UnsafeUnpin for CpuBackend
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
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>
Converts
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>
Converts
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