Skip to main content

Processing

Processing components process and transform data within a flow.

Use a processing component in a flow

The Split Text processing component in this flow splits the incoming Data into chunks to be embedded into the vector store component.

The component offers control over chunk size, overlap, and separator, which affect context and granularity in vector store retrieval results.

A vector store ingesting documents

Combine data

important

Prior to Langflow version 1.1.3, this component was named Merge Data.

This component combines multiple data sources into a single unified Data object.

The component iterates through the input list of data objects, merging them into a single data object. If the input list is empty, it returns an empty data object. If there's only one input data object, it returns that object unchanged. The merging process uses the addition operator to combine data objects.

Inputs

NameDisplay NameInfo
dataDataA list of data objects to be merged.

Outputs

NameDisplay NameInfo
merged_dataMerged DataA single Data object containing the combined information from all input data objects.

Combine text

This component concatenates two text sources into a single text chunk using a specified delimiter.

  1. To use this component in a flow, connect two components that output Messages to the Combine Text component's First Text and Second Text inputs. This example uses two Text Input components.

Combine text component

  1. In the Combine Text component, in the Text fields of both Text Input components, enter some text to combine.
  2. In the Combine Text component, enter an optional Delimiter value. The delimiter character separates the combined texts. This example uses \n\n **end first text** \n\n **start second text** \n\n to label the texts and create newlines between them.
  3. Connect a Chat Output component to view the text combination.
  4. Click Playground, and then click Run Flow. The combined text appears in the Playground.

_10
This is the first text. Let's combine text!
_10
end first text
_10
start second text
_10
Here's the second part. We'll see how combining text works.

Inputs

NameDisplay NameInfo
first_textFirst TextThe first text input to concatenate.
second_textSecond TextThe second text input to concatenate.
delimiterDelimiterA string used to separate the two text inputs. Defaults to a space.

Outputs

NameDisplay NameInfo
messageMessageA Message object containing the combined text.

DataFrame operations

This component performs operations on DataFrame rows and columns.

To use this component in a flow, connect a component that outputs DataFrame to the DataFrame Operations component.

This example fetches JSON data from an API. The Lambda filter component extracts and flattens the results into a tabular DataFrame. The DataFrame Operations component can then work with the retrieved data.

Dataframe operations with flattened dataframe

  1. The API Request component retrieves data with only source and result fields. For this example, the desired data is nested within the result field.
  2. Connect a Lambda Filter to the API request component, and a Language model to the Lambda Filter. This example connects a Groq model component.
  3. In the Groq model component, add your Groq API key.
  4. To filter the data, in the Lambda filter component, in the Instructions field, use natural language to describe how the data should be filtered. For this example, enter:

_10
I want to explode the result column out into a Data object

tip

Avoid punctuation in the Instructions field, as it can cause errors.

  1. To run the flow, in the Lambda Filter component, click .
  2. To inspect the filtered data, in the Lambda Filter component, click . The result is a structured DataFrame.

_10
id | name | company | username | email | address | zip
_10
---|------------------|----------------------|-----------------|------------------------------------|-------------------|-------
_10
1 | Emily Johnson | ABC Corporation | emily_johnson | emily.johnson@abccorporation.com | 123 Main St | 12345
_10
2 | Michael Williams | XYZ Corp | michael_williams| michael.williams@xyzcorp.com | 456 Elm Ave | 67890

  1. Add the DataFrame Operations component, and a Chat Output component to the flow.
  2. In the DataFrame Operations component, in the Operation field, select Filter.
  3. To apply a filter, in the Column Name field, enter a column to filter on. This example filters by name.
  4. Click Playground, and then click Run Flow. The flow extracts the values from the name column.

_10
name
_10
Emily Johnson
_10
Michael Williams
_10
John Smith
_10
...

Operations

This component can perform the following operations on Pandas DataFrame.

OperationDescriptionRequired Inputs
Add ColumnAdds a new column with a constant valuenew_column_name, new_column_value
Drop ColumnRemoves a specified columncolumn_name
FilterFilters rows based on column valuecolumn_name, filter_value
HeadReturns first n rowsnum_rows
Rename ColumnRenames an existing columncolumn_name, new_column_name
Replace ValueReplaces values in a columncolumn_name, replace_value, replacement_value
Select ColumnsSelects specific columnscolumns_to_select
SortSorts DataFrame by columncolumn_name, ascending
TailReturns last n rowsnum_rows

Inputs

NameDisplay NameInfo
dfDataFrameThe input DataFrame to operate on.
operationOperationSelect the DataFrame operation to perform. Options: Add Column, Drop Column, Filter, Head, Rename Column, Replace Value, Select Columns, Sort, Tail
column_nameColumn NameThe column name to use for the operation.
filter_valueFilter ValueThe value to filter rows by.
ascendingSort AscendingWhether to sort in ascending order.
new_column_nameNew Column NameThe new column name when renaming or adding a column.
new_column_valueNew Column ValueThe value to populate the new column with.
columns_to_selectColumns to SelectList of column names to select.
num_rowsNumber of RowsNumber of rows to return (for head/tail). Default: 5
replace_valueValue to ReplaceThe value to replace in the column.
replacement_valueReplacement ValueThe value to replace with.

Outputs

NameDisplay NameInfo
outputDataFrameThe resulting DataFrame after the operation.

Data to DataFrame

This component converts one or multiple Data objects into a DataFrame. Each Data object corresponds to one row in the resulting DataFrame. Fields from the .data attribute become columns, and the .text field (if present) is placed in a 'text' column.

  1. To use this component in a flow, connect a component that outputs Data to the Data to Dataframe component's input. This example connects a Webhook component to convert text and data into a DataFrame.
  2. To view the flow's output, connect a Chat Output component to the Data to Dataframe component.

A webhook and data to dataframe

  1. Send a POST request to the Webhook containing your JSON data. Replace YOUR_FLOW_ID with your flow ID. This example uses the default Langflow server address.

_10
curl -X POST "http://127.0.0.1:7860/api/v1/webhook/YOUR_FLOW_ID" \
_10
-H 'Content-Type: application/json' \
_10
-d '{
_10
"text": "Alex Cruz - Employee Profile",
_10
"data": {
_10
"Name": "Alex Cruz",
_10
"Role": "Developer",
_10
"Department": "Engineering"
_10
}
_10
}'

  1. In the Playground, view the output of your flow. The Data to DataFrame component converts the webhook request into a DataFrame, with text and data fields as columns.

_10
| text | data |
_10
|:-----------------------------|:------------------------------------------------------------------------|
_10
| Alex Cruz - Employee Profile | {'Name': 'Alex Cruz', 'Role': 'Developer', 'Department': 'Engineering'} |

  1. Send another employee data object.

_10
curl -X POST "http://127.0.0.1:7860/api/v1/webhook/YOUR_FLOW_ID" \
_10
-H 'Content-Type: application/json' \
_10
-d '{
_10
"text": "Kalani Smith - Employee Profile",
_10
"data": {
_10
"Name": "Kalani Smith",
_10
"Role": "Designer",
_10
"Department": "Design"
_10
}
_10
}'

  1. In the Playground, this request is also converted to DataFrame.

_10
| text | data |
_10
|:--------------------------------|:---------------------------------------------------------------------|
_10
| Kalani Smith - Employee Profile | {'Name': 'Kalani Smith', 'Role': 'Designer', 'Department': 'Design'} |

Inputs

NameDisplay NameInfo
data_listData or Data ListOne or multiple Data objects to transform into a DataFrame.

Outputs

NameDisplay NameInfo
dataframeDataFrameA DataFrame built from each Data object's fields plus a 'text' column.

Filter data

important

This component is in Beta as of Langflow version 1.1.3, and is not yet fully supported.

This component filters a Data object based on a list of keys.

Inputs

NameDisplay NameInfo
dataDataData object to filter.
filter_criteriaFilter CriteriaList of keys to filter by.

Outputs

NameDisplay NameInfo
filtered_dataFiltered DataA new Data object containing only the key-value pairs that match the filter criteria.

Filter values

important

This component is in Beta as of Langflow version 1.1.3, and is not yet fully supported.

The Filter values component filters a list of data items based on a specified key, filter value, and comparison operator.

Inputs

NameDisplay NameInfo
input_dataInput dataThe list of data items to filter.
filter_keyFilter KeyThe key to filter on, for example, 'route'.
filter_valueFilter ValueThe value to filter by, for example, 'CMIP'.
operatorComparison OperatorThe operator to apply for comparing the values.

Outputs

NameDisplay NameInfo
filtered_dataFiltered dataThe resulting list of filtered data items.

Lambda filter

This component uses an LLM to generate a Lambda function for filtering or transforming structured data.

To use the Lambda filter component, you must connect it to a Language Model component, which the component uses to generate a function based on the natural language instructions in the Instructions field.

This example gets JSON data from the https://jsonplaceholder.typicode.com/users API endpoint. The Instructions field in the Lambda filter component specifies the task extract emails. The connected LLM creates a filter based on the instructions, and successfully extracts a list of email addresses from the JSON data.

Inputs

NameDisplay NameInfo
dataDataThe structured data to filter or transform using a Lambda function.
llmLanguage ModelThe connection port for a Model component.
filter_instructionInstructionsNatural language instructions for how to filter or transform the data using a Lambda function, such as Filter the data to only include items where the 'status' is 'active'.
sample_sizeSample SizeFor large datasets, the number of characters to sample from the dataset head and tail.
max_sizeMax SizeThe number of characters for the data to be considered "large", which triggers sampling by the sample_size value.

Outputs

NameDisplay NameInfo
filtered_dataFiltered DataThe filtered or transformed Data object.
dataframeDataFrameThe filtered data as a DataFrame.

LLM router

This component routes requests to the most appropriate LLM based on OpenRouter model specifications.

Inputs

NameDisplay NameInfo
modelsLanguage ModelsList of LLMs to route between
input_valueInputThe input message to be routed
judge_llmJudge LLMLLM that will evaluate and select the most appropriate model
optimizationOptimizationOptimization preference (quality/speed/cost/balanced)

Outputs

NameDisplay NameInfo
outputOutputThe response from the selected model
selected_modelSelected ModelName of the chosen model

Message to data

This component converts Message objects to Data objects.

Inputs

NameDisplay NameInfo
messageMessageThe Message object to convert to a Data object.

Outputs

NameDisplay NameInfo
dataDataThe converted Data object.

Parser

This component formats DataFrame or Data objects into text using templates, with an option to convert inputs directly to strings using stringify.

To use this component, create variables for values in the template the same way you would in a Prompt component. For DataFrames, use column names, for example Name: {Name}. For Data objects, use {text}.

To use the Parser component with a Structured Output component, do the following:

  1. Connect a Structured Output component's DataFrame output to the Parser component's DataFrame input.
  2. Connect the File component to the Structured Output component's Message input.
  3. Connect the OpenAI model component's Language Model output to the Structured Output component's Language Model input.

The flow looks like this:

A parser component connected to OpenAI and structured output

  1. In the Structured Output component, click Open Table. This opens a pane for structuring your table. The table contains the rows Name, Description, Type, and Multiple.
  2. Create a table that maps to the data you're loading from the File loader. For example, to create a table for employees, you might have the rows id, name, and email, all of type string.
  3. In the Template field of the Parser component, enter a template for parsing the Structured Output component's DataFrame output into structured text. Create variables for values in the template the same way you would in a Prompt component. For example, to present a table of employees in Markdown:

_10
# Employee Profile
_10
## Personal Information
_10
- **Name:** {name}
_10
- **ID:** {id}
_10
- **Email:** {email}

  1. To run the flow, in the Parser component, click .
  2. To view your parsed text, in the Parser component, click .
  3. Optionally, connect a Chat Output component, and open the Playground to see the output.

For an additional example of using the Parser component to format a DataFrame from a Structured Output component, see the Market Research template flow.

Inputs

NameDisplay NameInfo
modeModeTab selection between "Parser" and "Stringify" modes. "Stringify" converts input to a string instead of using a template.
patternTemplateTemplate for formatting using variables in curly brackets. For DataFrames, use column names, such as Name: {Name}. For Data objects, use {text}.
input_dataData or DataFrameThe input to parse - accepts either a DataFrame or Data object.
sepSeparatorString used to separate rows/items. Default: newline.
clean_dataClean DataWhen stringify is enabled, cleans data by removing empty rows and lines.

Outputs

NameDisplay NameInfo
parsed_textParsed TextThe resulting formatted text as a Message object.

Split text

This component splits text into chunks based on specified criteria. It's ideal for chunking data to be tokenized and embedded into vector databases.

The Split Text component outputs Chunks or DataFrame. The Chunks output returns a list of individual text chunks. The DataFrame output returns a structured data format, with additional text and metadata columns applied.

  1. To use this component in a flow, connect a component that outputs Data or DataFrame to the Split Text component's Data port. This example uses the URL component, which is fetching JSON placeholder data.

Split text component and chroma-db

  1. In the Split Text component, define your data splitting parameters.

This example splits incoming JSON data at the separator },, so each chunk contains one JSON object.

The order of precedence is Separator, then Chunk Size, and then Chunk Overlap. If any segment after separator splitting is longer than chunk_size, it is split again to fit within chunk_size.

After chunk_size, Chunk Overlap is applied between chunks to maintain context.

  1. Connect a Chat Output component to the Split Text component's DataFrame output to view its output.
  2. Click Playground, and then click Run Flow. The output contains a table of JSON objects split at },.

_16
{
_16
"userId": 1,
_16
"id": 1,
_16
"title": "Introduction to Artificial Intelligence",
_16
"body": "Learn the basics of Artificial Intelligence and its applications in various industries.",
_16
"link": "https://example.com/article1",
_16
"comment_count": 8
_16
},
_16
{
_16
"userId": 2,
_16
"id": 2,
_16
"title": "Web Development with React",
_16
"body": "Build modern web applications using React.js and explore its powerful features.",
_16
"link": "https://example.com/article2",
_16
"comment_count": 12
_16
},

  1. Clear the Separator field, and then run the flow again. Instead of JSON objects, the output contains 50-character lines of text with 10 characters of overlap.

_10
First chunk: "title": "Introduction to Artificial Intelligence""
_10
Second chunk: "elligence", "body": "Learn the basics of Artif"
_10
Third chunk: "s of Artificial Intelligence and its applications"

Inputs

NameDisplay NameInfo
data_inputsInput DocumentsThe data to split.The component accepts Data or DataFrame objects.
chunk_overlapChunk OverlapThe number of characters to overlap between chunks. Default: 200.
chunk_sizeChunk SizeThe maximum number of characters in each chunk. Default: 1000.
separatorSeparatorThe character to split on. Default: newline.
text_keyText KeyThe key to use for the text column (advanced). Default: text.

Outputs

NameDisplay NameInfo
chunksChunksList of split text chunks as Data objects.
dataframeDataFrameList of split text chunks as DataFrame objects.

Update data

This component dynamically updates or appends data with specified fields.

Inputs

NameDisplay NameInfo
old_dataDataThe records to update
number_of_fieldsNumber of FieldsNumber of fields to add (max 15)
text_keyText KeyKey for text content
text_key_validatorText Key ValidatorValidates text key presence

Outputs

NameDisplay NameInfo
dataDataUpdated Data objects.

Legacy components

Legacy components are available to use but no longer supported.

Alter metadata

This component modifies metadata of input objects. It can add new metadata, update existing metadata, and remove specified metadata fields. The component works with both Message and Data objects, and can also create a new Data object from user-provided text.

Inputs

NameDisplay NameInfo
input_valueInputObjects to which Metadata should be added
text_inUser TextText input; the value will be in the 'text' attribute of the Data object. Empty text entries are ignored.
metadataMetadataMetadata to add to each object
remove_fieldsFields to RemoveMetadata fields to remove

Outputs

NameDisplay NameInfo
dataDataList of Input objects, each with added metadata

Create data

important

This component is in Legacy, which means it is no longer in active development as of Langflow version 1.1.3.

This component dynamically creates a Data object with a specified number of fields.

Inputs

NameDisplay NameInfo
number_of_fieldsNumber of FieldsThe number of fields to be added to the record.
text_keyText KeyKey that identifies the field to be used as the text content.
text_key_validatorText Key ValidatorIf enabled, checks if the given Text Key is present in the given Data.

Outputs

NameDisplay NameInfo
dataDataA Data object created with the specified fields and text key.

Data to message

important

This component is in Legacy, which means it is no longer in active development as of Langflow version 1.3. Instead, use the Parser component.

important

Prior to Langflow version 1.1.3, this component was named Parse Data.

The ParseData component converts data objects into plain text using a specified template. This component transforms structured data into human-readable text formats, allowing for customizable output through the use of templates.

Inputs

NameDisplay NameInfo
dataDataThe data to convert to text.
templateTemplateThe template to use for formatting the data. It can contain the keys {text}, {data}, or any other key in the data.
sepSeparatorThe separator to use between multiple data items.

Outputs

NameDisplay NameInfo
textTextThe resulting formatted text string as a Message object.

Parse DataFrame

important

This component is in Legacy, which means it is no longer in active development as of Langflow version 1.3. Instead, use the Parser component.

This component converts DataFrames into plain text using templates.

Inputs

NameDisplay NameInfo
dfDataFrameThe DataFrame to convert to text rows.
templateTemplateTemplate for formatting (use {column_name} placeholders).
sepSeparatorString to join rows in output.

Outputs

NameDisplay NameInfo
textTextAll rows combined into single text.

Parse JSON

important

This component is in Legacy, which means it is no longer in active development as of Langflow version 1.1.3.

This component converts and extracts JSON fields using JQ queries.

Inputs

NameDisplay NameInfo
input_valueInputData object to filter (Message or Data).
queryJQ QueryJQ Query to filter the data

Outputs

NameDisplay NameInfo
filtered_dataFiltered DataFiltered data as list of Data objects.

Select data

important

This component is in Legacy, which means it is no longer in active development as of Langflow version 1.1.3.

This component selects a single Data item from a list.

Inputs

NameDisplay NameInfo
data_listData ListList of data to select from
data_indexData IndexIndex of the data to select

Outputs

NameDisplay NameInfo
selected_dataSelected DataThe selected Data object.
Search