Create AI chat Sessions and messages
https://cite.petal.org/api/ai/session/create
. You will need to send a POST request to the endpoint, with the following parameters:
document_ids
, but it is not possible to have a single-doc Session with more than one Documentprivate
or shared
. Determines whether other users in the Workspace can see this Sessionid
returned, as that is the unique Session ID that you will need to create messages within it. Once you have located it, we can move on to message creation.
https://cite.petal.org/api/ai/session/<id>/qa/create
. You need to enter the Session ID into the URI (at <id>
), and the body of the request should contain your message to the AI:
pending
to running
to success
over time.task_status
should be pending
. This is because it takes some time to submit the user message to the AI and get a response. In order to fetch updates to the message, you should use the API https://cite.petal.org/api/ai/session/<id>/qa/list
, which will return a list that contains all chat messages for the given Session.
response
field in the JSON. While the task_status
of that message is running
, the response may be incomplete because the AI is still working. Once the task_status
is success
, the response will be complete.