pub struct LLMHandle { /* private fields */ }Expand description
Handle to an LLM instance.
Implementations§
Source§impl LLMHandle
impl LLMHandle
Sourcepub fn destroy(&self) -> Result<(), Box<dyn Error + Send + Sync>>
pub fn destroy(&self) -> Result<(), Box<dyn Error + Send + Sync>>
Destroys the LLM instance and releases its resources.
Sourcepub fn run(
&self,
rkllm_input: RKLLMInput,
rkllm_infer_params: Option<RKLLMInferParam>,
user_data: impl RkllmCallbackHandler + Send + Sync + 'static,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub fn run( &self, rkllm_input: RKLLMInput, rkllm_infer_params: Option<RKLLMInferParam>, user_data: impl RkllmCallbackHandler + Send + Sync + 'static, ) -> Result<(), Box<dyn Error + Send + Sync>>
Runs an LLM inference task asynchronously.
§Parameters
rkllm_input: The input data for the LLM.rkllm_infer_params: Optional parameters for the inference task.user_data: The callback handler to process the results.
§Returns
This function does not return a value directly. Instead, it starts an asynchronous operation and processes results via the provided callback handler.
Sourcepub fn load_prompt_cache(
&self,
cache_path: &str,
) -> Result<(), Box<dyn Error + Send + Sync>>
pub fn load_prompt_cache( &self, cache_path: &str, ) -> Result<(), Box<dyn Error + Send + Sync>>
Sourcepub fn release_prompt_cache(&self) -> Result<(), Box<dyn Error + Send + Sync>>
pub fn release_prompt_cache(&self) -> Result<(), Box<dyn Error + Send + Sync>>
Release a prompt cache from a file.
Trait Implementations§
impl Copy for LLMHandle
impl Send for LLMHandle
impl Sync for LLMHandle
Auto Trait Implementations§
impl Freeze for LLMHandle
impl RefUnwindSafe for LLMHandle
impl Unpin for LLMHandle
impl UnwindSafe for LLMHandle
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