POST
/
library
/
{library_id}
/
query

Parameters

library_id
string
required

The ID of the library you are going to ask a question

Body

query
string
required

The question you will make to the library.

conversationId
string | null

Optional. Use this for a continuation of the conversation. You will receive a conversation id on the first query you send.

streaming
boolean | null

Optional. Whether or not you want to receive a streamed response. Default value is False.

Response

The response will vary according to the value of the streaming attribute.

Non-streamed response

When streaming is equal to false the response will be a JSON object containing the following fields

reply
string
required

The response from the library for the query provided in the request body

conversationId
string
required

Optional. Use this in follow-up requests for a continuation of the conversation. You will receive a conversation id on the first query you send.

metadata
json
required

A map containing data used to generate the query response. It provides additional sources of information to the reply.

Streamed response

When streaming is equal to true the response is sent as a series of chunk where each of them will be a JSON object.

type
string
required

Specifies the type of the chunk that is being sent

Possible values are: initializing, token, response, done

value
string | null

It only appears when type == token.

It represents the token that is currently being sent as part of a partial response. If you concatenate all tokens you will have the complete response.

data
json | null

It only appears when type == response.

A json object containing the final response and metadata for the gptQuery.