Skip to content

UseReply

katanakit-js / 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.

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.

Promise<AssistantResult>

An AssistantResult with the reply and session id.

import { useReply } from "katanakit-js";
const result = await useReply(undefined, "How do I reset my password?");
if (result.ok) console.log(result.data.reply);