pub struct LlamaContext {
pub backend: Arc<LlamaLib>,
pub handle: *mut llama_context,
}Expand description
Inference context attached to a model
Fields§
§backend: Arc<LlamaLib>§handle: *mut llama_contextImplementations§
Source§impl LlamaContext
impl LlamaContext
pub fn new( model: &LlamaModel, params: llama_context_params, ) -> Result<Self, LlamaError>
pub fn default_params(model: &LlamaModel) -> llama_context_params
pub fn decode(&mut self, batch: &LlamaBatch) -> Result<(), LlamaError>
Sourcepub fn kv_cache_clear(&mut self)
pub fn kv_cache_clear(&mut self)
Clear the KV cache for this context. Resets all cached key/value state, allowing the context to be reused for a fresh generation without reallocating.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LlamaContext
impl RefUnwindSafe for LlamaContext
impl !Send for LlamaContext
impl !Sync for LlamaContext
impl Unpin for LlamaContext
impl UnsafeUnpin for LlamaContext
impl UnwindSafe for LlamaContext
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