Docs
Chat with Chatbot

Chat with Chatbot

Learn how to chat with a chatbot

Chat with the Chatbot

POST /api/v1/backend/chatbot/{bot_uid}/chat

The Chat API enables programmatic interaction with chatbots through a POST request. This API is accessible to users with a paid subscription and facilitates communication with chatbots.

Path Parameters

ParameterTypeRequiredDescription
bot_uidstringYesThe unique ID of the chatbot with which you intend to engage in conversation.

Body Parameters

The Content-Type of the request should be set to application/json.

ParameterTypeRequiredDescription
qstringYesThe question you want to pose to the chatbot.
conversation_uidstringOptionalThe session ID for the chat. Note that you should not manually construct a session ID. After conversing with the chatbot, a session ID will be returned. If you wish to continue the same session, you can pass this session ID in subsequent interactions.
languagestringOptionalThe desired language for chatting with the chatbot. Currently supports English, French, Spanish, Russian, Simplified Chinese, and more. Default is auto.
streambooleanOptionalIndicates whether to enable streaming output. Default is False.

Returns

Normal

{
  "code": 0,
  "data": {
    "answer": "answer",
    "conversation_uid": "f05f1800-a728-4e23-adb8-69abd55b5dcb",
    "is_qa_mode": true,
    "question": "Ut minim ex",
    "system_message": ""
  },
  "msg": "Success.",
  "request_id": "25a40914-d8d9-4b0f-a92d-b8844bfc9852"
}

Stream

{"answer": "", "question": "Ut minim ex", "related_docs": [], "conversation_uid": "9628808a-dbb6-42c3-aba6-9fe5b772c724", "is_qa_mode": true, "system_message": ""}
645130146e8d07b175fd8b1d5682d520answer

Data

FieldTypeDescription
answerstringThe chatbot's response to the question.
conversation_uidstringThe session ID for the current conversation.
is_qa_modebooleanIndicates whether it's in QA mode (QA mode provides references to answers).
questionstringThe user's posed question.
system_messagestringSystem-generated message for displaying system notifications.

In streaming mode, the response data is separated by the magic number "645130146e8d07b175fd8b1d5682d520"
Before this magic number is a JSON string, and after the magic number is the actual answer.

Appendix

1. Language Codes

CodeNameNative NameRemark
autoAutoAutoAutomatically determines language based on input
enEnglishEnglish
frFrenchFrançais
esSpanishEspañol
ruRussianРусский
zh-HansSimplified Chinese中文 (简体)
zh-HantTraditional Chinese中文 (繁體)
arArabicالعربية
deGermanDeutsch
jpJapanese日本語
ptPortuguesePortuguês
hiHindiहिंदी
koKorean한국어
itItalianItaliano
ukUkrainianУкраїнська