mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-26 07:52:29 +08:00
docs: rename component categories and make all components single pages (#10648)
* docs: OpenAPI spec version upgraded from 1.6.5 to 1.6.8 (#10627) Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com> Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com> * up to models and agents * sidebars * fix-broken-links * chore: Fix indentation on bundles-docling.mdx (#10640) * sidebars * redo-intros * link-to-models * data-components * files-components-no-kb * io-components * helper-utility-components * llm-ops-components * logic-components * processing-pages * sidebars * combine-legacy-components-into-one-page * update-links * remove-overview-pages-and-redirect * make-mcp-tools-page * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * no-cap --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com> Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
This commit is contained in:
@ -235,7 +235,7 @@ To send image files to your flows through the API, see [Upload image files (v1)]
|
||||
:::
|
||||
|
||||
This endpoint uploads files to your Langflow server's file management system.
|
||||
To use an uploaded file in a flow, send the file path to a flow with a [**Read File** component](/components-data#file).
|
||||
To use an uploaded file in a flow, send the file path to a flow with a [**Read File** component](/read-file).
|
||||
|
||||
The default file limit is 1024 MB. To configure this value, change the `LANGFLOW_MAX_FILE_SIZE_UPLOAD` [environment variable](/environment-variables).
|
||||
|
||||
|
||||
@ -175,7 +175,7 @@ curl -X POST \
|
||||
Use the `/webhook` endpoint to start a flow by sending an HTTP `POST` request.
|
||||
|
||||
:::tip
|
||||
After you add a [**Webhook** component](/components-data#webhook) to a flow, open the [**API access** pane](/concepts-publish), and then click the **Webhook curl** tab to get an automatically generated `POST /webhook` request for your flow.
|
||||
After you add a [**Webhook** component](/webhook) to a flow, open the [**API access** pane](/concepts-publish), and then click the **Webhook curl** tab to get an automatically generated `POST /webhook` request for your flow.
|
||||
For more information, see [Trigger flows with webhooks](/webhook).
|
||||
:::
|
||||
|
||||
|
||||
@ -198,7 +198,7 @@ inputs = [
|
||||
|
||||
## Use flows as tools
|
||||
|
||||
An agent can use your other flows as tools with the [**Run Flow** component](/components-logic#run-flow).
|
||||
An agent can use your other flows as tools with the [**Run Flow** component](/run-flow).
|
||||
|
||||
1. Add a **Run Flow** component to your flow.
|
||||
2. Select the flow you want the agent to use as a tool.
|
||||
|
||||
@ -32,7 +32,7 @@ For more information, see [Agent component parameters](#agent-component-paramete
|
||||
4. Enter a valid credential for your selected model provider.
|
||||
Make sure that the credential has permission to call the selected model.
|
||||
|
||||
5. Add [**Chat Input** and **Chat Output** components](/components-io) to your flow, and then connect them to the **Agent** component.
|
||||
5. Add [**Chat Input** and **Chat Output** components](/chat-input-and-output) to your flow, and then connect them to the **Agent** component.
|
||||
|
||||
At this point, you have created a basic LLM-based chat flow that you can test in the <Icon name="Play" aria-hidden="true" /> **Playground**.
|
||||
However, this flow only chats with the LLM.
|
||||
@ -127,7 +127,7 @@ To attach a component as a tool, you must enable **Tool Mode** on the component
|
||||
For more information, see [Configure tools for agents](/agents-tools).
|
||||
|
||||
:::tip
|
||||
To allow agents to use tools from MCP servers, use the [**MCP Tools** component](/components-agents#mcp-connection).
|
||||
To allow agents to use tools from MCP servers, use the [**MCP Tools** component](/mcp-tools).
|
||||
:::
|
||||
|
||||
### Agent memory
|
||||
@ -143,7 +143,7 @@ By default, the **Agent** component uses your Langflow installation's storage, a
|
||||
The **Message History** component isn't required for default chat memory, but it is required if you want to use external chat memory like Mem0.
|
||||
Additionally, the **Message History** component provides more options for sorting, filtering, and limiting memories. Although, most of these options are built-in to the **Agent** component with default values.
|
||||
|
||||
For more information, see [Store chat memory](/memory#store-chat-memory) and [**Message History** component](/components-helpers#message-history).
|
||||
For more information, see [Store chat memory](/memory#store-chat-memory) and [**Message History** component](/message-history).
|
||||
|
||||
### Additional parameters
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@ For information about using Langflow as an MCP client and managing MCP server co
|
||||
|
||||
## Prerequisites
|
||||
|
||||
* A [Langflow project](/concepts-flows#projects) with at least one flow that has a [**Chat Output** component](/components-io#chat-output).
|
||||
* A [Langflow project](/concepts-flows#projects) with at least one flow that has a [**Chat Output** component](/chat-input-and-output).
|
||||
|
||||
The **Chat Output** component is required to use a flow as an MCP tool.
|
||||
|
||||
|
||||
40
docs/docs/Components/api-request.mdx
Normal file
40
docs/docs/Components/api-request.mdx
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
title: API Request
|
||||
slug: /api-request
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
The **API Request** component constructs and sends HTTP requests using URLs or curl commands:
|
||||
|
||||
* **URL mode**: Enter one or more comma-separated URLs, and then select the method for the request to each URL.
|
||||
* **curl mode**: Enter the curl command to execute.
|
||||
|
||||
You can enable additional request options and fields in the component's parameters.
|
||||
|
||||
Returns a [`Data` object](/data-types#data) containing the response.
|
||||
|
||||
For provider-specific API components, see <Icon name="Blocks" aria-hidden="true" /> [**Bundles**](/components-bundle-components).
|
||||
|
||||
### API Request parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| mode | Mode | Input parameter. Set the mode to either **URL** or **curl**. |
|
||||
| urls | URL | Input parameter. Enter one or more comma-separated URLs for the request. |
|
||||
| curl | curl | Input parameter. **curl mode** only. Enter a complete curl command. Other component parameters are populated from the command arguments. |
|
||||
| method | Method | Input parameter. The HTTP method to use. |
|
||||
| query_params | Query Parameters | Input parameter. The query parameters to append to the URL. |
|
||||
| body | Body | Input parameter. The body to send with POST, PATCH, and PUT requests as a dictionary. |
|
||||
| headers | Headers | Input parameter. The headers to send with the request as a dictionary. |
|
||||
| timeout | Timeout | Input parameter. The timeout to use for the request. |
|
||||
| follow_redirects | Follow Redirects | Input parameter. Whether to follow HTTP redirects. Starting in Langflow version 1.7, the **Follow Redirects** parameter is disabled (`false`) by default to prevent SSRF bypass attacks where a public URL redirects to internal resources. Only enable redirects if you trust the target server. For more information, see [SSRF protection environment variables](/api-keys-and-authentication#ssrf-protection). |
|
||||
| save_to_file | Save to File | Input parameter. Whether to save the API response to a temporary file. Default: Disabled (`false`) |
|
||||
| include_httpx_metadata | Include HTTPx Metadata | Input parameter. Whether to include properties such as `headers`, `status_code`, `response_headers`, and `redirection_history` in the output. Default: Disabled (`false`) |
|
||||
|
||||
65
docs/docs/Components/batch-run.mdx
Normal file
65
docs/docs/Components/batch-run.mdx
Normal file
@ -0,0 +1,65 @@
|
||||
---
|
||||
title: Batch Run
|
||||
slug: /batch-run
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
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 output 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 0-indexed processing order for all rows in the `DataFrame`
|
||||
* `metadata` (optional): Additional information about the processing
|
||||
|
||||
### Use the Batch Run component in a flow
|
||||
|
||||
If you pass the **Batch Run** output to a [**Parser** component](/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.
|
||||
|
||||

|
||||
|
||||
1. Connect any language model component to a **Batch Run** component's **Language model** port.
|
||||
|
||||
2. Connect `DataFrame` output from another component to the **Batch Run** component's **DataFrame** input.
|
||||
For example, you could connect a **Read File** component with a CSV file.
|
||||
|
||||
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.
|
||||
|
||||
4. Connect the **Batch Run** component's **Batch Results** output to a **Parser** component's **DataFrame** input.
|
||||
|
||||
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.`
|
||||
|
||||
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`):
|
||||
|
||||
For example, this template uses three columns from the resulting, post-batch `DataFrame`:
|
||||
|
||||
```text
|
||||
record_number: {batch_index}, name: {text_input}, summary: {model_response}
|
||||
```
|
||||
|
||||
7. To test the processing, click the **Parser** component, 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`.
|
||||
|
||||
You can also connect a **Chat Output** component to the **Parser** component if you want to see the output in the **Playground**.
|
||||
|
||||
### Batch Run parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| model | HandleInput | Input parameter. Connect the 'Language Model' output from a language model component. 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. |
|
||||
|
||||
@ -25,4 +25,4 @@ It returns a list of search results as a [`DataFrame`](/data-types#dataframe).
|
||||
|
||||
## See also
|
||||
|
||||
* [**Web Search** component](/components-data#web-search)
|
||||
* [**Web Search** component](/web-search)
|
||||
@ -29,5 +29,5 @@ It returns a list of search results as a [`DataFrame`](/data-types#dataframe).
|
||||
|
||||
## See also
|
||||
|
||||
* [**Web Search** component](/components-data#web-search)
|
||||
* [**Web Search** component](/web-search)
|
||||
* [**SearchApi** bundle](/bundles-searchapi)
|
||||
@ -68,7 +68,7 @@ The **Cassandra Chat Memory** component retrieves and stores chat messages using
|
||||
Chat memories are passed between memory storage components as the [`Memory`](/data-types#memory) data type.
|
||||
Specifically, the component creates an instance of `CassandraChatMessageHistory`, which is a LangChain chat message history class that uses a Cassandra database for storage.
|
||||
|
||||
For more information about using external chat memory in flows, see the [**Message History** component](/components-helpers#message-history).
|
||||
For more information about using external chat memory in flows, see the [**Message History** component](/message-history).
|
||||
|
||||
### Cassandra Chat Memory parameters
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ The following example flow uses one **Chroma DB** component for both reads and w
|
||||
|
||||

|
||||
|
||||
* When writing, it splits `Data` from a [**URL** component](/components-data#url) into chunks, computes embeddings with attached **Embedding Model** component, and then loads the chunks and embeddings into the Chroma vector store.
|
||||
* When writing, it splits `Data` from a [**URL** component](/url) into chunks, computes embeddings with attached **Embedding Model** component, and then loads the chunks and embeddings into the Chroma vector store.
|
||||
To trigger writes, click <Icon name="Play" aria-hidden="true"/> **Run component** on the **Chroma DB** component.
|
||||
|
||||
* When reading, it uses chat input to perform a similarity search on the vector store, and then print the search results to the chat.
|
||||
|
||||
@ -28,9 +28,9 @@ For demonstration purposes, the following example modifies a template flow to us
|
||||

|
||||
|
||||
1. Create a flow based on the **Simple Agent** template, and then replace the **Agent** component with the **CUGA** component.
|
||||
2. Connect an [**MCP Tools** component](/mcp-client) and a [**Calculator** component](/components-helpers#calculator) to the **CUGA** component's **Tools** port, and then connect the **MCP Tools** component to any MCP server.
|
||||
2. Connect an [**MCP Tools** component](/mcp-client) and a [**Calculator** component](/calculator) to the **CUGA** component's **Tools** port, and then connect the **MCP Tools** component to any MCP server.
|
||||
This example connected to a server containing sales data for a business organization.
|
||||
3. Add a [**Read File** component](/components-data#file), and then connect it to the **CUGA** component's **Policies** port.
|
||||
3. Add a [**Read File** component](/read-file), and then connect it to the **CUGA** component's **Policies** port.
|
||||
Alternatively, click <Icon name="Scan" aria-hidden="true" /> **Edit text** to open the **Edit text content** pane, and enter your policy directly into the **CUGA** component.
|
||||
4. Create a Markdown file on your computer called `policy.md`, and then insert the following content.
|
||||
It's important to clearly format the document with `## Plan` and `## Answer` for the agent to understand your instructions.
|
||||
|
||||
@ -413,7 +413,7 @@ Your agentic flows don't need an external database to store chat memory.
|
||||
For more information, see [Memory management options](/memory).
|
||||
:::
|
||||
|
||||
For more information about using external chat memory in flows, see the [**Message History** component](/components-helpers#message-history).
|
||||
For more information about using external chat memory in flows, see the [**Message History** component](/message-history).
|
||||
|
||||
#### Astra DB Chat Memory parameters
|
||||
|
||||
|
||||
@ -13,7 +13,8 @@ Langflow integrates with [Docling](https://docling-project.github.io/docling/) t
|
||||
## Prerequisites
|
||||
|
||||
* **Enable Developer Mode for Windows**:
|
||||
<PartialDevModeWindows />
|
||||
|
||||
<PartialDevModeWindows />
|
||||
|
||||
* **Install Docling dependency**:
|
||||
The Docling dependency is required to use the Docling components in Langflow.
|
||||
@ -35,7 +36,7 @@ To learn more about content extraction with Docling, see the video tutorial [Doc
|
||||
|
||||
This example demonstrates how to use Docling components to split a PDF in a flow:
|
||||
|
||||
1. Connect a **Docling** and an **Export DoclingDocument** component to a [**Split Text** component](/components-processing#split-text).
|
||||
1. Connect a **Docling** and an **Export DoclingDocument** component to a [**Split Text** component](/split-text).
|
||||
|
||||
The **Docling** component loads the document, and the **Export DoclingDocument** component converts the `DoclingDocument` into the format you select. This example converts the document to Markdown, with images represented as placeholders.
|
||||
The **Split Text** component will split the Markdown into chunks for the vector database to store in the next part of the flow.
|
||||
@ -131,4 +132,4 @@ For more information, see the [Docling core project repository](https://github.c
|
||||
|
||||
## See also
|
||||
|
||||
* [**File** component](/components-data#file)
|
||||
* [**Read File** component](/read-file)
|
||||
@ -28,5 +28,5 @@ It outputs a list of search results as a [`DataFrame`](/data-types#dataframe) wi
|
||||
|
||||
## See also
|
||||
|
||||
* [**Web Search** component](/components-data#web-search)
|
||||
* [**Web Search** component](/web-search)
|
||||
* [**SearchApi** bundle](/bundles-searchapi)
|
||||
@ -30,4 +30,4 @@ It returns a list of search results as a [`DataFrame`](/data-types#dataframe).
|
||||
|
||||
## See also
|
||||
|
||||
* [**Web Search** component](/components-data#web-search)
|
||||
* [**Web Search** component](/web-search)
|
||||
@ -144,8 +144,8 @@ Langflow includes multiple components that support Google Search, such as the fo
|
||||
* [**Apify Actors** component](/bundles-apify)
|
||||
* [**SearchApi** component](/bundles-searchapi)
|
||||
* [**Serper Google Search API** component](/bundles-serper)
|
||||
* [**News Search** component](/components-data#news-search)
|
||||
* [**Web Search** component](/components-data#web-search)
|
||||
* [**News Search** component](/news-search)
|
||||
* [**Web Search** component](/web-search)
|
||||
|
||||
## Google Vertex AI
|
||||
|
||||
@ -182,7 +182,7 @@ As an alternative, you can use [Composio components](/bundles-composio) to conne
|
||||
|
||||
This component loads documents from Google Drive using [Service Account JSON](https://developers.google.com/identity/protocols/oauth2/service-account) credentials and document ID filters.
|
||||
|
||||
While there is no direct replacement, consider using the [**API Request** component](/components-data#api-request) to call the Google Drive API.
|
||||
While there is no direct replacement, consider using the [**API Request** component](/api-request) to call the Google Drive API.
|
||||
|
||||
</details>
|
||||
|
||||
@ -191,7 +191,7 @@ While there is no direct replacement, consider using the [**API Request** compon
|
||||
|
||||
This component searches Google Drive using [Service Account JSON](https://developers.google.com/identity/protocols/oauth2/service-account) credentials and various query strings and filters.
|
||||
|
||||
While there is no direct replacement, consider using the [**API Request** component](/components-data#api-request) to call the Google Drive API.
|
||||
While there is no direct replacement, consider using the [**API Request** component](/api-request) to call the Google Drive API.
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ For more information, see the [LangChain SQL agent documentation](https://docs.l
|
||||
|
||||
The LangChain **SQL Database** component establishes a connection to an SQL database.
|
||||
|
||||
This component is different from the [**SQL Database** core component](/components-data#sql-database), which executes SQL queries on SQLAlchemy-compatible databases.
|
||||
This component is different from the [**SQL Database** core component](/sql-database), which executes SQL queries on SQLAlchemy-compatible databases.
|
||||
|
||||
## Text Splitters
|
||||
|
||||
@ -183,4 +183,4 @@ The following LangChain components are in legacy status:
|
||||
* **Vector Store Info/Agent**
|
||||
* **VectorStoreRouterAgent**
|
||||
|
||||
To replace these components, consider other components in the **LangChain** bundle or general Langflow components, such as the [**Agent** component](/components-agents) or the [**SQL Database** component](/components-data#sql-database).
|
||||
To replace these components, consider other components in the **LangChain** bundle or general Langflow components, such as the [**Agent** component](/components-agents) or the [**SQL Database** component](/sql-database).
|
||||
@ -34,6 +34,6 @@ The **Mem0 Chat Memory** component retrieves and stores chat messages using Mem0
|
||||
The **Mem0 Chat Memory** component can output either **Mem0 Memory** ([`Memory`](/data-types#memory)) or **Search Results** ([`Data`](/data-types#data)).
|
||||
You can select the output type near the component's output port.
|
||||
|
||||
Use **Mem0 Chat Memory** for memory storage and retrieval operations with the [**Message History** component](/components-helpers#message-history).
|
||||
Use **Mem0 Chat Memory** for memory storage and retrieval operations with the [**Message History** component](/message-history).
|
||||
|
||||
Use the **Search Results** output to retrieve specific memories based on a search query.
|
||||
@ -71,7 +71,7 @@ For more information about using embedding model components in flows, see [Embed
|
||||
:::tip Tokenization considerations
|
||||
Be aware of your embedding model's chunk size limit.
|
||||
Tokenization errors can occur if your text chunks are too large.
|
||||
For more information, see [Tokenization errors due to chunk size](/components-processing#chunk-size).
|
||||
For more information, see [Tokenization errors due to chunk size](/split-text#chunk-size).
|
||||
:::
|
||||
|
||||
## NVIDIA Rerank
|
||||
@ -153,7 +153,7 @@ For more information, see the [NV-Ingest documentation](https://nvidia.github.io
|
||||
| extract_infographics | Extract Infographics | Extract infographics from document. Default: `false`. |
|
||||
| text_depth | Text Depth | The level at which text is extracted. Options: 'document', 'page', 'block', 'line', 'span'. Default: `page`. |
|
||||
| split_text | Split Text | Split text into smaller chunks. Default: `true`. |
|
||||
| chunk_size | Chunk Size | The number of tokens per chunk. Default: `500`. Make sure the chunk size is compatible with your embedding model. For more information, see [Tokenization errors due to chunk size](/components-processing#chunk-size). |
|
||||
| chunk_size | Chunk Size | The number of tokens per chunk. Default: `500`. Make sure the chunk size is compatible with your embedding model. For more information, see [Tokenization errors due to chunk size](/split-text#chunk-size). |
|
||||
| chunk_overlap | Chunk Overlap | Number of tokens to overlap from previous chunk. Default: `150`. |
|
||||
| filter_images | Filter Images | Filter images (see advanced options for filtering criteria). Default: `false`. |
|
||||
| min_image_size | Minimum Image Size Filter | Minimum image width/length in pixels. Default: `128`. |
|
||||
|
||||
@ -16,7 +16,7 @@ The **Redis Chat Memory** component retrieves and stores chat messages using Red
|
||||
|
||||
Chat memories are passed between memory storage components as the [`Memory`](/data-types#memory) data type.
|
||||
|
||||
For more information about using external chat memory in flows, see the [**Message History** component](/components-helpers#message-history).
|
||||
For more information about using external chat memory in flows, see the [**Message History** component](/message-history).
|
||||
|
||||
### Redis Chat Memory parameters
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ It returns a list of search results as a [`DataFrame`](/data-types#dataframe).
|
||||
|
||||
## See also
|
||||
|
||||
* [**Web Search** component](/components-data#web-search)
|
||||
* [**Web Search** component](/web-search)
|
||||
* [**Google** bundle](/bundles-google)
|
||||
* [**Bing** bundle](/bundles-bing)
|
||||
* [**DuckDuckGo** bundle](/bundles-duckduckgo)
|
||||
@ -27,7 +27,7 @@ It returns a list of search results as a [`DataFrame`](/data-types#dataframe).
|
||||
|
||||
## See also
|
||||
|
||||
* [**Web Search** component](/components-data#web-search)
|
||||
* [**Web Search** component](/web-search)
|
||||
* [**Google** bundle](/bundles-google)
|
||||
* [**Bing** bundle](/bundles-bing)
|
||||
* [**DuckDuckGo** bundle](/bundles-duckduckgo)
|
||||
@ -40,4 +40,4 @@ This component searches and retrieves information from Wikipedia with the [WikiM
|
||||
|
||||
## See also
|
||||
|
||||
* [**API Request** component](/components-data#api-request)
|
||||
* [**API Request** component](/api-request)
|
||||
20
docs/docs/Components/calculator.mdx
Normal file
20
docs/docs/Components/calculator.mdx
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
title: Calculator
|
||||
slug: /calculator
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
The **Calculator** component performs basic arithmetic operations on mathematical expressions.
|
||||
It supports addition, subtraction, multiplication, division, and exponentiation operations.
|
||||
|
||||
For an example of using this component in a flow, see the [**Python Interpreter** component](/python-interpreter).
|
||||
|
||||
### Calculator parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| expression | String | Input parameter. The arithmetic expression to evaluate, such as `4*4*(33/22)+12-20`. |
|
||||
| result | Data | Output parameter. The calculation result as a [`Data` object](/data-types) containing the evaluated expression. |
|
||||
@ -1,21 +1,11 @@
|
||||
---
|
||||
title: Input / Output
|
||||
slug: /components-io
|
||||
title: Chat Input and Output
|
||||
slug: /chat-input-and-output
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
|
||||
Input and output components define where data enters and exits your flow, but they don't have identical functionality.
|
||||
|
||||
Specifically, **Chat Input and Output** components are designed to facilitate conversational interactions where messages are exchanged in a cumulative dialogue.
|
||||
The data handled by these components includes the message text plus additional metadata like senders, session IDs, and timestamps.
|
||||
|
||||
In contrast, **Text Input and Output** components are designed for simple string input and output that doesn't require the additional context and metadata associated with chat messages.
|
||||
The data handled by these components is pared down to basic text strings.
|
||||
|
||||
## Chat Input and Output {#chat-io}
|
||||
|
||||
:::warning
|
||||
**Chat Input and Output** components are required to chat with your flow in the **Playground**.
|
||||
For more information, see [Test flows in the Playground](/concepts-playground).
|
||||
@ -23,14 +13,14 @@ For more information, see [Test flows in the Playground](/concepts-playground).
|
||||
|
||||
**Chat Input and Output** components are designed to handle conversational interactions in Langflow.
|
||||
|
||||
### Chat Input
|
||||
## Chat Input
|
||||
|
||||
The **Chat Input** component accepts text and file input, such as a chat message or a file.
|
||||
This data is passed to other components as [`Message` data](/data-types) containing the provided input as well as associated chat metadata, such as the sender, session ID, timestamp, and file attachments.
|
||||
|
||||
Initial input should _not_ be provided as a complete `Message` object because the **Chat Input** component constructs the `Message` object that is then passed to other components in the flow.
|
||||
|
||||
#### Chat Input parameters
|
||||
### Chat Input parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
@ -71,7 +61,7 @@ message = await Message.create(
|
||||
|
||||
</details>
|
||||
|
||||
### Chat Output
|
||||
## Chat Output
|
||||
|
||||
The **Chat Output** component ingests `Message`, `Data`, or `DataFrame` data from other components, transforms it into `Message` data if needed, and then emits the final output as a chat message.
|
||||
For information about these data types, see [Use Langflow data types](/data-types).
|
||||
@ -83,7 +73,7 @@ When using the Langflow API, the API response includes the **Chat Output** `Mess
|
||||
Langflow API responses can be extremely verbose, so your applications must include code to extract relevant data from the response to return to the user.
|
||||
For an example, see the [Langflow quickstart](/get-started-quickstart).
|
||||
|
||||
#### Chat Output parameters
|
||||
### Chat Output parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
@ -102,7 +92,7 @@ For an example, see the [Langflow quickstart](/get-started-quickstart).
|
||||
|
||||
For information about the resulting `Message` object, including input parameters that are directly mapped to `Message` attributes, see [`Message` data](/data-types#message).
|
||||
|
||||
### Use Chat Input and Output components in a flow
|
||||
## Use Chat Input and Output components in a flow
|
||||
|
||||
To use the **Chat Input** and **Chat Output** components in a flow, connect them to components that accept or emit [`Message` data](/data-types#message).
|
||||
|
||||
@ -153,34 +143,4 @@ curl --request POST \
|
||||
}'
|
||||
```
|
||||
|
||||
For more information, see [Trigger flows with the Langflow API](/concepts-publish).
|
||||
|
||||
## Text Input and Output {#text-io}
|
||||
|
||||
:::warning
|
||||
**Text Input and Output** components aren't supported in the **Playground**.
|
||||
Because the data isn't formatted as a chat message, the data doesn't appear in the **Playground**, and you can't chat with your flow in the **Playground**.
|
||||
|
||||
If you want to chat with a flow in the **Playground**, you must use the [**Chat Input and Output** components](#chat-io).
|
||||
:::
|
||||
|
||||
**Text Input and Output** components are designed for flows that ingest or emit simple text strings.
|
||||
These components don't support full conversational interactions.
|
||||
|
||||
Passing chat-like metadata to a **Text Input and Output** component doesn't change the component's behavior; the result is still a simple text string.
|
||||
|
||||
### Text Input
|
||||
|
||||
The **Text Input** component accepts a text string input that is passed to other components as [`Message` data](/data-types) containing only the provided input text string in the `text` attribute.
|
||||
|
||||
It accepts only **Text** (`input_value`), which is the text supplied as input to the component.
|
||||
This can be entered directly into the component or passed as `Message` data from other components.
|
||||
|
||||
Initial input _shouldn't_ be provided as a complete `Message` object because the **Text Input** component constructs the `Message` object that is then passed to other components in the flow.
|
||||
|
||||
### Text Output
|
||||
|
||||
The **Text Output** component ingests [`Message` data](/data-types#message) from other components, emitting only the `text` attribute in a simplified `Message` object.
|
||||
|
||||
It accepts only **Text** (`input_value`), which is the text to be ingested and output as a string.
|
||||
This can be entered directly into the component or passed as `Message` data from other components.
|
||||
For more information, see [Trigger flows with the Langflow API](/concepts-publish).
|
||||
@ -5,14 +5,14 @@ slug: /components-agents
|
||||
|
||||
import PartialAgentsWork from '@site/docs/_partial-agents-work.mdx';
|
||||
|
||||
Langflow's **Agent** and **MCP Tools** components are critical for building agent flows.
|
||||
These components define the behavior and capabilities of AI agents in your flows.
|
||||
Langflow's **Agent** component is critical for building agent flows.
|
||||
This component defines the behavior and capabilities of AI agents in your flows.
|
||||
|
||||
<PartialAgentsWork />
|
||||
|
||||
## Examples of agent flows
|
||||
|
||||
For examples of flows using the **Agent** and **MCP Tools** components, see the following:
|
||||
For examples of flows using the **Agent** component, see the following:
|
||||
|
||||
* [Langflow quickstart](/get-started-quickstart): Start with the **Simple Agent** template, modify its tools, and then learn how to use an agent flow in an application.
|
||||
|
||||
@ -21,7 +21,7 @@ For examples of flows using the **Agent** and **MCP Tools** components, see the
|
||||
|
||||
* [Use an agent as a tool](/agents-tools#use-an-agent-as-a-tool): Create a multi-agent flow.
|
||||
|
||||
* [Use Langflow as an MCP client](/mcp-client) and [Use Langflow as an MCP server](/mcp-server): Use the **Agent** and **MCP Tools** components to implement the Model Context Protocol (MCP) in your flows.
|
||||
* [Use Langflow as an MCP client](/mcp-client) and [Use Langflow as an MCP server](/mcp-server): Use the **Agent** and [**MCP Tools** component](/mcp-tools) to implement the Model Context Protocol (MCP) in your flows.
|
||||
|
||||
## Agent component {#agent-component}
|
||||
|
||||
@ -29,30 +29,14 @@ The **Agent** component is the primary agent actor in your agent flows.
|
||||
This component uses an LLM integration to respond to input, such as a chat message or file upload.
|
||||
|
||||
The agent can use the tools already available in the base LLM as well as additional tools that you connect to the **Agent** component's **Tools** port.
|
||||
You can connect any Langflow component as a tool, including other **Agent** components and MCP servers through the [**MCP Tools** component](#mcp-connection).
|
||||
You can connect any Langflow component as a tool, including other **Agent** components and MCP servers through the [**MCP Tools** component](/mcp-tools).
|
||||
|
||||
For more information about using this component, see [Use Langflow agents](/agents).
|
||||
|
||||
## MCP Tools component {#mcp-connection}
|
||||
|
||||
The **MCP Tools** component connects to a Model Context Protocol (MCP) server and exposes the MCP server's functions as tools for Langflow agents to use to respond to input.
|
||||
|
||||
In addition to publicly available MCP servers and your own custom-built MCP servers, you can connect Langflow MCP servers, which allow your agent to use your Langflow flows as tools.
|
||||
To do this, use the **MCP Tools** component's [SSE mode](/mcp-client#mcp-sse-mode) to connect to your Langflow project's MCP server at the `/api/v1/mcp/sse` endpoint.
|
||||
|
||||
For more information, see [Use Langflow as an MCP client](/mcp-client) and [Use Langflow as an MCP server](/mcp-server).
|
||||
|
||||
<details>
|
||||
<summary>Earlier versions of the MCP Tools component</summary>
|
||||
|
||||
* In Langflow version 1.5, the **MCP Connection** component was renamed to the **MCP Tools** component.
|
||||
* In Langflow version 1.3, the **MCP Tools (stdio)** and **MCP Tools (SSE)** components were removed and replaced by the unified **MCP Connection** component, which was later renamed to **MCP Tools**.
|
||||
|
||||
</details>
|
||||
|
||||
## See also
|
||||
|
||||
* [**Message History** component](/components-helpers#message-history)
|
||||
* [**MCP Tools** component](/mcp-tools)
|
||||
* [**Message History** component](/message-history)
|
||||
* [Store chat memory](/memory#store-chat-memory)
|
||||
* [Bundles](/components-bundle-components)
|
||||
* [Legacy LangChain components](/bundles-langchain#legacy-langchain-components)
|
||||
@ -224,7 +224,7 @@ The following parameters are available in **Retrieve** mode:
|
||||
<summary>Zep Chat Memory</summary>
|
||||
|
||||
The **Zep Chat Memory** component is a legacy component.
|
||||
Replace this component with the [**Message History** component](/components-helpers#message-history).
|
||||
Replace this component with the [**Message History** component](/message-history).
|
||||
|
||||
This component creates a `ZepChatMessageHistory` instance, enabling storage and retrieval of chat messages using Zep, a memory server for LLMs.
|
||||
|
||||
|
||||
@ -1,616 +0,0 @@
|
||||
---
|
||||
title: Data
|
||||
slug: /components-data
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
Data components bring data into your flows from various sources like files, API endpoints, and URLs.
|
||||
For example:
|
||||
|
||||
* **Load files**: Import data from a file or directory with the [**Read File** component](#file) and [**Directory** component](#directory).
|
||||
|
||||
* **Search the web**: Fetch data from the web with components like the [**News Search** component](#news-search), [**RSS Reader** component](#rss-reader), [**Web Search** component](#web-search), and [**URL** component](#url).
|
||||
|
||||
* **Make API calls**: Use APIs to trigger flows or perform actions with the [**API Request** component](#api-request) and [**Webhook** component](#webhook).
|
||||
|
||||
* **Run SQL queries**: Query an SQL database with the [**SQL Database** component](#sql-database).
|
||||
|
||||
Each component runs different commands for retrieval, processing, and type checking.
|
||||
Some components are a minimal wrapper for a command that you provide, and others include built-in scripts to fetch and process data based on variable inputs.
|
||||
Additionally, some components return raw data, whereas others can convert, restructure, or validate the data before outputting it.
|
||||
This means that some similar components might produce different results.
|
||||
|
||||
:::tip
|
||||
Data components pair well with [Processing components](/components-processing) that can perform additional parsing, transformation, and validation after retrieving the data.
|
||||
|
||||
This can include basic operations, like saving a file in a specific format, or more complex tasks, like using a **Text Splitter** component to break down a large document into smaller chunks before generating embeddings for vector search.
|
||||
:::
|
||||
|
||||
## Use Data components in flows
|
||||
|
||||
Data components are used often in flows because they offer a versatile way to perform common functions.
|
||||
|
||||
You can use these components to perform their base functions as isolated steps in your flow, or you can connect them to an **Agent** component as tools.
|
||||
|
||||

|
||||
|
||||
For example flows, see the following:
|
||||
|
||||
* [Create a chatbot that can ingest files](/chat-with-files): Learn how to use a **Read File** component to load a file as context for a chatbot.
|
||||
The file and user input are both passed to the LLM so you can ask questions about the file you uploaded.
|
||||
|
||||
* [Create a vector RAG chatbot](/chat-with-rag): Learn how to ingest files for use in Retrieval-Augmented Generation (RAG), and then set up a chatbot that can use the ingested files as context.
|
||||
The two flows in this tutorial prepare files for RAG, and then let your LLM use vector search to retrieve contextually relevant data during a chat session.
|
||||
|
||||
* [Configure tools for agents](/agents-tools): Learn how to use any component as a tool for an agent.
|
||||
When used as tools, the agent autonomously decides when to call a component based on the user's query.
|
||||
|
||||
* [Trigger flows with webhooks](/webhook): Learn how to use the **Webhook** component to trigger a flow run in response to an external event.
|
||||
|
||||
## API Request
|
||||
|
||||
The **API Request** component constructs and sends HTTP requests using URLs or curl commands:
|
||||
|
||||
* **URL mode**: Enter one or more comma-separated URLs, and then select the method for the request to each URL.
|
||||
* **curl mode**: Enter the curl command to execute.
|
||||
|
||||
You can enable additional request options and fields in the component's parameters.
|
||||
|
||||
Returns a [`Data` object](/data-types#data) containing the response.
|
||||
|
||||
For provider-specific API components, see <Icon name="Blocks" aria-hidden="true" /> [**Bundles**](/components-bundle-components).
|
||||
|
||||
### API Request parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| mode | Mode | Input parameter. Set the mode to either **URL** or **curl**. |
|
||||
| urls | URL | Input parameter. Enter one or more comma-separated URLs for the request. |
|
||||
| curl | curl | Input parameter. **curl mode** only. Enter a complete curl command. Other component parameters are populated from the command arguments. |
|
||||
| method | Method | Input parameter. The HTTP method to use. |
|
||||
| query_params | Query Parameters | Input parameter. The query parameters to append to the URL. |
|
||||
| body | Body | Input parameter. The body to send with POST, PATCH, and PUT requests as a dictionary. |
|
||||
| headers | Headers | Input parameter. The headers to send with the request as a dictionary. |
|
||||
| timeout | Timeout | Input parameter. The timeout to use for the request. |
|
||||
| follow_redirects | Follow Redirects | Input parameter. Whether to follow HTTP redirects. Starting in Langflow version 1.7, the **Follow Redirects** parameter is disabled (`false`) by default to prevent SSRF bypass attacks where a public URL redirects to internal resources. Only enable redirects if you trust the target server. For more information, see [SSRF protection environment variables](/api-keys-and-authentication#ssrf-protection). |
|
||||
| save_to_file | Save to File | Input parameter. Whether to save the API response to a temporary file. Default: Disabled (`false`) |
|
||||
| include_httpx_metadata | Include HTTPx Metadata | Input parameter. Whether to include properties such as `headers`, `status_code`, `response_headers`, and `redirection_history` in the output. Default: Disabled (`false`) |
|
||||
|
||||
## Directory
|
||||
|
||||
The **Directory** component recursively loads files from a directory, with options for file types, depth, and concurrency.
|
||||
|
||||
Files must be of a [supported type and size](#file-type-and-size-limits) to be loaded.
|
||||
|
||||
Outputs either a [`Data`](/data-types#data) or [`DataFrame`](/data-types#dataframe) object, depending on the directory contents.
|
||||
|
||||
### Directory parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------------ | ---------------- | -------------------------------------------------- |
|
||||
| path | MessageTextInput | Input parameter. The path to the directory to load files from. Default: Current directory (`.`) |
|
||||
| types | MessageTextInput | Input parameter. The file types to load. Select one or more, or leave empty to attempt to load all files. |
|
||||
| depth | IntInput | Input parameter. The depth to search for files. |
|
||||
| max_concurrency | IntInput | Input parameter. The maximum concurrency for loading multiple files. |
|
||||
| load_hidden | BoolInput | Input parameter. If `true`, hidden files are loaded. |
|
||||
| recursive | BoolInput | Input parameter. If `true`, the search is recursive. |
|
||||
| silent_errors | BoolInput | Input parameter. If `true`, errors don't raise an exception. |
|
||||
| use_multithreading | BoolInput | Input parameter. If `true`, multithreading is used. |
|
||||
|
||||
## Mock Data
|
||||
|
||||
The **Mock Data** component generates sample data for testing and development.
|
||||
You can select these output types:
|
||||
|
||||
* `message_output`: A [Message (text)](/data-types#message) output with Lorem Ipsum sample text.
|
||||
* `data_output`: A [Data (JSON)](/data-types#data) object containing a JSON structure with one sample record under `records` and a `summary` section.
|
||||
* `dataframe_output`: A [DataFrame (tabular)](/data-types#dataframe) with 50 mock records, including columns such as `customer_id`, `first_name`, and `last_name`.
|
||||
|
||||
## Read File {#file}
|
||||
|
||||
In Langflow version 1.7.0, this component was renamed from **File** to **Read File**.
|
||||
|
||||
The **Read File** component loads and parses files, converts the content into a `Data`, `DataFrame`, or `Message` object.
|
||||
It supports multiple file types, provides parameters for parallel processing and error handling, and supports advanced parsing with the Docling library.
|
||||
|
||||
You can add files to the **Read File** component in the visual editor or at runtime, and you can upload multiple files at once.
|
||||
For more information about uploading files and working with files in flows, see [File management](/concepts-file-management) and [Create a chatbot that can ingest files](/chat-with-files).
|
||||
|
||||
### File type and size limits
|
||||
|
||||
By default, the maximum file size is 1024 MB.
|
||||
To modify this value, change the `LANGFLOW_MAX_FILE_SIZE_UPLOAD` [environment variable](/environment-variables).
|
||||
|
||||
<details>
|
||||
<summary>Supported file types</summary>
|
||||
|
||||
The following file types are supported by the **Read File** component.
|
||||
Use archive and compressed formats to bundle multiple files together, or use the [**Directory** component](#directory) to load all files in a directory.
|
||||
|
||||
- `.bz2`
|
||||
- `.csv`
|
||||
- `.docx`
|
||||
- `.gz`
|
||||
- `.htm`
|
||||
- `.html`
|
||||
- `.json`
|
||||
- `.js`
|
||||
- `.md`
|
||||
- `.mdx`
|
||||
- `.pdf`
|
||||
- `.py`
|
||||
- `.sh`
|
||||
- `.sql`
|
||||
- `.tar`
|
||||
- `.tgz`
|
||||
- `.ts`
|
||||
- `.tsx`
|
||||
- `.txt`
|
||||
- `.xml`
|
||||
- `.yaml`
|
||||
- `.yml`
|
||||
- `.zip`
|
||||
|
||||
</details>
|
||||
|
||||
If you need to load an unsupported file type, you must use a different component that supports that file type and, potentially, parses it outside Langflow, or you must convert it to a supported type before uploading it.
|
||||
|
||||
For images, see [Upload images](/concepts-file-management#upload-images).
|
||||
|
||||
For videos, see the **Twelve Labs** and **YouTube** <Icon name="Blocks" aria-hidden="true" /> [**Bundles**](/components-bundle-components).
|
||||
|
||||
### File parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| path | Files | Input parameter. The path to files to load. Can be local or in [Langflow file management](/concepts-file-management). Supports individual files and bundled archives. |
|
||||
| file_path | Server File Path | Input parameter. A `Data` object with a `file_path` property pointing to a file in [Langflow file management](/concepts-file-management) or a `Message` object with a path to the file. Supersedes **Files** (`path`) but supports the same file types. |
|
||||
| separator | Separator | Input parameter. The separator to use between multiple outputs in `Message` format. |
|
||||
| silent_errors | Silent Errors | Input parameter. If `true`, errors in the component don't raise an exception. Default: Disabled (`false`). |
|
||||
| delete_server_file_after_processing | Delete Server File After Processing | Input parameter. If `true` (default), the **Server File Path** (`file_path`) is deleted after processing. |
|
||||
| ignore_unsupported_extensions | Ignore Unsupported Extensions | Input parameter. If enabled (`true`), files with unsupported extensions are accepted but not processed. If disabled (`false`), the **Read File** component either can throw an error if an unsupported file type is provided. The default is `true`. |
|
||||
| ignore_unspecified_files | Ignore Unspecified Files | Input parameter. If `true`, `Data` with no `file_path` property is ignored. If `false` (default), the component errors when a file isn't specified. |
|
||||
| concurrency_multithreading | Processing Concurrency | Input parameter. The number of files to process concurrently if multiple files are uploaded. Default is 1. Values greater than 1 enable parallel processing for 2 or more files. Ignored for single-file uploads and advanced parsing. |
|
||||
| advanced_parser | Advanced Parser | Input parameter. If `true`, enables [advanced parsing](#advanced-parsing). Only available for single-file uploads of compatible file types. Default: Disabled (`false`). |
|
||||
|
||||
### Advanced parsing
|
||||
|
||||
Starting in Langflow version 1.6, the **Read File** component supports advanced document parsing using the [Docling](https://docling-project.github.io/docling/) library for supported file types.
|
||||
|
||||
To use advanced parsing, do the following:
|
||||
|
||||
1. Complete the following prerequisites, if applicable:
|
||||
|
||||
* **Install Langflow version 1.6 or later**: Earlier versions don't support advanced parsing with the **Read File** component. For upgrade guidance, see the [Release notes](/release-notes).
|
||||
|
||||
* **Install Docling dependency on macOS Intel (x86_64)**: The Docling dependency isn't installed by default for macOS Intel (x86_64). Use the [Docling installation guide](https://docling-project.github.io/docling/installation/) to install the Docling dependency.
|
||||
|
||||
For all other operating systems, the Docling dependency is installed by default.
|
||||
|
||||
* **Enable Developer Mode for Windows**:
|
||||
<PartialDevModeWindows />
|
||||
|
||||
Developer Mode isn't required for Langflow OSS on Windows.
|
||||
|
||||
2. Add one valid file to the **Read File** component.
|
||||
|
||||
:::info Advanced parsing limitations
|
||||
* Advanced parsing processes only one file.
|
||||
If you select multiple files, the **Read File** component processes the first file only, ignoring any additional files.
|
||||
To process multiple files with advanced parsing, pass each file to a separate **Read File** components, or use the dedicated [**Docling** components](/bundles-docling).
|
||||
|
||||
* Advanced parsing can process any of the **Read File** component's supported file types except `.csv`, `.xlsx`, and `.parquet` files because it is designed for document processing, such as extracting text from PDFs.
|
||||
For structured data analysis, use the [**Parser** component](/components-processing#parser).
|
||||
:::
|
||||
|
||||
3. Enable **Advanced Parsing**.
|
||||
|
||||
4. Click <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls** in the [component's header menu](/concepts-components#component-menus) to configure advanced parsing parameters, which are hidden by default:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| pipeline | Pipeline | Input parameter, advanced parsing. The Docling pipeline to use, either `standard` (default, recommended) or `vlm` (may produce inconsistent results). |
|
||||
| ocr_engine | OCR Engine | Input parameter, advanced parsing. The OCR parser to use if `pipeline` is `standard`. Options are `None` (default) or [`EasyOCR`](https://pypi.org/project/easyocr/). `None` means that no OCR engine is used, and this can produce inconsistent or broken results for some documents. This setting has no effect with the `vlm` pipeline. |
|
||||
| md_image_placeholder | Markdown Image Placeholder | Input parameter, advanced parsing. Defines the placeholder for image files if the output type is **Markdown**. Default: `<!-- image -->`. |
|
||||
| md_page_break_placeholder | Markdown Page Break Placeholder | Input parameter, advanced parsing. Defines the placeholder for page breaks if the output type is **Markdown**. Default: `""` (empty string). |
|
||||
| doc_key | Document Key | Input parameter, advanced parsing. The key to use for the `DoclingDocument` column, which holds the structured information extracted from the source document. See [Docling Document](https://docling-project.github.io/docling/concepts/docling_document/) for details. Default: `doc`. |
|
||||
|
||||
:::tip
|
||||
For additional Docling features, including other components and OCR parsers, use the [**Docling** bundle](/bundles-docling).
|
||||
:::
|
||||
|
||||
### File output
|
||||
|
||||
The output of the **Read File** component depends on the number of files loaded and whether advanced parsing is enabled.
|
||||
If multiple options are available, you can set the output type near the component's output port.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="zero" label="No files">
|
||||
|
||||
If you run the **Read File** component with no file selected, it throws an error, or, if **Silent Errors** is enabled, produces no output.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="one-false" label="One file without advanced parsing">
|
||||
|
||||
If advanced parsing is disabled and you upload one file, the following output types are available:
|
||||
|
||||
- **Structured Content**: Available only for `.csv`, `.xlsx`, `.parquet`, and `.json` files.
|
||||
|
||||
- For `.csv` files, produces a [`DataFrame`](/data-types#dataframe) representing the table data.
|
||||
- For `.json` files, produces a [`Data`](/data-types#data) object with the parsed JSON data.
|
||||
|
||||
- **Raw Content**: A [`Message`](/data-types#message) containing the file's raw text content.
|
||||
|
||||
- **File Path**: A [`Message`](/data-types#message) containing the path to the file in [Langflow file management](/concepts-file-management).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="one-true" label="One file with advanced parsing">
|
||||
|
||||
If advanced parsing is enabled and you upload one file, the following output types are available:
|
||||
|
||||
- **Structured Output**: A [`DataFrame`](/data-types#dataframe) containing the Docling-processed document data with text elements, page numbers, and metadata.
|
||||
|
||||
- **Markdown**: A [`Message`](/data-types#message) containing the uploaded document contents in Markdown format with image placeholders.
|
||||
|
||||
- **File Path**: A [`Message`](/data-types#message) containing the path to the file in [Langflow file management](/concepts-file-management).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="multi" label="Multiple files">
|
||||
|
||||
If you upload multiple files, the component outputs **Files**, which is a [`DataFrame`](/data-types#dataframe) containing the content and metadata of all selected files.
|
||||
|
||||
[Advanced parsing](#advanced-parsing) doesn't support multiple files; it processes only the first file.
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## News Search
|
||||
|
||||
The **News Search** component searches Google News through RSS, and then returns clean article data as a [`DataFrame`](/data-types#dataframe) containing article titles, links, publication dates, and summaries.
|
||||
The component's `clean_html` method parses the HTML content with the BeautifulSoup library, removes HTML markup, and strips whitespace to output clean data.
|
||||
|
||||
For other RSS feeds, use the [**RSS Reader** component](#rss-reader), and for other searches use the [**Web Search** component](#web-search) or provider-specific <Icon name="Blocks" aria-hidden="true" /> [**Bundles**](/components-bundle-components).
|
||||
|
||||
When used as a standard component in a flow, the **News Search** component must be connected to a component that accepts `DataFrame` input.
|
||||
You can connect the **News Search** component directly to a compatible component, or you can use a [Processing component](/components-processing) to convert or extract data of a different type between components.
|
||||
|
||||
When used in **Tool Mode** with an **Agent** component, the **News Search** component can be connected directly to the **Agent** component's **Tools** port without converting the data.
|
||||
The agent decides whether to use the **News Search** component based on the user's query, and it can process the `DataFrame` output directly.
|
||||
|
||||
### News Search parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| query | Search Query | Input parameter. Search keywords for news articles. |
|
||||
| hl | Language (hl) | Input parameter. Language code, such as en-US, fr, de. Default: `en-US`. |
|
||||
| gl | Country (gl) | Input parameter. Country code, such as US, FR, DE. Default: `US`. |
|
||||
| ceid | Country:Language (ceid) | Input parameter. Language, such as US:en, FR:fr. Default: `US:en`. |
|
||||
| topic | Topic | Input parameter. One of: `WORLD`, `NATION`, `BUSINESS`, `TECHNOLOGY`, `ENTERTAINMENT`, `SCIENCE`, `SPORTS`, `HEALTH`. |
|
||||
| location | Location (Geo) | Input parameter. City, state, or country for location-based news. Leave blank for keyword search. |
|
||||
| timeout | Timeout | Input parameter. Timeout for the request in seconds. |
|
||||
| articles | News Articles | Output parameter. A `DataFrame` with the key columns `title`, `link`, `published` and `summary`. |
|
||||
|
||||
## RSS Reader
|
||||
|
||||
The **RSS Reader** component fetches and parses RSS feeds from any valid RSS feed URL, and then returns the feed content as a [`DataFrame`](/data-types#dataframe) containing article titles, links, publication dates, and summaries.
|
||||
|
||||
When used as a standard component in a flow, the **RSS Reader** component must be connected to a component that accepts `DataFrame` input.
|
||||
You can connect the **RSS Reader** component directly to a compatible component, or you can use a [Processing component](/components-processing) to convert or extract data of a different type between components.
|
||||
|
||||
When used in **Tool Mode** with an **Agent** component, the **RSS Reader** component can be connected directly to the **Agent** component's **Tools** port without converting the data.
|
||||
The agent decides whether to use the **RSS Reader** component based on the user's query, and it can process the `DataFrame` output directly.
|
||||
|
||||
### RSS Reader parameters
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| rss_url | RSS Feed URL | Input parameter. URL of the RSS feed to parse, such as `https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml`. |
|
||||
| timeout | Timeout | Input parameter. Timeout for the RSS feed request in seconds. Default: `5`. |
|
||||
| articles | Articles | Output parameter. A `DataFrame` containing the key columns `title`, `link`, `published` and `summary`. |
|
||||
|
||||
## SQL Database
|
||||
|
||||
The **SQL Database** component executes SQL queries on [SQLAlchemy-compatible databases](https://docs.sqlalchemy.org/en/20/).
|
||||
It supports any SQLAlchemy-compatible database, such as PostgreSQL, MySQL, and SQLite.
|
||||
|
||||
For CQL queries, see the [**DataStax** bundle](/bundles-datastax).
|
||||
|
||||
### Query an SQL database with natural language prompts
|
||||
|
||||
The following example demonstrates how to use the **SQL Database** component in a flow, and then modify the component to support natural language queries through an **Agent** component.
|
||||
|
||||
This allows you to use the same **SQL Database** component for any query, rather than limiting it to a single manually entered query or requiring the user, application, or another component to provide valid SQL syntax as input.
|
||||
Users don't need to master SQL syntax because the **Agent** component translates the users' natural language prompts into SQL queries, passes the query to the **SQL Database** component, and then returns the results to the user.
|
||||
|
||||
Additionally, input from applications and other components doesn't have to be extracted and transformed to exact SQL queries.
|
||||
Instead, you only need to provide enough context for the agent to understand that it should create and run a SQL query according to the incoming data.
|
||||
|
||||
1. Use your own sample database or create a test database.
|
||||
|
||||
<details>
|
||||
<summary>Create a test SQL database</summary>
|
||||
|
||||
1. Create a database called `test.db`:
|
||||
|
||||
```shell
|
||||
sqlite3 test.db
|
||||
```
|
||||
|
||||
2. Add some values to the database:
|
||||
|
||||
```shell
|
||||
sqlite3 test.db "
|
||||
CREATE TABLE users (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT,
|
||||
email TEXT,
|
||||
age INTEGER
|
||||
);
|
||||
|
||||
INSERT INTO users (name, email, age) VALUES
|
||||
('John Doe', 'john@example.com', 30),
|
||||
('Jane Smith', 'jane@example.com', 25),
|
||||
('Bob Johnson', 'bob@example.com', 35);
|
||||
"
|
||||
```
|
||||
|
||||
3. Verify that the database has been created and contains your data:
|
||||
|
||||
```shell
|
||||
sqlite3 test.db "SELECT * FROM users;"
|
||||
```
|
||||
|
||||
The result should list the text data you entered in the previous step:
|
||||
|
||||
```shell
|
||||
1|John Doe|john@example.com
|
||||
2|Jane Smith|jane@example.com
|
||||
3|John Doe|john@example.com
|
||||
4|Jane Smith|jane@example.com
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
2. Add an **SQL Database** component to your flow.
|
||||
|
||||
3. In the **Database URL** field, add the connection string for your database, such as `sqlite:///test.db`.
|
||||
|
||||
At this point, you can enter an SQL query in the **SQL Query** field or use the [port](/concepts-components#component-ports) to pass a query from another component, such as a **Chat Input** component.
|
||||
If you need more space, click <Icon name="Expand" aria-hidden="true"/> **Expand** to open a full-screen text field.
|
||||
|
||||
However, to make this component more dynamic in an agentic context, use an **Agent** component to transform natural language input to SQL queries, as explained in the following steps.
|
||||
|
||||
4. Click the **SQL Database** component to expose the [component's header menu](/concepts-components#component-menus), and then enable **Tool Mode**.
|
||||
|
||||
You can now use this component as a tool for an agent.
|
||||
In **Tool Mode**, no query is set in the **SQL Database** component because the agent will generate and send one if it determines that the tool is required to complete the user's request.
|
||||
For more information, see [Configure tools for agents](/agents-tools).
|
||||
|
||||
5. Add an **Agent** component to your flow, and then enter your OpenAI API key.
|
||||
|
||||
The default model is an OpenAI model.
|
||||
If you want to use a different model, edit the **Model Provider**, **Model Name**, and **API Key** fields accordingly.
|
||||
|
||||
If you need to execute highly specialized queries, consider selecting a model that is trained for tasks like advanced SQL queries.
|
||||
If your preferred model isn't in the **Agent** component's built-in model list, set **Model Provider** to **Connect other models**, and then connect any [language model component](/components-models).
|
||||
|
||||
6. Connect the **SQL Database** component's **Toolset** output to the **Agent** component's **Tools** input.
|
||||
|
||||

|
||||
|
||||
7. Click **Playground**, and then ask the agent a question about the data in your database, such as `Which users are in my database?`
|
||||
|
||||
The agent determines that it needs to query the database to answer the question, uses the LLM to generate an SQL query, and then uses the **SQL Database** component's `RUN_SQL_QUERY` action to run the query on your database.
|
||||
Finally, it returns the results in a conversational format, unless you provide instructions to return raw results or a different format.
|
||||
|
||||
The following example queried a test database with little data, but with a more robust dataset you could ask more detailed or complex questions.
|
||||
|
||||
```text
|
||||
Here are the users in your database:
|
||||
|
||||
1. **John Doe** - Email: john@example.com
|
||||
2. **Jane Smith** - Email: jane@example.com
|
||||
3. **John Doe** - Email: john@example.com
|
||||
4. **Jane Smith** - Email: jane@example.com
|
||||
|
||||
It seems there are duplicate entries for the users.
|
||||
```
|
||||
|
||||
### SQL Database parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| database_url | Database URL | Input parameter. The SQLAlchemy-compatible database connection URL. |
|
||||
| query | SQL Query | Input parameter. The SQL query to execute, which can be entered directly, passed in from another component, or, in **Tool Mode**, automatically provided by an **Agent** component. |
|
||||
| include_columns | Include Columns | Input parameter. Whether to include column names in the result. The default is enabled (`true`). |
|
||||
| add_error | Add Error | Input parameter. If enabled, adds any error messages to the result, if any are returned. The default is disabled (`false`). |
|
||||
| run_sql_query | Result Table | Output parameter. The query results as a [`DataFrame`](/data-types#dataframe). |
|
||||
|
||||
## URL
|
||||
|
||||
The **URL** component fetches content from one or more URLs, processes the content, and returns it in various formats.
|
||||
It follows links recursively to a given depth, and it supports output in plain text or raw HTML.
|
||||
|
||||
### URL parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
Some of the available parameters include the following:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| urls | URLs | Input parameter. One or more URLs to crawl recursively. In the visual editor, click <Icon name="Plus" aria-hidden="true"/> **Add URL** to add multiple URLs. |
|
||||
| max_depth | Depth | Input parameter. Controls link traversal: how many "clicks" away from the initial page the crawler will go. A depth of 1 limits the crawl to the first page at the given URL only. A depth of 2 means the crawler crawls the first page plus each page directly linked from the first page, then stops. This setting exclusively controls link traversal; it doesn't limit the number of URL path segments or the domain. |
|
||||
| prevent_outside | Prevent Outside | Input parameter. If enabled, only crawls URLs within the same domain as the root URL. This prevents the crawler from accessing sites outside the given URL's domain, even if they are linked from one of the crawled pages. |
|
||||
| use_async | Use Async | Input parameter. If enabled, uses asynchronous loading which can be significantly faster but might use more system resources. |
|
||||
| format | Output Format | Input parameter. Sets the desired output format as **Text** or **HTML**. The default is **Text**. For more information, see [URL output](#url-output).|
|
||||
| timeout | Timeout | Input parameter. Timeout for the request in seconds. |
|
||||
| headers | Headers | Input parameter. The headers to send with the request if needed for authentication or otherwise. |
|
||||
|
||||
Additional input parameters are available for error handling and encoding.
|
||||
|
||||
### URL output
|
||||
|
||||
There are two settings that control the output of the **URL** component at different stages:
|
||||
|
||||
* **Output Format**: This optional parameter controls the content extracted from the crawled pages:
|
||||
|
||||
* **Text (default)**: The component extracts only the text from the HTML of the crawled pages.
|
||||
* **HTML**: The component extracts the entire raw HTML content of the crawled pages.
|
||||
|
||||
* **Output data type**: In the component's output field (near the output port) you can select the structure of the outgoing data when it is passed to other components:
|
||||
|
||||
* **Extracted Pages**: Outputs a [`DataFrame`](/data-types#dataframe) that breaks the crawled pages into columns for the entire page content (`text`) and metadata like `url` and `title`.
|
||||
* **Raw Content**: Outputs a [`Message`](/data-types#message) containing the entire text or HTML from the crawled pages, including metadata, in a single block of text.
|
||||
|
||||
When used as a standard component in a flow, the **URL** component must be connected to a component that accepts the selected output data type (`DataFrame` or `Message`).
|
||||
You can connect the **URL** component directly to a compatible component, or you can use a [**Type Convert** component](/components-processing#type-convert) to convert the output to another type before passing the data to other components if the data types aren't directly compatible.
|
||||
|
||||
Processing components like the **Type Convert** component are useful with the **URL** component because it can extract a large amount of data from the crawled pages.
|
||||
For example, if you only want to pass specific fields to other components, you can use a [**Parser** component](/components-processing#parser) to extract only that data from the crawled pages before passing the data to other components.
|
||||
|
||||
When used in **Tool Mode** with an **Agent** component, the **URL** component can be connected directly to the **Agent** component's **Tools** port without converting the data.
|
||||
The agent decides whether to use the **URL** component based on the user's query, and it can process the `DataFrame` or `Message` output directly.
|
||||
|
||||
## Web Search
|
||||
|
||||
The **Web Search** component performs a basic web search using DuckDuckGo's HTML scraping interface.
|
||||
For other search APIs, see <Icon name="Blocks" aria-hidden="true" /> [**Bundles**](/components-bundle-components).
|
||||
|
||||
:::info
|
||||
The **Web Search** component uses web scraping that can be subject to rate limits.
|
||||
|
||||
For production use, consider using another search component with more robust API support, such as provider-specific bundles.
|
||||
:::
|
||||
|
||||
### Use the Web Search component in a flow
|
||||
|
||||
The following steps demonstrate one way that you can use a **Web Search** component in a flow:
|
||||
|
||||
1. Create a flow based on the **Basic Prompting** template.
|
||||
|
||||
2. Add a **Web Search** component, and then enter a search query, such as `environmental news`.
|
||||
|
||||
3. Add a [**Type Convert** component](/components-processing#type-convert), set the **Output Type** to **Message**, and then connect the **Web Search** component's output to the **Type Convert** component's input.
|
||||
|
||||
By default, the **Web Search** component outputs a `DataFrame`.
|
||||
Because the **Prompt Template** component only accepts `Message` data, this conversion is required so that the flow can pass the search results to the **Prompt Template** component.
|
||||
For more information, see [Web Search output](#web-search-output).
|
||||
|
||||
5. In the **Prompt Template** component's **Template** field, add a variable like `{searchresults}` or `{context}`.
|
||||
|
||||
This adds a field to the **Prompt Template** component that you can use to pass the converted search results to the prompt.
|
||||
For more information, see [Define variables in prompts](/components-prompts#define-variables-in-prompts).
|
||||
|
||||
6. Connect the **Type Convert** component's output to the new variable field on the **Prompt Template** component.
|
||||
|
||||

|
||||
|
||||
7. In the **Language Model** component, add your OpenAI API key, or select a different provider and model.
|
||||
|
||||
8. Click **Playground**, and then enter `latest news`.
|
||||
|
||||
The LLM processes the request, including the context passed through the **Prompt Template** component, and then prints the response in the **Playground** chat interface.
|
||||
|
||||
<details>
|
||||
<summary>Result</summary>
|
||||
|
||||
The following is an example of a possible response.
|
||||
Your response may vary based on the current state of the web, your specific query, the model, and other factors.
|
||||
|
||||
```text
|
||||
Here are some of the latest news articles related to the environment:
|
||||
Ozone Pollution and Global Warming: A recent study highlights that ozone pollution is a significant global environmental concern, threatening human health and crop production while exacerbating global warming. Read more
|
||||
...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Web Search parameters
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| query | Search Query | Input parameter. Keywords to search for. |
|
||||
| timeout | Timeout | Input parameter. Timeout for the web search request in seconds. Default: `5`. |
|
||||
| results | Search Results | Output parameter. Returns a `DataFrame` containing `title`, `links`, and `snippets`. For more information, see [Web Search output](#web-search-output). |
|
||||
|
||||
### Web Search output
|
||||
|
||||
The **Web Search** component outputs a [`DataFrame`](/data-types#dataframe) containing the key columns `title`, `links`, and `snippets`.
|
||||
|
||||
When used as a standard component in a flow, the **Web Search** component must be connected to a component that accepts `DataFrame` input, or you must use a [**Type Convert** component](/components-processing#type-convert) to convert the output to `Data` or `Message` type before passing the data to other components.
|
||||
|
||||
When used in **Tool Mode** with an **Agent** component, the **Web Search** component can be connected directly to the **Agent** component's **Tools** port without converting the data.
|
||||
The agent decides whether to use the **Web Search** component based on the user's query, and it can process the `DataFrame` output directly.
|
||||
|
||||
## Webhook
|
||||
|
||||
The **Webhook** component defines a webhook trigger that runs a flow when it receives an HTTP POST request.
|
||||
|
||||
### Trigger the webhook
|
||||
|
||||
When you add a **Webhook** component to your flow, a **Webhook curl** tab is added to the flow's [**API Access** pane](/concepts-publish#api-access).
|
||||
This tab automatically generates an HTTP POST request code snippet that you can use to trigger your flow through the **Webhook** component.
|
||||
For example:
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
"http://$LANGFLOW_SERVER_ADDRESS/api/v1/webhook/$FLOW_ID" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'x-api-key: $LANGFLOW_API_KEY' \
|
||||
-d '{"any": "data"}'
|
||||
```
|
||||
|
||||
For more information, see [Trigger flows with webhooks](/webhook).
|
||||
|
||||
### Webhook parameters
|
||||
|
||||
| Name | Display Name | Description |
|
||||
|------|--------------|-------------|
|
||||
| data | Payload | Input parameter. Receives a payload from external systems through HTTP POST requests. |
|
||||
| curl | curl | Input parameter. The curl command template for making requests to this webhook. |
|
||||
| endpoint | Endpoint | Input parameter. The endpoint URL where this webhook receives requests. |
|
||||
| output_data | Data | Output parameter. The processed data from the webhook input. Returns an empty [`Data`](/data-types#data) object if no input is provided. If the input isn't valid JSON, the **Webhook** component wraps it in a `payload` object so that it can be accepted as input to trigger the flow. |
|
||||
|
||||
## Additional Data components
|
||||
|
||||
Langflow's core components are meant to be generic and support a range of use cases.
|
||||
Core components typically aren't limited to a single provider.
|
||||
|
||||
If the core components don't meet your needs, you can find provider-specific components in <Icon name="Blocks" aria-hidden="true" /> [**Bundles**](/components-bundle-components).
|
||||
|
||||
For example, the [**DataStax** bundle](/bundles-datastax) includes components for CQL queries, and the [**Google** bundle](/bundles-google) includes components for Google Search APIs.
|
||||
|
||||
## Legacy Data components
|
||||
|
||||
import PartialLegacy from '@site/docs/_partial-legacy.mdx';
|
||||
|
||||
<PartialLegacy />
|
||||
|
||||
The following Data components are in legacy status:
|
||||
|
||||
* **Load CSV**
|
||||
* **Load JSON**
|
||||
|
||||
Replace these components with the **Read File** component, which supports loading CSV and JSON files, as well as many other file types.
|
||||
|
||||
## See also
|
||||
|
||||
- [**Google** bundle](/bundles-google)
|
||||
- [**Composio** bundle](/bundles-composio)
|
||||
- [File management](/concepts-file-management)
|
||||
@ -30,7 +30,7 @@ You can enter the API key directly or use a <Icon name="Globe" aria-hidden="true
|
||||
Browse <Icon name="Blocks" aria-hidden="true" /> [**Bundles**](/components-bundle-components) or <Icon name="Search" aria-hidden="true" /> **Search** for your preferred provider to find additional embedding models, such as the [**Hugging Face Embeddings Inference** component](/bundles-huggingface#hugging-face-embeddings-inference).
|
||||
:::
|
||||
|
||||
3. Add a [**Split Text** component](/components-processing#split-text) to your flow.
|
||||
3. Add a [**Split Text** component](/split-text) to your flow.
|
||||
This component splits text input into smaller chunks to be processed into embeddings.
|
||||
|
||||
4. Add a vector store component, such as the **Chroma DB** component, to your flow, and then configure the component to connect to your vector database.
|
||||
@ -42,7 +42,7 @@ This component stores the generated embeddings so they can be used for similarit
|
||||
* Connect the **Split Text** component's **Chunks** output to the vector store component's **Ingest Data** input.
|
||||
* Connect the **Embedding Model** component's **Embeddings** output to the vector store component's **Embedding** input.
|
||||
|
||||
6. To query the vector store, add [**Chat Input and Output** components](/components-io#chat-io):
|
||||
6. To query the vector store, add [**Chat Input and Output** components](/chat-input-and-output):
|
||||
|
||||
* Connect the **Chat Input** component to the vector store component's **Search Query** input.
|
||||
* Connect the vector store component's **Search Results** output to the **Chat Output** component.
|
||||
|
||||
@ -1,302 +0,0 @@
|
||||
---
|
||||
title: Logic
|
||||
slug: /components-logic
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
|
||||
Logic components provide functionalities for routing, conditional processing, and flow management.
|
||||
|
||||
## If-Else (conditional router) {#if-else}
|
||||
|
||||
The **If-Else** component is a conditional router that routes messages by comparing two strings.
|
||||
It evaluates a condition by comparing two text inputs using the specified operator, and then routes the message to `true_result` or `false_result` depending on the evaluation.
|
||||
|
||||
The operator looks for single strings in the input (`input_text`) based on an operator and match text (`match_text`), but it can also search for multiple words by matching a regex.
|
||||
Available operators include:
|
||||
|
||||
- **equals**: Exact match comparison
|
||||
- **not equals**: Inverse of exact match
|
||||
- **contains**: Checks if the `match_text` is found within `input_text`
|
||||
- **starts with**: Checks if `input_text` begins with `match_text`
|
||||
- **ends with**: Checks if `input_text` ends with `match_text`
|
||||
- **regex**: Matches on a case-sensitive pattern
|
||||
|
||||
By default, all operators are case insensitive except **regex**.
|
||||
**regex** is always case sensitive, and you can enable case sensitivity for all other operators in the [If-Else parameters](#if-else-parameters).
|
||||
|
||||
### Use the If-Else component in a flow
|
||||
|
||||
The following example uses the **If-Else** component to check incoming chat messages with regex matching, and then output a different response depending on whether the match evaluated to true or false.
|
||||
|
||||

|
||||
|
||||
1. Add an **If-Else** component to your flow, and then configure it as follows:
|
||||
|
||||
* **Text Input**: Connect the **Text Input** port to a **Chat Input** component or another `Message` input.
|
||||
|
||||
If your input isn't in `Message` format, you can use another component to transform it, such as the [**Type Convert** component](/components-processing#type-convert) or [**Parser** component](/components-processing#parser).
|
||||
If your input isn't appropriate for `Message` format, consider using another component for conditional routing, such as the [**Data Operations** component](/components-processing#data-operations).
|
||||
|
||||
* **Match Text**: Enter `.*(urgent|warning|caution).*` so the component looks for these values in incoming input. The regex match is case sensitive, so if you need to look for all permutations of `warning`, enter `warning|Warning|WARNING`.
|
||||
|
||||
* **Operator**: Select **regex**.
|
||||
|
||||
* **Case True**: In the [component's header menu](/concepts-components#component-menus), click <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls**, enable the **Case True** parameter, click **Close**, and then enter `New Message Detected` in the field.
|
||||
|
||||
The **Case True** message is sent from the **True** output port when the match condition evaluates to true.
|
||||
|
||||
No message is set for **Case False** so the component doesn't emit a message when the condition evaluates to false.
|
||||
|
||||
3. Depending on what you want to happen when the outcome is **True**, add components to your flow to execute that logic:
|
||||
|
||||
1. Add a **Language Model**, **Prompt Template**, and **Chat Output** component to your flow.
|
||||
|
||||
2. In the **Language Model** component, enter your OpenAI API key or select a different provider and model.
|
||||
|
||||
3. Connect the **If-Else** component's **True** output port to the **Language Model** component's **Input** port.
|
||||
|
||||
4. In the **Prompt Template** component, enter instructions for the model when the evaluation is true, such as `Send a message that a new warning, caution, or urgent message was received`.
|
||||
|
||||
5. Connect the **Prompt Template** component to the **Language Model** component's **System Message** port.
|
||||
|
||||
6. Connect the **Language Model** component's output to the **Chat Output** component.
|
||||
|
||||
4. Repeat the same process with another set of **Language Model**, **Prompt Template**, and **Chat Output** components for the **False** outcome.
|
||||
|
||||
Connect the **If-Else** component's **False** output port to the second **Language Model** component's **Input** port.
|
||||
In the second **Prompt Template**, enter instructions for the model when the evaluation is false, such as `Send a message that a new low-priority message was received`.
|
||||
|
||||
5. To test the flow, open the **Playground**, and then send the flow some messages with and without your regex strings.
|
||||
The chat output should reflect the instructions in your prompts based on the regex evaluation.
|
||||
|
||||
```text
|
||||
User: A new user was created.
|
||||
|
||||
AI: A new low-priority message was received.
|
||||
|
||||
User: Sign-in warning: new user locked out.
|
||||
|
||||
AI: A new warning, caution, or urgent message was received. Please review it at your earliest convenience.
|
||||
```
|
||||
|
||||
### If-Else parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Type | Description |
|
||||
|----------------|----------|-------------------------------------------------------------------|
|
||||
| input_text | String | Input parameter. The primary text input for the operation. |
|
||||
| match_text | String | Input parameter. The text to compare against. |
|
||||
| operator | Dropdown | Input parameter. The operator used to compare texts. Options include `equals`, `not equals`, `contains`, `starts with`, `ends with`, and `regex`. The default is `equals`. |
|
||||
| case_sensitive | Boolean | Input parameter. When `true`, the comparison is case sensitive. The default is `false`. This setting doesn't apply to regex comparisons. |
|
||||
| max_iterations | Integer | Input parameter. The maximum number of iterations allowed for the conditional router. The default is 10. |
|
||||
| default_route | Dropdown | Input parameter. The route to take when max iterations are reached. Options include `true_result` or `false_result`. The default is `false_result`. |
|
||||
| true_result | Message | Output parameter. The output produced when the condition is true. |
|
||||
| false_result | Message | Output parameter. The output produced when the condition is false. |
|
||||
|
||||
## Loop
|
||||
|
||||
The **Loop** component iterates over a list of input by passing individual items to other components attached at the **Item** output port until there are no items left to process.
|
||||
Then, the **Loop** component passes the aggregated result of all looping to the component connected to the **Done** port.
|
||||
|
||||
### The looping process
|
||||
|
||||
The **Loop** component is like a miniature flow within your flow.
|
||||
Here's a breakdown of the looping process:
|
||||
|
||||
1. Accepts a list of [`Data`](/data-types#data) or [`DataFrame`](/data-types#dataframe) objects, such as a CSV file, through the **Loop** component's **Inputs** port.
|
||||
|
||||
2. Splits the input into individual items. For example, a CSV file is broken down by rows.
|
||||
|
||||
Specifically, the **Loop** component repeatedly extracts items by `text` key in the `Data` or `DataFrame` objects until there are no more items to extract.
|
||||
Each `item` output is a `Data` objects.
|
||||
|
||||
3. Iterates over each `item` by passing them to the **Item** output port.
|
||||
|
||||
This port connects to one or more components that perform actions on each item.
|
||||
The final component in the **Item** loop connects back to the **Loop** component's **Looping** port to process the next item.
|
||||
|
||||
Only one component connects to the **Item** port, but you can pass the data through as many components as you need, as long as the last component in the chain connects back to the **Looping** port.
|
||||
|
||||
The **If-Else** component isn't compatible with the **Loop** component.
|
||||
For more information, see [Conditional looping](#conditional-looping).
|
||||
|
||||
4. After processing all items, the results are aggregated into a single `Data` object that is passed from the **Loop** component's **Done** port to the next component in the flow.
|
||||
|
||||
The following simplified Python code summarizes how the **Loop** component works.
|
||||
This _isn't_ the actual component code; it is only meant to help you understand the general process.
|
||||
|
||||
```python
|
||||
for i in input: # Receive input data as a list
|
||||
process_item(i) # Process each item through components connected at the Item port
|
||||
if has_more_items():
|
||||
continue # Loop back to Looping port to process the next item
|
||||
else:
|
||||
break # Exit the loop when no more items are left
|
||||
|
||||
done = aggregate_results() # Compile all returned items
|
||||
|
||||
print(done) # Send the aggregated results from the Done port to another component
|
||||
```
|
||||
|
||||
### Loop example
|
||||
|
||||
In the follow example, the **Loop** component iterates over a CSV file until there are no rows left to process.
|
||||
In this case, the **Item** port passes each row to a **Type Convert** component to convert the row into a `Message` object, passes the `Message` to a **Structured Output** component to be processed into structured data that is then passed back to the **Loop** component's **Looping** port.
|
||||
After processing all rows, the **Loop** component loads the aggregated list of structured data into a Chroma DB database through the **Chroma DB** component connected to the **Done** port.
|
||||
|
||||

|
||||
|
||||
:::tip
|
||||
For more examples of the **Loop** component, try the **Research Translation Loop** template in Langflow, or see the video tutorial [Mastering the Loop Component & Agentic RAG in Langflow](https://www.youtube.com/watch?v=9Wx7WODSKTo).
|
||||
:::
|
||||
|
||||
### Conditional looping
|
||||
|
||||
The **If-Else** component isn't compatible with the **Loop** component.
|
||||
If you need conditional loop events, redesign your flow to process conditions before the loop.
|
||||
For example, if you are looping over a `DataFrame`, you could use multiple [**DataFrame Operations** components](/components-processing#dataframe-operations) to conditionally filter data, and then run separate loops on each set of filtered data.
|
||||
|
||||

|
||||
|
||||
## Notify and Listen
|
||||
|
||||
The **Notify** and **Listen** components are used together.
|
||||
|
||||
The **Notify** component builds a notification from the current flow's context, including specific data content and a status identifier.
|
||||
|
||||
The resulting notification is sent to the **Listen** component.
|
||||
The notification data can then be passed to other components in the flow, such as the **If-Else** component.
|
||||
|
||||
## Run flow
|
||||
|
||||
The **Run Flow** component runs another Langflow flow as a subprocess of the current flow.
|
||||
|
||||
You can use this component to chain flows together, run flows conditionally, and attach flows to [**Agent** components](/components-agents) as [tools for agents](/agents-tools) to run as needed.
|
||||
|
||||
When used with an agent, the `name` and `description` metadata that the agent uses to register the tool are created automatically.
|
||||
|
||||
When you select a flow for the **Run Flow** component, it uses the target flow's graph structure to dynamically generate input and output fields on the **Run Flow** component.
|
||||
|
||||
### Run Flow parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Type | Description |
|
||||
|-------------------|----------|----------------------------------------------------------------|
|
||||
| flow_name_selected| Dropdown | Input parameter. The name of the flow to run. |
|
||||
| session_id | String | Input parameter. The session ID for the flow run, if you want to pass a custom session ID for the subflow. |
|
||||
| flow_tweak_data | Dict | Input parameter. Dictionary of tweaks to customize the flow's behavior. Available tweaks depend on the selected flow. |
|
||||
| dynamic inputs | Various | Input parameter. Additional inputs are generated based on the selected flow. |
|
||||
| run_outputs | A `List` of types (`Data`, `Message`, or `DataFrame`) | Output parameter. All outputs are generated from running the flow. |
|
||||
|
||||
## Smart Router {#smart-router}
|
||||
|
||||
The **Smart Router** component is an LLM-powered variation of the [**If-Else** component](#if-else).
|
||||
Instead of string matching, the **Smart Router** uses a connected [**Language Model** component](/components-models) to categorize and route incoming messages.
|
||||
|
||||
You can use the **Smart Router** component anywhere you would use the **If-Else** component.
|
||||
For an example, create [If-Else component example flow](#use-the-if-else-component-in-a-flow), then replace the **If-Else** component with a **Smart Router** component.
|
||||
Instead of a regex, use the **Routes** table to define the outputs for your messages.
|
||||
Finally, connect a **Language Model** component to provide the sorting intelligence.
|
||||
|
||||
### Smart Router parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------------------|----------|-------------------------------------------------------------------|
|
||||
| llm | [LanguageModel](/data-types#languagemodel | Input parameter. The language model to use for categorization. Required. |
|
||||
| input_text | String | Input parameter. The primary text input for categorization. Required. |
|
||||
| routes | Table | Input parameter. Table defining categories and optional output values. Each row should have a route/category name and optionally a custom output value. Required. |
|
||||
| message | Message | Input parameter. Optional override message that replaces both the Input and Output Value for all routes when filled. Advanced. |
|
||||
| enable_else_output | Boolean | Input parameter. Include an Else output for cases that don't match any route. Default: false. |
|
||||
| custom_prompt | String | Input parameter. Additional instructions for LLM-based categorization. Use `{input_text}` for the input text and `{routes}` for the available categories. |
|
||||
| default_result | Message | Output parameter. The Else output. Only available when `enable_else_output` is `true`. Otherwise, output is produced and routed according to the `routes` parameter. |
|
||||
|
||||
## Legacy Logic components
|
||||
|
||||
import PartialLegacy from '@site/docs/_partial-legacy.mdx';
|
||||
|
||||
<PartialLegacy />
|
||||
|
||||
The following Logic components are in legacy status:
|
||||
|
||||
<details>
|
||||
<summary>Condition</summary>
|
||||
|
||||
As an alternative to this legacy component, see the [**If-Else** component](#if-else).
|
||||
|
||||
The **Condition** component routes `Data` objects based on a condition applied to a specified key, including Boolean validation.
|
||||
It supports `true_output` and `false_output` for routing the results based on the condition evaluation.
|
||||
|
||||
This component is useful in workflows that require conditional routing of complex data structures, enabling dynamic decision-making based on data content.
|
||||
|
||||
It can process either a single `Data` object or a list of `Data` objects.
|
||||
The following actions occur when processing a list of `Data` objects:
|
||||
|
||||
- Each object in the list is evaluated individually.
|
||||
- Objects meeting the condition go to `true_output`.
|
||||
- Objects not meeting the condition go to `false_output`.
|
||||
- If all objects go to one output, the other output is empty.
|
||||
|
||||
The **Condition** component accepts the following parameters:
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------------|----------|---------------------------------------------|
|
||||
| data_input | Data | Input parameter. The Data object or list of Data objects to process. This input can handle both single items and lists. |
|
||||
| key_name | String | Input parameter. The name of the key in the Data object to check. |
|
||||
| operator | Dropdown | Input parameter. The operator to apply. Options: `equals`, `not equals`, `contains`, `starts with`, `ends with`, `boolean validator`. Default: `equals`. |
|
||||
| compare_value | String | Input parameter. The value to compare against. Not shown/used when operator is `boolean validator`. |
|
||||
|
||||
The `operator` options have the following behaviors:
|
||||
|
||||
- `equals`: Exact match comparison between the key's value and compare_value.
|
||||
- `not equals`: Inverse of exact match.
|
||||
- `contains`: Checks if compare_value is found within the key's value.
|
||||
- `starts with`: Checks if the key's value begins with compare_value.
|
||||
- `ends with`: Checks if the key's value ends with compare_value.
|
||||
- `boolean validator`: Treats the key's value as a Boolean. The following values are considered true:
|
||||
- Boolean `true`.
|
||||
- Strings: `true`, `1`, `yes`, `y`, `on` (case-insensitive)
|
||||
- Any other value is converted using Python's `bool()` function
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Pass</summary>
|
||||
|
||||
As an alternative to this legacy component, use the [**If-Else** component](#if-else) to pass a message without modification.
|
||||
|
||||
The **Pass** component forwards the input message without modification.
|
||||
|
||||
It accepts the following parameters:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| input_message | Input Message | Input parameter. The message to forward. |
|
||||
| ignored_message | Ignored Message | Input parameter. A second message that is ignored. Used as a workaround for continuity. |
|
||||
| output_message | Output Message | Output parameter. The forwarded message from the input. |
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Flow As Tool</summary>
|
||||
|
||||
This component constructed a tool from a function that ran a loaded flow.
|
||||
|
||||
It was deprecated in Langflow version 1.1.2 and replaced by the [**Run Flow** component](#run-flow).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Sub Flow</summary>
|
||||
|
||||
This component integrated entire flows as components within a larger workflow.
|
||||
It dynamically generated inputs based on the selected flow and executed the flow with provided parameters.
|
||||
|
||||
It was deprecated in Langflow version 1.1.2 and replaced by the [**Run Flow** component](#run-flow).
|
||||
|
||||
</details>
|
||||
@ -43,7 +43,7 @@ The following example uses a language model component in a chatbot flow similar
|
||||
|
||||
6. Connect the **Prompt Template** component's output to the **Language Model** component's **System Message** input.
|
||||
|
||||
7. Add [**Chat Input** and **Chat Output** components](/components-io#chat-io) to your flow.
|
||||
7. Add [**Chat Input** and **Chat Output** components](/chat-input-and-output) to your flow.
|
||||
These components are required for direct chat interaction with an LLM.
|
||||
|
||||
8. Connect the **Chat Input** component to the **Language Model** component's **Input**, and then connect the **Language Model** component's **Message** output to the **Chat Output** component.
|
||||
@ -95,7 +95,7 @@ For example, if you are using the **Language Model** core component, you could t
|
||||
|
||||
Some components use a language model component to perform LLM-driven actions.
|
||||
Typically, these components prepare data for further processing by downstream components, rather than emitting direct chat output.
|
||||
For an example, see the [**Smart Transform** component](/components-processing#smart-transform).
|
||||
For an example, see the [**Smart Transform** component](/smart-transform).
|
||||
|
||||
A component must accept a `LanguageModel` input to use a language model component as a driver, and you must set the language model component's output type to `LanguageModel`.
|
||||
For more information, see [Language Model output types](#language-model-output-types).
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,7 @@ The **Prompt Template** component can also output variable instructions to other
|
||||
|
||||
Variables in a **Prompt Template** component dynamically add fields to the **Prompt Template** component so that your flow can receive definitions for those values from other components, Langflow global variables, or fixed input.
|
||||
|
||||
For example, with the [**Message History** component](/components-helpers#message-history), you can use a `{memory}` variable to pass chat history to the prompt.
|
||||
For example, with the [**Message History** component](/message-history), you can use a `{memory}` variable to pass chat history to the prompt.
|
||||
However, the **Agent** component includes built-in chat memory that is enabled by default.
|
||||
For more information, see [Memory management options](/memory).
|
||||
|
||||
@ -73,4 +73,4 @@ For example, you could add variables for `{references}` and `{instructions}`, an
|
||||
## See also
|
||||
|
||||
* [**LangChain Prompt Hub** component](/bundles-langchain#prompt-hub)
|
||||
* [Processing components](/components-processing)
|
||||
* [Processing components](/concepts-components)
|
||||
@ -1,41 +0,0 @@
|
||||
---
|
||||
title: Tools
|
||||
slug: /components-tools
|
||||
---
|
||||
|
||||
In Langflow version 1.5, the **Tools** category was deprecated.
|
||||
All components that were in this category were replaced by other components or moved to other component categories.
|
||||
|
||||
## MCP Connection component
|
||||
|
||||
This component was moved to the **Agents** category and renamed to the [**MCP Tools** component](/components-agents#mcp-connection)
|
||||
|
||||
## Legacy Tools components
|
||||
|
||||
import PartialLegacy from '@site/docs/_partial-legacy.mdx';
|
||||
|
||||
<PartialLegacy />
|
||||
|
||||
The following Tools components are in legacy status:
|
||||
|
||||
* **Calculator Tool**: Replaced by the [**Calculator** component](/components-helpers#calculator).
|
||||
* **Python Code Structured**: Replaced by the [**Python Interpreter** component](/components-processing#python-interpreter).
|
||||
* **Python REPL**: Replaced by the [**Python Interpreter** component](/components-processing#python-interpreter).
|
||||
* **Search API**: Replaced by the [**SearchApi** bundle](/bundles-searchapi).
|
||||
* **SearXNG Search**: No direct replacement. Use another provider's search component, create a custom component, or use a core component like the [**API Request** component](/components-data#api-request).
|
||||
* **Serp Search API**: Replace by the **SerpApi** bundle.
|
||||
* **Tavily Search API**: Replaced by the **Tavily** bundle.
|
||||
* **Wikidata API**: Replaced by the [**Wikipedia** bundle](/bundles-wikipedia).
|
||||
* **Wikipedia API**: Replaced by the [**Wikipedia** bundle](/bundles-wikipedia).
|
||||
* **Yahoo! Finance**: Replaced by the **Yahoo! Search** bundle.
|
||||
|
||||
## See also
|
||||
|
||||
* [**API Request** component](/components-data#api-request)
|
||||
* [**News Search** component](/components-data#news-search)
|
||||
* [**Web Search** component](/components-data#web-search)
|
||||
* [**Bing** bundle](/bundles-bing)
|
||||
* [**DuckDuckGo** bundle](/bundles-duckduckgo)
|
||||
* [**Exa** bundle](/bundles-exa)
|
||||
* [**Google** bundle](/bundles-google)
|
||||
* [**Serper** bundle](/bundles-serper)
|
||||
@ -98,7 +98,7 @@ For information about the programmatic representation of each data type, see [La
|
||||
* In the workspace, hover over a port to see connection details for that port.
|
||||
Click a port to <Icon name="Search" aria-hidden="true" /> **Search** for compatible components.
|
||||
|
||||
* If two components have incompatible data types, you can use a processing component like the [**Type Convert** component](/components-processing#type-convert) to convert the data between components.
|
||||
* If two components have incompatible data types, you can use a processing component like the [**Type Convert** component](/type-convert) to convert the data between components.
|
||||
:::
|
||||
|
||||
### Dynamic ports
|
||||
@ -120,7 +120,7 @@ Some components can produce multiple types of output:
|
||||
|
||||
For example, a language model component can output _either_ a **Model Response** or **Language Model**.
|
||||
The **Model Response** output produces [`Message`](/data-types#message) data that can be passed to another component's `Message` port.
|
||||
The **Language Model** output must be connected to a component with a **Language Model** input, such as the [**Structured Output** component](/components-processing#structured-output), that uses the attached LLM to power the receiving component's reasoning.
|
||||
The **Language Model** output must be connected to a component with a **Language Model** input, such as the [**Structured Output** component](/structured-output), that uses the attached LLM to power the receiving component's reasoning.
|
||||
|
||||

|
||||
|
||||
|
||||
18
docs/docs/Components/current-date.mdx
Normal file
18
docs/docs/Components/current-date.mdx
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
title: Current Date
|
||||
slug: /current-date
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
The **Current Date** component returns the current date and time in a selected timezone. This component provides a flexible way to obtain timezone-specific date and time information within a Langflow pipeline.
|
||||
|
||||
### Current Date parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| timezone | String | Input parameter. The timezone for the current date and time. |
|
||||
| current_date | String | Output parameter. The resulting current date and time in the selected timezone. |
|
||||
|
||||
163
docs/docs/Components/data-operations.mdx
Normal file
163
docs/docs/Components/data-operations.mdx
Normal file
@ -0,0 +1,163 @@
|
||||
---
|
||||
title: Data Operations
|
||||
slug: /data-operations
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialCurlyBraces from '@site/docs/_partial-escape-curly-braces.mdx';
|
||||
|
||||
The **Data Operations** component performs operations on [`Data`](/data-types#data) objects, including extracting, filtering, and editing keys and values in the `Data`.
|
||||
For all options, see [Available data operations](#available-data-operations).
|
||||
The output is a new `Data` object containing the modified data after running the selected operation.
|
||||
|
||||
### Use the Data Operations component in a flow
|
||||
|
||||
The following example demonstrates how to use a **Data Operations** component in a flow using data from a webhook payload:
|
||||
|
||||
1. Create a flow with a **Webhook** component and a **Data Operations** component, and then connect the **Webhook** component's output to the **Data Operations** component's **Data** input.
|
||||
|
||||
All operations in the **Data Operations** component require at least one `Data` input from another component.
|
||||
If the preceding component doesn't produce `Data` output, you can use another component, such as the [**Type Convert** component](/type-convert), to reformat the data before passing it to the **Data Operations** component.
|
||||
Alternatively, you could consider using a component that is designed to process the original data type, such as the [**Parser** component](/parser) or [**DataFrame Operations** component](/dataframe-operations).
|
||||
|
||||
2. In the **Operations** field, select the operation you want to perform on the incoming `Data`.
|
||||
For this example, select the **Select Keys** operation.
|
||||
|
||||
:::tip
|
||||
You can select only one operation.
|
||||
If you need to perform multiple operations on the data, you can chain multiple **Data Operations** components together to execute each operation in sequence.
|
||||
For more complex multi-step operations, consider using a component like the [**Smart Transform** component](/smart-transform).
|
||||
:::
|
||||
|
||||
3. Under **Select Keys**, add keys for `name`, `username`, and `email`.
|
||||
Click <Icon name="Plus" aria-hidden="true" /> **Add more** to add a field for each key.
|
||||
|
||||
For this example, assume that the webhook will receive consistent payloads that always contain `name`, `username`, and `email` keys.
|
||||
The **Select Keys** operation extracts the value of these keys from each incoming payload.
|
||||
|
||||
4. Optional: If you want to view the output in the **Playground**, connect the **Data Operations** component's output to a **Chat Output** component.
|
||||
|
||||

|
||||
|
||||
5. To test the flow, send the following request to your flow's webhook endpoint.
|
||||
For more information about the webhook endpoint, see [Trigger flows with webhooks](/webhook).
|
||||
|
||||
```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"
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
6. To view the `Data` resulting from the **Select Keys** operation, do one of the following:
|
||||
|
||||
* If you attached a **Chat Output** component, open the **Playground** to see the result as a chat message.
|
||||
* Click <Icon name="TextSearch" aria-hidden="true" /> **Inspect output** on the **Data Operations** component.
|
||||
|
||||
### Data Operations parameters
|
||||
|
||||
Many parameters are conditional based on the selected **Operation** (`operation`).
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data | Data | Input parameter. The `Data` object to operate on. |
|
||||
| operation | Operation | Input parameter. The operation to perform on the data. See [Available data operations](#available-data-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. |
|
||||
| mapped_json_display | JSON to Map | Input parameter. JSON structure to explore for path selection. Only applies to the **Path Selection** operation. For more information, see [Path Selection operation examples](#path-selection-operation-examples). |
|
||||
| selected_key | Select Path | Input parameter. The JSON path expression to extract values. Only applies to the **Path Selection** operation. For more information, see [Path Selection operation examples](#path-selection-operation-examples). |
|
||||
| query | JQ Expression | Input parameter. The [`jq`](https://jqlang.org/manual/) expression for advanced JSON filtering and transformation. Only applies to the **JQ Expression** operation. For more information, see [JQ Expression operation examples](#jq-expression-operation-examples). |
|
||||
|
||||
#### Available data 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. |
|
||||
| Combine | None | Combines multiple data objects into one. |
|
||||
| Filter Values | `filter_key`, `filter_values`, `operator` | Filters data based on key-value pair. |
|
||||
| Append or Update | `append_update_data` | Adds or updates key-value pairs. |
|
||||
| Remove Keys | `remove_keys_input` | Removes specified keys from the data. |
|
||||
| Rename Keys | `rename_keys_input` | Renames keys in the data. |
|
||||
| Path Selection | `mapped_json_display`, `selected_key` | Extracts values from nested JSON structures using path expressions. |
|
||||
| JQ Expression | `query` | Performs advanced JSON queries using [`jq`](https://jqlang.org/manual/) syntax for filtering, projections, and transformations. |
|
||||
|
||||
### Path Selection operation examples
|
||||
|
||||
Use the Path Selection operation to extract values from nested JSON structures with dot notation paths.
|
||||
|
||||
1. In the **Operations** dropdown, select **Path Selection**.
|
||||
2. In the **JSON to Map** field, enter your JSON structure.
|
||||
|
||||
This example uses the following JSON structure.
|
||||
```json
|
||||
{
|
||||
"user": {
|
||||
"profile": {
|
||||
"name": "John Doe",
|
||||
"email": "john@example.com"
|
||||
},
|
||||
"settings": {
|
||||
"theme": "dark"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
The **Select Path** dropdown auto-populates with available paths.
|
||||
3. In the **Select Paths** dropdown, select the path.
|
||||
You can select paths such as `.user.profile.name` to extract "John Doe", or select `.user.settings.theme` to extract "dark".
|
||||
|
||||
### JQ Expression operation example {#jq-expression-operation-examples}
|
||||
|
||||
Use the **JQ Expressions** operation to use the [jq](https://jqlang.org/) query language to perform more advanced JSON filtering.
|
||||
1. In the **Operations** dropdown, select **JQ Expression**.
|
||||
2. In the **JQ Expression** field, enter a `jq` filter to query against the **Data Operations** component's Data input.
|
||||
|
||||
For this example JSON structure, enter expressions like `.user.profile.name` to extract "John Doe", `.user.profile | {name, email}` to project fields to a new object, or `.user.profile | tostring` to convert the field to a string.
|
||||
```json
|
||||
{
|
||||
"user": {
|
||||
"profile": {
|
||||
"name": "John Doe",
|
||||
"email": "john@example.com"
|
||||
},
|
||||
"settings": {
|
||||
"theme": "dark"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
193
docs/docs/Components/dataframe-operations.mdx
Normal file
193
docs/docs/Components/dataframe-operations.mdx
Normal file
@ -0,0 +1,193 @@
|
||||
---
|
||||
title: DataFrame Operations
|
||||
slug: /dataframe-operations
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialCurlyBraces from '@site/docs/_partial-escape-curly-braces.mdx';
|
||||
|
||||
The **DataFrame Operations** component performs operations on [`DataFrame`](/data-types#dataframe) (table) rows and columns, including schema changes, record changes, sorting, and filtering.
|
||||
For all options, see [DataFrame Operations parameters](#dataframe-operations-parameters).
|
||||
|
||||
The output is a new `DataFrame` containing the modified data after running the selected operation.
|
||||
|
||||
### Use the DataFrame Operations component in a flow
|
||||
|
||||
The following steps explain how to configure a **DataFrame Operations** component in a flow.
|
||||
You can follow along with an example or use your own flow.
|
||||
The only requirement is that the preceding component must create `DataFrame` output that you can pass to the **DataFrame Operations** component.
|
||||
|
||||
1. Create a new flow or use an existing flow.
|
||||
|
||||
<details>
|
||||
<summary>Example: API response extraction flow</summary>
|
||||
|
||||
The following example flow uses five components to extract `Data` from an API response, transform it to a `DataFrame`, and then perform further processing on the tabular data using a **DataFrame Operations** component.
|
||||
The sixth component, **Chat Output**, is optional in this example.
|
||||
It only serves as a convenient way for you to view the final output in the **Playground**, rather than inspecting the component logs.
|
||||
|
||||

|
||||
|
||||
If you want to use this example to test the **DataFrame Operations** component, do the following:
|
||||
|
||||
1. Create a flow with the following components:
|
||||
|
||||
* **API Request**
|
||||
* **Language Model**
|
||||
* **Smart Transform**
|
||||
* **Type Convert**
|
||||
|
||||
2. Configure the [**Smart Transform** component](/smart-transform) and its dependencies:
|
||||
|
||||
* **API Request**: Configure the [**API Request** component](/api-request) to get JSON data from an endpoint of your choice, and then connect the **API Response** output to the **Smart Transform** component's **Data** input.
|
||||
* **Language Model**: Select your preferred provider and model, and then enter a valid API key.
|
||||
Change the output to **Language Model**, and then connect the `LanguageModel` output to the **Smart Transform** component's **Language Model** input.
|
||||
* **Smart Transform**: In the **Instructions** field, enter natural language instructions to extract data from the API response.
|
||||
Your instructions depend on the response content and desired outcome.
|
||||
For example, if the response contains a large `result` field, you might provide instructions like `explode the result field out into a Data object`.
|
||||
|
||||
3. Convert the **Smart Transform** component's `Data` output to `DataFrame`:
|
||||
|
||||
1. Connect the **Filtered Data** output to the **Type Convert** component's **Data** input.
|
||||
2. Set the **Type Convert** component's **Output Type** to **DataFrame**.
|
||||
|
||||
Now the flow is ready for you to add the **DataFrame Operations** component.
|
||||
|
||||
</details>
|
||||
|
||||
2. Add a **DataFrame Operations** component to the flow, and then connect `DataFrame` output from another component to the **DataFrame** input.
|
||||
|
||||
All operations in the **DataFrame Operations** component require at least one `DataFrame` input from another component.
|
||||
If a component doesn't produce `DataFrame` output, you can use another component, such as the [**Type Convert** component](/type-convert), to reformat the data before passing it to the **DataFrame Operations** component.
|
||||
Alternatively, you could consider using a component that is designed to process the original data type, such as the [**Parser** component](/parser) or [**Data Operations** component](/data-operations).
|
||||
|
||||
If you are following along with the example flow, connect the **Type Convert** component's **DataFrame Output** port to the **DataFrame** input.
|
||||
|
||||
3. In the **Operations** field, select the operation you want to perform on the incoming `DataFrame`.
|
||||
For example, the **Filter** operation filters the rows based on a specified column and value.
|
||||
|
||||
:::tip
|
||||
You can select only one operation.
|
||||
If you need to perform multiple operations on the data, you can chain multiple **DataFrame Operations** components together to execute each operation in sequence.
|
||||
For more complex multi-step operations, like dramatic schema changes or pivots, consider using an LLM-powered component, like the [**Structured Output** component](/structured-output) or [**Smart Transform** component](/smart-transform), as a replacement or preparation for the **DataFrame Operations** component.
|
||||
:::
|
||||
|
||||
If you're following along with the example flow, select any operation that you want to apply to the data that was extracted by the **Smart Transform** component.
|
||||
To view the contents of the incoming `DataFrame`, click <Icon name="Play" aria-hidden="true" /> **Run component** on the **Type Convert** component, and then <Icon name="TextSearch" aria-hidden="true" /> **Inspect output**.
|
||||
If the `DataFrame` seems malformed, click <Icon name="TextSearch" aria-hidden="true" /> **Inspect output** on each upstream component to determine where the error occurs, and then modify your flow's configuration as needed.
|
||||
For example, if the **Smart Transform** component didn't extract the expected fields, modify your instructions or verify that the given fields are present in the **API Response** output.
|
||||
|
||||
4. Configure the operation's parameters.
|
||||
The specific parameters depend on the selected operation.
|
||||
For example, if you select the **Filter** operation, you must define a filter condition using the **Column Name**, **Filter Value**, and **Filter Operator** parameters.
|
||||
For more information, see [DataFrame Operations parameters](#dataframe-operations-parameters)
|
||||
|
||||
5. To test the flow, click <Icon name="Play" aria-hidden="true" /> **Run component** on the **DataFrame Operations** component, and then click <Icon name="TextSearch" aria-hidden="true" /> **Inspect output** to view the new `DataFrame` created from the **Filter** operation.
|
||||
|
||||
If you want to view the output in the **Playground**, connect the **DataFrame Operations** component's output to a **Chat Output** component, rerun the **DataFrame Operations** component, and then click **Playground**.
|
||||
|
||||
For another example, see [Conditional looping](/loop#conditional-looping).
|
||||
|
||||
### DataFrame Operations parameters
|
||||
|
||||
Most **DataFrame Operations** parameters are conditional because they only apply to specific operations.
|
||||
|
||||
The only permanent parameters are **DataFrame** (`df`), which is the `DataFrame` input, and **Operation** (`operation`), which is the operation to perform on the `DataFrame`.
|
||||
Once you select an operation, the conditional parameters for that operation appear on the **DataFrame Operations** component.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="addcolumn" label="Add Column" default>
|
||||
|
||||
The **Add Column** operation allows you to add a new column to the `DataFrame` with a constant value.
|
||||
|
||||
The parameters are **New Column Name** (`new_column_name`) and **New Column Value** (`new_column_value`).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="dropcolumn" label="Drop Column">
|
||||
|
||||
The **Drop Column** operation allows you to remove a column from the `DataFrame`, specified by **Column Name** (`column_name`).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="filter" label="Filter">
|
||||
|
||||
The **Filter** operation allows you to filter the `DataFrame` based on a specified condition.
|
||||
The output is a `DataFrame` containing only the rows that matched the filter condition.
|
||||
|
||||
Provide the following parameters:
|
||||
|
||||
* **Column Name** (`column_name`): The name of the column to filter on.
|
||||
* **Filter Value** (`filter_value`): The value to filter on.
|
||||
* **Filter Operator** (`filter_operator`): The operator to use for filtering, one of `equals` (default), `not equals`, `contains`, `not contains`, `starts with`, `ends with`, `greater than`, or `less than`.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="head" label="Head">
|
||||
|
||||
The **Head** operation allows you to retrieve the first `n` rows of the `DataFrame`, where `n` is set in **Number of Rows** (`num_rows`).
|
||||
The default is `5`.
|
||||
|
||||
The output is a `DataFrame` containing only the selected rows.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="renamecolumn" label="Rename Column">
|
||||
|
||||
The **Rename Column** operation allows you to rename an existing column in the `DataFrame`.
|
||||
|
||||
The parameters are **Column Name** (`column_name`), which is the current name, and **New Column Name** (`new_column_name`).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="replacevalue" label="Replace Value">
|
||||
|
||||
The **Replace Value** operation allows you to replace values in a specific column of the `DataFrame`.
|
||||
This operation replaces a target value with a new value.
|
||||
All cells matching the target value are replaced with the new value in the new `DataFrame` output.
|
||||
|
||||
Provide the following parameters:
|
||||
|
||||
* **Column Name** (`column_name`): The name of the column to modify.
|
||||
* **Value to Replace** (`replace_value`): The value that you want to replace.
|
||||
* **Replacement Value** (`replacement_value`): The new value to use.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="selectcolumns" label="Select Columns">
|
||||
|
||||
The **Select Columns** operation allows you to select one or more specific columns from the `DataFrame`.
|
||||
|
||||
Provide a list of column names in **Columns to Select** (`columns_to_select`).
|
||||
In the visual editor, click <Icon name="Plus" aria-hidden="true"/> **Add More** to add multiple fields, and then enter one column name in each field.
|
||||
|
||||
The output is a `DataFrame` containing only the specified columns.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="sort" label="Sort">
|
||||
|
||||
The **Sort** operation allows you to sort the `DataFrame` on a specific column in ascending or descending order.
|
||||
|
||||
Provide the following parameters:
|
||||
|
||||
* **Column Name** (`column_name`): The name of the column to sort on.
|
||||
* **Sort Ascending** (`ascending`): Whether to sort in ascending or descending order. If enabled (`true`), sorts in ascending order; if disabled (`false`), sorts in descending order. Default: Enabled (`true`)
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="tail" label="Tail">
|
||||
|
||||
The **Tail** operation allows you to retrieve the last `n` rows of the `DataFrame`, where `n` is set in **Number of Rows** (`num_rows`).
|
||||
The default is `5`.
|
||||
|
||||
The output is a `DataFrame` containing only the selected rows.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="dropduplicates" label="Drop Duplicates">
|
||||
|
||||
The **Drop Duplicates** operation removes rows from the `DataFrame` by identifying all duplicate values within a single column.
|
||||
|
||||
The only parameter is the **Column Name** (`column_name`).
|
||||
|
||||
When the flow runs, all rows with duplicate values in the given column are removed.
|
||||
The output is a `DataFrame` containing all columns from the original `DataFrame`, but only rows with non-duplicate values.
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
32
docs/docs/Components/directory.mdx
Normal file
32
docs/docs/Components/directory.mdx
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
title: Directory
|
||||
slug: /directory
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
The **Directory** component recursively loads files from a directory, with options for file types, depth, and concurrency.
|
||||
|
||||
Files must be of a [supported type and size](/read-file#file-type-and-size-limits) to be loaded.
|
||||
|
||||
Outputs either a [`Data`](/data-types#data) or [`DataFrame`](/data-types#dataframe) object, depending on the directory contents.
|
||||
|
||||
### Directory parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Type | Description |
|
||||
| ------------------ | ---------------- | -------------------------------------------------- |
|
||||
| path | MessageTextInput | Input parameter. The path to the directory to load files from. Default: Current directory (`.`) |
|
||||
| types | MessageTextInput | Input parameter. The file types to load. Select one or more, or leave empty to attempt to load all files. |
|
||||
| depth | IntInput | Input parameter. The depth to search for files. |
|
||||
| max_concurrency | IntInput | Input parameter. The maximum concurrency for loading multiple files. |
|
||||
| load_hidden | BoolInput | Input parameter. If `true`, hidden files are loaded. |
|
||||
| recursive | BoolInput | Input parameter. If `true`, the search is recursive. |
|
||||
| silent_errors | BoolInput | Input parameter. If `true`, errors don't raise an exception. |
|
||||
| use_multithreading | BoolInput | Input parameter. If `true`, multithreading is used. |
|
||||
|
||||
51
docs/docs/Components/dynamic-create-data.mdx
Normal file
51
docs/docs/Components/dynamic-create-data.mdx
Normal file
@ -0,0 +1,51 @@
|
||||
---
|
||||
title: Dynamic Create Data
|
||||
slug: /dynamic-create-data
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialCurlyBraces from '@site/docs/_partial-escape-curly-braces.mdx';
|
||||
|
||||
The **Dynamic Create Data** component creates a [`Data`](/data-types#data) object or [`Message`](/data-types#message) with configurable fields.
|
||||
Define the table in the **Input Configuration** field, and the component creates corresponding input or output handles in the component.
|
||||
|
||||
### Use the Dynamic Create Data component in a flow
|
||||
|
||||
The following example demonstrates how to use a **Dynamic Create Data** component to create a structured `Data` or `Message` object from multiple sources.
|
||||
|
||||
1. Add the **Dynamic Create Data** component to your flow.
|
||||
|
||||
2. To define your data's fields, in the **Input Configuration** field, click <Icon name="Table" aria-hidden="true"/> **Open table**.
|
||||
|
||||
3. To add rows to your table, click <Icon name="Plus" aria-hidden="true"/> **Add a new row**.
|
||||
Adding a new row creates input and output handles for the **Field Type**.
|
||||
For example, if you add a `Text` type field, then`Text` input and output handles are added to the component.
|
||||
For each new row, configure the **Field Name** and **Field Type**.
|
||||
|
||||
* **Field Name**: The name of the field used as both the internal key and display label.
|
||||
* **Field Type**: The type of input field to create. The type options are:
|
||||
* Text: Accepts direct text input or accepts `Text` or `Message` output from other components.
|
||||
* Data: Accepts `Data` input from other components.
|
||||
* Number: Accepts direct numeric input or accepts `Text` or `Message` outputs from other components.
|
||||
* Handle: Accepts `Text`, `Data`, or `Message` output from other components.
|
||||
* Boolean: Accepts Boolean values. Cannot accept input from another component.
|
||||
|
||||
For more information, see [Langflow data types](/data-types).
|
||||
4. Depending on your **Field Type** selections, either connect output from other components to dynamically populate the inputs, or enter values manually in the **Dynamic Create Data** component's fields.
|
||||
|
||||
5. Select the desired output type at the component's output port. The component outputs either a [`Data`](/data-types#data) object containing all field values from the component's inputs, or a [`Message`](/data-types#message) containing all field values formatted as a text string.
|
||||
|
||||
### Dynamic Create Data parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| `form_fields` | **Input Configuration** | Input parameter. A table that defines the dynamic form fields. |
|
||||
| `include_metadata` | **Include Metadata** | Input parameter. Whether to include form configuration metadata in the output.|
|
||||
| `form_data` | **Data** | Output parameter. A `Data` object containing all field values from the dynamic inputs. |
|
||||
| `message` | **Message** | Output parameter. A formatted `Text` message containing all field values in a human-readable format. |
|
||||
|
||||
94
docs/docs/Components/if-else.mdx
Normal file
94
docs/docs/Components/if-else.mdx
Normal file
@ -0,0 +1,94 @@
|
||||
---
|
||||
title: If-Else
|
||||
slug: /if-else
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
|
||||
The **If-Else** component is a conditional router that routes messages by comparing two strings.
|
||||
It evaluates a condition by comparing two text inputs using the specified operator, and then routes the message to `true_result` or `false_result` depending on the evaluation.
|
||||
|
||||
The operator looks for single strings in the input (`input_text`) based on an operator and match text (`match_text`), but it can also search for multiple words by matching a regex.
|
||||
Available operators include:
|
||||
|
||||
- **equals**: Exact match comparison
|
||||
- **not equals**: Inverse of exact match
|
||||
- **contains**: Checks if the `match_text` is found within `input_text`
|
||||
- **starts with**: Checks if `input_text` begins with `match_text`
|
||||
- **ends with**: Checks if `input_text` ends with `match_text`
|
||||
- **regex**: Matches on a case-sensitive pattern
|
||||
|
||||
By default, all operators are case insensitive except **regex**.
|
||||
**regex** is always case sensitive, and you can enable case sensitivity for all other operators in the [If-Else parameters](#if-else-parameters).
|
||||
|
||||
### Use the If-Else component in a flow
|
||||
|
||||
The following example uses the **If-Else** component to check incoming chat messages with regex matching, and then output a different response depending on whether the match evaluated to true or false.
|
||||
|
||||

|
||||
|
||||
1. Add an **If-Else** component to your flow, and then configure it as follows:
|
||||
|
||||
* **Text Input**: Connect the **Text Input** port to a **Chat Input** component or another `Message` input.
|
||||
|
||||
If your input isn't in `Message` format, you can use another component to transform it, such as the [**Type Convert** component](/type-convert) or [**Parser** component](/parser).
|
||||
If your input isn't appropriate for `Message` format, consider using another component for conditional routing, such as the [**Data Operations** component](/data-operations).
|
||||
|
||||
* **Match Text**: Enter `.*(urgent|warning|caution).*` so the component looks for these values in incoming input. The regex match is case sensitive, so if you need to look for all permutations of `warning`, enter `warning|Warning|WARNING`.
|
||||
|
||||
* **Operator**: Select **regex**.
|
||||
|
||||
* **Case True**: In the [component's header menu](/concepts-components#component-menus), click <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls**, enable the **Case True** parameter, click **Close**, and then enter `New Message Detected` in the field.
|
||||
|
||||
The **Case True** message is sent from the **True** output port when the match condition evaluates to true.
|
||||
|
||||
No message is set for **Case False** so the component doesn't emit a message when the condition evaluates to false.
|
||||
|
||||
3. Depending on what you want to happen when the outcome is **True**, add components to your flow to execute that logic:
|
||||
|
||||
1. Add a **Language Model**, **Prompt Template**, and **Chat Output** component to your flow.
|
||||
|
||||
2. In the **Language Model** component, enter your OpenAI API key or select a different provider and model.
|
||||
|
||||
3. Connect the **If-Else** component's **True** output port to the **Language Model** component's **Input** port.
|
||||
|
||||
4. In the **Prompt Template** component, enter instructions for the model when the evaluation is true, such as `Send a message that a new warning, caution, or urgent message was received`.
|
||||
|
||||
5. Connect the **Prompt Template** component to the **Language Model** component's **System Message** port.
|
||||
|
||||
6. Connect the **Language Model** component's output to the **Chat Output** component.
|
||||
|
||||
4. Repeat the same process with another set of **Language Model**, **Prompt Template**, and **Chat Output** components for the **False** outcome.
|
||||
|
||||
Connect the **If-Else** component's **False** output port to the second **Language Model** component's **Input** port.
|
||||
In the second **Prompt Template**, enter instructions for the model when the evaluation is false, such as `Send a message that a new low-priority message was received`.
|
||||
|
||||
5. To test the flow, open the **Playground**, and then send the flow some messages with and without your regex strings.
|
||||
The chat output should reflect the instructions in your prompts based on the regex evaluation.
|
||||
|
||||
```text
|
||||
User: A new user was created.
|
||||
|
||||
AI: A new low-priority message was received.
|
||||
|
||||
User: Sign-in warning: new user locked out.
|
||||
|
||||
AI: A new warning, caution, or urgent message was received. Please review it at your earliest convenience.
|
||||
```
|
||||
|
||||
### If-Else parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Type | Description |
|
||||
|----------------|----------|-------------------------------------------------------------------|
|
||||
| input_text | String | Input parameter. The primary text input for the operation. |
|
||||
| match_text | String | Input parameter. The text to compare against. |
|
||||
| operator | Dropdown | Input parameter. The operator used to compare texts. Options include `equals`, `not equals`, `contains`, `starts with`, `ends with`, and `regex`. The default is `equals`. |
|
||||
| case_sensitive | Boolean | Input parameter. When `true`, the comparison is case sensitive. The default is `false`. This setting doesn't apply to regex comparisons. |
|
||||
| max_iterations | Integer | Input parameter. The maximum number of iterations allowed for the conditional router. The default is 10. |
|
||||
| default_route | Dropdown | Input parameter. The route to take when max iterations are reached. Options include `true_result` or `false_result`. The default is `false_result`. |
|
||||
| true_result | Message | Output parameter. The output produced when the condition is true. |
|
||||
| false_result | Message | Output parameter. The output produced when the condition is false. |
|
||||
|
||||
345
docs/docs/Components/legacy-core-components.mdx
Normal file
345
docs/docs/Components/legacy-core-components.mdx
Normal file
@ -0,0 +1,345 @@
|
||||
---
|
||||
title: Legacy core components
|
||||
slug: /legacy-core-components
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import PartialLegacy from '@site/docs/_partial-legacy.mdx';
|
||||
|
||||
<PartialLegacy />
|
||||
|
||||
## Legacy Data components
|
||||
|
||||
The following Data components are in legacy status:
|
||||
|
||||
* **Load CSV**
|
||||
* **Load JSON**
|
||||
|
||||
Replace these components with the [**Read File** component](/read-file), which supports loading CSV and JSON files, as well as many other file types.
|
||||
|
||||
## Legacy Helper components
|
||||
|
||||
The following Helper components are in legacy status:
|
||||
|
||||
* **Message Store**: Replaced by the [**Message History** component](/message-history)
|
||||
* **Create List**: Replace with [Processing components](/concepts-components)
|
||||
* **ID Generator**: Replace with a component that executes arbitrary code to generate an ID or embed an ID generator script your application code (external to your Langflow flows).
|
||||
* **Output Parser**: Replace with the [**Structured Output** component](/structured-output) and [**Parser** component](/parser).
|
||||
The components you need depend on the data types and complexity of the parsing task.
|
||||
|
||||
The **Output Parser** component transformed the output of a language model into comma-separated values (CSV) format, such as `["item1", "item2", "item3"]`, using LangChain's `CommaSeparatedListOutputParser`.
|
||||
The **Structured Output** component is a good alternative for this component because it also formats LLM responses with support for custom schemas and more complex parsing.
|
||||
|
||||
**Parsing** components only provide formatting instructions and parsing functionality.
|
||||
_They don't include prompts._
|
||||
You must connect parsers to **Prompt Template** components to create prompts that LLMs can use.
|
||||
|
||||
## Legacy Logic components
|
||||
|
||||
The following Logic components are in legacy status:
|
||||
|
||||
<details>
|
||||
<summary>Condition</summary>
|
||||
|
||||
As an alternative to this legacy component, see the [**If-Else** component](/if-else).
|
||||
|
||||
The **Condition** component routes `Data` objects based on a condition applied to a specified key, including Boolean validation.
|
||||
It supports `true_output` and `false_output` for routing the results based on the condition evaluation.
|
||||
|
||||
This component is useful in workflows that require conditional routing of complex data structures, enabling dynamic decision-making based on data content.
|
||||
|
||||
It can process either a single `Data` object or a list of `Data` objects.
|
||||
The following actions occur when processing a list of `Data` objects:
|
||||
|
||||
- Each object in the list is evaluated individually.
|
||||
- Objects meeting the condition go to `true_output`.
|
||||
- Objects not meeting the condition go to `false_output`.
|
||||
- If all objects go to one output, the other output is empty.
|
||||
|
||||
The **Condition** component accepts the following parameters:
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------------|----------|---------------------------------------------|
|
||||
| data_input | Data | Input parameter. The Data object or list of Data objects to process. This input can handle both single items and lists. |
|
||||
| key_name | String | Input parameter. The name of the key in the Data object to check. |
|
||||
| operator | Dropdown | Input parameter. The operator to apply. Options: `equals`, `not equals`, `contains`, `starts with`, `ends with`, `boolean validator`. Default: `equals`. |
|
||||
| compare_value | String | Input parameter. The value to compare against. Not shown/used when operator is `boolean validator`. |
|
||||
|
||||
The `operator` options have the following behaviors:
|
||||
|
||||
- `equals`: Exact match comparison between the key's value and compare_value.
|
||||
- `not equals`: Inverse of exact match.
|
||||
- `contains`: Checks if compare_value is found within the key's value.
|
||||
- `starts with`: Checks if the key's value begins with compare_value.
|
||||
- `ends with`: Checks if the key's value ends with compare_value.
|
||||
- `boolean validator`: Treats the key's value as a Boolean. The following values are considered true:
|
||||
- Boolean `true`.
|
||||
- Strings: `true`, `1`, `yes`, `y`, `on` (case-insensitive)
|
||||
- Any other value is converted using Python's `bool()` function
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Pass</summary>
|
||||
|
||||
As an alternative to this legacy component, use the [**If-Else** component](/if-else) to pass a message without modification.
|
||||
|
||||
The **Pass** component forwards the input message without modification.
|
||||
|
||||
It accepts the following parameters:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| input_message | Input Message | Input parameter. The message to forward. |
|
||||
| ignored_message | Ignored Message | Input parameter. A second message that is ignored. Used as a workaround for continuity. |
|
||||
| output_message | Output Message | Output parameter. The forwarded message from the input. |
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Flow As Tool</summary>
|
||||
|
||||
This component constructed a tool from a function that ran a loaded flow.
|
||||
|
||||
It was deprecated in Langflow version 1.1.2 and replaced by the [**Run Flow** component](/run-flow).
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Sub Flow</summary>
|
||||
|
||||
This component integrated entire flows as components within a larger workflow.
|
||||
It dynamically generated inputs based on the selected flow and executed the flow with provided parameters.
|
||||
|
||||
It was deprecated in Langflow version 1.1.2 and replaced by the [**Run Flow** component](/run-flow).
|
||||
|
||||
</details>
|
||||
|
||||
## Legacy Processing components
|
||||
|
||||
The following Processing components are in legacy status:
|
||||
|
||||
<details>
|
||||
<summary>Alter Metadata</summary>
|
||||
|
||||
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 | 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>
|
||||
|
||||
<details>
|
||||
<summary>Combine Data</summary>
|
||||
|
||||
Replace this legacy component with the [**Data Operations** component](/data-operations) or the [**Loop** component](/loop).
|
||||
|
||||
This component combines multiple data sources into a single unified `Data` object.
|
||||
|
||||
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.
|
||||
|
||||
The merging process uses the addition operator to combine data objects.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Combine Text</summary>
|
||||
|
||||
Replace this legacy component with the [**Data Operations** component](/data-operations).
|
||||
|
||||
This component concatenates two text inputs into a single text chunk using a specified delimiter, outputting a `Message` object with the combined text.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Create Data</summary>
|
||||
|
||||
Replace this legacy component with the [**Dynamic Create Data** component](/dynamic-create-data).
|
||||
|
||||
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 |
|
||||
|------|--------------|------|
|
||||
| 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>
|
||||
|
||||
<details>
|
||||
<summary>Extract Key</summary>
|
||||
|
||||
Replace this legacy component with the [**Data Operations** component](/data-operations).
|
||||
|
||||
This component extracts a specific key from a `Data` object and returns the value associated with that key.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Data to DataFrame/Data to Message</summary>
|
||||
|
||||
Replace these legacy components with newer Processing components, such as the [**Data Operations** component](/data-operations) and [**Type Convert** component](/type-convert).
|
||||
|
||||
These components converted one or more `Data` objects into a `DataFrame` or `Message` object.
|
||||
|
||||
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>
|
||||
|
||||
<details>
|
||||
<summary>Filter Data</summary>
|
||||
|
||||
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.
|
||||
|
||||
It accepts the following parameters:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| 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>
|
||||
|
||||
<details>
|
||||
<summary>JSON Cleaner</summary>
|
||||
|
||||
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 | 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>
|
||||
|
||||
<details>
|
||||
<summary>Message to Data</summary>
|
||||
|
||||
Replace this legacy component with the [**Type Convert** component](/type-convert).
|
||||
|
||||
This component converts `Message` objects to `Data` objects.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Parse DataFrame</summary>
|
||||
|
||||
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 | 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>
|
||||
|
||||
<details>
|
||||
<summary>Parse JSON</summary>
|
||||
|
||||
Replace this legacy component with the [**Parser** component](/parser).
|
||||
|
||||
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>
|
||||
|
||||
<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.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Select Data</summary>
|
||||
|
||||
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 | 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>
|
||||
|
||||
<details>
|
||||
<summary>Update Data</summary>
|
||||
|
||||
Replace this legacy component with the [**Data Operations** component](/data-operations).
|
||||
|
||||
This component dynamically updates or appends data with specified fields.
|
||||
|
||||
It accepts the following parameters:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| 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>
|
||||
|
||||
## Legacy Tools components
|
||||
|
||||
The following Tools components are in legacy status:
|
||||
|
||||
* **Calculator Tool**: Replaced by the [**Calculator** component](/calculator).
|
||||
* **Python Code Structured**: Replaced by the [**Python Interpreter** component](/python-interpreter).
|
||||
* **Python REPL**: Replaced by the [**Python Interpreter** component](/python-interpreter).
|
||||
* **Search API**: Replaced by the [**SearchApi** bundle](/bundles-searchapi).
|
||||
* **SearXNG Search**: No direct replacement. Use another provider's search component, create a custom component, or use a core component like the [**API Request** component](/api-request).
|
||||
* **Serp Search API**: Replace by the **SerpApi** bundle.
|
||||
* **Tavily Search API**: Replaced by the **Tavily** bundle.
|
||||
* **Wikidata API**: Replaced by the [**Wikipedia** bundle](/bundles-wikipedia).
|
||||
* **Wikipedia API**: Replaced by the [**Wikipedia** bundle](/bundles-wikipedia).
|
||||
* **Yahoo! Finance**: Replaced by the **Yahoo! Search** bundle.
|
||||
|
||||
64
docs/docs/Components/llm-router.mdx
Normal file
64
docs/docs/Components/llm-router.mdx
Normal file
@ -0,0 +1,64 @@
|
||||
---
|
||||
title: LLM Router
|
||||
slug: /llm-router
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
The **LLM Router** component routes requests to the most appropriate LLM based on [OpenRouter](https://openrouter.ai/docs/quickstart) model specifications.
|
||||
|
||||
To use the component in a flow, you connect multiple language model components to the **LLM Router** components.
|
||||
One model is the judge LLM that analyzes input messages to understand the evaluation context, selects the most appropriate model from the other attached LLMs, and then routes the input to the selected model.
|
||||
The selected model processes the input, and then returns the generated response.
|
||||
|
||||
The following example flow has three language model components.
|
||||
One is the judge LLM, and the other two are in the LLM pool for request routing.
|
||||
The input and output components create a seamless chat interaction where you send a message and receive a response without any user awareness of the underlying routing.
|
||||
|
||||

|
||||
|
||||
### LLM Router parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| `models` | **Language Models** | Input parameter. Connect [`LanguageModel`](/data-types#languagemodel) output from multiple [language model components](/components-models) to create a pool of models. The `judge_llm` selects models from this pool when routing requests. The first model you connect is the default model if there is a problem with model selection or routing. |
|
||||
| `input_value` | **Input** | Input parameter. The incoming query to be routed to the model selected by the judge LLM. |
|
||||
| `judge_llm` | **Judge LLM** | Input parameter. Connect `LanguageModel` output from _one_ **Language Model** component to serve as the judge LLM for request routing. |
|
||||
| `optimization` | **Optimization** | Input parameter. Set a preferred characteristic for model selection by the judge LLM. The options are `quality` (highest response quality), `speed` (fastest response time), `cost` (most cost-effective model), or `balanced` (equal weight for quality, speed, and cost). Default: `balanced` |
|
||||
| `use_openrouter_specs` | **Use OpenRouter Specs** | Input parameter. Whether to fetch model specifications from the OpenRouter API.
|
||||
If `false`, only the model name is provided to the judge LLM. Default: Enabled (`true`) |
|
||||
| `timeout` | **API Timeout** | Input parameter. Set a timeout duration in seconds for API requests made by the router. Default: `10` |
|
||||
| `fallback_to_first` | **Fallback to First Model** | Input parameter. Whether to use the first LLM in `models` as a backup if routing fails to reach the selected model. Default: Enabled (`true`) |
|
||||
|
||||
### LLM Router outputs
|
||||
|
||||
The **LLM Router** component provides three output options.
|
||||
You can set the desired output type near the component's output port.
|
||||
|
||||
* **Output**: A `Message` containing the response to the original query as generated by the selected LLM.
|
||||
Use this output for regular chat interactions.
|
||||
|
||||
* **Selected Model Info**: A `Data` object containing information about the selected model, such as its name and version.
|
||||
|
||||
* **Routing Decision**: A `Message` containing the judge model's reasoning for selecting a particular model, including input query length and number of models considered.
|
||||
For example:
|
||||
|
||||
```text
|
||||
Model Selection Decision:
|
||||
- Selected Model Index: 0
|
||||
- Selected Langflow Model Name: gpt-4o-mini
|
||||
- Selected API Model ID (if resolved): openai/gpt-4o-mini
|
||||
- Optimization Preference: cost
|
||||
- Input Query Length: 27 characters (~5 tokens)
|
||||
- Number of Models Considered: 2
|
||||
- Specifications Source: OpenRouter API
|
||||
```
|
||||
|
||||
This is useful for debugging if you feel the judge model isn't selecting the best model.
|
||||
|
||||
71
docs/docs/Components/loop.mdx
Normal file
71
docs/docs/Components/loop.mdx
Normal file
@ -0,0 +1,71 @@
|
||||
---
|
||||
title: Loop
|
||||
slug: /loop
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
|
||||
The **Loop** component iterates over a list of input by passing individual items to other components attached at the **Item** output port until there are no items left to process.
|
||||
Then, the **Loop** component passes the aggregated result of all looping to the component connected to the **Done** port.
|
||||
|
||||
### The looping process
|
||||
|
||||
The **Loop** component is like a miniature flow within your flow.
|
||||
Here's a breakdown of the looping process:
|
||||
|
||||
1. Accepts a list of [`Data`](/data-types#data) or [`DataFrame`](/data-types#dataframe) objects, such as a CSV file, through the **Loop** component's **Inputs** port.
|
||||
|
||||
2. Splits the input into individual items. For example, a CSV file is broken down by rows.
|
||||
|
||||
Specifically, the **Loop** component repeatedly extracts items by `text` key in the `Data` or `DataFrame` objects until there are no more items to extract.
|
||||
Each `item` output is a `Data` objects.
|
||||
|
||||
3. Iterates over each `item` by passing them to the **Item** output port.
|
||||
|
||||
This port connects to one or more components that perform actions on each item.
|
||||
The final component in the **Item** loop connects back to the **Loop** component's **Looping** port to process the next item.
|
||||
|
||||
Only one component connects to the **Item** port, but you can pass the data through as many components as you need, as long as the last component in the chain connects back to the **Looping** port.
|
||||
|
||||
The [**If-Else** component](/if-else) isn't compatible with the **Loop** component.
|
||||
For more information, see [Conditional looping](#conditional-looping).
|
||||
|
||||
4. After processing all items, the results are aggregated into a single `Data` object that is passed from the **Loop** component's **Done** port to the next component in the flow.
|
||||
|
||||
The following simplified Python code summarizes how the **Loop** component works.
|
||||
This _isn't_ the actual component code; it is only meant to help you understand the general process.
|
||||
|
||||
```python
|
||||
for i in input: # Receive input data as a list
|
||||
process_item(i) # Process each item through components connected at the Item port
|
||||
if has_more_items():
|
||||
continue # Loop back to Looping port to process the next item
|
||||
else:
|
||||
break # Exit the loop when no more items are left
|
||||
|
||||
done = aggregate_results() # Compile all returned items
|
||||
|
||||
print(done) # Send the aggregated results from the Done port to another component
|
||||
```
|
||||
|
||||
### Loop example
|
||||
|
||||
In the follow example, the **Loop** component iterates over a CSV file until there are no rows left to process.
|
||||
In this case, the **Item** port passes each row to a **Type Convert** component to convert the row into a `Message` object, passes the `Message` to a **Structured Output** component to be processed into structured data that is then passed back to the **Loop** component's **Looping** port.
|
||||
After processing all rows, the **Loop** component loads the aggregated list of structured data into a Chroma DB database through the **Chroma DB** component connected to the **Done** port.
|
||||
|
||||

|
||||
|
||||
:::tip
|
||||
For more examples of the **Loop** component, try the **Research Translation Loop** template in Langflow, or see the video tutorial [Mastering the Loop Component & Agentic RAG in Langflow](https://www.youtube.com/watch?v=9Wx7WODSKTo).
|
||||
:::
|
||||
|
||||
### Conditional looping
|
||||
|
||||
The [**If-Else** component](/if-else) isn't compatible with the **Loop** component.
|
||||
If you need conditional loop events, redesign your flow to process conditions before the loop.
|
||||
For example, if you are looping over a `DataFrame`, you could use multiple [**DataFrame Operations** components](/dataframe-operations) to conditionally filter data, and then run separate loops on each set of filtered data.
|
||||
|
||||

|
||||
|
||||
22
docs/docs/Components/mcp-tools.mdx
Normal file
22
docs/docs/Components/mcp-tools.mdx
Normal file
@ -0,0 +1,22 @@
|
||||
---
|
||||
title: MCP Tools
|
||||
slug: /mcp-tools
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
|
||||
The **MCP Tools** component connects to a Model Context Protocol (MCP) server and exposes the MCP server's functions as tools for Langflow agents to use to respond to input.
|
||||
|
||||
In addition to publicly available MCP servers and your own custom-built MCP servers, you can connect Langflow MCP servers, which allow your agent to use your Langflow flows as tools.
|
||||
To do this, use the **MCP Tools** component's [SSE mode](/mcp-client#mcp-sse-mode) to connect to your Langflow project's MCP server at the `/api/v1/mcp/sse` endpoint.
|
||||
|
||||
For more information, see [Use Langflow as an MCP client](/mcp-client) and [Use Langflow as an MCP server](/mcp-server).
|
||||
|
||||
<details>
|
||||
<summary>Earlier versions of the MCP Tools component</summary>
|
||||
|
||||
* In Langflow version 1.5, the **MCP Connection** component was renamed to the **MCP Tools** component.
|
||||
* In Langflow version 1.3, the **MCP Tools (stdio)** and **MCP Tools (SSE)** components were removed and replaced by the unified **MCP Connection** component, which was later renamed to **MCP Tools**.
|
||||
|
||||
</details>
|
||||
@ -1,40 +1,12 @@
|
||||
---
|
||||
title: Helpers
|
||||
slug: /components-helpers
|
||||
title: Message History
|
||||
slug: /message-history
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
Helper components provide utility functions to help manage data and perform simple tasks in your flow.
|
||||
|
||||
## Calculator
|
||||
|
||||
The **Calculator** component performs basic arithmetic operations on mathematical expressions.
|
||||
It supports addition, subtraction, multiplication, division, and exponentiation operations.
|
||||
|
||||
For an example of using this component in a flow, see the [**Python Interpreter** component](/components-processing#python-interpreter).
|
||||
|
||||
### Calculator parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| expression | String | Input parameter. The arithmetic expression to evaluate, such as `4*4*(33/22)+12-20`. |
|
||||
| result | Data | Output parameter. The calculation result as a [`Data` object](/data-types) containing the evaluated expression. |
|
||||
|
||||
## Current Date
|
||||
|
||||
The **Current Date** component returns the current date and time in a selected timezone. This component provides a flexible way to obtain timezone-specific date and time information within a Langflow pipeline.
|
||||
|
||||
### Current Date parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| timezone | String | Input parameter. The timezone for the current date and time. |
|
||||
| current_date | String | Output parameter. The resulting current date and time in the selected timezone. |
|
||||
|
||||
## Message History
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
|
||||
The **Message History** component provides combined chat history and message storage functionality.
|
||||
It can store and retrieve chat messages from either [Langflow storage](/memory) _or_ a dedicated chat memory database like Mem0 or Redis.
|
||||
@ -177,8 +149,6 @@ Other options include the [**Mem0 Chat Memory** component](/bundles-mem0) and [*
|
||||
|
||||
### Message History parameters
|
||||
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
|
||||
<PartialParams />
|
||||
|
||||
The available parameters depend on whether the component is in **Retrieve** or **Store** mode.
|
||||
@ -221,25 +191,4 @@ This is the typical output format used to pass memories _as chat messages_ to an
|
||||
* **DataFrame**: Returns memories as a `DataFrame` containing the message data.
|
||||
Useful for cases where you need to retrieve memories in a tabular format rather than as chat messages.
|
||||
|
||||
You can set the output type near the component's output port.
|
||||
|
||||
## Legacy Helper components
|
||||
|
||||
import PartialLegacy from '@site/docs/_partial-legacy.mdx';
|
||||
|
||||
<PartialLegacy />
|
||||
|
||||
The following Helper components are in legacy status:
|
||||
|
||||
* **Message Store**: Replaced by the [**Message History** component](#message-history)
|
||||
* **Create List**: Replace with [Processing components](/components-processing)
|
||||
* **ID Generator**: Replace with a component that executes arbitrary code to generate an ID or embed an ID generator script your application code (external to your Langflow flows).
|
||||
* **Output Parser**: Replace with the [**Structured Output** component](/components-processing#structured-output) and [**Parser** component](/components-processing#parser).
|
||||
The components you need depend on the data types and complexity of the parsing task.
|
||||
|
||||
The **Output Parser** component transformed the output of a language model into comma-separated values (CSV) format, such as `["item1", "item2", "item3"]`, using LangChain's `CommaSeparatedListOutputParser`.
|
||||
The **Structured Output** component is a good alternative for this component because it also formats LLM responses with support for custom schemas and more complex parsing.
|
||||
|
||||
**Parsing** components only provide formatting instructions and parsing functionality.
|
||||
_They don't include prompts._
|
||||
You must connect parsers to **Prompt Template** components to create prompts that LLMs can use.
|
||||
You can set the output type near the component's output port.
|
||||
18
docs/docs/Components/mock-data.mdx
Normal file
18
docs/docs/Components/mock-data.mdx
Normal file
@ -0,0 +1,18 @@
|
||||
---
|
||||
title: Mock Data
|
||||
slug: /mock-data
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
The **Mock Data** component generates sample data for testing and development.
|
||||
You can select these output types:
|
||||
|
||||
* `message_output`: A [Message (text)](/data-types#message) output with Lorem Ipsum sample text.
|
||||
* `data_output`: A [Data (JSON)](/data-types#data) object containing a JSON structure with one sample record under `records` and a `summary` section.
|
||||
* `dataframe_output`: A [DataFrame (tabular)](/data-types#dataframe) with 50 mock records, including columns such as `customer_id`, `first_name`, and `last_name`.
|
||||
|
||||
35
docs/docs/Components/news-search.mdx
Normal file
35
docs/docs/Components/news-search.mdx
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
title: News Search
|
||||
slug: /news-search
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
The **News Search** component searches Google News through RSS, and then returns clean article data as a [`DataFrame`](/data-types#dataframe) containing article titles, links, publication dates, and summaries.
|
||||
The component's `clean_html` method parses the HTML content with the BeautifulSoup library, removes HTML markup, and strips whitespace to output clean data.
|
||||
|
||||
When used as a standard component in a flow, the **News Search** component must be connected to a component that accepts `DataFrame` input.
|
||||
You can connect the **News Search** component directly to a compatible component, or you can use a [Processing component](/concepts-components) to convert or extract data of a different type between components.
|
||||
|
||||
When used in **Tool Mode** with an **Agent** component, the **News Search** component can be connected directly to the **Agent** component's **Tools** port without converting the data.
|
||||
The agent decides whether to use the **News Search** component based on the user's query, and it can process the `DataFrame` output directly.
|
||||
|
||||
### News Search parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| query | Search Query | Input parameter. Search keywords for news articles. |
|
||||
| hl | Language (hl) | Input parameter. Language code, such as en-US, fr, de. Default: `en-US`. |
|
||||
| gl | Country (gl) | Input parameter. Country code, such as US, FR, DE. Default: `US`. |
|
||||
| ceid | Country:Language (ceid) | Input parameter. Language, such as US:en, FR:fr. Default: `US:en`. |
|
||||
| topic | Topic | Input parameter. One of: `WORLD`, `NATION`, `BUSINESS`, `TECHNOLOGY`, `ENTERTAINMENT`, `SCIENCE`, `SPORTS`, `HEALTH`. |
|
||||
| location | Location (Geo) | Input parameter. City, state, or country for location-based news. Leave blank for keyword search. |
|
||||
| timeout | Timeout | Input parameter. Timeout for the request in seconds. |
|
||||
| articles | News Articles | Output parameter. A `DataFrame` with the key columns `title`, `link`, `published` and `summary`. |
|
||||
|
||||
15
docs/docs/Components/notify-and-listen.mdx
Normal file
15
docs/docs/Components/notify-and-listen.mdx
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
title: Notify and Listen
|
||||
slug: /notify-and-listen
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
|
||||
The **Notify** and **Listen** components are used together.
|
||||
|
||||
The **Notify** component builds a notification from the current flow's context, including specific data content and a status identifier.
|
||||
|
||||
The resulting notification is sent to the **Listen** component.
|
||||
The notification data can then be passed to other components in the flow, such as the [**If-Else** component](/if-else).
|
||||
|
||||
142
docs/docs/Components/parser.mdx
Normal file
142
docs/docs/Components/parser.mdx
Normal file
@ -0,0 +1,142 @@
|
||||
---
|
||||
title: Parser
|
||||
slug: /parser
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialCurlyBraces from '@site/docs/_partial-escape-curly-braces.mdx';
|
||||
|
||||
The **Parser** component extracts text from structured data (`DataFrame` or `Data`) using a template or direct stringification.
|
||||
The output is a `Message` containing the parsed text.
|
||||
|
||||
This is a versatile component for data extraction and manipulation in your flows.
|
||||
For examples of **Parser** components in flows, see the following:
|
||||
|
||||
* [**Batch Run** component example](/batch-run)
|
||||
* [**Structured Output** component example](/structured-output)
|
||||
* **Financial Report Parser** template
|
||||
* [Trigger flows with webhooks](/webhook)
|
||||
* [Create a vector RAG chatbot](/chat-with-rag)
|
||||
|
||||

|
||||
|
||||
### Parsing modes
|
||||
|
||||
The **Parser** component has two modes: **Parser** and **Stringify**.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="template" label="Parser (template) mode" default>
|
||||
|
||||
In **Parser** mode, you create a template for text output that can include literal strings and variables for extracted keys.
|
||||
|
||||
Use curly braces to define variables anywhere in the template.
|
||||
Variables must match keys in the `DataFrame` or `Data` input, such as column names.
|
||||
For example, `{name}` extracts the value of a `name` key.
|
||||
For more information about the content and structure of `DataFrame` and `Data` objects, see [Langflow data types](/data-types).
|
||||
|
||||
<PartialCurlyBraces />
|
||||
|
||||
When the flow runs, the **Parser** component iterates over the input, producing a `Message` for each parsed item.
|
||||
For example, parsing a `DataFrame` creates a `Message` for each row, populated with the unique values from that row.
|
||||
|
||||
<details>
|
||||
<summary>Employee summary template</summary>
|
||||
|
||||
This example template extracts employee data into a natural language summary about an employee's hire date and current role:
|
||||
|
||||
```text
|
||||
{employee_first_name} {employee_last_name} was hired on {start_date}.
|
||||
Their current position is {job_title} ({grade}).
|
||||
```
|
||||
|
||||
The resulting `Message` output replaces the variables with the corresponding extracted values.
|
||||
For example:
|
||||
|
||||
```text
|
||||
Renlo Kai was hired on 11-July-2017.
|
||||
Their current position is Software Engineer (Principal).
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Employee profile template</summary>
|
||||
|
||||
This example template uses Markdown syntax and extracted employee data to create an employee profile:
|
||||
|
||||
```text
|
||||
# Employee Profile
|
||||
## Personal Information
|
||||
- **Name:** {name}
|
||||
- **ID:** {id}
|
||||
- **Email:** {email}
|
||||
```
|
||||
|
||||
When the flow runs, the **Parser** component iterates over each row of the `DataFrame`, populating the template's variables with the appropriate extracted values.
|
||||
The resulting text for each row is output as a [`Message`](/data-types#message).
|
||||
|
||||
</details>
|
||||
|
||||
The following parameters are available in **Parser** mode.
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| input_data | Data or DataFrame | Input parameter. The `Data` or `DataFrame` input to parse. |
|
||||
| pattern | Template | Input parameter. The formatting template using plaintext and variables for keys (`{KEY_NAME}`). See the preceding examples for more information. |
|
||||
| sep | Separator | Input parameter. A string defining the separator for rows or lines. Default: `\n` (new line). |
|
||||
| clean_data | Clean Data | Whether to remove empty rows and lines in each cell or key of the `DataFrame` or `Data` input. Default: Enabled (`true`) |
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="stringify" label="Stringify mode">
|
||||
|
||||
Use **Stringify** mode to convert the entire input directly to text.
|
||||
This mode doesn't support templates or key selection.
|
||||
|
||||
The following parameters are available in **Stringify** mode.
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| input_data | Data or DataFrame | Input parameter. The `Data` or `DataFrame` input to parse. |
|
||||
| sep | Separator | Input parameter. A string defining the separator for rows or lines. Default: `\n` (new line). |
|
||||
| clean_data | Clean Data | Whether to remove empty rows and lines in each cell or key of the `DataFrame` or `Data` input. Default: Enabled (`true`) |
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Test and troubleshoot parsed text
|
||||
|
||||
To test the **Parser** component, click <Icon name="Play" aria-hidden="true"/> **Run component**, and then click <Icon name="TextSearch" aria-hidden="true"/> **Inspect output** to see the `Message` output with the parsed text.
|
||||
You can also connect a **Chat Output** component if you want to view the output in the **Playground**.
|
||||
|
||||
If the `Message` output from the **Parser** component has empty or unexpected values, there might be a mapping error between the input and the parsing mode, the input has empty values, or the input isn't suitable for plaintext extraction.
|
||||
|
||||
For example, assume you use the following template to parse a `DataFrame`:
|
||||
|
||||
```text
|
||||
{employee_first_name} {employee_last_name} is a {job_title} ({grade}).
|
||||
```
|
||||
|
||||
The following `Message` could result from parsing a row where `employee_first_name` was empty and `grade` was `null`:
|
||||
|
||||
```text
|
||||
Smith is a Software Engineer (null).
|
||||
```
|
||||
|
||||
To troubleshoot missing or unexpected values, you can do the following:
|
||||
|
||||
* Make sure the variables in your template map to keys in the incoming `Data` or `DataFrame`.
|
||||
To see the data being passed directly to the **Parser** component, click <Icon name="TextSearch" aria-hidden="true"/> **Inspect output** on the component that is sending data to the **Parser** component.
|
||||
|
||||
* Check the source data for missing or incorrect values.
|
||||
There are several ways you can address these inconsistencies:
|
||||
|
||||
* Rectify the source data directly.
|
||||
* Use other components to amend or filter anomalies before passing the data to the **Parser** component.
|
||||
There are many components you can use for this depending on your goal, such as the [**Data Operations** component](/data-operations), [**Structured Output** component](/structured-output), and [**Smart Transform** component](/smart-transform).
|
||||
* Enable the **Parser** component's **Clean Data** parameter to skip empty rows or lines.
|
||||
|
||||
86
docs/docs/Components/python-interpreter.mdx
Normal file
86
docs/docs/Components/python-interpreter.mdx
Normal file
@ -0,0 +1,86 @@
|
||||
---
|
||||
title: Python Interpreter
|
||||
slug: /python-interpreter
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
This component allows you to execute Python code with imported packages.
|
||||
|
||||
The **Python Interpreter** component can only import packages that are already installed in your Langflow environment.
|
||||
If you encounter an `ImportError` when trying to use a package, you need to install it first.
|
||||
|
||||
To install custom packages, see [Install custom dependencies](/install-custom-dependencies).
|
||||
|
||||
### 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.
|
||||
3. Optional: Enable **Tool Mode**, and then connect the **Python Interpreter** component to an **Agent** component as a tool.
|
||||
For example, connect a **Python Interpreter** component and a [**Calculator** component](/calculator) as tools for an **Agent** component, and then test how it chooses different tools to solve math problems.
|
||||

|
||||
4. Ask the agent an easier math question.
|
||||
The **Calculator** tool can add, subtract, multiple, divide, or perform exponentiation.
|
||||
The agent executes the `evaluate_expression` tool to correctly answer the question.
|
||||
|
||||
Result:
|
||||
```text
|
||||
Executed evaluate_expression
|
||||
Input:
|
||||
{
|
||||
"expression": "2+5"
|
||||
}
|
||||
Output:
|
||||
{
|
||||
"result": "7"
|
||||
}
|
||||
```
|
||||
|
||||
5. Give the agent complete Python code.
|
||||
This example creates a Pandas DataFrame table with the imported `pandas` packages, and returns the square root of the mean squares.
|
||||
|
||||
```python
|
||||
import pandas as pd
|
||||
import math
|
||||
|
||||
# Create a simple DataFrame
|
||||
df = pd.DataFrame({
|
||||
'numbers': [1, 2, 3, 4, 5],
|
||||
'squares': [x**2 for x in range(1, 6)]
|
||||
})
|
||||
|
||||
# Calculate the square root of the mean
|
||||
result = math.sqrt(df['squares'].mean())
|
||||
print(f"Square root of mean squares: {result}")
|
||||
```
|
||||
|
||||
The agent correctly chooses the `run_python_repl` tool to solve the problem.
|
||||
|
||||
Result:
|
||||
```text
|
||||
Executed run_python_repl
|
||||
|
||||
Input:
|
||||
|
||||
{
|
||||
"python_code": "import pandas as pd\nimport math\n\n# Create a simple DataFrame\ndf = pd.DataFrame({\n 'numbers': [1, 2, 3, 4, 5],\n 'squares': [x**2 for x in range(1, 6)]\n})\n\n# Calculate the square root of the mean\nresult = math.sqrt(df['squares'].mean())\nprint(f\"Square root of mean squares: {result}\")"
|
||||
}
|
||||
Output:
|
||||
|
||||
{
|
||||
"result": "Square root of mean squares: 3.3166247903554"
|
||||
}
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
### Python Interpreter parameters
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| 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. |
|
||||
169
docs/docs/Components/read-file.mdx
Normal file
169
docs/docs/Components/read-file.mdx
Normal file
@ -0,0 +1,169 @@
|
||||
---
|
||||
title: Read File
|
||||
slug: /read-file
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
In Langflow version 1.7.0, this component was renamed from **File** to **Read File**.
|
||||
|
||||
The **Read File** component loads and parses files, converts the content into a `Data`, `DataFrame`, or `Message` object.
|
||||
It supports multiple file types, provides parameters for parallel processing and error handling, and supports advanced parsing with the Docling library.
|
||||
|
||||
You can add files to the **Read File** component in the visual editor or at runtime, and you can upload multiple files at once.
|
||||
For more information about uploading files and working with files in flows, see [File management](/concepts-file-management) and [Create a chatbot that can ingest files](/chat-with-files).
|
||||
|
||||
### File type and size limits
|
||||
|
||||
By default, the maximum file size is 1024 MB.
|
||||
To modify this value, change the `LANGFLOW_MAX_FILE_SIZE_UPLOAD` [environment variable](/environment-variables).
|
||||
|
||||
<details>
|
||||
<summary>Supported file types</summary>
|
||||
|
||||
The following file types are supported by the **Read File** component.
|
||||
Use archive and compressed formats to bundle multiple files together, or use the [**Directory** component](/directory) to load all files in a directory.
|
||||
|
||||
- `.bz2`
|
||||
- `.csv`
|
||||
- `.docx`
|
||||
- `.gz`
|
||||
- `.htm`
|
||||
- `.html`
|
||||
- `.json`
|
||||
- `.js`
|
||||
- `.md`
|
||||
- `.mdx`
|
||||
- `.pdf`
|
||||
- `.py`
|
||||
- `.sh`
|
||||
- `.sql`
|
||||
- `.tar`
|
||||
- `.tgz`
|
||||
- `.ts`
|
||||
- `.tsx`
|
||||
- `.txt`
|
||||
- `.xml`
|
||||
- `.yaml`
|
||||
- `.yml`
|
||||
- `.zip`
|
||||
|
||||
</details>
|
||||
|
||||
If you need to load an unsupported file type, you must use a different component that supports that file type and, potentially, parses it outside Langflow, or you must convert it to a supported type before uploading it.
|
||||
|
||||
For images, see [Upload images](/concepts-file-management#upload-images).
|
||||
|
||||
For videos, see the **Twelve Labs** and **YouTube** <Icon name="Blocks" aria-hidden="true" /> [**Bundles**](/components-bundle-components).
|
||||
|
||||
### File parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| path | Files | Input parameter. The path to files to load. Can be local or in [Langflow file management](/concepts-file-management). Supports individual files and bundled archives. |
|
||||
| file_path | Server File Path | Input parameter. A `Data` object with a `file_path` property pointing to a file in [Langflow file management](/concepts-file-management) or a `Message` object with a path to the file. Supersedes **Files** (`path`) but supports the same file types. |
|
||||
| separator | Separator | Input parameter. The separator to use between multiple outputs in `Message` format. |
|
||||
| silent_errors | Silent Errors | Input parameter. If `true`, errors in the component don't raise an exception. Default: Disabled (`false`). |
|
||||
| delete_server_file_after_processing | Delete Server File After Processing | Input parameter. If `true` (default), the **Server File Path** (`file_path`) is deleted after processing. |
|
||||
| ignore_unsupported_extensions | Ignore Unsupported Extensions | Input parameter. If enabled (`true`), files with unsupported extensions are accepted but not processed. If disabled (`false`), the **Read File** component either can throw an error if an unsupported file type is provided. The default is `true`. |
|
||||
| ignore_unspecified_files | Ignore Unspecified Files | Input parameter. If `true`, `Data` with no `file_path` property is ignored. If `false` (default), the component errors when a file isn't specified. |
|
||||
| concurrency_multithreading | Processing Concurrency | Input parameter. The number of files to process concurrently if multiple files are uploaded. Default is 1. Values greater than 1 enable parallel processing for 2 or more files. Ignored for single-file uploads and advanced parsing. |
|
||||
| advanced_parser | Advanced Parser | Input parameter. If `true`, enables [advanced parsing](#advanced-parsing). Only available for single-file uploads of compatible file types. Default: Disabled (`false`). |
|
||||
|
||||
### Advanced parsing
|
||||
|
||||
Starting in Langflow version 1.6, the **Read File** component supports advanced document parsing using the [Docling](https://docling-project.github.io/docling/) library for supported file types.
|
||||
|
||||
To use advanced parsing, do the following:
|
||||
|
||||
1. Complete the following prerequisites, if applicable:
|
||||
|
||||
* **Install Langflow version 1.6 or later**: Earlier versions don't support advanced parsing with the **Read File** component. For upgrade guidance, see the [Release notes](/release-notes).
|
||||
|
||||
* **Install Docling dependency on macOS Intel (x86_64)**: The Docling dependency isn't installed by default for macOS Intel (x86_64). Use the [Docling installation guide](https://docling-project.github.io/docling/installation/) to install the Docling dependency.
|
||||
|
||||
For all other operating systems, the Docling dependency is installed by default.
|
||||
|
||||
* **Enable Developer Mode for Windows**:
|
||||
<PartialDevModeWindows />
|
||||
|
||||
Developer Mode isn't required for Langflow OSS on Windows.
|
||||
|
||||
2. Add one valid file to the **Read File** component.
|
||||
|
||||
:::info Advanced parsing limitations
|
||||
* Advanced parsing processes only one file.
|
||||
If you select multiple files, the **Read File** component processes the first file only, ignoring any additional files.
|
||||
To process multiple files with advanced parsing, pass each file to a separate **Read File** components, or use the dedicated [**Docling** components](/bundles-docling).
|
||||
|
||||
* Advanced parsing can process any of the **Read File** component's supported file types except `.csv`, `.xlsx`, and `.parquet` files because it is designed for document processing, such as extracting text from PDFs.
|
||||
For structured data analysis, use the [**Parser** component](/parser).
|
||||
:::
|
||||
|
||||
3. Enable **Advanced Parsing**.
|
||||
|
||||
4. Click <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls** in the [component's header menu](/concepts-components#component-menus) to configure advanced parsing parameters, which are hidden by default:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| pipeline | Pipeline | Input parameter, advanced parsing. The Docling pipeline to use, either `standard` (default, recommended) or `vlm` (may produce inconsistent results). |
|
||||
| ocr_engine | OCR Engine | Input parameter, advanced parsing. The OCR parser to use if `pipeline` is `standard`. Options are `None` (default) or [`EasyOCR`](https://pypi.org/project/easyocr/). `None` means that no OCR engine is used, and this can produce inconsistent or broken results for some documents. This setting has no effect with the `vlm` pipeline. |
|
||||
| md_image_placeholder | Markdown Image Placeholder | Input parameter, advanced parsing. Defines the placeholder for image files if the output type is **Markdown**. Default: `<!-- image -->`. |
|
||||
| md_page_break_placeholder | Markdown Page Break Placeholder | Input parameter, advanced parsing. Defines the placeholder for page breaks if the output type is **Markdown**. Default: `""` (empty string). |
|
||||
| doc_key | Document Key | Input parameter, advanced parsing. The key to use for the `DoclingDocument` column, which holds the structured information extracted from the source document. See [Docling Document](https://docling-project.github.io/docling/concepts/docling_document/) for details. Default: `doc`. |
|
||||
|
||||
:::tip
|
||||
For additional Docling features, including other components and OCR parsers, use the [**Docling** bundle](/bundles-docling).
|
||||
:::
|
||||
|
||||
### File output
|
||||
|
||||
The output of the **Read File** component depends on the number of files loaded and whether advanced parsing is enabled.
|
||||
If multiple options are available, you can set the output type near the component's output port.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="zero" label="No files">
|
||||
|
||||
If you run the **Read File** component with no file selected, it throws an error, or, if **Silent Errors** is enabled, produces no output.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="one-false" label="One file without advanced parsing">
|
||||
|
||||
If advanced parsing is disabled and you upload one file, the following output types are available:
|
||||
|
||||
- **Structured Content**: Available only for `.csv`, `.xlsx`, `.parquet`, and `.json` files.
|
||||
|
||||
- For `.csv` files, produces a [`DataFrame`](/data-types#dataframe) representing the table data.
|
||||
- For `.json` files, produces a [`Data`](/data-types#data) object with the parsed JSON data.
|
||||
|
||||
- **Raw Content**: A [`Message`](/data-types#message) containing the file's raw text content.
|
||||
|
||||
- **File Path**: A [`Message`](/data-types#message) containing the path to the file in [Langflow file management](/concepts-file-management).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="one-true" label="One file with advanced parsing">
|
||||
|
||||
If advanced parsing is enabled and you upload one file, the following output types are available:
|
||||
|
||||
- **Structured Output**: A [`DataFrame`](/data-types#dataframe) containing the Docling-processed document data with text elements, page numbers, and metadata.
|
||||
|
||||
- **Markdown**: A [`Message`](/data-types#message) containing the uploaded document contents in Markdown format with image placeholders.
|
||||
|
||||
- **File Path**: A [`Message`](/data-types#message) containing the path to the file in [Langflow file management](/concepts-file-management).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="multi" label="Multiple files">
|
||||
|
||||
If you upload multiple files, the component outputs **Files**, which is a [`DataFrame`](/data-types#dataframe) containing the content and metadata of all selected files.
|
||||
|
||||
[Advanced parsing](#advanced-parsing) doesn't support multiple files; it processes only the first file.
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
27
docs/docs/Components/rss-reader.mdx
Normal file
27
docs/docs/Components/rss-reader.mdx
Normal file
@ -0,0 +1,27 @@
|
||||
---
|
||||
title: RSS Reader
|
||||
slug: /rss-reader
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
The **RSS Reader** component fetches and parses RSS feeds from any valid RSS feed URL, and then returns the feed content as a [`DataFrame`](/data-types#dataframe) containing article titles, links, publication dates, and summaries.
|
||||
|
||||
When used as a standard component in a flow, the **RSS Reader** component must be connected to a component that accepts `DataFrame` input.
|
||||
You can connect the **RSS Reader** component directly to a compatible component, or you can use a [Processing component](/concepts-components) to convert or extract data of a different type between components.
|
||||
|
||||
When used in **Tool Mode** with an **Agent** component, the **RSS Reader** component can be connected directly to the **Agent** component's **Tools** port without converting the data.
|
||||
The agent decides whether to use the **RSS Reader** component based on the user's query, and it can process the `DataFrame` output directly.
|
||||
|
||||
### RSS Reader parameters
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| rss_url | RSS Feed URL | Input parameter. URL of the RSS feed to parse, such as `https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml`. |
|
||||
| timeout | Timeout | Input parameter. Timeout for the RSS feed request in seconds. Default: `5`. |
|
||||
| articles | Articles | Output parameter. A `DataFrame` containing the key columns `title`, `link`, `published` and `summary`. |
|
||||
|
||||
28
docs/docs/Components/run-flow.mdx
Normal file
28
docs/docs/Components/run-flow.mdx
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
title: Run Flow
|
||||
slug: /run-flow
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
|
||||
The **Run Flow** component runs another Langflow flow as a subprocess of the current flow.
|
||||
|
||||
You can use this component to chain flows together, run flows conditionally, and attach flows to [**Agent** components](/components-agents) as [tools for agents](/agents-tools) to run as needed.
|
||||
|
||||
When used with an agent, the `name` and `description` metadata that the agent uses to register the tool are created automatically.
|
||||
|
||||
When you select a flow for the **Run Flow** component, it uses the target flow's graph structure to dynamically generate input and output fields on the **Run Flow** component.
|
||||
|
||||
### Run Flow parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Type | Description |
|
||||
|-------------------|----------|----------------------------------------------------------------|
|
||||
| flow_name_selected| Dropdown | Input parameter. The name of the flow to run. |
|
||||
| session_id | String | Input parameter. The session ID for the flow run, if you want to pass a custom session ID for the subflow. |
|
||||
| flow_tweak_data | Dict | Input parameter. Dictionary of tweaks to customize the flow's behavior. Available tweaks depend on the selected flow. |
|
||||
| dynamic inputs | Various | Input parameter. Additional inputs are generated based on the selected flow. |
|
||||
| run_outputs | A `List` of types (`Data`, `Message`, or `DataFrame`) | Output parameter. All outputs are generated from running the flow. |
|
||||
|
||||
33
docs/docs/Components/smart-router.mdx
Normal file
33
docs/docs/Components/smart-router.mdx
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
title: Smart Router
|
||||
slug: /smart-router
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
The **Smart Router** component is an LLM-powered variation of the [**If-Else** component](/if-else).
|
||||
Instead of string matching, the **Smart Router** uses a connected [**Language Model** component](/components-models) to categorize and route incoming messages.
|
||||
|
||||
You can use the **Smart Router** component anywhere you would use the **If-Else** component.
|
||||
For an example, create [If-Else component example flow](/if-else#use-the-if-else-component-in-a-flow), then replace the **If-Else** component with a **Smart Router** component.
|
||||
Instead of a regex, use the **Routes** table to define the outputs for your messages.
|
||||
Finally, connect a **Language Model** component to provide the sorting intelligence.
|
||||
|
||||
### Smart Router parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Type | Description |
|
||||
|---------------------|----------|-------------------------------------------------------------------|
|
||||
| llm | [LanguageModel](/data-types#languagemodel | Input parameter. The language model to use for categorization. Required. |
|
||||
| input_text | String | Input parameter. The primary text input for categorization. Required. |
|
||||
| routes | Table | Input parameter. Table defining categories and optional output values. Each row should have a route/category name and optionally a custom output value. Required. |
|
||||
| message | Message | Input parameter. Optional override message that replaces both the Input and Output Value for all routes when filled. Advanced. |
|
||||
| enable_else_output | Boolean | Input parameter. Include an Else output for cases that don't match any route. Default: false. |
|
||||
| custom_prompt | String | Input parameter. Additional instructions for LLM-based categorization. Use `{input_text}` for the input text and `{routes}` for the available categories. |
|
||||
| default_result | Message | Output parameter. The Else output. Only available when `enable_else_output` is `true`. Otherwise, output is produced and routed according to the `routes` parameter. |
|
||||
|
||||
43
docs/docs/Components/smart-transform.mdx
Normal file
43
docs/docs/Components/smart-transform.mdx
Normal file
@ -0,0 +1,43 @@
|
||||
---
|
||||
title: Smart Transform
|
||||
slug: /smart-transform
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
This component has been renamed multiple times.
|
||||
Its previous names include **Lambda Filter** and **Smart Function**.
|
||||
|
||||
The **Smart Transform** component uses an LLM to generate a Lambda function to filter or transform structured data based on natural language instructions.
|
||||
You must connect this component to a [language model component](/components-models), which is used to generate a function based on the natural language instructions you provide in the **Instructions** parameter.
|
||||
The LLM runs the function against the data input, and then outputs the results as [`Data`](/data-types#data).
|
||||
|
||||
:::tip
|
||||
Provide brief, clear instructions, focusing on the desired outcome or specific actions, such as `Filter the data to only include items where the 'status' is 'active'`.
|
||||
One sentence or less is preferred because end punctuation, like periods, can cause errors or unexpected behavior.
|
||||
|
||||
If you need to provide more details instructions that aren't directly relevant to the Lambda function, you can input them in the **Language Model** component's **Input** field or through a **Prompt Template** component.
|
||||
:::
|
||||
|
||||
The following example uses the **API Request** endpoint to pass JSON data from the `https://jsonplaceholder.typicode.com/users` endpoint to the **Smart Transform** component.
|
||||
Then, the **Smart Transform** component passes the data and the instruction `extract emails` to the attached **Language Model** component.
|
||||
From there, the LLM generates a filter function that extracts email addresses from the JSON data, returning the filtered data as chat output.
|
||||
|
||||

|
||||
|
||||
### Smart Transform parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data | Data | Input parameter. The structured data to filter or transform using a Lambda function. |
|
||||
| llm | Language Model | Input parameter. Connect [`LanguageModel`](/data-types#languagemodel) output from a **Language Model** component. |
|
||||
| filter_instruction | Instructions | Input parameter. The natural language instructions for how to filter or transform the data. The LLM uses these instructions to create a Lambda function. |
|
||||
| sample_size | Sample Size | Input parameter. For large datasets, the number of characters to sample from the dataset head and tail. Only applied if the dataset meets or exceeds `max_size`. Default: `1000`. |
|
||||
| max_size | Max Size | Input parameter. The number of characters for the dataset to be considered large, which triggers sampling by the `sample_size` value. Default: `30000`. |
|
||||
|
||||
50
docs/docs/Components/split-text.mdx
Normal file
50
docs/docs/Components/split-text.mdx
Normal file
@ -0,0 +1,50 @@
|
||||
---
|
||||
title: Split Text
|
||||
slug: /split-text
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialCurlyBraces from '@site/docs/_partial-escape-curly-braces.mdx';
|
||||
|
||||
The **Split Text** component splits data into chunks based on parameters like chunk size and separator.
|
||||
It is often used to chunk data to be tokenized and embedded into vector databases.
|
||||
For examples, see [Use embedding model components in a flow](/components-embedding-models#use-embedding-model-components-in-a-flow) and [Create a Vector RAG chatbot](/chat-with-rag).
|
||||
|
||||

|
||||
|
||||
The component accepts `Message`, `Data`, or `DataFrame`, and then outputs either **Chunks** or **DataFrame**.
|
||||
The **Chunks** output returns a list of [`Data`](/data-types#data) objects containing individual text chunks.
|
||||
The **DataFrame** output returns the list of chunks as a structured [`DataFrame`](/data-types#dataframe) with additional `text` and `metadata` columns.
|
||||
|
||||
### Split Text parameters
|
||||
|
||||
The **Split Text** component's parameters control how the text is split into chunks, specifically the `chunk_size`, `chunk_overlap`, and `separator` parameters.
|
||||
|
||||
To test the chunking behavior, add a **Text Input** or **Read File** component with some sample data to chunk, click <Icon name="Play" aria-hidden="true" /> **Run component** on the **Split Text** component, and then click <Icon name="TextSearch" aria-hidden="true" /> **Inspect output** to view the list of chunks and their metadata. The **text** column contains the actual text chunks created from your chunking settings.
|
||||
If the chunks aren't split as you expect, adjust the parameters, rerun the component, and then inspect the new output.
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| data_inputs | Input | Input parameter. The data to split. Input must be in `Message`, `Data`, or `DataFrame` format. |
|
||||
| chunk_overlap | Chunk Overlap | Input parameter. The number of characters to overlap between chunks. This helps maintain context across chunks. When a separator is encountered, the overlap is applied at the point of the separator so that the subsequent chunk contains the last _n_ characters of the preceding chunk. Default: `200`. |
|
||||
| chunk_size | Chunk Size | Input parameter. The target length for each chunk after splitting. The data is first split by separator, and then chunks smaller than the `chunk_size` are merged up to this limit. However, if the initial separator split produces any chunks larger than the `chunk_size`, those chunks are neither further subdivided nor combined with any smaller chunks; these chunks will be output as-is even though they exceed the `chunk_size`. Default: `1000`. See [Tokenization errors due to chunk size](#chunk-size) for important considerations. |
|
||||
| separator | Separator | Input parameter. A string defining a character to split on, such as `\n` to split on new line characters, `\n\n` to split at paragraph breaks, or `},` to split at the end of JSON objects. You can directly provide the separator string, or pass a separator string from another component as `Message` input. |
|
||||
| text_key | Text Key | Input parameter. The key to use for the text column that is extracted from the input and then split. Default: `text`. |
|
||||
| keep_separator | Keep Separator | Input parameter. Select how to handle separators in output chunks. If `False`, separators are omitted from output chunks. Options include `False` (remove separators), `True` (keep separators in chunks without preference for placement), `Start` (place separators at the beginning of chunks), or `End` (place separators at the end of chunks). Default: `False`. |
|
||||
|
||||
### Tokenization errors due to chunk size {#chunk-size}
|
||||
|
||||
When using **Split Text** with embedding models (especially NVIDIA models like `nvidia/nv-embed-v1`), you may need to use smaller chunk sizes (`500` or less) even though the model supports larger token limits.
|
||||
The **Split Text** component doesn't always enforce the exact chunk size you set, and individual chunks may exceed your specified limit.
|
||||
If you encounter tokenization errors, modify your text splitting strategy by reducing the chunk size, changing the overlap length, or using a more common separator.
|
||||
Then, test your configuration by running the flow and inspecting the component's output.
|
||||
|
||||
### Other text splitters
|
||||
|
||||
See [LangChain text splitter components](/bundles-langchain#text-splitters).
|
||||
|
||||
127
docs/docs/Components/sql-database.mdx
Normal file
127
docs/docs/Components/sql-database.mdx
Normal file
@ -0,0 +1,127 @@
|
||||
---
|
||||
title: SQL Database
|
||||
slug: /sql-database
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
|
||||
The **SQL Database** component executes SQL queries on [SQLAlchemy-compatible databases](https://docs.sqlalchemy.org/en/20/).
|
||||
It supports any SQLAlchemy-compatible database, such as PostgreSQL, MySQL, and SQLite.
|
||||
|
||||
For CQL queries, see the [**DataStax** bundle](/bundles-datastax).
|
||||
|
||||
### Query an SQL database with natural language prompts
|
||||
|
||||
The following example demonstrates how to use the **SQL Database** component in a flow, and then modify the component to support natural language queries through an **Agent** component.
|
||||
|
||||
This allows you to use the same **SQL Database** component for any query, rather than limiting it to a single manually entered query or requiring the user, application, or another component to provide valid SQL syntax as input.
|
||||
Users don't need to master SQL syntax because the **Agent** component translates the users' natural language prompts into SQL queries, passes the query to the **SQL Database** component, and then returns the results to the user.
|
||||
|
||||
Additionally, input from applications and other components doesn't have to be extracted and transformed to exact SQL queries.
|
||||
Instead, you only need to provide enough context for the agent to understand that it should create and run a SQL query according to the incoming data.
|
||||
|
||||
1. Use your own sample database or create a test database.
|
||||
|
||||
<details>
|
||||
<summary>Create a test SQL database</summary>
|
||||
|
||||
1. Create a database called `test.db`:
|
||||
|
||||
```shell
|
||||
sqlite3 test.db
|
||||
```
|
||||
|
||||
2. Add some values to the database:
|
||||
|
||||
```shell
|
||||
sqlite3 test.db "
|
||||
CREATE TABLE users (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT,
|
||||
email TEXT,
|
||||
age INTEGER
|
||||
);
|
||||
|
||||
INSERT INTO users (name, email, age) VALUES
|
||||
('John Doe', 'john@example.com', 30),
|
||||
('Jane Smith', 'jane@example.com', 25),
|
||||
('Bob Johnson', 'bob@example.com', 35);
|
||||
"
|
||||
```
|
||||
|
||||
3. Verify that the database has been created and contains your data:
|
||||
|
||||
```shell
|
||||
sqlite3 test.db "SELECT * FROM users;"
|
||||
```
|
||||
|
||||
The result should list the text data you entered in the previous step:
|
||||
|
||||
```shell
|
||||
1|John Doe|john@example.com
|
||||
2|Jane Smith|jane@example.com
|
||||
3|John Doe|john@example.com
|
||||
4|Jane Smith|jane@example.com
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
2. Add an **SQL Database** component to your flow.
|
||||
|
||||
3. In the **Database URL** field, add the connection string for your database, such as `sqlite:///test.db`.
|
||||
|
||||
At this point, you can enter an SQL query in the **SQL Query** field or use the [port](/concepts-components#component-ports) to pass a query from another component, such as a **Chat Input** component.
|
||||
If you need more space, click <Icon name="Expand" aria-hidden="true"/> **Expand** to open a full-screen text field.
|
||||
|
||||
However, to make this component more dynamic in an agentic context, use an **Agent** component to transform natural language input to SQL queries, as explained in the following steps.
|
||||
|
||||
4. Click the **SQL Database** component to expose the [component's header menu](/concepts-components#component-menus), and then enable **Tool Mode**.
|
||||
|
||||
You can now use this component as a tool for an agent.
|
||||
In **Tool Mode**, no query is set in the **SQL Database** component because the agent will generate and send one if it determines that the tool is required to complete the user's request.
|
||||
For more information, see [Configure tools for agents](/agents-tools).
|
||||
|
||||
5. Add an **Agent** component to your flow, and then enter your OpenAI API key.
|
||||
|
||||
The default model is an OpenAI model.
|
||||
If you want to use a different model, edit the **Model Provider**, **Model Name**, and **API Key** fields accordingly.
|
||||
|
||||
If you need to execute highly specialized queries, consider selecting a model that is trained for tasks like advanced SQL queries.
|
||||
If your preferred model isn't in the **Agent** component's built-in model list, set **Model Provider** to **Connect other models**, and then connect any [language model component](/components-models).
|
||||
|
||||
6. Connect the **SQL Database** component's **Toolset** output to the **Agent** component's **Tools** input.
|
||||
|
||||

|
||||
|
||||
7. Click **Playground**, and then ask the agent a question about the data in your database, such as `Which users are in my database?`
|
||||
|
||||
The agent determines that it needs to query the database to answer the question, uses the LLM to generate an SQL query, and then uses the **SQL Database** component's `RUN_SQL_QUERY` action to run the query on your database.
|
||||
Finally, it returns the results in a conversational format, unless you provide instructions to return raw results or a different format.
|
||||
|
||||
The following example queried a test database with little data, but with a more robust dataset you could ask more detailed or complex questions.
|
||||
|
||||
```text
|
||||
Here are the users in your database:
|
||||
|
||||
1. **John Doe** - Email: john@example.com
|
||||
2. **Jane Smith** - Email: jane@example.com
|
||||
3. **John Doe** - Email: john@example.com
|
||||
4. **Jane Smith** - Email: jane@example.com
|
||||
|
||||
It seems there are duplicate entries for the users.
|
||||
```
|
||||
|
||||
### SQL Database parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| database_url | Database URL | Input parameter. The SQLAlchemy-compatible database connection URL. |
|
||||
| query | SQL Query | Input parameter. The SQL query to execute, which can be entered directly, passed in from another component, or, in **Tool Mode**, automatically provided by an **Agent** component. |
|
||||
| include_columns | Include Columns | Input parameter. Whether to include column names in the result. The default is enabled (`true`). |
|
||||
| add_error | Add Error | Input parameter. If enabled, adds any error messages to the result, if any are returned. The default is disabled (`false`). |
|
||||
| run_sql_query | Result Table | Output parameter. The query results as a [`DataFrame`](/data-types#dataframe). |
|
||||
120
docs/docs/Components/structured-output.mdx
Normal file
120
docs/docs/Components/structured-output.mdx
Normal file
@ -0,0 +1,120 @@
|
||||
---
|
||||
title: Structured Output
|
||||
slug: /structured-output
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
The **Structured Output** component uses an LLM to transform any input into structured data (`Data` or `DataFrame`) using natural language formatting instructions and an output schema definition.
|
||||
For example, you can extract specific details from documents, like email messages or scientific papers.
|
||||
|
||||
### Use the Structured Output component in a flow
|
||||
|
||||
To use the **Structured Output** component in a flow, do the following:
|
||||
|
||||
1. Provide an **Input Message**, which is the source material from which you want to extract structured data.
|
||||
This can come from practically any component, but it is typically a **Chat Input**, **Read File**, or other component that provides some unstructured or semi-structured input.
|
||||
|
||||
:::tip
|
||||
Not all source material has to become structured output.
|
||||
The power of the **Structured Output** component is that you can specify the information you want to extract, even if that data isn't explicitly labeled or an exact keyword match.
|
||||
Then, the LLM can use your instructions to analyze the source material, extract the relevant data, and format it according to your specifications.
|
||||
Any irrelevant source material isn't included in the structured output.
|
||||
:::
|
||||
|
||||
2. Define **Format Instructions** and an **Output Schema** to specify the data to extract from the source material and how to structure it in the final `Data` or `DataFrame` output.
|
||||
|
||||
The instructions are a prompt that tell the LLM what data to extract, how to format it, how to handle exceptions, and any other instructions relevant to preparing the structured data.
|
||||
|
||||
The schema is a table that defines the fields (keys) and data types to organize the data extracted by the LLM into a structured `Data` or `DataFrame` object.
|
||||
For more information, see [Output Schema options](#output-schema-options)
|
||||
|
||||
3. Attach a [language model component](/components-models) that is set to emit [`LanguageModel`](/data-types#languagemodel) output.
|
||||
|
||||
The LLM uses the **Input Message** and **Format Instructions** from the **Structured Output** component to extract specific pieces of data from the input text.
|
||||
The output schema is applied to the model's response to produce the final `Data` or `DataFrame` structured object.
|
||||
|
||||
4. Optional: Typically, the structured output is passed to downstream components that use the extracted data for other processes, such as the **Parser** or **Data Operations** components.
|
||||
|
||||

|
||||
|
||||
<details>
|
||||
<summary>Structured Output example: Financial Report Parser template</summary>
|
||||
|
||||
The **Financial Report Parser** template provides an example of how the **Structured Output** component can be used to extract structured data from unstructured text.
|
||||
|
||||
The template's **Structured Output** component has the following configuration:
|
||||
|
||||
* The **Input Message** comes from a **Chat Input** component that is preloaded with quotes from sample financial reports
|
||||
|
||||
* The **Format Instructions** are as follows:
|
||||
|
||||
```text
|
||||
You are an AI that extracts structured JSON objects from unstructured text.
|
||||
Use a predefined schema with expected types (str, int, float, bool, dict).
|
||||
Extract ALL relevant instances that match the schema - if multiple patterns exist, capture them all.
|
||||
Fill missing or ambiguous values with defaults: null for missing values.
|
||||
Remove exact duplicates but keep variations that have different field values.
|
||||
Always return valid JSON in the expected format, never throw errors.
|
||||
If multiple objects can be extracted, return them all in the structured format.
|
||||
```
|
||||
|
||||
* The **Output Schema** includes keys for `EBITDA`, `NET_INCOME`, and `GROSS_PROFIT`.
|
||||
|
||||
The structured `Data` object is passed to a **Parser** component that produces a text string by mapping the schema keys to variables in the parsing template:
|
||||
|
||||
```text
|
||||
EBITDA: {EBITDA} , Net Income: {NET_INCOME} , GROSS_PROFIT: {GROSS_PROFIT}
|
||||
```
|
||||
|
||||
When printed to the **Playground**, the resulting `Message` replaces the variables with the actual values extracted by the **Structured Output** component. For example:
|
||||
|
||||
```text
|
||||
EBITDA: 900 million , Net Income: 500 million , GROSS_PROFIT: 1.2 billion
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Structured Output parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| Language Model (`llm`) | `LanguageModel` | Input parameter. The [`LanguageModel`](/data-types#languagemodel) output from a **Language Model** component that defines the LLM to use to analyze, extract, and prepare the structured output. |
|
||||
| Input Message (`input_value`) | String | Input parameter. The input message containing source material for extraction. |
|
||||
| Format Instructions (`system_prompt`) | String | Input parameter. The instructions to the language model for extracting and formatting the output. |
|
||||
| Schema Name (`schema_name`) | String | Input parameter. An optional title for the **Output Schema**. |
|
||||
| Output Schema (`output_schema`)| Table | Input parameter. A table describing the schema of the desired structured output, ultimately determining the content of the `Data` or `DataFrame` output. See [Output Schema options](#output-schema-options). |
|
||||
| Structured Output (`structured_output`) | `Data` or `DataFrame` | Output parameter. The final structured output produced by the component. Near the component's output port, you can select the output data type as either **Structured Output Data** or **Structured Output DataFrame**. The specific content and structure of the output depends on the input parameters. |
|
||||
|
||||
#### Output Schema options {#output-schema-options}
|
||||
|
||||
After the LLM extracts the relevant data from the **Input Message** and **Format Instructions**, the data is organized according to the **Output Schema**.
|
||||
|
||||
The schema is a table that defines the fields (keys) and data types for the final `Data` or `DataFrame` output from the **Structured Output** component.
|
||||
|
||||
The default schema is a single `field` string.
|
||||
|
||||
To add a key to the schema, click <Icon name="Plus" aria-hidden="true"/> **Add a new row**, and then edit each column to define the schema:
|
||||
|
||||
* **Name**: The name of the output field. Typically a specific key for which you want to extract a value.
|
||||
|
||||
You can reference these keys as variables in downstream components, such as a **Parser** component's template.
|
||||
For example, the schema key `NET_INCOME` could be referenced by the variable `{NET_INCOME}`.
|
||||
|
||||
* **Description**: An optional metadata description of the field's contents and purpose.
|
||||
|
||||
* **Type**: The data type of the value stored in the field.
|
||||
Supported types are `str` (default), `int`, `float`, `bool`, and `dict`.
|
||||
|
||||
* **As List**: Enable this setting if you want the field to contain a list of values rather than a single value.
|
||||
|
||||
For simple schemas, you might only extract a few `string` or `int` fields.
|
||||
For more complex schemas with lists and dictionaries, it might help to refer to the `Data` and `DataFrame` structures and attributes, as described in [Langflow data types](/data-types).
|
||||
You can also emit a rough `Data` or `DataFrame`, and then use downstream components for further refinement, such as a **Data Operations** component.
|
||||
|
||||
36
docs/docs/Components/text-input-and-output.mdx
Normal file
36
docs/docs/Components/text-input-and-output.mdx
Normal file
@ -0,0 +1,36 @@
|
||||
---
|
||||
title: Text Input and Output
|
||||
slug: /text-input-and-output
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
|
||||
:::warning
|
||||
**Text Input and Output** components aren't supported in the **Playground**.
|
||||
Because the data isn't formatted as a chat message, the data doesn't appear in the **Playground**, and you can't chat with your flow in the **Playground**.
|
||||
|
||||
If you want to chat with a flow in the **Playground**, you must use the [**Chat Input and Output** components](/chat-input-and-output).
|
||||
:::
|
||||
|
||||
**Text Input and Output** components are designed for flows that ingest or emit simple text strings.
|
||||
These components don't support full conversational interactions.
|
||||
|
||||
Passing chat-like metadata to a **Text Input and Output** component doesn't change the component's behavior; the result is still a simple text string.
|
||||
|
||||
### Text Input
|
||||
|
||||
The **Text Input** component accepts a text string input that is passed to other components as [`Message` data](/data-types) containing only the provided input text string in the `text` attribute.
|
||||
|
||||
It accepts only **Text** (`input_value`), which is the text supplied as input to the component.
|
||||
This can be entered directly into the component or passed as `Message` data from other components.
|
||||
|
||||
Initial input _shouldn't_ be provided as a complete `Message` object because the **Text Input** component constructs the `Message` object that is then passed to other components in the flow.
|
||||
|
||||
### Text Output
|
||||
|
||||
The **Text Output** component ingests [`Message` data](/data-types#message) from other components, emitting only the `text` attribute in a simplified `Message` object.
|
||||
|
||||
It accepts only **Text** (`input_value`), which is the text to be ingested and output as a string.
|
||||
This can be entered directly into the component or passed as `Message` data from other components.
|
||||
|
||||
138
docs/docs/Components/type-convert.mdx
Normal file
138
docs/docs/Components/type-convert.mdx
Normal file
@ -0,0 +1,138 @@
|
||||
---
|
||||
title: Type Convert
|
||||
slug: /type-convert
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialCurlyBraces from '@site/docs/_partial-escape-curly-braces.mdx';
|
||||
|
||||
The **Type Convert** component converts data from one type to another.
|
||||
It supports `Data`, `DataFrame`, and `Message` data types.
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="data" label="Data" default>
|
||||
|
||||
A `Data` object is a structured object that contains a primary `text` key and other key-value pairs:
|
||||
|
||||
```json
|
||||
"data": {
|
||||
"text": "User Profile",
|
||||
"name": "Charlie Lastname",
|
||||
"age": 28,
|
||||
"email": "charlie.lastname@example.com"
|
||||
},
|
||||
```
|
||||
|
||||
The larger context associated with a component's `data` dictionary also identifies which key is the primary `text_key`, and it can provide an optional default value if the primary key isn't specified.
|
||||
For example:
|
||||
|
||||
```json
|
||||
{
|
||||
"text_key": "text",
|
||||
"data": {
|
||||
"text": "User Profile",
|
||||
"name": "Charlie Lastname",
|
||||
"age": 28,
|
||||
"email": "charlie.lastname@example.com"
|
||||
},
|
||||
"default_value": ""
|
||||
}
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="dataframe" label="DataFrame">
|
||||
|
||||
A `DataFrame` is an array that represents a tabular data structure with rows and columns.
|
||||
|
||||
It consists of a list (array) of dictionary objects, where each dictionary represents a row.
|
||||
Each key in the dictionaries corresponds to a column name.
|
||||
For example, the following `DataFrame` contains two rows with columns for `name`, `age`, and `email`:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "Charlie Lastname",
|
||||
"age": 28,
|
||||
"email": "charlie.lastname@example.com"
|
||||
},
|
||||
{
|
||||
"name": "Bobby Othername",
|
||||
"age": 25,
|
||||
"email": "bobby.othername@example.com"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="message" label="Message">
|
||||
|
||||
A `Message` is primarily for passing a `text` string, such as`"Name: Charlie Lastname, Age: 28, Email: charlie.lastname@example.com"`.
|
||||
However, the entire `Message` object can include metadata about the message, particularly when used as chat input or output.
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
For more information, see [Langflow data types](/data-types).
|
||||
|
||||
### Use the Type Convert component in a flow
|
||||
|
||||
The **Type Convert** component is typically used to transform data into a format required by a downstream component.
|
||||
For example, if a component outputs a `Message`, but the following component requires `Data`, then you can use the **Type Convert** component to reformat the `Message` as `Data` before passing it to the downstream component.
|
||||
|
||||
The following example uses the **Type Convert** component to convert the `DataFrame` output from a **Web Search** component into `Message` data that is passed as text input for an LLM:
|
||||
|
||||
1. Create a flow based on the **Basic prompting** template.
|
||||
|
||||
2. Add a **Web Search** component to the flow, and then enter a search query, such as `environmental news`.
|
||||
|
||||
3. In the **Prompt Template** component, replace the contents of the **Template** field with the following text:
|
||||
|
||||
```text
|
||||
Answer the user's question using the {context}
|
||||
```
|
||||
|
||||
The curly braces define a [prompt variable](/components-prompts#define-variables-in-prompts) that becomes an input field on the **Prompt Template** component.
|
||||
In this example, you will use the **context** field to pass the search results into the template, as explained in the next steps.
|
||||
|
||||
3. Add a **Type Convert** component to the flow, and then set the **Output Type** to **Message**.
|
||||
|
||||
Because the **Web Search** component's `DataFrame` output is incompatible with the **context** variable's `Message` input, you must use the **Type Convert** component to change the `DataFrame` to a `Message` in order to pass the search results to the **Prompt Template** component.
|
||||
|
||||
4. Connect the additional components to the rest of the flow:
|
||||
|
||||
* Connect the **Web Search** component's output to the **Type Convert** component's input.
|
||||
* Connect the **Type Convert** component's output to the **Prompt Template** component's **context** input.
|
||||
|
||||

|
||||
|
||||
5. In the **Language Model** component, add your OpenAI API key.
|
||||
|
||||
If you want to use a different provider or model, edit the **Model Provider**, **Model Name**, and **API Key** fields accordingly.
|
||||
|
||||
6. Click **Playground**, and then ask something relevant to your search query, such as `latest news` or `what's the latest research on the environment?`.
|
||||
|
||||
<details>
|
||||
<summary>Result</summary>
|
||||
|
||||
The LLM uses the search results context, your chat message, and it's built-in training data to respond to your question.
|
||||
For example:
|
||||
|
||||
```text
|
||||
Here are some of the latest news articles related to the environment:
|
||||
Ozone Pollution and Global Warming: A recent study highlights that ozone pollution is a significant global environmental concern, threatening human health and crop production while exacerbating global warming. Read more
|
||||
...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Type Convert parameters
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| input_data | Input Data | Input parameter. The data to convert. Accepts `Data`, `DataFrame`, or `Message` input. |
|
||||
| output_type | Output Type | Input parameter. The desired output type, as one of **Data**, **DataFrame** or **Message**. |
|
||||
| output | Output | Output parameter. The converted data in the specified format. The output port changes depending on the selected **Output Type**. |
|
||||
|
||||
55
docs/docs/Components/url.mdx
Normal file
55
docs/docs/Components/url.mdx
Normal file
@ -0,0 +1,55 @@
|
||||
---
|
||||
title: URL
|
||||
slug: /url
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
The **URL** component fetches content from one or more URLs, processes the content, and returns it in various formats.
|
||||
It follows links recursively to a given depth, and it supports output in plain text or raw HTML.
|
||||
|
||||
### URL parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
Some of the available parameters include the following:
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| urls | URLs | Input parameter. One or more URLs to crawl recursively. In the visual editor, click <Icon name="Plus" aria-hidden="true"/> **Add URL** to add multiple URLs. |
|
||||
| max_depth | Depth | Input parameter. Controls link traversal: how many "clicks" away from the initial page the crawler will go. A depth of 1 limits the crawl to the first page at the given URL only. A depth of 2 means the crawler crawls the first page plus each page directly linked from the first page, then stops. This setting exclusively controls link traversal; it doesn't limit the number of URL path segments or the domain. |
|
||||
| prevent_outside | Prevent Outside | Input parameter. If enabled, only crawls URLs within the same domain as the root URL. This prevents the crawler from accessing sites outside the given URL's domain, even if they are linked from one of the crawled pages. |
|
||||
| use_async | Use Async | Input parameter. If enabled, uses asynchronous loading which can be significantly faster but might use more system resources. |
|
||||
| format | Output Format | Input parameter. Sets the desired output format as **Text** or **HTML**. The default is **Text**. For more information, see [URL output](#url-output).|
|
||||
| timeout | Timeout | Input parameter. Timeout for the request in seconds. |
|
||||
| headers | Headers | Input parameter. The headers to send with the request if needed for authentication or otherwise. |
|
||||
|
||||
Additional input parameters are available for error handling and encoding.
|
||||
|
||||
### URL output
|
||||
|
||||
There are two settings that control the output of the **URL** component at different stages:
|
||||
|
||||
* **Output Format**: This optional parameter controls the content extracted from the crawled pages:
|
||||
|
||||
* **Text (default)**: The component extracts only the text from the HTML of the crawled pages.
|
||||
* **HTML**: The component extracts the entire raw HTML content of the crawled pages.
|
||||
|
||||
* **Output data type**: In the component's output field (near the output port) you can select the structure of the outgoing data when it is passed to other components:
|
||||
|
||||
* **Extracted Pages**: Outputs a [`DataFrame`](/data-types#dataframe) that breaks the crawled pages into columns for the entire page content (`text`) and metadata like `url` and `title`.
|
||||
* **Raw Content**: Outputs a [`Message`](/data-types#message) containing the entire text or HTML from the crawled pages, including metadata, in a single block of text.
|
||||
|
||||
When used as a standard component in a flow, the **URL** component must be connected to a component that accepts the selected output data type (`DataFrame` or `Message`).
|
||||
You can connect the **URL** component directly to a compatible component, or you can use a [**Type Convert** component](/type-convert) to convert the output to another type before passing the data to other components if the data types aren't directly compatible.
|
||||
|
||||
Processing components like the **Type Convert** component are useful with the **URL** component because it can extract a large amount of data from the crawled pages.
|
||||
For example, if you only want to pass specific fields to other components, you can use a [**Parser** component](/parser) to extract only that data from the crawled pages before passing the data to other components.
|
||||
|
||||
When used in **Tool Mode** with an **Agent** component, the **URL** component can be connected directly to the **Agent** component's **Tools** port without converting the data.
|
||||
The agent decides whether to use the **URL** component based on the user's query, and it can process the `DataFrame` or `Message` output directly.
|
||||
|
||||
80
docs/docs/Components/web-search.mdx
Normal file
80
docs/docs/Components/web-search.mdx
Normal file
@ -0,0 +1,80 @@
|
||||
---
|
||||
title: Web Search
|
||||
slug: /web-search
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
The **Web Search** component performs a basic web search using DuckDuckGo's HTML scraping interface.
|
||||
For other search APIs, see <Icon name="Blocks" aria-hidden="true" /> [**Bundles**](/components-bundle-components).
|
||||
|
||||
:::info
|
||||
The **Web Search** component uses web scraping that can be subject to rate limits.
|
||||
|
||||
For production use, consider using another search component with more robust API support, such as provider-specific bundles.
|
||||
:::
|
||||
|
||||
### Use the Web Search component in a flow
|
||||
|
||||
The following steps demonstrate one way that you can use a **Web Search** component in a flow:
|
||||
|
||||
1. Create a flow based on the **Basic Prompting** template.
|
||||
|
||||
2. Add a **Web Search** component, and then enter a search query, such as `environmental news`.
|
||||
|
||||
3. Add a [**Type Convert** component](/type-convert), set the **Output Type** to **Message**, and then connect the **Web Search** component's output to the **Type Convert** component's input.
|
||||
|
||||
By default, the **Web Search** component outputs a `DataFrame`.
|
||||
Because the **Prompt Template** component only accepts `Message` data, this conversion is required so that the flow can pass the search results to the **Prompt Template** component.
|
||||
For more information, see [Web Search output](#web-search-output).
|
||||
|
||||
5. In the **Prompt Template** component's **Template** field, add a variable like `{searchresults}` or `{context}`.
|
||||
|
||||
This adds a field to the **Prompt Template** component that you can use to pass the converted search results to the prompt.
|
||||
For more information, see [Define variables in prompts](/components-prompts#define-variables-in-prompts).
|
||||
|
||||
6. Connect the **Type Convert** component's output to the new variable field on the **Prompt Template** component.
|
||||
|
||||

|
||||
|
||||
7. In the **Language Model** component, add your OpenAI API key, or select a different provider and model.
|
||||
|
||||
8. Click **Playground**, and then enter `latest news`.
|
||||
|
||||
The LLM processes the request, including the context passed through the **Prompt Template** component, and then prints the response in the **Playground** chat interface.
|
||||
|
||||
<details>
|
||||
<summary>Result</summary>
|
||||
|
||||
The following is an example of a possible response.
|
||||
Your response may vary based on the current state of the web, your specific query, the model, and other factors.
|
||||
|
||||
```text
|
||||
Here are some of the latest news articles related to the environment:
|
||||
Ozone Pollution and Global Warming: A recent study highlights that ozone pollution is a significant global environmental concern, threatening human health and crop production while exacerbating global warming. Read more
|
||||
...
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### Web Search parameters
|
||||
|
||||
| Name | Display Name | Info |
|
||||
|------|--------------|------|
|
||||
| query | Search Query | Input parameter. Keywords to search for. |
|
||||
| timeout | Timeout | Input parameter. Timeout for the web search request in seconds. Default: `5`. |
|
||||
| results | Search Results | Output parameter. Returns a `DataFrame` containing `title`, `links`, and `snippets`. For more information, see [Web Search output](#web-search-output). |
|
||||
|
||||
### Web Search output
|
||||
|
||||
The **Web Search** component outputs a [`DataFrame`](/data-types#dataframe) containing the key columns `title`, `links`, and `snippets`.
|
||||
|
||||
When used as a standard component in a flow, the **Web Search** component must be connected to a component that accepts `DataFrame` input, or you must use a [**Type Convert** component](/type-convert) to convert the output to `Data` or `Message` type before passing the data to other components.
|
||||
|
||||
When used in **Tool Mode** with an **Agent** component, the **Web Search** component can be connected directly to the **Agent** component's **Tools** port without converting the data.
|
||||
The agent decides whether to use the **Web Search** component based on the user's query, and it can process the `DataFrame` output directly.
|
||||
|
||||
35
docs/docs/Components/webhook.mdx
Normal file
35
docs/docs/Components/webhook.mdx
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
title: Webhook
|
||||
slug: /component-webhook
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
|
||||
The **Webhook** component defines a webhook trigger that runs a flow when it receives an HTTP POST request.
|
||||
|
||||
### Trigger the webhook
|
||||
|
||||
When you add a **Webhook** component to your flow, a **Webhook curl** tab is added to the flow's [**API Access** pane](/concepts-publish#api-access).
|
||||
This tab automatically generates an HTTP POST request code snippet that you can use to trigger your flow through the **Webhook** component.
|
||||
For example:
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
"http://$LANGFLOW_SERVER_ADDRESS/api/v1/webhook/$FLOW_ID" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'x-api-key: $LANGFLOW_API_KEY' \
|
||||
-d '{"any": "data"}'
|
||||
```
|
||||
|
||||
For more information, see [Trigger flows with webhooks](/webhook).
|
||||
|
||||
### Webhook parameters
|
||||
|
||||
| Name | Display Name | Description |
|
||||
|------|--------------|-------------|
|
||||
| data | Payload | Input parameter. Receives a payload from external systems through HTTP POST requests. |
|
||||
| curl | curl | Input parameter. The curl command template for making requests to this webhook. |
|
||||
| endpoint | Endpoint | Input parameter. The endpoint URL where this webhook receives requests. |
|
||||
| output_data | Data | Output parameter. The processed data from the webhook input. Returns an empty [`Data`](/data-types#data) object if no input is provided. If the input isn't valid JSON, the **Webhook** component wraps it in a `payload` object so that it can be accepted as input to trigger the flow. |
|
||||
|
||||
73
docs/docs/Components/write-file.mdx
Normal file
73
docs/docs/Components/write-file.mdx
Normal file
@ -0,0 +1,73 @@
|
||||
---
|
||||
title: Write File
|
||||
slug: /write-file
|
||||
---
|
||||
|
||||
import Icon from "@site/src/components/icon";
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
||||
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
||||
|
||||
In Langflow version 1.7.0, this component was renamed from **Save File** to **Write File**.
|
||||
|
||||
The **Write File** component creates a file containing data produced by another component.
|
||||
Several file formats are supported, and you can store files in [Langflow storage](/memory), AWS S3, Google Drive, or the local file system.
|
||||
|
||||
To configure the **Write File** component and use it in a flow, do the following:
|
||||
|
||||
1. Connect [`DataFrame`](/data-types#dataframe), [`Data`](/data-types#data), or [`Message`](/data-types#message) output from another component to the **Write File** component's **Input** port.
|
||||
|
||||
You can connect the same output to multiple **Write File** components if you want to create multiple files, save the data in different file formats, or save files to multiple locations.
|
||||
|
||||
2. In **File Name**, enter a file name and an optional path.
|
||||
|
||||
The **File Name** parameter controls where the file is saved.
|
||||
It can contain a file name or an entire file path:
|
||||
|
||||
* **Default location**: If you only provide a file name, then the file is stored in the Langflow data directory. For example,`~/Library/Caches/langflow/data` on macOS.
|
||||
|
||||
* **Subdirectory**: To store files in subdirectories, add the path to the **File Name** parameter.
|
||||
If a given subdirectory doesn't already exist, Langflow automatically creates it.
|
||||
For example, `files/my_file` creates `my_file` in `/data/files`, and it creates the `files` subdirectory if it doesn't already exist.
|
||||
|
||||
* **Absolute or relative path**: To store files elsewhere in your environment or local file storage, provide the absolute or relative path to the desired location.
|
||||
For example, `~/Desktop/my_file` saves `my_file` to the desktop.
|
||||
|
||||
Don't include an extension in the file name.
|
||||
If you do, the extension is treated as part of the file name; it has no impact on the **File Format** parameter.
|
||||
|
||||
3. In the [component's header menu](/concepts-components#component-menus), click <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls**, select the desired file format, and then click **Close**.
|
||||
|
||||
The available **File Format** options depend on the input data type:
|
||||
|
||||
* `DataFrame` can be saved to CSV (default), Excel (requires `openpyxl` [custom dependency](/install-custom-dependencies)), JSON (fallback default), or Markdown.
|
||||
|
||||
* `Data` can be saved to CSV, Excel (requires `openpyxl` [custom dependency](/install-custom-dependencies)), JSON (default), or Markdown.
|
||||
|
||||
* `Message` can be saved to TXT, JSON (default), or Markdown.
|
||||
|
||||
:::warning Overwrites allowed
|
||||
If you have multiple **Write File** components, in one or more flows, with the same file name, path, and extension, the file contains the data from the most recent run only.
|
||||
Langflow doesn't block overwrites if a matching file already exists.
|
||||
To avoid unintended overwrites, use unique file names and paths.
|
||||
:::
|
||||
|
||||
4. To test the **Write File** component, click <Icon name="Play" aria-hidden="true" /> **Run component**, and then click <Icon name="TextSearch" aria-hidden="true" /> **Inspect output** to get the filepath where the file was saved.
|
||||
|
||||
The component's literal output is a `Message` containing the original data type, the file name and extension, and the absolute filepath to the file based on the **File Name** parameter.
|
||||
For example:
|
||||
|
||||
```text
|
||||
DataFrame saved successfully as 'my_file.csv' at /Users/user.name/Library/Caches/langflow/data/my_file.csv
|
||||
```
|
||||
|
||||
If the **File Name** contains a subdirectory or other non-default path, this is reflected in the `Message` output.
|
||||
For example, a CSV file with the file name `~/Desktop/my_file` could produce the following output:
|
||||
|
||||
```text
|
||||
DataFrame saved successfully as '/Users/user.name/Desktop/my_file.csv' at /Users/user.name/Desktop/my_file.csv
|
||||
```
|
||||
|
||||
5. Optional: If you want to use the saved file in a flow, you must use an API call or another component to retrieve the file from the given filepath.
|
||||
|
||||
@ -321,7 +321,7 @@ LANGFLOW_CORS_ALLOW_METHODS=GET,POST,PUT
|
||||
|
||||
### SSRF protection {#ssrf-protection}
|
||||
|
||||
The following environment variables configure Server-Side Request Forgery (SSRF) protection for the [**API Request** component](/components-data#api-request).
|
||||
The following environment variables configure Server-Side Request Forgery (SSRF) protection for the [**API Request** component](/api-request).
|
||||
SSRF protection prevents requests to internal or private network resources, such as private IP ranges, loopback addresses, and cloud metadata endpoints.
|
||||
|
||||
| Variable | Format | Default | Description |
|
||||
|
||||
@ -50,17 +50,17 @@ To use files in your Langflow file management system in a flow, add a component
|
||||
|
||||
For example, add a **Read File** component to your flow, click **Select files**, and then select files from the **My Files** list.
|
||||
|
||||
This list includes all files in your server's file management system, but you can only select [file types that are supported by the **Read File** component](/components-data#file).
|
||||
This list includes all files in your server's file management system, but you can only select [file types that are supported by the **Read File** component](/read-file).
|
||||
If you need another file type, you must use a different component that supports that file type, or you need to convert it to a supported type before uploading it.
|
||||
|
||||
For more information about the **Read File** component and other data loading components, see [Data components](/components-data).
|
||||
For more information about the **Read File** component and other data loading components, see the [**Read file** component](/read-file).
|
||||
|
||||
### Load files at runtime
|
||||
|
||||
You can use preloaded files in your flows, and you can load files at runtime, if your flow accepts file input.
|
||||
To enable file input in your flow, do the following:
|
||||
|
||||
1. Add a [**Read File** component](/components-data#file) to your flow.
|
||||
1. Add a [**Read File** component](/read-file) to your flow.
|
||||
|
||||
2. Click **Share**, select **API access**, and then click **Input Schema** to add [`tweaks`](/concepts-publish#input-schema) to the request payload in the flow's automatically generated code snippets.
|
||||
|
||||
@ -128,5 +128,4 @@ For videos, see the **Twelve Labs** and **YouTube** <Icon name="Blocks" aria-hid
|
||||
|
||||
## See also
|
||||
|
||||
* [Data components](/components-data)
|
||||
* [Processing components](/components-processing)
|
||||
* [Components reference](/concepts-components)
|
||||
@ -22,7 +22,7 @@ When building flows, connect output ports to input ports of the same type (color
|
||||
* In the [workspace](/concepts-overview#workspace), hover over a port to see connection details for that port.
|
||||
Click a port to <Icon name="Search" aria-hidden="true" /> **Search** for compatible components.
|
||||
|
||||
* If two components have incompatible data types, you can use a processing component like the [**Type Convert** component](/components-processing#type-convert) to convert the data between components.
|
||||
* If two components have incompatible data types, you can use a processing component like the [**Type Convert** component](/type-convert) to convert the data between components.
|
||||
:::
|
||||
|
||||
## Data
|
||||
@ -159,7 +159,7 @@ You can inspect the [component code](/concepts-components#component-code) to see
|
||||
|
||||
**Memory** ports <Icon name="Circle" size="16" aria-label="Orange memory port" style={{ color: '#f97316', fill: '#f97316' }} /> are used to integrate a **Message History** component with external chat memory storage.
|
||||
|
||||
For more information, see the [**Message History** component](/components-helpers#message-history).
|
||||
For more information, see the [**Message History** component](/message-history).
|
||||
|
||||
## Message
|
||||
|
||||
@ -217,14 +217,14 @@ The strictness depends on the component.
|
||||
|
||||
### Message data in Input and Output components
|
||||
|
||||
In flows with [**Chat Input and Output** components](/components-io#chat-io), `Message` data provides a consistent structure for chat interactions, and it is ideal for chatbots, conversational analysis, and other use cases based on a dialogue with an LLM or agent.
|
||||
In flows with [**Chat Input and Output** components](/chat-input-and-output), `Message` data provides a consistent structure for chat interactions, and it is ideal for chatbots, conversational analysis, and other use cases based on a dialogue with an LLM or agent.
|
||||
In these flows, the **Playground** chat interface prints only the `Message` attributes that are relevant to the conversation, such as `text`, `files`, and error messages from `content_blocks`.
|
||||
To see all `Message` attributes, inspect the message logs in the **Playground**.
|
||||
|
||||
In flows with [**Text Input and Output** components](/components-io#text-io), `Message` data is used to pass simple text strings without the chat-related metadata.
|
||||
In flows with [**Text Input and Output** components](/text-input-and-output), `Message` data is used to pass simple text strings without the chat-related metadata.
|
||||
These components handle `Message` data as independent text strings, not as part of an ongoing conversation.
|
||||
For this reason, a flow with only **Text Input and Output** components isn't compatible with the **Playground**.
|
||||
For more information, see [Input and output components](/components-io).
|
||||
For more information, see [Text input and output components](/text-input-and-output).
|
||||
|
||||
When using the Langflow API, the response includes the `Message` object along with other response data from the flow run.
|
||||
Langflow API responses can be extremely verbose, so your applications must include code to extract relevant data from the response to return to the user.
|
||||
@ -255,7 +255,7 @@ Hover over the port to see the accepted or produced data types.
|
||||
In Langflow, you can use <Icon name="TextSearch" aria-hidden="true" /> **Inspect output** to view the output of individual components.
|
||||
This can help you learn about the different data type and debug problems with invalid or malformed inputs and output.
|
||||
|
||||
The following example shows how to inspect the output of a [**Type Convert** component](/components-processing#type-convert), which can convert data from one type to another:
|
||||
The following example shows how to inspect the output of a [**Type Convert** component](/type-convert), which can convert data from one type to another:
|
||||
|
||||
1. Create a flow, and then connect a **Chat Input** component to a **Type Convert** component.
|
||||
|
||||
@ -336,7 +336,6 @@ The following example shows how to inspect the output of a [**Type Convert** com
|
||||
|
||||
## See also
|
||||
|
||||
- [Processing components](/components-processing)
|
||||
- [Custom components](/components-custom-components)
|
||||
- [Pydantic Models](https://docs.pydantic.dev/latest/api/base_model/)
|
||||
- [pandas.DataFrame](https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.html)
|
||||
@ -91,7 +91,7 @@ To monitor Langflow logs as they are generated, you can follow the log file:
|
||||
## Flow and component logs
|
||||
|
||||
After you run a flow, you can inspect the logs for the each component and flow run.
|
||||
For example, you can inspect `Message` objects ingested and generated by [Input and Output components](/components-io).
|
||||
For example, you can inspect `Message` objects ingested and generated by [Input and Output components](/chat-input-and-output).
|
||||
|
||||
### View flow logs
|
||||
|
||||
|
||||
@ -172,7 +172,7 @@ All messages are stored in [Langflow storage](#storage-options-and-paths), and t
|
||||
Typically, this is necessary only if you have specific storage needs that aren't met by Langflow storage.
|
||||
For example, if you want to manage chat memory data by directly working with the database, or if you want to use a different database than the default Langflow storage.
|
||||
|
||||
For more information and examples, see [**Message History** component](/components-helpers#message-history) and [Agent memory](/agents#agent-memory).
|
||||
For more information and examples, see [**Message History** component](/message-history) and [Agent memory](/agents#agent-memory).
|
||||
|
||||
## See also
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ The `my_custom_session_value` value is used in components that accept it, and th
|
||||
|
||||
## Retrieval of messages from memory by session ID
|
||||
|
||||
To retrieve messages from local Langflow memory, add a [**Message History** component](/components-helpers#message-history) to your flow.
|
||||
To retrieve messages from local Langflow memory, add a [**Message History** component](/message-history) to your flow.
|
||||
The component accepts `sessionID` as a filter parameter, and uses the session ID value from upstream automatically to retrieve message history by session ID from storage.
|
||||
|
||||
Messages can be retrieved by `session_id` from the Langflow API at `GET /v1/monitor/messages`. For more information, see [Monitor endpoints](https://docs.langflow.org/api-monitor).
|
||||
|
||||
@ -17,7 +17,7 @@ The **Playground** allows you to quickly iterate over your flow's logic and beha
|
||||
## Run a flow in the Playground
|
||||
|
||||
To run a flow in the **Playground**, open the flow, and then click <Icon name="Play" aria-hidden="true"/> **Playground**.
|
||||
Then, if your flow has a [**Chat Input** component](/components-io), enter a prompt or [use voice mode](/concepts-voice-mode) to trigger the flow and start a chat session.
|
||||
Then, if your flow has a [**Chat Input** component](/chat-input-and-output), enter a prompt or [use voice mode](/concepts-voice-mode) to trigger the flow and start a chat session.
|
||||
|
||||
:::tip
|
||||
If there is no message input field in the **Playground**, make sure your flow has a **Chat Input** component that is connected, directly or indirectly, to the **Input** port of a **Language Model** or **Agent** component.
|
||||
@ -82,7 +82,7 @@ You can set custom session IDs in the visual editor and programmatically.
|
||||
<Tabs>
|
||||
<TabItem value="visual" label="Visual editor" default>
|
||||
|
||||
In your [input and output components](/components-io), use the **Session ID** field:
|
||||
In your [input and output components](/chat-input-and-output), use the **Session ID** field:
|
||||
|
||||
1. Click the component where you want to set a custom session ID.
|
||||
2. In the [component's header menu](/concepts-components#component-menus), click <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls**.
|
||||
|
||||
@ -122,7 +122,7 @@ For each flow, Langflow provides a code snippet that you can insert into the `<b
|
||||
The chat widget only supports flows that have **Chat Input** and **Chat Output** components, which are required for the chat experience.
|
||||
**Text Input** and **Text Output** components can send and receive messages, but they don't include ongoing LLM chat context.
|
||||
|
||||
Attempting to chat with a flow that doesn't have [**Chat Input** component](/components-io) will trigger the flow, but the response only indicates that the input was empty.
|
||||
Attempting to chat with a flow that doesn't have a [**Chat Input** component](/chat-input-and-output) will trigger the flow, but the response only indicates that the input was empty.
|
||||
:::
|
||||
|
||||
### Get a langflow-chat snippet
|
||||
|
||||
@ -23,7 +23,7 @@ To use the **Webhook** component in a flow, do the following:
|
||||
|
||||
1. In Langflow, open the flow where you want to use the **Webhook** component.
|
||||
|
||||
2. Add a [**Webhook** component](/components-data#webhook) and a [**Parser** component](/components-processing#parser) to your flow.
|
||||
2. Add a [**Webhook** component](/webhook) and a [**Parser** component](/parser) to your flow.
|
||||
|
||||
These two components are commonly paired together because the **Parser** component extracts relevant data from the raw payload received by the **Webhook** component.
|
||||
|
||||
@ -124,5 +124,5 @@ Then, you can examine the string output and troubleshoot your parsing template,
|
||||
## See also
|
||||
|
||||
- [Get started with the Langflow API](/api-reference-api-examples)
|
||||
- [**Webhook** component](/components-data#webhook)
|
||||
- [**Webhook** component](/webhook)
|
||||
- [Flow trigger endpoints](/api-flows-run)
|
||||
@ -53,7 +53,7 @@ Get started with Langflow by loading a template flow, running it, and then servi
|
||||
|
||||

|
||||
|
||||
The **Simple Agent** template consists of an [**Agent** component](/agents) connected to [**Chat Input** and **Chat Output** components](/components-io), a [**Calculator** component](/components-helpers#calculator), and a [**URL** component](/components-data#url). When you run this flow, you submit a query to the agent through the **Chat Input** component, the agent uses the **Calculator** and **URL** tools to generate a response, and then returns the response through the **Chat Output** component.
|
||||
The **Simple Agent** template consists of an [**Agent** component](/agents) connected to [**Chat Input** and **Chat Output** components](/chat-input-and-output), a [**Calculator** component](/calculator), and a [**URL** component](/url). When you run this flow, you submit a query to the agent through the **Chat Input** component, the agent uses the **Calculator** and **URL** tools to generate a response, and then returns the response through the **Chat Output** component.
|
||||
|
||||
Many components can be tools for agents, including [Model Context Protocol (MCP) servers](/mcp-server). The agent decides which tools to call based on the context of a given query.
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ For all changes, see the [Changelog](https://github.com/langflow-ai/langflow/rel
|
||||
|
||||
- SSRF protection
|
||||
|
||||
Added SSRF (Server-Side Request Forgery) protection to the [**API Request** component](/components-data#api-request). HTTP redirects are disabled by default to prevent SSRF bypass attacks. To enable SSRF protection, set `LANGFLOW_SSRF_PROTECTION_ENABLED=TRUE`. Configure allowed hosts with `LANGFLOW_SSRF_ALLOWED_HOSTS`. Flows that relied on automatic redirects will need to enable it manually.
|
||||
Added SSRF (Server-Side Request Forgery) protection to the [**API Request** component](/api-request). HTTP redirects are disabled by default to prevent SSRF bypass attacks. To enable SSRF protection, set `LANGFLOW_SSRF_PROTECTION_ENABLED=TRUE`. Configure allowed hosts with `LANGFLOW_SSRF_ALLOWED_HOSTS`. Flows that relied on automatic redirects will need to enable it manually.
|
||||
|
||||
- Changes to read/write file components
|
||||
|
||||
@ -72,21 +72,21 @@ For all changes, see the [Changelog](https://github.com/langflow-ai/langflow/rel
|
||||
|
||||
New filter operator for **DataFrame Operations** component
|
||||
|
||||
The [**DataFrame Operations** component](components-processing#dataframe-operations) now includes a `not contains` filter operator.
|
||||
The [**DataFrame Operations** component](/dataframe-operations) now includes a `not contains` filter operator.
|
||||
Use it to clean data by extracting only records that _don't_ contain specific values.
|
||||
For example, you can filter out invalid email addresses that don't contain `@`.
|
||||
|
||||
New JSON operations for **Data Operations** component
|
||||
|
||||
The [**Data Operations** component](components-processing#data-operations) now includes two operations for advanced JSON data manipulation.
|
||||
The [**Data Operations** component](/data-operations) now includes two operations for advanced JSON data manipulation.
|
||||
The **Path Selection** operation extracts values from nested JSON structures, and the **JQ Expression** operation uses the [`jq`](https://jqlang.org/) query language to perform advanced JSON filtering, projections, and transformations.
|
||||
|
||||
New [**Smart Router** component](/components-logic#smart-router)
|
||||
New [**Smart Router** component](/smart-router)
|
||||
|
||||
New [**Mock Data** component](/components-data#mock-data)
|
||||
New [**Mock Data** component](/mock-data)
|
||||
|
||||
New [**Dynamic Create Data** component](/dynamic-create-data)
|
||||
|
||||
New [**Dynamic Create Data** component](/components-processing#dynamic-create-data)
|
||||
|
||||
New [**ALTK** bundle](/bundles-altk)
|
||||
|
||||
New [**CometAPI** bundle](/bundles-cometapi)
|
||||
@ -180,7 +180,7 @@ This is expected behavior.
|
||||
|
||||
To make it easier to use the [**Docling** components](/bundles-docling) and the **Read File** component's new advanced parsing feature, the Docling dependency is now included with Langflow for all operating systems except macOS Intel (x86_64).
|
||||
|
||||
For more information, see [Advanced parsing](/components-data#advanced-parsing).
|
||||
For more information, see [Advanced parsing](/read-file#advanced-parsing).
|
||||
|
||||
- Reorganized component menus and visual editor controls
|
||||
|
||||
@ -249,9 +249,8 @@ For all changes, see the [Changelog](https://github.com/langflow-ai/langflow/rel
|
||||
|
||||
The [**MCP Tools** component](/mcp-client) is now under the **Agents** category.
|
||||
|
||||
Tools that performed the same function were combined into single components that support multiple providers, such as the [**Web Search** component](/components-data#web-search) and the [**News Search** component](/components-data#news-search).
|
||||
Tools that performed the same function were combined into single components that support multiple providers, such as the [**Web Search** component](/web-search) and the [**News Search** component](/news-search).
|
||||
|
||||
For more information, see [Tools components](/components-tools).
|
||||
|
||||
- Stability improvements
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ If you still cannot locate the component, see [Langflow GitHub Issues and Discus
|
||||
|
||||
## No input in the Playground
|
||||
|
||||
If there is no message input field in the **Playground**, make sure your flow has a [**Chat Input** component](/components-io#chat-io) that is connected, directly or indirectly, to the **Input** port of a **Language Model** or **Agent** component.
|
||||
If there is no message input field in the **Playground**, make sure your flow has a [**Chat Input** component](/chat-input-and-output) that is connected, directly or indirectly, to the **Input** port of a **Language Model** or **Agent** component.
|
||||
|
||||
Because the **Playground** is designed for flows that use an LLM in a query-and-response format, such as chatbots and agents, a flow must have **Chat Input**, **Language Model**/**Agent**, and **Chat Output** components to be fully supported by the **Playground** chat interface.
|
||||
|
||||
@ -283,7 +283,7 @@ Alternatively, configure Langflow Desktop to accept connections from WSL at the
|
||||
## Token length limit errors in Embedding Model components
|
||||
|
||||
Token length errors can happen if your chunking strategy doesn't align with your embedding model's tokenization limits.
|
||||
For more information, see [Tokenization errors due to chunk size](/components-processing#chunk-size).
|
||||
For more information, see [Tokenization errors due to chunk size](/split-text#chunk-size).
|
||||
|
||||
## Custom components and integrations issues
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ This tutorial uses an OpenAI LLM. If you want to use a different provider, you n
|
||||
|
||||
## Create an agent flow
|
||||
|
||||
The following steps modify the **Simple Agent** template to connect a [**Directory** component](/components-data#directory) and a [**Web Search** component](/components-data#web-search) as tools for an **Agent** component.
|
||||
The following steps modify the **Simple Agent** template to connect a [**Directory** component](/directory) and a [**Web Search** component](/web-search) as tools for an **Agent** component.
|
||||
The **Directory** component loads all files of a given type from a target directory on your local machine, and the **Web Search** component performs a DuckDuckGo search.
|
||||
When connected to an **Agent** component as tools, the agent has the option to use these components when handling requests.
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ To do this, edit the **Template** field, and then replace the default prompt wit
|
||||
For this tutorial, the variables are named after the components that connect to them: **chat-input** for the **Chat Input** component and **file** for the **Read File** component.
|
||||
:::
|
||||
|
||||
5. Add a [**Read File** component](/components-data#file) to the flow, and then connect the **Raw Content** output port to the **Prompt Template** component's **file** input port.
|
||||
5. Add a [**Read File** component](/read-file) to the flow, and then connect the **Raw Content** output port to the **Prompt Template** component's **file** input port.
|
||||
To connect ports, click and drag from one port to the other.
|
||||
|
||||
You can add files directly to the **Read File** component to pre-load input before running the flow, or you can load files at runtime. The next section of this tutorial covers runtime file uploads.
|
||||
@ -211,7 +211,7 @@ def chat_with_flow(input_message, file_paths):
|
||||
tweaks[component_id] = {"path": file_path}
|
||||
```
|
||||
|
||||
You can also use a [**Directory** component](/components-data#directory) to load all files in a directory or pass an archive file to the **Read File** component.
|
||||
You can also use a [**Directory** component](/directory) to load all files in a directory or pass an archive file to the **Read File** component.
|
||||
|
||||
### Upload external files at runtime
|
||||
|
||||
@ -225,4 +225,4 @@ In the visual editor, you can preload files to the **Read File** component by se
|
||||
|
||||
For example, you can preload an instructions file for a prompt template, or you can preload a vector store with documents that you want to query in a Retrieval Augmented Generation (RAG) flow.
|
||||
|
||||
For more information about the **Read File** component and other data loading components, see [Data components](/components-data).
|
||||
For more information about the **Read File** component and other data loading components, see the [**Read File** component](/read-file).
|
||||
@ -9,7 +9,7 @@ If you aren't sure how to replace a legacy component, <Icon name="Search" aria-h
|
||||
The component may have been deprecated in favor of a completely new component, a similar component, or a new version of the same component in a different category.
|
||||
|
||||
If there is no obvious replacement, consider whether another component can be adapted to your use case.
|
||||
For example, many <Icon name="Component" aria-hidden="true" /> **Core components** provide generic functionality that can support multiple providers and use cases, such as the [**API Request** component](/components-data#api-request).
|
||||
For example, many <Icon name="Component" aria-hidden="true" /> **Core components** provide generic functionality that can support multiple providers and use cases, such as the [**API Request** component](/api-request).
|
||||
|
||||
If neither of these options are viable, you could use the legacy component's code to create your own custom component, or [start a discussion](/contributing-github-issues) about the legacy component.
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ Make sure the components connect to the same vector store, and that the componen
|
||||
Mixing embedding models in the same vector store can produce inaccurate search results.
|
||||
:::
|
||||
|
||||
4. Recommended: In the [**Split Text** component](/components-processing#split-text), optimize the chunking settings for your embedding model.
|
||||
4. Recommended: In the [**Split Text** component](/split-text), optimize the chunking settings for your embedding model.
|
||||
For example, if your embedding model has a token limit of 512, then the **Chunk Size** parameter must not exceed that limit.
|
||||
|
||||
Additionally, because the **Retriever** subflow passes the chat input directly to the vector store component for vector search, make sure that your chat input string doesn't exceed your embedding model's limits.
|
||||
|
||||
@ -202,7 +202,18 @@ const config = {
|
||||
},
|
||||
{
|
||||
to: "/concepts-components",
|
||||
from: ["/components", "/components-overview"],
|
||||
from: [
|
||||
"/components",
|
||||
"/components-overview",
|
||||
"/components-processing",
|
||||
"/components-data",
|
||||
"/components-files",
|
||||
"/components-logic",
|
||||
"/components-tools",
|
||||
"/components-io",
|
||||
"/components-helpers",
|
||||
"/components-memories",
|
||||
],
|
||||
},
|
||||
{
|
||||
to: "/configuration-global-variables",
|
||||
@ -327,10 +338,6 @@ const config = {
|
||||
to: "/data-types",
|
||||
from: "/concepts-objects",
|
||||
},
|
||||
{
|
||||
to: "/components-helpers",
|
||||
from: "/components-memories",
|
||||
},
|
||||
{
|
||||
to: "/bundles-apify",
|
||||
from: "/integrations-apify",
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
"openapi": "3.1.0",
|
||||
"info": {
|
||||
"title": "Langflow",
|
||||
"version": "1.6.5"
|
||||
"version": "1.6.8"
|
||||
},
|
||||
"paths": {
|
||||
"/api/v1/build/{flow_id}/vertices": {
|
||||
|
||||
@ -266,28 +266,92 @@ module.exports = {
|
||||
type: "category",
|
||||
label: "Core components",
|
||||
items: [
|
||||
"Components/components-io",
|
||||
"Components/components-agents",
|
||||
{
|
||||
type: "category",
|
||||
label: "Models",
|
||||
label: "Input / Output",
|
||||
items: [
|
||||
"Components/components-models",
|
||||
"Components/components-embedding-models",
|
||||
"Components/chat-input-and-output",
|
||||
"Components/text-input-and-output",
|
||||
"Components/webhook",
|
||||
]
|
||||
},
|
||||
"Components/components-data",
|
||||
{
|
||||
type: "category",
|
||||
label: "Processing",
|
||||
items: [
|
||||
"Components/components-processing",
|
||||
"Components/components-prompts",
|
||||
"Components/data-operations",
|
||||
"Components/dataframe-operations",
|
||||
"Components/dynamic-create-data",
|
||||
"Components/parser",
|
||||
"Components/split-text",
|
||||
"Components/type-convert",
|
||||
]
|
||||
},
|
||||
"Components/components-logic",
|
||||
"Components/components-helpers",
|
||||
"Components/components-tools",
|
||||
{
|
||||
type: "category",
|
||||
label: "Data Source",
|
||||
items: [
|
||||
"Components/api-request",
|
||||
"Components/mock-data",
|
||||
"Components/url",
|
||||
"Components/web-search",
|
||||
"Components/news-search",
|
||||
"Components/rss-reader",
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "Files and Knowledge",
|
||||
items: [
|
||||
"Components/directory",
|
||||
"Components/read-file",
|
||||
"Components/write-file",
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "Flow Controls",
|
||||
items: [
|
||||
"Components/if-else",
|
||||
"Components/loop",
|
||||
"Components/notify-and-listen",
|
||||
"Components/run-flow",
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "LLM Operations",
|
||||
items: [
|
||||
"Components/batch-run",
|
||||
"Components/llm-router",
|
||||
"Components/smart-router",
|
||||
"Components/smart-transform",
|
||||
"Components/structured-output",
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "Models and Agents",
|
||||
items: [
|
||||
"Components/components-models",
|
||||
"Components/components-prompts",
|
||||
"Components/components-agents",
|
||||
"Components/mcp-tools",
|
||||
"Components/components-embedding-models",
|
||||
"Components/message-history",
|
||||
]
|
||||
},
|
||||
{
|
||||
type: "category",
|
||||
label: "Utilities",
|
||||
items: [
|
||||
"Components/calculator",
|
||||
"Components/current-date",
|
||||
"Components/python-interpreter",
|
||||
"Components/sql-database",
|
||||
]
|
||||
},
|
||||
"Components/legacy-core-components",
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user