UseReply
katanakit-js / useReply
Function: useReply()
Section titled “Function: useReply()”function useReply( sessionId, text, options?): Promise<AssistantResult>;Defined in: core/services/assistant.service.ts:349
Sends a user message within a conversation and returns the assistant reply.
If no sessionId is provided, a new session is created. The user message and
the assistant reply are persisted only on success.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
sessionId |
string | undefined |
Existing session id, or undefined to start a new one. |
text |
string |
The user’s message. |
options? |
AssistantReplyOptions |
Optional completion options. |
Returns
Section titled “Returns”Promise<AssistantResult>
An AssistantResult with the reply and session id.
Example
Section titled “Example”import { useReply } from "katanakit-js";
const result = await useReply(undefined, "How do I reset my password?");if (result.ok) console.log(result.data.reply);