$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:
Argument | Type | Description | Required |
---|---|---|---|
secretName | String | Name of the knowledge base secret. | Yes |
chatId | Number | Chat identifier. Use the identifier returned by the$rag.chat.create method. | Yes |
timeout | Number | 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.
- Positional arguments
- Via object
Specify the arguments in order:
await $rag.chat.get("MyKnowledgeHub", 12345, 5000);
Pass an object whose fields match the names of the arguments:
await $rag.chat.get({
secretName: "MyKnowledgeHub",
chatId: 12345,
timeout: 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:
- The bot creates a chat and saves its identifier.
- The bot gets the information about the chat by this identifier and sends the chat name to the user.