File Extraction
File Extraction reads a file and gives you its text and details, such as the number of pages.
Screenshot placeholder
When to use it
Use it to read the contents of a document, such as an invoice PDF, before you pass it to an agent or another node. In the palette it is described as "Extract text & metadata from a file".
Settings
| Field | What it does | Notes |
|---|---|---|
| File type | What kind of file it is | PDF (default), DOCX, TXT, XLSX, CSV, PNG image, JPG / JPEG image, JSON, XML, Other |
| File source | Where the file comes from | File URL (default) or Base64 content |
| File name | The file's name | Jinja2 supported. Placeholder e.g. invoice.pdf or {{ filename }} |
| File URL | The address of the file | Shown when the source is File URL. Placeholder https://… or {{ file_url }} |
| Base64 content | The file's bytes as base64 | Shown when the source is Base64 content. Placeholder Base64 data or {{ file_b64 }} |
| Output key | Where the result is saved | Default extracted_file |
Inputs and outputs
- Input: one connection at the top.
- Output: one connection at the bottom. Later nodes read the result through the output key, for example
{{ extracted_file.text }}and{{ extracted_file.metadata.page_count }}.
Example
Illustrative. Set File source to File URL, File URL to {{ file_url }}, and use {{ extracted_file.text }} in the next node.
Tips
- Set File type to match the file.
- Use Base64 content when the file arrives inside an earlier node's output rather than at a web address.