Skip to main content

Data components in Langflow

Data components load data from a source into your flow.

They may perform some processing or type checking, like converting raw HTML data into text, or ensuring your loaded file is of an acceptable type.

Use a data component in a flow

The URL data component loads content from a list of URLs.

In the component's URLs field, enter a comma-separated list of URLs you want to load. Alternatively, connect a component that outputs the Message type, like the Chat Input component, to supply your URLs with a component.

To output a Data type, in the Output Format dropdown, select Raw HTML. To output a Message type, in the Output Format dropdown, select Text. This option applies postprocessing with the data_to_text helper function.

In this example of a document ingestion pipeline, the URL component outputs raw HTML to a text splitter, which splits the raw content into chunks for a vector database to ingest.

URL component in a data ingestion pipeline

API Request

This component makes HTTP requests using URLs or cURL commands.

Inputs

NameDisplay NameInfo
urlsURLsEnter one or more URLs, separated by commas.
curlcURLPaste a curl command to populate the dictionary fields for headers and body.
methodMethodThe HTTP method to use.
use_curlUse cURLEnable cURL mode to populate fields from a cURL command.
query_paramsQuery ParametersThe query parameters to append to the URL.
bodyBodyThe body to send with the request as a dictionary (for POST, PATCH, PUT).
headersHeadersThe headers to send with the request as a dictionary.
timeoutTimeoutThe timeout to use for the request.
follow_redirectsFollow RedirectsWhether to follow http redirects.
save_to_fileSave to FileSave the API response to a temporary file
include_httpx_metadataInclude HTTPx MetadataInclude properties such as headers, status_code, response_headers, and redirection_history in the output.

Outputs

NameDisplay NameInfo
dataDataThe result of the API requests.

Directory

This component recursively loads files from a directory, with options for file types, depth, and concurrency.

Inputs

InputTypeDescription
pathMessageTextInputPath to the directory to load files from
typesMessageTextInputFile types to load (leave empty to load all types)
depthIntInputDepth to search for files
max_concurrencyIntInputMaximum concurrency for loading files
load_hiddenBoolInputIf true, hidden files are loaded
recursiveBoolInputIf true, the search is recursive
silent_errorsBoolInputIf true, errors do not raise an exception
use_multithreadingBoolInputIf true, multithreading is used

Outputs

OutputTypeDescription
dataList[Data]Loaded file data from the directory

File

The FileComponent is a class that loads and parses text files of various supported formats, converting the content into a Data object. It supports multiple file types and provides an option for silent error handling.

The maximum supported file size is 100 MB.

Inputs

NameDisplay NameInfo
pathPathFile path to load.
silent_errorsSilent ErrorsIf true, errors do not raise an exception.

Outputs

NameDisplay NameInfo
dataDataParsed content of the file as a Data object.

Gmail Loader

This component loads emails from Gmail using provided credentials and filters.

For more on creating a service account JSON, see Service Account JSON.

Inputs

InputTypeDescription
json_stringSecretStrInputJSON string containing OAuth 2.0 access token information for service account access
label_idsMessageTextInputComma-separated list of label IDs to filter emails
max_resultsMessageTextInputMaximum number of emails to load

Outputs

OutputTypeDescription
dataDataLoaded email data

Google Drive Loader

This component loads documents from Google Drive using provided credentials and a single document ID.

For more on creating a service account JSON, see Service Account JSON.

Inputs

InputTypeDescription
json_stringSecretStrInputJSON string containing OAuth 2.0 access token information for service account access
document_idMessageTextInputSingle Google Drive document ID

Outputs

OutputTypeDescription
docsDataLoaded document data

This component searches Google Drive files using provided credentials and query parameters.

For more on creating a service account JSON, see Service Account JSON.

Inputs

InputTypeDescription
token_stringSecretStrInputJSON string containing OAuth 2.0 access token information for service account access
query_itemDropdownInputThe field to query
valid_operatorDropdownInputOperator to use in the query
search_termMessageTextInputThe value to search for in the specified query item
query_stringMessageTextInputThe query string used for searching (can be edited manually)

Outputs

OutputTypeDescription
doc_urlsList[str]URLs of the found documents
doc_idsList[str]IDs of the found documents
doc_titlesList[str]Titles of the found documents
DataDataDocument titles and URLs in a structured format

SQL Query

This component executes SQL queries on a specified database.

Inputs

NameDisplay NameInfo
queryQueryThe SQL query to execute.
database_urlDatabase URLThe URL of the database.
include_columnsInclude ColumnsInclude columns in the result.
passthroughPassthroughIf an error occurs, return the query instead of raising an exception.
add_errorAdd ErrorAdd the error to the result.

Outputs

NameDisplay NameInfo
resultResultThe result of the SQL query execution.

URL

This component fetches content from one or more URLs, processes the content, and returns it as a list of Data objects.

Inputs

NameDisplay NameInfo
urlsURLsEnter one or more URLs

Outputs

NameDisplay NameInfo
dataDataList of Data objects containing fetched content and metadata

Webhook

This component defines a webhook trigger that runs a flow when it receives an HTTP POST request.

If the input is not valid JSON, the component wraps it in a payload object so that it can be processed and still trigger the flow. The component does not require an API key.

When a Webhook component is added to the workspace, a new Webhook cURL tab becomes available in the API pane that contains an HTTP POST request for triggering the webhook component. For example:


_10
curl -X POST \
_10
"http://127.0.0.1:7860/api/v1/webhook/**YOUR_FLOW_ID**" \
_10
-H 'Content-Type: application/json'\
_10
-d '{"any": "data"}'

To test the webhook component:

  1. Add a Webhook component to the flow.
  2. Connect the Webhook component's Data output to the Data input of a Data to Message component.
  3. Connect the Data to Message component's Message output to the Text input of a Chat Output component.
  4. To send a POST request, copy the code from the Webhook cURL tab in the API pane and paste it into a terminal.
  5. Send the POST request.
  6. Open the Playground. Your JSON data is posted to the Chat Output component, which indicates that the webhook component is correctly triggering the flow.

Inputs

NameTypeDescription
dataStringJSON payload for testing the webhook component

Outputs

NameTypeDescription
output_dataDataProcessed data from the webhook input

Hi, how can I help you?