Aller au contenu principal

Contextes

Files​

You can add files as context to a chat. Files are parsed and included completly in the prompt as text. Therefore, adding large of many files will break request size limit very quickly. We only support text and markdown files in chats currently.

Add file to context​

Call the create attachment endpoint to request a new upload URL. Then upload the file to the given URL.

POST /conversations/:conversationId/context/attachments
Content-Type: application/json
Body :
{
type: 'file'',
name: string,
mimeType: string,
size: number,
ext: string,
}

Response:
{
type: 'file'',
name: string,
mimeType: string,
size: number,
ext: string,
postURL: string,
formData: {[p: string]: any},
}

Upload your file with at postURL with the provided formData and your file content.

Once your file as been uploaded call the complete attachment endpoint to notify the system that your file is ready to be processed.

POST /conversations/:conversationId/context/attachments/:attachmentId/uploaded

Your file should now be ready to be used by your agent in your chat.