Using the LLM helper
Actions
All of the below are abstracted actions. As with all actions, they can be awaited or chained with.then()
.
If the bot is unable to process the action, it will trigger the onMessageError
callback and MessageError
event.
getContext()
llm:get_context
Retrieve LLM context from bot. Returns Promise<LLMContext>
setContext()
llm:set_context
Replaces the current LLM context with the provided one. Returns Promise<boolean>
.
LLMContext option to set.
Interrupt the current conversation and apply the new context immediately.
appendToMessages()
llm:append_to_messages
Append a new message to the existing context. Returns Promise<boolean>
.
New message to apply to the context.
Apply the new message immediately, or wait until the current turn concludes.
Callbacks and events
- onLLMJsonCompletion: (jsonString: string) => void;`
- onLLMFunctionCall: (func: LLMFunctionCallData) => void;
- onLLMFunctionCallStart: (functionName: string) => void;
- onLLMMessage: (message: LLMContextMessage) => void;