POST
/
api
/
ai
/
session
/
{ai_session_id}
/
qa
/
create
curl --request POST \
  --url https://cite.petal.org/api/ai/session/{ai_session_id}/qa/create \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "chat_model": "<string>",
  "language": "English (US)",
  "meta": {},
  "query": "<string>",
  "restrict_to_context": "True",
  "use_cells": "True",
  "use_context": "True",
  "use_history": "True",
  "use_meta": "True"
}'
[
  {
    "ai_session_id": 123,
    "created_at": "<string>",
    "id": 123,
    "meta": {},
    "query": "<string>",
    "response": "<string>",
    "task_id": "<string>",
    "task_status": "<string>",
    "user_id": 123,
    "user_rating": "<string>"
  }
]

Authorizations

Authorization
string
header
required

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

Path Parameters

ai_session_id
integer
required

The unique ID of the Session in which the new message is to be created

Body

application/json
query
string
required

Your chat message to the AI

chat_model
string

The model of AI to use. Defaults to gpt-3.5-turbo for single-doc chat, and gpt-3.5-turbo-16k for multi-doc chat. Do not change unless you are will to incur potentially much higher costs

language
string
default:
English (US)

Desired language of the AI response

meta
object

Metadata, for internal use

restrict_to_context
boolean
default:
True

Whether to only use information from the document(s) in this Session

use_cells
boolean
default:
True

Whether to use information from AI Cells associated with Documents from this Sesssion

use_context
boolean
default:
True

Whether to use information from the document(s) in this Session. Cannot be False if restrict_to_context is True

use_history
boolean
default:
True

Whether the new AI response should be related to the previous chat history

use_meta
boolean
default:
True

Whether to use the metadata of the document(s) in this Session

Response

200
application/json
OK
ai_session_id
integer
required

The unique ID of the AI Session this message belongs to

created_at
string
required

Time of message creation, in UTC

id
integer
required

Unique ID of this message

meta
object
required

Metadata, for internal use

query
string
required

The user-provided message to the AI

task_id
string
required

Task ID for internal use

task_status
string
required

Progress on obtaining a response from the AI

user_id
integer
required

ID of user who submitted the message

user_rating
string
required

User's assessment of the AI response

response
string

The AI's response to the user