POST
/
knowledge-bases
/
{knowledge_base_id}
/
chat
curl --request POST \
  --url https://api.totoy.ai/v1/knowledge-bases/{knowledge_base_id}/chat \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "output_language": "en",
  "language_level": "plain",
  "markdown_response": true,
  "messages": [
    {
      "role": "user",
      "content": "Who are the co-founders of Totoy?"
    }
  ]
}'
{
  "project_id": "pj_avX7imfLaPcQnv5ckvGlOEBA9",
  "output_language": "en",
  "language_level": "plain",
  "answer": {
    "role": "assistant",
    "content": "Hi!\nThe co-founders of Totoy are Benedikt Hielscher, Francis Rafal, Marcel Koller, Michael Perger and Simon Hoffmann.[R1]",
    "references": [
      {
        "text": "[R1]",
        "source_id": "src_oXiYDg8QOc9JsOk86idRXiywD",
        "page_number": 5,
        "backlink": "https://www.totoy.ai/totoy-company-overview.pdf",
        "custom_metadata": {
          "internal_tag": "general_documents"
        }
      }
    ]
  },
  "knowledge_base_id": "kb_feMfJbeqbAEj4u8K5HqmKpUbY",
  "markdown_response": true
}

Authorizations

Authorization
string
headerrequired

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

knowledge_base_id
string
required

Unique identifier for a Knowledge Base.

Maximum length: 28

Body

application/json
output_language
enum<string>
required

The ISO 639-1 code for the language in which the Explanation should be generated. Supported Languages:

  • ar: Arabic
  • bs: Bosnian
  • cs: Czech
  • de: German
  • es: Spanish
  • en: English
  • fa: Farsi
  • fr: French
  • hr: Croatian
  • hu: Hungarian
  • it: Italian
  • pl: Polish
  • ro: Romanian
  • sk: Slovak
  • sl: Slovenian
  • sr: Serbian
  • tl: Tagalog
  • tr: Turkish
  • uk: Ukrainian
Available options:
ar,
bs,
cs,
de,
es,
en,
fa,
fr,
hr,
hu,
it,
pl,
ro,
sk,
sl,
sr,
tl,
tr,
uk
language_level
enum<string>
required

One of three language levels for the generated text:

  1. Simple Language: Answers are short and simple, using easy words and a clear structure.
  2. Plain Language: Answers are short and the assistant explains complicated terms.
  3. Detailed Language: Answers are not simplified and the assistant answers in detail.
Available options:
simple,
plain,
detailed
messages
object[]
required

The conversation history. Provide at least one user message to start the conversation.

markdown_response
boolean
default: true

Whether the response should be returned as Markdown formatted text. If 'false', the response will be returned in plain text.

Response

200 - application/json
project_id
string
required

The Project that the Knowledge Base is assigned to.

Maximum length: 28
output_language
enum<string>
required

The ISO 639-1 code for the language in which the Explanation should be generated. Supported Languages:

  • ar: Arabic
  • bs: Bosnian
  • cs: Czech
  • de: German
  • es: Spanish
  • en: English
  • fa: Farsi
  • fr: French
  • hr: Croatian
  • hu: Hungarian
  • it: Italian
  • pl: Polish
  • ro: Romanian
  • sk: Slovak
  • sl: Slovenian
  • sr: Serbian
  • tl: Tagalog
  • tr: Turkish
  • uk: Ukrainian
Available options:
ar,
bs,
cs,
de,
es,
en,
fa,
fr,
hr,
hu,
it,
pl,
ro,
sk,
sl,
sr,
tl,
tr,
uk
language_level
enum<string>
required

One of three language levels for the generated text:

  1. Simple Language: Answers are short and simple, using easy words and a clear structure.
  2. Plain Language: Answers are short and the assistant explains complicated terms.
  3. Detailed Language: Answers are not simplified and the assistant answers in detail.
Available options:
simple,
plain,
detailed
answer
object
required

Represents a message within an Explanation or a Knowledge Base Chat. For Explanations - An assistant message is either an initial Explanation for the document when no messages were provided in the request or an answer to a user message in the provided conversation history.

markdown_response
boolean
required

Whether the response is a Markdown formatted text.

knowledge_base_id
string
required

The unique identifier of the Knowledge Base that was used for the Chat.

Maximum length: 28