Type Alias: LLMChatSession
LLMChatSession =
object
Defined in: extensions/llm/tasks/llmChatSession.ts:102
Handle to an active LLM chat session.
Methods
dispose()
dispose():
void
Defined in: extensions/llm/tasks/llmChatSession.ts:111
Disposes native model weights, KV cache, and tokenizer runtime resources.
Returns
void
getHistory()
getHistory(): readonly
ChatMessage[]
Defined in: extensions/llm/tasks/llmChatSession.ts:116
Returns a snapshot of the current message history in the session.
Returns
readonly ChatMessage[]
getKVCacheState()
getKVCacheState():
LLMKVCacheState
Defined in: extensions/llm/tasks/llmChatSession.ts:121
Returns current KV cache occupancy and total capacity statistics for the session runner.
Returns
sendMessage()
sendMessage(
message,onToken?,genConfig?):Promise<LLMChatTurnResult>
Defined in: extensions/llm/tasks/llmChatSession.ts:133
Sends a user message or chat turn to the model and generates a response.
Parameters
message
Message string or interleaved media payload array.
onToken?
(token) => void
Callback fired on the RN thread for each decoded token.
genConfig?
Generation options overriding session defaults.
Returns
Promise<LLMChatTurnResult>
A promise resolving to the generated messages and turn stats.
Throws
With code INVALID_ARGUMENT if the message is
malformed, INVALID_STATE if the chat template is non-monotonic, or
RESOURCE_BUSY if another turn is in progress.
stop()
stop():
void
Defined in: extensions/llm/tasks/llmChatSession.ts:106
Stops active generation and discards the current turn after its tool calls finish.
Returns
void