v2

latestOpenAPI 3.1.02026-07-313981108.2 KB
Knowledge Bases

Query Knowledge Base

Send a question to the specified knowledge base and receive a response. Optionally pass a conversation history for the assistant to take into consideration while generating responses.

post/kb/v1/knowledge-bases/{id}/query

Path parameters

idstring required

The ID of the knowledge base to train.

Request body

model'gpt-4o' | 'gpt-4o-mini'

Optional parameter - The GPT model to use for generating responses

promptstring

[DEPRECATED. USE "messages" instead] The query prompt to send to the knowledge base.

temperaturenumber

Temperature controls the randomness in the output of the underlying language model; while lower values produce predictable and factual replies, higher values allow the model to be creative and reword the responses.

seedinteger

Seed initializes the random number generator in the underlying language model, ensuring reproducible outputs for the same prompt and settings.

streamboolean

Determines whether to stream the generated response back instead of returning it all at once. When stream = true, the response is a list of JSON objects of the form {"response": string} separated by newline characters

Example request

{
  "messages": [
    {
      "role": "user",
      "content": "What are the services offered?"
    }
  ],
  "temperature": 0.1,
  "seed": 42
}

Response

Successful response

responsestring

The response from the knowledge base.

Example response

{
  "response": "string"
}