Skip to content

Attaching files to the AI assistant: pictures, PDFs, sheets and text

Describes AI Agent 0.2.0.

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.

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. Each one shows as a chip above the message box:

  • while it uploads, a progress bar and an × to cancel it;
  • 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 being read, the panel says Wait until the files are read.

A file you added but did not send stays with the chat 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.
  • 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.

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: [...].