LLMResultCallback

Type Alias LLMResultCallback 

Source
pub type LLMResultCallback = Option<unsafe extern "C" fn(result: *mut RKLLMResult, userdata: *mut c_void, state: LLMCallState) -> c_int>;
Expand description

@typedef LLMResultCallback @brief Callback function to handle LLM results. @param result Pointer to the LLM result. @param userdata Pointer to user data for the callback. @param state State of the LLM call (e.g., finished, error). @return int Return value indicating the handling status: - 0: Continue inference normally. - 1: Pause inference. If the user wants to modify or intervene in the result (e.g., editing output, injecting new prompt), return 1 to suspend the current inference. Later, call rkllm_run with updated content to resume inference.

Aliased Type§

pub enum LLMResultCallback {
    None,
    Some(unsafe extern "C" fn(*mut RKLLMResult, *mut c_void, u32) -> i32),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(*mut RKLLMResult, *mut c_void, u32) -> i32)

Some value of type T.