Skip to main content

$rag

The $rag service lets you access the RAG knowledge base from the bot script. For examples of working with the knowledge base, see the Use in script article.

caution

The service methods are available only in the ECMAScript 6 runtime and are asynchronous.

Methods

General methods

MethodDescription
project.getInfoGet information about the knowledge base project.
getChatHistoryGet the history of dialog with the bot in the current session. The method returns the history in a format for the knowledge base.

Single requests to knowledge base

MethodDescription
query.generateAnswerGenerate a response to the user query.
query.generateAnswerAsyncCreate a request for response generation.
query.getAnswerGet response generation status.
query.cancelProcessingCancel a request for response generation.
retrieveChunksRetrieve chunks relevant to the user’s query from a knowledge base.

Requests within chat with knowledge base

MethodDescription
chat.createCreate a chat with a knowledge base.
chat.getGet information about a chat.
chat.processQueryGenerate a response to the user query within a chat.
chat.processQueryAsyncCreate a request for response generation within a chat.
chat.getQueryAnswerGet response generation status.
chat.cancelRecordProcessingCancel a request for response generation.
chat.retrieveChunksFromChatRetrieve chunks relevant to the user’s query from a knowledge base.