Skip to main content

$rag.chat.get

The method returns information about the knowledge base chat.

caution

The method is available only in the ECMAScript 6 runtime and is asynchronous.

Syntax

The method accepts the following arguments:

ArgumentTypeDescriptionRequired
secretNameStringName of the knowledge base secret.Yes
chatIdNumber

Chat identifier.

Use the identifier returned by the $rag.chat.create method.
Yes
timeoutNumber

Timeout in milliseconds for the method execution. If the timeout is exceeded, an error will occur.

By default, the timeout is not set.
No

You can pass arguments to the method in different ways.

Specify the arguments in order:

await $rag.chat.get("MyKnowledgeHub", 12345, 5000);

Return value

The method returns an object with information about the chat.

{
"id": 12345,
"settings": {
"pipeline": "semantic",
"search": {
"similarityTopK": 5,
"numCandidates": 50,
"candidateRadius": 0,
"rephraseUserQuery": null,
"segment": null
},
"llm": {
"model": "GPT-4o",
"contextWindow": 16000,
"maxTokens": 1000,
"temperature": 0,
"topP": 1,
"frequencyPenalty": 0,
"presencePenalty": 0
},
"responseGeneration": {
"prompt": "You help users look for information in the documentation…"
}
},
"name": "My chat"
}

The object has the same format as the response to the GET /api/knowledge-hub/chat/{chatId} request in the Tovie Data Agent API.

How to use

state: NewChat
intent!: /new chat
scriptEs6:
const chat = await $rag.chat.create("MyKnowledgeHub", "My chat");
var chatInfo = await $rag.chat.get("MyKnowledgeHub", chat.id);
$reactions.answer("Chat name: " + chatInfo.name);

In this state:

  1. The bot creates a chat and saves its identifier.
  2. The bot gets the information about the chat by this identifier and sends the chat name to the user.