File to Text

File to Text Input in AgenticFlow AI

What is a File to Text Input?

A File to Text Input is an input component that allows you to upload a file and automatically extract all the included text or transcribe the file. This extracted text can then be used as the source of truth in tasks such as question-answering, summarization, and more.

When to Use the File to Text Component

The File to Text Input component is suitable for scenarios where you need to work with the content of a file. For example, you can upload a 10-page report to a Large Language Model (LLM) to summarize the information to 2 pages, or list all the items discussed in an audio recording.

Supported Formats

  • Documents: PDF (no OCR), Word (.doc, .docx), Excel (.xlsx, .xls), CSV, JSON, TXT

  • Audio: .mp3, .mp4, .mp2, .aac, .wav, .flac, .pcm, .m4a, .ogg, .opus, .webm

Note: Audio transcription is done using the Whipser model.

How to Add a File to Text Input to Your Custom Workflow

The File to Text Input component is listed under User Inputs. You can add it to your workflow using the main section or the sidebar.

Adding a File to Text Input

  1. Navigate to the Workflow page.

  2. Click on + Create Workflow or select an existing workflow.

  3. In the empty state or within your workflow, click on + Add Input.

  4. Select File to Text Input from the list of input components.

File to Text Input Settings

Title

The title of your input component.

Description

Describe what this input is or will be used for. This helps users understand the purpose of the input.

Variable Name

Located at the bottom left and marked in green, you can rename the variable. Use this name to access the data in your workflow.

Optional/Required

Located at the top right, indicating whether the input is mandatory for the workflow to run:

  • Optional: The input is not required for the workflow to function.

  • Required: The input must be provided before the workflow can start.

Accessing the Extracted Text

To access the extracted text output, use the variable name within double curly braces {{}}.

For example, if the variable name is file_text, you can access it as:

  • {{file_text}} in most workflow steps.

  • params.file_text in a JavaScript step.

Example Usage in a Prompt:

Summarize the following document: "{{file_text}}"

Practical Example

Example Workflow: Summarizing a Document

  1. Add a File to Text Input:

    • Title: "Upload Document"

    • Description: "Upload the document you want to summarize."

    • Variable Name: document_text

  2. Add a Summarization Action:

    • Use the text provided by the document_text variable to access the document's content.

    • Prompt:

      Summarize the following document content to 2 pages: "{{document_text}}"
  3. Run the Workflow:

    • Save the workflow.

    • On the App page, upload the document using the File to Text Input component.

    • Run the workflow to see the summarized document content.

By following these steps, you can effectively utilize File to Text Input components in your workflows to upload and process files, extracting text content for further analysis or summarization, enhancing the capabilities of your AI-driven automation in AgenticFlow AI.

Last updated