POST
/
api
/
v1
/
collection
/
generative-qa
curl --request POST \
  --url https://app.twilix.io/api/v1/collection/generative-qa \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "collection": "<string>",
  "prompt": "<string>",
  "promptFields": [
    {}
  ],
  "fields": [
    {}
  ],
  "conversationID": "<string>",
  "minimumScore": 123,
  "includeModeration": true,
  "limit": 123,
  "stream": true
}'

Generative QA returns relevant answers to the user input question.

Under the hood, we perform vector search and reranking on the input collection to retrieve the most relevant results, then use the results to generate an answer.

collection
string
required

The collection to query.

prompt
string
required

The question from the user

promptFields
array

The fields that you want the generation to be based on.

fields
array

The fields that you want to be returned as reference. If not specified, it returns all fields as reference.

conversationID
string

The conversation ID. This is returned in the response so you can use the one that has been automatically generated for you or you can also supply your own to keep track of the conversation on your side.

minimumScore
float

The minimum score.

includeModeration
boolean

If true then there will be a moderation layer applied after the user inputs a query and when the AI outputs to ensure that the generated content is not harmful or violent.

limit
integer

The max number of documents to returned

stream
boolean

Whether or not a stream response should be returned. See examples below for details.

Content-Type
default: "application/json"required

Requires JSON Content Type