pub struct LlamaKVCacheInterface { /* private fields */ }Expand description
Interface for interacting with llama.cpp’s KV cache
Implementations§
Source§impl LlamaKVCacheInterface
impl LlamaKVCacheInterface
pub fn new() -> Self
pub fn set_runtime(&mut self, runtime: Box<dyn ModelRuntime + Send>)
Sourcepub async fn get_current_cache_state(&self) -> Result<LlamaKVCacheState>
pub async fn get_current_cache_state(&self) -> Result<LlamaKVCacheState>
Get current KV cache state from llama.cpp
Sourcepub async fn extract_current_kv_entries(&self) -> Result<Vec<KVEntry>>
pub async fn extract_current_kv_entries(&self) -> Result<Vec<KVEntry>>
Extract current KV cache entries from llama.cpp
Sourcepub async fn inject_kv_entries(&self, entries: &[KVEntry]) -> Result<()>
pub async fn inject_kv_entries(&self, entries: &[KVEntry]) -> Result<()>
Inject KV cache entries back into llama.cpp
Sourcepub async fn clear_cache_entries(
&self,
layer_indices: &[i32],
head_indices: &[Option<i32>],
) -> Result<()>
pub async fn clear_cache_entries( &self, layer_indices: &[i32], head_indices: &[Option<i32>], ) -> Result<()>
Clear specific entries from llama.cpp’s KV cache
Sourcepub async fn get_cache_memory_usage(&self) -> Result<usize>
pub async fn get_cache_memory_usage(&self) -> Result<usize>
Calculate memory usage of current KV cache
Sourcepub async fn estimate_cache_capacity(&self) -> Result<f32>
pub async fn estimate_cache_capacity(&self) -> Result<f32>
Estimate when the KV cache will reach capacity
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LlamaKVCacheInterface
impl !RefUnwindSafe for LlamaKVCacheInterface
impl Send for LlamaKVCacheInterface
impl Sync for LlamaKVCacheInterface
impl Unpin for LlamaKVCacheInterface
impl UnsafeUnpin for LlamaKVCacheInterface
impl !UnwindSafe for LlamaKVCacheInterface
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
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