docs: Restructure navigation, refactor all component documentation, among many other things (#9115)
* reorg pt 1 * nav reorg pt 2 * update sidebar ad * resolve comments and combine app pages * playground and voice mode rewrite * fix link * add separate bundle pages * add new pages to sidebar * working on bundles * moving content to new bundle pages * move some sidebar items * fix build * nav labels * small edits * Working on helpers * core components work * wrapping up some more agent duplication * aligning file management * webhooks and file management * data components * address vector store and some legacy components * finish logic params * some work on processors * remove unneeded pages and tidy some llm info * progress on bundles pt 1 * bundles pt 2 * bundles pt 3 * finish looking at integrations * it is done * fix errors * coderabbit and typos * coderabbit pt 2 * resolving mcs pt 1 * separate agents and mcp * still working on some memory stuff * finish message history alignment * incorporate PR 9138 * missed a link * file management ui * align w ui pr * Apply suggestions from code review * memory edits after discussion
This commit is contained in:
parent
31d37dff75
commit
f8d8ff4599
73 changed files with 5124 additions and 5160 deletions
|
|
@ -1,123 +1,157 @@
|
|||
---
|
||||
title: Processing
|
||||
title: Processing components
|
||||
slug: /components-processing
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
|
||||
Processing components process and transform data within a flow, like converting `Data` to text with a [Parser](#parser) component, filtering data with natural language with the [Smart function](#smart-function), or saving data to your local machine with [Save File](#save-file).
|
||||
Langflow's processing components process and transform data within a flow.
|
||||
They have many uses, including:
|
||||
|
||||
* Feed instructions and context to your LLMs and agents with the [**Prompt Template** component](#prompt-template).
|
||||
* Extract content from larger chunks of data with a [**Parser** component](#parser).
|
||||
* Filter data with natural language with the [**Smart Function** component](#smart-function).
|
||||
* Save data to your local machine with the [**Save File** component](#save-file).
|
||||
* Transform data into a different data type with the [**Type Convert** component](#type-convert) to pass it between incompatible components.
|
||||
|
||||
## Prompt Template
|
||||
|
||||
See [Prompt Template](/components-prompts).
|
||||
|
||||
## Batch Run
|
||||
|
||||
The **Batch Run** component runs a language model over **each row** of a [DataFrame](/data-types#dataframe) text column and returns a new DataFrame with the original text and an LLM response.
|
||||
The **Batch Run** component runs a language model over _each row of one text column_ in a [`DataFrame`](/data-types#dataframe), and then returns a new `DataFrame` with the original text and an LLM response.
|
||||
|
||||
The response contains the following columns:
|
||||
|
||||
* `text_input`: The original text from the input DataFrame.
|
||||
* `model_response`: The model's response for each input.
|
||||
* `batch_index`: The processing order, with a `0`-based index.
|
||||
* `metadata` (optional): Additional information about the processing.
|
||||
* `text_input`: The original text from the input `DataFrame`
|
||||
* `model_response`: The model's response for each input
|
||||
* `batch_index`: The 0-indexed processing order for all rows in the `DataFrame`
|
||||
* `metadata` (optional): Additional information about the processing
|
||||
|
||||
These columns, when connected to a **Parser** component, can be used as variables within curly braces.
|
||||
### Use the Batch Run component in a flow
|
||||
|
||||
To use the Batch Run component with a **Parser** component, do the following:
|
||||
|
||||
1. Connect a **Model** component to the **Batch Run** component's **Language model** port.
|
||||
2. Connect a component that outputs DataFrame, like **File** component, to the **Batch Run** component's **DataFrame** input.
|
||||
3. Connect the **Batch Run** component's **Batch Results** output to a **Parser** component's **DataFrame** input.
|
||||
The flow looks like this:
|
||||
If you pass this output to a [**Parser** component](/components-processing#parser), you can use variables in the parsing template to reference these keys, such as `{text_input}` and `{model_response}`.
|
||||
This is demonstrated in the following example.
|
||||
|
||||

|
||||
|
||||
4. In the **Column Name** field of the **Batch Run** component, enter a column name based on the data you're loading from the **File** loader. For example, to process a column of `name`, enter `name`.
|
||||
5. Optionally, in the **System Message** field of the **Batch Run** component, enter a **System Message** to instruct the connected LLM on how to process your file. For example, `Create a business card for each name.`
|
||||
6. In the **Template** field of the **Parser** component, enter a template for using the **Batch Run** component's new DataFrame columns.
|
||||
To use all three columns from the **Batch Run** component, include them like this:
|
||||
```text
|
||||
record_number: {batch_index}, name: {text_input}, summary: {model_response}
|
||||
```
|
||||
7. To run the flow, in the **Parser** component, click <Icon name="Play" aria-hidden="True" /> **Run component**.
|
||||
8. To view your created DataFrame, in the **Parser** component, click <Icon name="TextSearch" aria-hidden="True" /> **Inspect output**.
|
||||
9. Optionally, connect a **Chat Output** component, and open the **Playground** to see the output.
|
||||
1. Connect a **Language Model** component to a **Batch Run** component's **Language model** port.
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
2. Connect `DataFrame` output from another component to the **Batch Run** component's **DataFrame** input.
|
||||
For example, you could connect a **File** component with a CSV file.
|
||||
|
||||
**Inputs**
|
||||
3. In the **Batch Run** component's **Column Name** field, enter the name of the column in the incoming `DataFrame` that contains the text to process.
|
||||
For example, if you want to extract text from a `name` column in a CSV file, enter `name` in the **Column Name** field.
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| model | HandleInput | Connect the 'Language Model' output from your LLM component here. Required. |
|
||||
| system_message | MultilineInput | A multi-line system instruction for all rows in the DataFrame. |
|
||||
| df | DataFrameInput | The DataFrame whose column is treated as text messages, as specified by 'column_name'. Required. |
|
||||
| column_name | MessageTextInput | The name of the DataFrame column to treat as text messages. If empty, all columns are formatted in TOML. |
|
||||
| output_column_name | MessageTextInput | Name of the column where the model's response is stored. Default=`model_response`. |
|
||||
| enable_metadata | BoolInput | If True, add metadata to the output DataFrame. |
|
||||
4. Connect the **Batch Run** component's **Batch Results** output to a **Parser** component's **DataFrame** input.
|
||||
|
||||
**Outputs**
|
||||
5. Optional: In the **Batch Run** [component's header menu](/concepts-components#component-menus), click <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls**, enable the **System Message** parameter, click **Close**, and then enter an instruction for how you want the LLM to process each cell extracted from the file.
|
||||
For example, `Create a business card for each name.`
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| batch_results | DataFrame | A DataFrame with all original columns plus the model's response column. |
|
||||
6. In the **Parser** component's **Template** field, enter a template for processing the **Batch Run** component's new `DataFrame` columns (`text_input`, `model_response`, and `batch_index`):
|
||||
|
||||
</details>
|
||||
For example, this template uses three columns from the resulting, post-batch `DataFrame`:
|
||||
|
||||
## Data operations
|
||||
|
||||
This component performs operations on [Data](/data-types#data) objects, including selecting keys, evaluating literals, combining data, filtering values, appending/updating data, removing keys, and renaming keys.
|
||||
|
||||
1. To use this component in a flow, connect a component that outputs [Data](/data-types#data) to the **Data Operations** component's input.
|
||||
All operations in the component require at least one [Data](/data-types#data) input.
|
||||
2. In the **Operations** field, select the operation you want to perform.
|
||||
For example, send this request to the **Webhook** component.
|
||||
Replace `FLOW_ID` and `LANGFLOW_API_KEY` with the values from your deployment.
|
||||
```bash
|
||||
curl -X POST "http://localhost:7860/api/v1/webhook/FLOW_ID" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'x-api-key: LANGFLOW_API_KEY' \
|
||||
-d '{
|
||||
"id": 1,
|
||||
"name": "Leanne Graham",
|
||||
"username": "Bret",
|
||||
"email": "Sincere@april.biz",
|
||||
"address": {
|
||||
"street": "Kulas Light",
|
||||
"suite": "Apt. 556",
|
||||
"city": "Gwenborough",
|
||||
"zipcode": "92998-3874",
|
||||
"geo": {
|
||||
"lat": "-37.3159",
|
||||
"lng": "81.1496"
|
||||
}
|
||||
},
|
||||
"phone": "1-770-736-8031 x56442",
|
||||
"website": "hildegard.org",
|
||||
"company": {
|
||||
"name": "Romaguera-Crona",
|
||||
"catchPhrase": "Multi-layered client-server neural-net",
|
||||
"bs": "harness real-time e-markets"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
3. In the **Data Operations** component, select the **Select Keys** operation to extract specific user information.
|
||||
To add additional keys, click <Icon name="Plus" aria-hidden="True" /> **Add more**.
|
||||

|
||||
4. Filter by `name`, `username`, and `email` to select the values from the request.
|
||||
```json
|
||||
{
|
||||
"name": "Leanne Graham",
|
||||
"username": "Bret",
|
||||
"email": "Sincere@april.biz"
|
||||
}
|
||||
```text
|
||||
record_number: {batch_index}, name: {text_input}, summary: {model_response}
|
||||
```
|
||||
|
||||
### Operations
|
||||
7. To test the processing, click the **Parser** component, and then click <Icon name="Play" aria-hidden="True" /> **Run component**, and then click <Icon name="TextSearch" aria-hidden="True" /> **Inspect output** to view the final `DataFrame`.
|
||||
|
||||
The component supports the following operations.
|
||||
All operations in the **Data operations** component require at least one [Data](/data-types#data) input.
|
||||
You can also connect a **Chat Output** component to the **Parser** component if you want to see the output in the **Playground**.
|
||||
|
||||
| Operation | Required Inputs | Info |
|
||||
### Batch Run parameters
|
||||
|
||||
Some **Batch Run** component input parameters are hidden by default in the visual editor.
|
||||
You can toggle parameters through the <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls** in the [component's header menu](/concepts-components#component-menus).
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| model | HandleInput | Input parameter. Connect the 'Language Model' output from your LLM component here. Required. |
|
||||
| system_message | MultilineInput | Input parameter. A multi-line system instruction for all rows in the DataFrame. |
|
||||
| df | DataFrameInput | Input parameter. The DataFrame whose column is treated as text messages, as specified by 'column_name'. Required. |
|
||||
| column_name | MessageTextInput | Input parameter. The name of the DataFrame column to treat as text messages. If empty, all columns are formatted in TOML. |
|
||||
| output_column_name | MessageTextInput | Input parameter. Name of the column where the model's response is stored. Default=`model_response`. |
|
||||
| enable_metadata | BoolInput | Input parameter. If True, add metadata to the output DataFrame. |
|
||||
| batch_results | DataFrame | Output parameter. A DataFrame with all original columns plus the model's response column. |
|
||||
|
||||
## Data Operations
|
||||
|
||||
The **Data Operations** component performs operations on [`Data`](/data-types#data) objects, including selecting keys, evaluating literals, combining data, filtering values, appending/updating data, removing keys, and renaming keys.
|
||||
|
||||
1. To use the **Data Operations** component in a flow, you must connect its **Data** input port to the output port of a component that outputs `Data`.
|
||||
All operations in the **Data Operations** component require at least one `Data` input.
|
||||
|
||||
For this example, add a **Webhook** component to the flow, and then connect it to a **Data Operations** component. Assume you'll send requests to the webhook with a consistent payload that has `name`, `username`, and `email` keys.
|
||||
|
||||
2. In the **Operations** field, select the operation you want to perform on the incoming `Data`.
|
||||
For this example, select the **Select Keys** operation to extract specific user information.
|
||||
|
||||
3. Add keys for `name`, `username`, and `email` to select those values from the incoming request payload.
|
||||
|
||||
To add additional keys, click <Icon name="Plus" aria-hidden="True" /> **Add more**.
|
||||
|
||||
4. Connect a **Chat Output** component.
|
||||
|
||||
|
||||

|
||||
|
||||
5. To test the flow, send the following request to your flow's webhook endpoint, and then open the **Playground** to see the resulting output from processing the payload.
|
||||
|
||||
```bash
|
||||
curl -X POST "http://$LANGFLOW_SERVER_URL/api/v1/webhook/$FLOW_ID" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "x-api-key: $LANGFLOW_API_KEY" \
|
||||
-d '{
|
||||
"id": 1,
|
||||
"name": "Leanne Graham",
|
||||
"username": "Bret",
|
||||
"email": "Sincere@april.biz",
|
||||
"address": {
|
||||
"street": "Main Street",
|
||||
"suite": "Apt. 556",
|
||||
"city": "Springfield",
|
||||
"zipcode": "92998-3874",
|
||||
"geo": {
|
||||
"lat": "-37.3159",
|
||||
"lng": "81.1496"
|
||||
}
|
||||
},
|
||||
"phone": "1-770-736-8031 x56442",
|
||||
"website": "hildegard.org",
|
||||
"company": {
|
||||
"name": "Acme-Corp",
|
||||
"catchPhrase": "Multi-layered client-server neural-net",
|
||||
"bs": "harness real-time e-markets"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
### Data Operations parameters
|
||||
|
||||
Some **Data Operations** component input parameters are hidden by default in the visual editor.
|
||||
You can toggle parameters through the <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls** in the [component's header menu](/concepts-components#component-menus).
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data | Data | Input parameter. The `Data` object to operate on. |
|
||||
| operations | Operations | Input parameter. The operation to perform on the data. See [Data Operations operations](#data-operations-operations) |
|
||||
| select_keys_input | Select Keys | Input parameter. A list of keys to select from the data. |
|
||||
| filter_key | Filter Key | Input parameter. The key to filter by. |
|
||||
| operator | Comparison Operator | Input parameter. The operator to apply for comparing values. |
|
||||
| filter_values | Filter Values | Input parameter. A list of values to filter by. |
|
||||
| append_update_data | Append or Update | Input parameter. The data to append or update the existing data with. |
|
||||
| remove_keys_input | Remove Keys | Input parameter. A list of keys to remove from the data. |
|
||||
| rename_keys_input | Rename Keys | Input parameter. A list of keys to rename in the data. |
|
||||
| data_output | Data | Output parameter. The resulting Data object after the operation. |
|
||||
|
||||
### Data Operations operations
|
||||
|
||||
Options for the `operations` input parameter are as follows.
|
||||
All operations act on an incoming `Data` object.
|
||||
|
||||
| Name | Required Inputs | Process |
|
||||
|-----------|----------------|-------------|
|
||||
| Select Keys | `select_keys_input` | Selects specific keys from the data. |
|
||||
| Literal Eval | None | Evaluates string values as Python literals. |
|
||||
|
|
@ -127,40 +161,16 @@ All operations in the **Data operations** component require at least one [Data](
|
|||
| Remove Keys | `remove_keys_input` | Removes specified keys from the data. |
|
||||
| Rename Keys | `rename_keys_input` | Renames keys in the data. |
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
|
||||
**Inputs**
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data | Data | The [Data](/data-types#data) object to operate on. |
|
||||
| operations | Operations | The operation to perform on the data. |
|
||||
| select_keys_input | Select Keys | A list of keys to select from the data. |
|
||||
| filter_key | Filter Key | The key to filter by. |
|
||||
| operator | Comparison Operator | The operator to apply for comparing values. |
|
||||
| filter_values | Filter Values | A list of values to filter by. |
|
||||
| append_update_data | Append or Update | The data to append or update the existing data with. |
|
||||
| remove_keys_input | Remove Keys | A list of keys to remove from the data. |
|
||||
| rename_keys_input | Rename Keys | A list of keys to rename in the data. |
|
||||
|
||||
**Outputs**
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data_output | Data | The resulting Data object after the operation. |
|
||||
|
||||
</details>
|
||||
|
||||
## DataFrame operations
|
||||
|
||||
This component performs operations on [DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html) rows and columns.
|
||||
The **DataFrame** component performs operations on [`DataFrame`](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html) rows and columns.
|
||||
|
||||
To use this component in a flow, connect a component that outputs [DataFrame](/data-types#dataframe) to the **DataFrame Operations** component.
|
||||
To use the **DataFrame Operations** component in a flow, you must connect its **DataFrame** input port to the output port of a component that outputs `DataFrame`.
|
||||
All operations in the **DataFrame Operations** component require at least one `DataFrame` input.
|
||||
|
||||
This example fetches JSON data from an API. The **Smart Filter** component extracts and flattens the results into a tabular DataFrame. The **DataFrame Operations** component can then work with the retrieved data.
|
||||
The following example fetches JSON data from an API. The **Smart Filter** component extracts and flattens the results into a tabular `DataFrame` that is then processed through the **DataFrame Operations** component.
|
||||
|
||||

|
||||

|
||||
|
||||
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.
|
||||
|
|
@ -361,10 +371,12 @@ For an additional example of using the **Parser** component to format a DataFram
|
|||
|
||||
</details>
|
||||
|
||||
## Python interpreter
|
||||
## Python Interpreter
|
||||
|
||||
This component allows you to execute Python code with imported packages.
|
||||
|
||||
### Use the Python Interpreter in a flow
|
||||
|
||||
1. To use this component in a flow,in the **Global Imports** field, add the packages you want to import as a comma-separated list, such as `math,pandas`.
|
||||
At least one import is required.
|
||||
2. In the **Python Code** field, enter the Python code you want to execute. Use `print()` to see the output.
|
||||
|
|
@ -427,23 +439,13 @@ Output:
|
|||
|
||||
If you don't include the package imports in the chat, the Agent can still create the table using `pd.DataFrame`, because the `pandas` package is imported globally by the Python interpreter component in the **Global Imports** field.
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
|
||||
**Inputs**
|
||||
### Python Interpreter parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| global_imports | String | A comma-separated list of modules to import globally, such as `math,pandas,numpy`. |
|
||||
| python_code | Code | The Python code to execute. Only modules specified in Global Imports can be used. |
|
||||
|
||||
**Outputs**
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| results | Data | The output of the executed Python code, including any printed results or errors. |
|
||||
|
||||
</details>
|
||||
| global_imports | String | Input parameter. A comma-separated list of modules to import globally, such as `math,pandas,numpy`. |
|
||||
| python_code | Code | Input parameter. The Python code to execute. Only modules specified in Global Imports can be used. |
|
||||
| results | Data | Output parameter. The output of the executed Python code, including any printed results or errors. |
|
||||
|
||||
## Save file
|
||||
|
||||
|
|
@ -567,7 +569,7 @@ The connected LLM creates a filter based on the instructions, and successfully e
|
|||
|
||||
</details>
|
||||
|
||||
## Split text
|
||||
## 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.
|
||||
|
||||
|
|
@ -640,6 +642,10 @@ Third chunk: "s of Artificial Intelligence and its applications"
|
|||
|
||||
</details>
|
||||
|
||||
### Other text splitters
|
||||
|
||||
- [LangChain text splitter components](/bundles-langchain#text-splitters)
|
||||
|
||||
## Structured output
|
||||
|
||||
This component transforms LLM responses into structured data formats.
|
||||
|
|
@ -761,447 +767,259 @@ Ozone Pollution and Global Warming: A recent study highlights that ozone polluti
|
|||
|
||||
</details>
|
||||
|
||||
## Legacy components
|
||||
## Legacy processing components
|
||||
|
||||
**Legacy** components are available for use but are no longer supported.
|
||||
The following processing components are legacy components.
|
||||
You can still use them in your flows, but they are no longer supported and can be removed in a future release.
|
||||
|
||||
### Alter metadata
|
||||
|
||||
:::important
|
||||
This component is in **Legacy**, which means it is available for use but no longer in active development.
|
||||
Instead, use the [Data operations](#data-operations) component.
|
||||
:::
|
||||
|
||||
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](/data-types#message) and [Data](/data-types#data) objects, and can also create a new Data object from user-provided text.
|
||||
Replace these components with suggested alternatives as soon as possible.
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
<summary>Alter Metadata</summary>
|
||||
|
||||
**Inputs**
|
||||
Replace this legacy component with the [**Data Operations** component](#data-operations).
|
||||
|
||||
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.
|
||||
|
||||
It accepts the following parameters:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| input_value | Input | Objects to which Metadata should be added. |
|
||||
| text_in | User Text | Text input; the value is contained in the 'text' attribute of the [Data](/data-types#data) object. Empty text entries are ignored. |
|
||||
| metadata | Metadata | Metadata to add to each object. |
|
||||
| remove_fields | Fields to Remove | Metadata fields to remove. |
|
||||
|
||||
**Outputs**
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data | Data | List of Input objects, each with added metadata. |
|
||||
| input_value | Input | Input parameter. Objects to which Metadata should be added. |
|
||||
| text_in | User Text | Input parameter. Text input; the value is contained in the 'text' attribute of the `Data` object. Empty text entries are ignored. |
|
||||
| metadata | Metadata | Input parameter. Metadata to add to each object. |
|
||||
| remove_fields | Fields to Remove | Input parameter. Metadata fields to remove. |
|
||||
| data | Data | Output parameter. List of Input objects, each with added metadata. |
|
||||
|
||||
</details>
|
||||
|
||||
### Combine data
|
||||
|
||||
:::important
|
||||
This component is in **Legacy**, which means it is available for use but no longer in active development.
|
||||
Prior to Langflow version 1.1.3, this component was named **Merge Data**.
|
||||
:::
|
||||
|
||||
This component combines multiple data sources into a single unified [Data](/data-types#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.
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
<summary>Combine Data/Merge Data</summary>
|
||||
|
||||
**Inputs**
|
||||
Replace this legacy component with the [**Data Operations** component](#data-operations) or the [**Loop** component](/components-logic#loop).
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data | Data | A list of data objects to be merged. |
|
||||
This component combines multiple data sources into a single unified `Data` object.
|
||||
|
||||
**Outputs**
|
||||
The component iterates through a list of `Data` objects, merging them into a single `Data` object (`merged_data`).
|
||||
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.
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| merged_data | Merged Data | A single [Data](/data-types#data) object containing the combined information from all input data objects. |
|
||||
The merging process uses the addition operator to combine data objects.
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
### Combine text
|
||||
|
||||
:::important
|
||||
This component is in **Legacy**, which means it is available for use but no longer in active development.
|
||||
:::
|
||||
|
||||
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](/data-types#message) to the **Combine Text** component's **First Text** and **Second Text** inputs.
|
||||
This example uses two **Text Input** components.
|
||||
|
||||

|
||||
|
||||
2. In the **Combine Text** component, in the **Text** fields of both **Text Input** components, enter some text to combine.
|
||||
3. 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.
|
||||
4. Connect a **Chat Output** component to view the text combination.
|
||||
5. Click **Playground**, and then click **Run Flow**.
|
||||
The combined text appears in the **Playground**.
|
||||
```text
|
||||
This is the first text. Let's combine text!
|
||||
end first text
|
||||
start second text
|
||||
Here's the second part. We'll see how combining text works.
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
<summary>Combine Text</summary>
|
||||
|
||||
**Inputs**
|
||||
Replace this legacy component with the [**Data Operations** component](#data-operations).
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| first_text | First Text | The first text input to concatenate. |
|
||||
| second_text | Second Text | The second text input to concatenate. |
|
||||
| delimiter | Delimiter | A string used to separate the two text inputs. The default is a space. |
|
||||
|
||||
**Outputs**
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| message | Message | A Message object containing the combined text. |
|
||||
This component concatenates two text inputs into a single text chunk using a specified delimiter, outputting a `Message` object with the combined text.
|
||||
|
||||
</details>
|
||||
|
||||
### Create data
|
||||
|
||||
:::important
|
||||
This component is in **Legacy**, which means it is available for use but no longer in active development.
|
||||
:::
|
||||
|
||||
This component dynamically creates a [Data](/data-types#data) object with a specified number of fields.
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
<summary>Create Data</summary>
|
||||
|
||||
**Inputs**
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| number_of_fields | Number of Fields | The number of fields to be added to the record. |
|
||||
| text_key | Text Key | Key that identifies the field to be used as the text content. |
|
||||
| text_key_validator | Text Key Validator | If enabled, checks if the given `Text Key` is present in the given `Data`. |
|
||||
Replace this legacy component with the [**Data Operations** component](#data-operations).
|
||||
|
||||
**Outputs**
|
||||
This component dynamically creates a `Data` object with a specified number of fields and a text key.
|
||||
|
||||
It accepts the following parameters:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data | Data | A [Data](/data-types#data) object created with the specified fields and text key. |
|
||||
| number_of_fields | Number of Fields | Input parameter. The number of fields to be added to the record. |
|
||||
| text_key | Text Key | Input parameter. Key that identifies the field to be used as the text content. |
|
||||
| text_key_validator | Text Key Validator | Input parameter. If enabled, checks if the given `Text Key` is present in the given `Data`. |
|
||||
|
||||
</details>
|
||||
|
||||
### Data to DataFrame
|
||||
|
||||
:::important
|
||||
This component is in **Legacy**, which means it is available for use but no longer in active development.
|
||||
:::
|
||||
This component converts one or multiple [Data](/data-types#data) objects into a [DataFrame](/data-types#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](/data-types#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.
|
||||
|
||||

|
||||
|
||||
3. 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.
|
||||
```text
|
||||
curl -X POST "http://127.0.0.1:7860/api/v1/webhook/YOUR_FLOW_ID" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"text": "Alex Cruz - Employee Profile",
|
||||
"data": {
|
||||
"Name": "Alex Cruz",
|
||||
"Role": "Developer",
|
||||
"Department": "Engineering"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
4. 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.
|
||||
```text
|
||||
| text | data |
|
||||
|:-----------------------------|:------------------------------------------------------------------------|
|
||||
| Alex Cruz - Employee Profile | {'Name': 'Alex Cruz', 'Role': 'Developer', 'Department': 'Engineering'} |
|
||||
```
|
||||
|
||||
5. Send another employee data object.
|
||||
```text
|
||||
curl -X POST "http://127.0.0.1:7860/api/v1/webhook/YOUR_FLOW_ID" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"text": "Kalani Smith - Employee Profile",
|
||||
"data": {
|
||||
"Name": "Kalani Smith",
|
||||
"Role": "Designer",
|
||||
"Department": "Design"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
6. In the **Playground**, this request is also converted to `DataFrame`.
|
||||
```text
|
||||
| text | data |
|
||||
|:--------------------------------|:---------------------------------------------------------------------|
|
||||
| Kalani Smith - Employee Profile | {'Name': 'Kalani Smith', 'Role': 'Designer', 'Department': 'Design'} |
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
<summary>Extract Key</summary>
|
||||
|
||||
**Inputs**
|
||||
Replace this legacy component with the [**Data Operations** component](#data-operations).
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data_list | Data or Data List | One or multiple Data objects to transform into a DataFrame. |
|
||||
|
||||
**Outputs**
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| dataframe | DataFrame | A DataFrame built from each Data object's fields plus a text column. |
|
||||
This component extracts a specific key from a `Data` object and returns the value associated with that key.
|
||||
|
||||
</details>
|
||||
|
||||
### Filter data
|
||||
|
||||
:::important
|
||||
This component is in **Legacy**, which means it is available for use but no longer in active development.
|
||||
Instead, use the [Data operations](#data-operations) component.
|
||||
:::
|
||||
|
||||
This component filters a [Data](/data-types#data) object based on a list of keys.
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
<summary>Data to DataFrame/Data to Message</summary>
|
||||
|
||||
**Inputs**
|
||||
Replace these legacy components with newer processing components, such as the [**Data Operations** component](#data-operations) and [**Type Convert** component](#type-convert).
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data | Data | The Data object to filter. |
|
||||
| filter_criteria | Filter Criteria | A list of keys to filter by. |
|
||||
These components converted one or more `Data` objects into a `DataFrame` or `Message` object.
|
||||
|
||||
**Outputs**
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| filtered_data | Filtered Data | A new Data object containing only the key-value pairs that match the filter criteria. |
|
||||
For the **Data to DataFrame** component, 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.
|
||||
|
||||
</details>
|
||||
|
||||
### Filter values
|
||||
<details>
|
||||
<summary>Filter Data</summary>
|
||||
|
||||
:::important
|
||||
This component is in **Legacy**, which means it is available for use but no longer in active development.
|
||||
Instead, use the [Data operations](#data-operations) component.
|
||||
:::
|
||||
Replace this legacy component with the [**Data Operations** component](#data-operations).
|
||||
|
||||
This component filters a `Data` object based on a list of keys (`filter_criteria`), returning a new `Data` object (`filtered_data`) that contains only the key-value pairs that match the filter criteria.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Filter Values</summary>
|
||||
|
||||
Replace this legacy component with the [**Data Operations** component](#data-operations).
|
||||
|
||||
The Filter values component filters a list of data items based on a specified key, filter value, and comparison operator.
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
|
||||
**Inputs**
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| input_data | Input data | The list of data items to filter. |
|
||||
| filter_key | Filter Key | The key to filter on. |
|
||||
| filter_value | Filter Value | The value to filter by. |
|
||||
| operator | Comparison Operator | The operator to apply for comparing the values. |
|
||||
|
||||
**Outputs**
|
||||
It accepts the following parameters:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| filtered_data | Filtered data | The resulting list of filtered data items. |
|
||||
| input_data | Input data | Input parameter. The list of data items to filter. |
|
||||
| filter_key | Filter Key | Input parameter. The key to filter on. |
|
||||
| filter_value | Filter Value | Input parameter. The value to filter by. |
|
||||
| operator | Comparison Operator | Input parameter. The operator to apply for comparing the values. |
|
||||
| filtered_data | Filtered data | Output parameter. The resulting list of filtered data items. |
|
||||
|
||||
</details>
|
||||
|
||||
### JSON cleaner
|
||||
|
||||
:::important
|
||||
This component is in **Legacy**, which means it is available for use but no longer in active development.
|
||||
:::
|
||||
|
||||
The JSON cleaner component cleans JSON strings to ensure they are fully compliant with the JSON specification.
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
<summary>JSON Cleaner</summary>
|
||||
|
||||
**Inputs**
|
||||
Replace this legacy component with the [**Parser** component](#parser).
|
||||
|
||||
This component cleans JSON strings to ensure they are fully compliant with the JSON specification.
|
||||
|
||||
It accepts the following parameters:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| json_str | JSON String | The JSON string to be cleaned. This can be a raw, potentially malformed JSON string produced by language models or other sources that may not fully comply with JSON specifications. |
|
||||
| remove_control_chars | Remove Control Characters | If set to True, this option removes control characters (ASCII characters 0-31 and 127) from the JSON string. This can help eliminate invisible characters that might cause parsing issues or make the JSON invalid. |
|
||||
| normalize_unicode | Normalize Unicode | When enabled, this option normalizes Unicode characters in the JSON string to their canonical composition form (NFC). This ensures consistent representation of Unicode characters across different systems and prevents potential issues with character encoding. |
|
||||
| validate_json | Validate JSON | If set to True, this option attempts to parse the JSON string to ensure it is well-formed before applying the final repair operation. It raises a ValueError if the JSON is invalid, allowing for early detection of major structural issues in the JSON. |
|
||||
|
||||
**Outputs**
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| output | Cleaned JSON String | The resulting cleaned, repaired, and validated JSON string that fully complies with the JSON specification. |
|
||||
| json_str | JSON String | Input parameter. The JSON string to be cleaned. This can be a raw, potentially malformed JSON string produced by language models or other sources that may not fully comply with JSON specifications. |
|
||||
| remove_control_chars | Remove Control Characters | Input parameter. If set to True, this option removes control characters (ASCII characters 0-31 and 127) from the JSON string. This can help eliminate invisible characters that might cause parsing issues or make the JSON invalid. |
|
||||
| normalize_unicode | Normalize Unicode | Input parameter. When enabled, this option normalizes Unicode characters in the JSON string to their canonical composition form (NFC). This ensures consistent representation of Unicode characters across different systems and prevents potential issues with character encoding. |
|
||||
| validate_json | Validate JSON | Input parameter. If set to True, this option attempts to parse the JSON string to ensure it is well-formed before applying the final repair operation. It raises a ValueError if the JSON is invalid, allowing for early detection of major structural issues in the JSON. |
|
||||
| output | Cleaned JSON String | Output parameter. The resulting cleaned, repaired, and validated JSON string that fully complies with the JSON specification. |
|
||||
|
||||
</details>
|
||||
|
||||
### Message to data
|
||||
|
||||
This component converts [Message](/data-types#message) objects to [Data](/data-types#data) objects.
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
<summary>Message to Data</summary>
|
||||
|
||||
**Inputs**
|
||||
Replace this legacy component with the [**Type Convert** component](#type-convert).
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| message | Message | The Message object to convert to a Data object. |
|
||||
|
||||
**Outputs**
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data | Data | The converted Data object. |
|
||||
This component converts `Message` objects to `Data` objects.
|
||||
|
||||
</details>
|
||||
|
||||
### Parse DataFrame
|
||||
|
||||
:::important
|
||||
This component is in **Legacy**, which means it is available for use but no longer in active development.
|
||||
Instead, use the [Parser](#parser) component.
|
||||
:::
|
||||
|
||||
This component converts DataFrames into plain text using templates.
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
<summary>Parse DataFrame</summary>
|
||||
|
||||
**Inputs**
|
||||
Replace this legacy component with the [**DataFrame Operations** component](#dataframe-operations) or [**Parser** component](#parser).
|
||||
|
||||
This component converts `DataFrame` objects into plain text using templates.
|
||||
|
||||
It accepts the following parameters:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| df | DataFrame | The DataFrame to convert to text rows. |
|
||||
| template | Template | Template for formatting (use `{column_name}` placeholders). |
|
||||
| sep | Separator | String to join rows in output. |
|
||||
|
||||
**Outputs**
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| text | Text | All rows combined into single text. |
|
||||
| df | DataFrame | Input parameter. The DataFrame to convert to text rows. |
|
||||
| template | Template | Input parameter. Template for formatting (use `{column_name}` placeholders). |
|
||||
| sep | Separator | Input parameter. String to join rows in output. |
|
||||
| text | Text | Output parameter. All rows combined into single text. |
|
||||
|
||||
</details>
|
||||
|
||||
### Parse JSON
|
||||
|
||||
:::important
|
||||
This component is in **Legacy**, which means it is available for use but no longer in active development.
|
||||
:::
|
||||
|
||||
This component converts and extracts JSON fields using JQ queries.
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
<summary>Parse JSON</summary>
|
||||
|
||||
**Inputs**
|
||||
Replace this legacy component with the [**Parser** component](#parser).
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| input_value | Input | Data object to filter ([Message](/data-types#message) or [Data](/data-types#data)). |
|
||||
| query | JQ Query | JQ Query to filter the data |
|
||||
|
||||
**Outputs**
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| filtered_data | Filtered Data | Filtered data as list of [Data](/data-types#data) objects. |
|
||||
This component converts and extracts JSON fields in `Message` and `Data` objects using JQ queries, then returns `filtered_data`, which is a list of `Data` objects.
|
||||
|
||||
</details>
|
||||
|
||||
### Regex extractor
|
||||
<details>
|
||||
<summary>Python REPL</summary>
|
||||
|
||||
:::important
|
||||
This component is in **Legacy**, which means it is available for use but no longer in active development.
|
||||
:::
|
||||
Replace this legacy component with the [**Python Interpreter** component](#python-interpreter) or another processing or logic component.
|
||||
|
||||
This component creates a Python REPL (Read-Eval-Print Loop) tool for executing Python code.
|
||||
|
||||
It accepts the following parameters:
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| name | String | Input parameter. The name of the tool. Default: `python_repl`. |
|
||||
| description | String | Input parameter. A description of the tool's functionality. |
|
||||
| global_imports | List[String] | Input parameter. A list of modules to import globally. Default: `math`. |
|
||||
| tool | Tool | Output parameter. A Python REPL tool for use in LangChain. |
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Python Code Structured</summary>
|
||||
|
||||
Replace this legacy component with the [**Python Interpreter** component](#python-interpreter) or another processing or logic component.
|
||||
|
||||
This component creates a structured tool from Python code using a dataclass.
|
||||
|
||||
The component dynamically updates its configuration based on the provided Python code, allowing for custom function arguments and descriptions.
|
||||
|
||||
It accepts the following parameters:
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| tool_code | String | Input parameter. The Python code for the tool's dataclass. |
|
||||
| tool_name | String | Input parameter. The name of the tool. |
|
||||
| tool_description | String | Input parameter. The description of the tool. |
|
||||
| return_direct | Boolean | Input parameter. Whether to return the function output directly. |
|
||||
| tool_function | String | Input parameter. The selected function for the tool. |
|
||||
| global_variables | Dict | Input parameter. Global variables or data for the tool. |
|
||||
| result_tool | Tool | Output parameter. A structured tool created from the Python code. |
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Regex Extractor</summary>
|
||||
|
||||
Replace this legacy component with the [**Parser** component](#parser).
|
||||
|
||||
This component extracts patterns in text using regular expressions. It can be used to find and extract specific patterns or information in text.
|
||||
|
||||
To use this component in a flow:
|
||||
|
||||
1. Connect the **Regex Extractor** to a **URL** component and a **Chat Output** component.
|
||||
|
||||
2. In the **Regex Extractor** tool, enter a pattern to extract text from the **URL** component's raw output.
|
||||
This example extracts the first paragraph from the "In the News" section of `https://en.wikipedia.org/wiki/Main_Page`:
|
||||
```
|
||||
In the news\s*\n(.*?)(?=\n\n)
|
||||
```
|
||||
|
||||
Result:
|
||||
```
|
||||
Peruvian writer and Nobel Prize in Literature laureate Mario Vargas Llosa (pictured) dies at the age of 89.
|
||||
```
|
||||
|
||||
### Select data
|
||||
|
||||
:::important
|
||||
This component is in **Legacy**, which means it is available for use but no longer in active development.
|
||||
:::
|
||||
|
||||
This component selects a single [Data](/data-types#data) item from a list.
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
<summary>Select Data</summary>
|
||||
|
||||
**Inputs**
|
||||
Replace this legacy component with the [**Data Operations** component](#data-operations).
|
||||
|
||||
This component selects a single `Data` object from a list.
|
||||
|
||||
It accepts the following parameters:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data_list | Data List | List of data to select from |
|
||||
| data_index | Data Index | Index of the data to select |
|
||||
|
||||
**Outputs**
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| selected_data | Selected Data | The selected [Data](/data-types#data) object. |
|
||||
| data_list | Data List | Input parameter. List of data to select from |
|
||||
| data_index | Data Index | Input parameter. Index of the data to select |
|
||||
| selected_data | Selected Data | Output parameter. The selected `Data` object. |
|
||||
|
||||
</details>
|
||||
|
||||
### Update data
|
||||
<details>
|
||||
<summary>Update Data</summary>
|
||||
|
||||
:::important
|
||||
This component is in **Legacy**, which means it is available for use but no longer in active development.
|
||||
:::
|
||||
Replace this legacy component with the [**Data Operations** component](#data-operations).
|
||||
|
||||
This component dynamically updates or appends data with specified fields.
|
||||
|
||||
<details>
|
||||
<summary>Parameters</summary>
|
||||
|
||||
**Inputs**
|
||||
It accepts the following parameters:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| old_data | Data | The records to update. |
|
||||
| number_of_fields | Number of Fields | The number of fields to add. The maximum is 15. |
|
||||
| text_key | Text Key | The key for text content. |
|
||||
| text_key_validator | Text Key Validator | Validates the text key presence. |
|
||||
|
||||
**Outputs**
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data | Data | The updated Data objects. |
|
||||
|
||||
</details>
|
||||
| old_data | Data | Input parameter. The records to update. |
|
||||
| number_of_fields | Number of Fields | Input parameter. The number of fields to add. The maximum is 15. |
|
||||
| text_key | Text Key | Input parameter. The key for text content. |
|
||||
| text_key_validator | Text Key Validator | Input parameter. Validates the text key presence. |
|
||||
| data | Data | Output parameter. The updated Data objects. |
|
||||
|
||||
</details>
|
||||
Loading…
Add table
Add a link
Reference in a new issue