Skip to main content
This page explains sources. After you read it, you can upload an image for a chat message, list and download the files an agent holds, and read a citation. A source is a file that an agent holds. There are two kinds:
  • A document that the agent learned from through observe-file. The upload response returns its source_id.
  • An image that you attach to one chat message with PUT .../sources/images. The model looks at the image when it writes that one answer.
Sources belong to the agent. Every thread of the agent can point to them.

Upload an image for a chat message

Send the image bytes with PUT /v1/agents/{agent_id}/threads/{thread_id}/sources/images. Set Content-Type to image/png, image/jpeg, or image/webp. The image can be up to 10 MB.
The response has the same format as a citation:
Then send the source_id in image_source_ids on a chat message. One message can name up to 10 images, with a total of 32 MB. GET /v1/session returns the limits that apply to your organization.

Errors

List and download sources

Errors

Upload state on the list

For a document whose upload did not finish, each entry on the list also says where it stands. The fields are null when there is nothing unfinished.

Finish an upload that stopped

When an upload stopped partway or failed, Priors keeps the file. Call POST .../threads/{thread_id}/sources/{source_id}/finish-learning to finish it. You send no file. Only the pieces that were not learned are read and charged.
The response is 202, with the same body as observe-file. Poll the observation_id it returns. The upload resumes in the thread it was uploaded into, which can be a different thread from the one in the path. The response names the thread, and the Location header gives the status path. To resume an upload in its own thread, you must be able to open that thread. can_finish on the list says whether you can. If you cannot, the call returns 409 conflict. You can then send {"here": true} to read the whole file again in your thread. That stores a second copy, charged in full.

Read unread pictures again

Sometimes a document’s text is learned, but some of its pictures cannot be read. figures_unread on the list then counts them, and figures_retry is available. Call POST .../threads/{thread_id}/sources/{source_id}/retry-pictures to read only those pictures again. Priors never does this by itself.
The response is 202 with an observation_id. Poll it like an upload. Each picture that can now be read is learned as one short piece that cites the document. The text of the document is not read or charged again: the charge is for the words of the picture pieces only. A picture that still cannot be read costs nothing. The job adds nothing to the thread in the path. 409 conflict means no pictures are left to read, or a retry of this file is already running.

Citations

A chat answer has a citations list. Each citation points to one source that the answer used. It has a source_id, a label to show to people, and an href on the same host that downloads the file. The verified field tells you how the source reached the answer:
  • true: the image was attached to this message, and the model looked at it.
  • false: the file was learned earlier, and the answer used a memory that came from it. This is the normal case for documents.
observe-and-respond and observe-and-enrich do not return citations. They return used_source_ids. Use the sources list to find the file for each id.

An image can also be a document

observe-file accepts an image file (PNG, JPEG, GIF, or WebP). Priors reads the format from the bytes, not from the file name, so a wrong extension is fine and a renamed file of another type is refused. Priors reads the text in the image, for example the text in a photographed receipt or a screenshot, and learns it like a one-page document. This is different from attaching an image to a chat message. A chat attachment shows the image to the model for one answer. The agent learns nothing from the image itself.