Attaching files to the AI assistant: pictures, PDFs, sheets and text
Describes AI Agent 0.3.0. On an older release? The version menu above has this guide as it was then.
You can add files to a message in the AI assistant: pictures, PDFs, spreadsheets and plain text. The assistant reads them before it answers.
Where to find it
In the chat panel of the AI assistant, the paper clip under the message box (Attach a file). You need what the chat panel needs: the AI Agent module enabled and the AI Agent permission.
Which files
- Pictures: png, jpg, webp and heic.
- PDF.
- Sheets: xlsx and csv.
- Text: txt and md.
An administrator can narrow this list under Types of file in chats in Settings > AI Agent. A file of a type the site doesn’t take is refused with This site accepts only these kinds of file: and the list.
What the file is is decided by its content, not by its name. A txt, csv or md file must be saved as UTF-8. One saved in another encoding (a common case with Excel) is refused with The text is not in UTF-8. Save the file as UTF-8 and add it again.
Adding and removing files
Files upload as soon as you pick them, up to three at a time. While a file uploads, it shows in the upload list under the message box with its progress and buttons to pause, retry or cancel it. Files are sent in parts, so a lost connection or a reload of the page carries on where the file stopped.
Once uploaded, each file shows as a chip above the message box:
- while it is being read, a spinner;
- when it failed, a red border and the reason.
The × on a chip (Remove the file) takes it off. Send sends the files that are ready with your message. If a file is still uploading or being read, the panel says Wait until the files are uploaded and read; a paused file has to be resumed or removed first.
A file you added but did not send stays with the chat it was added in, and is there when you open it again.
How the assistant reads them
- A PDF gives its text.
- A sheet becomes plain rows, the first rows of each sheet.
- A text file is read as it is.
- A picture, or a PDF that is only a scan, is either shown to the model directly, when the model is known to take pictures, or described in words by the vision model chosen in Settings > AI Agent. A description is made once and kept with the chat.
Long files are cut to fit. When that happens, the assistant is told how much it did not see (for example how many rows or sheets are left out), so it does not take part of the data for all of it.
Photos sent to a model lose their hidden metadata, such as the time and place they were taken.
Your files are kept apart from the site’s media: they don’t show in any media picker or browser, and only you can open them.
Limits
Set per user on AI Agent > Users, or for everyone in Settings > AI Agent:
- Largest attachment: 20 MB by default.
- Attachments per message: 5 by default.
On top of that, you can’t have more than 20 files waiting for a message across all your chats, failed ones included, until you remove some. The panel then says Too many files are waiting. Send or remove some of them first.
Describing a picture costs money on the vision model, so it counts toward your spending limits.
When a file fails
The chip says why. The reasons you may see:
- This kind of file is not supported. Send a picture, a PDF, an xlsx or csv sheet, or a txt or md text. When the site takes fewer types, the message is This site accepts only these kinds of file: with the list instead.
- The file is too large. or The file is too large to read.
- Pictures cannot be read: no model that sees images is set up. The assistant’s model doesn’t take pictures and no vision model is chosen in Settings > AI Agent.
- This kind of file cannot be read on this server. The server lacks the tools for PDFs or pictures.
- Your assistant limit is reached, so it was not read. or The AI budget is used up, so it was not read.
- Reading it took too long. or The server was too busy to read it. Add it again.
If the model changes between adding a picture and sending it, and the new model can’t take pictures, nothing is sent and the chat says: The model does not take pictures now, so they were not sent. Remove them and attach them again to have them described, or choose a model that sees.
Pictures from Telegram
In the assistant’s Telegram chat, a photo, or a png, jpeg or webp image sent as a file, is added to the conversation like a picture added here, with the same limits. Its caption is the question; without one, the question is “What is in this picture?” Several photos sent together are one question. PDFs and sheets are not taken from Telegram. See the guide on the assistant in Telegram.
What it doesn’t do
- It does not read other file types, such as docx or pptx.
- It does not convert text files from other encodings.
- It does not guess whether a model takes pictures: if nobody knows, the picture is described by the vision model instead.
For developers
PDFs need poppler (pdfinfo, pdftotext, pdftoppm) and pictures need ImageMagick (convert, identify) on the server. Without them those files fail and nothing else breaks. How much of a file is kept is set by config :phoenix_kit_agent, attachment_limits: [...].