Skip to content

File

File reads a file you upload to the flow or pick from the ones you have already uploaded. It can return the text of the file, so an agent or a model can work with it, or the file itself, to pass it on to another component.

It supports text documents (txt, md, mdx), PDFs, Word documents (docx), spreadsheets (xlsx, xls, csv), data files (json, yaml, yml, xml), web pages (html, htm) and code files (py, sh, sql, js, ts, tsx).

When to use it

  • Give an agent a reference document, such as a product catalogue or an internal policy.
  • Extract the details of a contract or an invoice in PDF.
  • Pass a file to another component that works with files.

Configuration

FieldWhat it does
Upload file or select file (required)The file you want to read. You can upload a new one or pick one you have already uploaded.

Advanced options

FieldWhat it does
Silent ErrorsIf the file can’t be read, the flow carries on without its content instead of stopping.

Output

  • Data: the text of the file, along with its location. Connect it to an agent, a model or a document store.
  • Files: the file as it is, to pass it to components that work with files.

Example

A customer service team wants its agent to know the returns policy:

  1. Add File and upload the PDF with the returns policy.
  2. Connect Data to Parse Data to turn it into text.
  3. Include that text in the instructions of the agent that serves customers.

Good practices

  • .doc files from older versions of Word are not supported: save them as .docx before uploading them.
  • If you have several files in a folder, use Directory to read them all at once.