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

Copilot 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.

This endpoint has coding functionality. This endpoint is useful if you are looking to provide a chatbot interface on top of your documentation and codebase.

collection
string
required

The collection to query.

prompt
string
required

The message 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 rerank score.

limit
integer

The max number of documents to returned

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.

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