docs: 1.5 release (#8387)

* publish-pane

* export-flow

* update-publish-page-for-input-schema

* input-schema

* mcp-one-click-install

* release-notes

* models-components-page

* components-updates

* url-example

* embedding-model-example

* models

* release-notes

* data-components-new-intro

* docs: update data components section for clarity and detail

* move-batch-run

* add-sql-component-example

* type-convert

* anchor

* type-convert-and-web-search-example

* fix-broken-links

* overview-and-screenshots

* playground-componente-and-overview

* import-and-export-flows

* fix-build-error

* move-em-and-em-bundled-components

* links-to-embeddings

* smart-filter

* python-repl

* processing-done

* screenshot-for-python-interpreter

* message-history-component

* include-imports

* merge-conflict

* fix: update link in memories documentation and add icon import to API example

* move-agent-components

* starter-flow-updates

* components-and-overview

* fix-links

* api-pane-screenshot

* quickstart

* link

* merge-conflicts-builds-successfully

* add-document-analysis-metadata

* Apply suggestions from code review

Co-authored-by: KimberlyFields <46325568+KimberlyFields@users.noreply.github.com>

* docs-review

* release-notes

* broken-links

* add-language-model-output-example-andupdate-screenshot

* add-auth-to-release-notes

* replace-astra-chat-memory

* move-memories-to-bundles

* component-screenshots

* component-screenshots

* Apply suggestions from code review

Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>

* clarify-global-env-with-export

* further-explanation

* docs-review

* Add LLM Router component documentation and image

* remove-text-summarizer-example

* multiple-mcp-clients

* update-mcp-tools-client-use

* export-flow-api-keys

* uncomment-prompts-and-fix-build-error

* docs-review

* bundles-and-embeddings-docs-review

* language-model-docs-review

* restore-see-alsos

* Apply suggestions from code review

Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>

* mcp-autoinstall

* template-explanations

* Apply suggestions from code review

Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: KimberlyFields <46325568+KimberlyFields@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>

* release-notes

* Apply suggestions from code review

Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>

* fix-links

* mcp-settings-page

* Apply suggestions from code review

Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>

* update-actions-to-tools

* cleanup-mcp-nomenclature

* Update docs/docs/Support/release-notes.md

* output-type-selection

* replace-changelog-with-release-notes

* cleanup

* input-schema-name-endpoint

---------

Co-authored-by: KimberlyFields <46325568+KimberlyFields@users.noreply.github.com>
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
This commit is contained in:
Mendon Kissling 2025-07-10 10:54:17 -04:00 committed by GitHub
commit ea6bbc7666
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
94 changed files with 3157 additions and 2475 deletions

View file

@ -34,7 +34,7 @@ Agents are most useful when they have the appropriate tools available to complet
An Agent component can use any Langflow component as a tool, as long as you attach it to the Agent component.
:::tip
To allow agents to use tools from MCP servers, use the [**MCP connection** component](/components-tools#mcp-connection).
To allow agents to use tools from MCP servers, use the [**MCP Tools** component](/components-tools#mcp-connection).
:::
When you attach a component as a tool, you must configure the component as a tool by enabling **Tool Mode**.

View file

@ -56,6 +56,18 @@ For more information on this component, see the [Agent documentation](/agents).
</details>
## MCP tools {#mcp-connection}
:::important
Prior to Langflow 1.5, this component was named **MCP connection**.
:::
The **MCP tools** component connects to a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server and exposes the MCP server's tools as tools for Langflow agents.
In addition to being an MCP client that can leverage MCP servers, the **MCP tools** component's [SSE mode](/mcp-client#mcp-sse-mode) allows you to connect your flow to the Langflow MCP server at the `/api/v1/mcp/sse` API endpoint, exposing all flows within your [project](/concepts-overview#projects) as tools within a flow.
For more information, see [MCP client](/mcp-client).
## Legacy components
**Legacy** components are available for use but are no longer supported.

File diff suppressed because it is too large Load diff

View file

@ -11,17 +11,25 @@ Data components load data from a source into your flow.
They may perform some processing or type checking, like converting raw HTML data into text, or ensuring your loaded file is of an acceptable type.
## Use a data component in a flow
## Use data components in a flow
The **URL** data component loads content from a list of URLs.
Components like [News search](#news-search), [RSS reader](#rss-reader), and [Web search](#web-search) all fetch data into Langflow, and connect to Langflow in the same way. They can output the retrieved data in [DataFrame](/concepts-objects#dataframe-object) format, or can be connected to an **Agent** component to be used as tools.
In the component's **URLs** field, enter the URL you want to load. To add multiple URL fields, click <Icon name="Plus" aria-hidden="true"/> **Add URL**.
For example, to connect all three components to an Agent component, do the following:
Alternatively, connect a component that outputs the `Message` type, like the **Chat Input** component, to supply your URLs from a component.
1. Create the [Simple Agent starter flow](/simple-agent).
2. In the **Agent** component, in the **OpenAI API Key** field, add your OpenAI API key.
3. Add the **News search**, **RSS reader**, and **Web Search** components to your flow.
4. In all three components, enable **Tool Mode**.
5. Connect the three components to the **Agent** component's **Tools** port.
The flow looks like the following:
In this example of a document ingestion pipeline, the URL component outputs raw HTML to a text splitter, which splits the raw content into chunks for a vector database to ingest.
![Data components connected to agent](/img/connect-data-components-to-agent.png)
![URL component in a data ingestion pipeline](/img/url-component.png)
6. Open the **Playground** and enter `Use the websearch component to get me an RSS feed of the latest news.`
The Agent uses the `perform_search` tool to return a list of RSS feeds.
7. Enter the name of an RSS feed that interests you.
The Agent uses the `read_rss` tool to fetch and summarize the latest RSS feed.
## API Request
@ -30,8 +38,6 @@ This component makes HTTP requests using URLs or cURL commands.
1. To use this component in a flow, connect the **Data** output to a component that accepts the input.
For example, connect the **API Request** component to a **Chat Output** component.
![API request into a chat output component](/img/component-api-request-chat-output.png)
2. In the API component's **URLs** field, enter the endpoint for your request.
This example uses `https://dummy-json.mock.beeceptor.com/posts`, which is a list of technology blog posts.
@ -168,9 +174,16 @@ Archive formats (for bundling multiple files):
- `.bz2` - Bzip2 compressed files
- `.gz` - Gzip compressed files
## SQL Query
## News search
This component executes SQL queries on a specified database.
This component searches Google News with RSS and returns clean article data. The `clean_html` method parses the HTML content with the BeautifulSoup library, and then removes HTML markup and strips whitespace so the output data is clean.
It returns news content as a DataFrame containing article titles, links, publication dates, and summaries. The component can also be used in **Tool Mode** with a connected **Agent**.
To use this component in a flow, connect the **News Search** output to a component that accepts the DataFrame input.
For example, connect the **News Search** component to a **Chat Output** component. Enter a search query, open the Playground, and click **Run Flow**.
The latest content is returned in a structured DataFrame, with the key columns `title`, `link`, `published` and `summary`.
<details>
<summary>Parameters</summary>
@ -179,17 +192,178 @@ This component executes SQL queries on a specified database.
| Name | Display Name | Info |
|------|--------------|------|
| query | Query | The SQL query to execute. |
| database_url | Database URL | The URL of the database. |
| include_columns | Include Columns | Include columns in the result. |
| passthrough | Passthrough | If an error occurs, return the query instead of raising an exception. |
| add_error | Add Error | Add the error to the result. |
| query | Search Query | Search keywords for news articles. |
| hl | Language (hl) | Language code, such as en-US, fr, de. Default: `en-US`. |
| gl | Country (gl) | Country code, such as US, FR, DE. Default: `US`. |
| ceid | Country:Language (ceid) | Language, such as US:en, FR:fr. Default: `US:en`. |
| topic | Topic | One of: WORLD, NATION, BUSINESS, TECHNOLOGY, ENTERTAINMENT, SCIENCE, SPORTS, HEALTH. |
| location | Location (Geo) | City, state, or country for location-based news. Leave blank for keyword search. |
| timeout | Timeout | Timeout for the request in seconds. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| result | Result | The result of the SQL query execution. |
| articles | News Articles | A DataFrame containing article titles, links, publication dates, and summaries. |
</details>
## RSS Reader
This component fetches and parses RSS feeds from any valid RSS feed URL. It returns the feed content as a DataFrame containing article titles, links, publication dates, and summaries. The component can also be used in **Tool Mode** with a connected **Agent**.
To use this component in a flow, do the following:
1. Connect the **RSS reader** output to a component that accepts the DataFrame input, such as a **Chat Output** component.
2. In the **RSS Feed URL** field, enter an RSS feed, such as `https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml` for the New York Times.
3. Open the **Playground**, and then click **Run Flow**.
The latest content is returned in a structured DataFrame, with the key columns `title`, `link`, `published` and `summary`.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| rss_url | RSS Feed URL | URL of the RSS feed to parse. |
| timeout | Timeout | Timeout for the RSS feed request in seconds. Default: `5`. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| articles | Articles | A DataFrame containing article titles, links, publication dates, and summaries. |
</details>
## SQL database
This component executes SQL queries on [SQLAlchemy-compatible databases](https://docs.sqlalchemy.org/en/20/).
It supports any SQLAlchemy-compatible database, including PostgreSQL, MySQL, SQLite, and others.
To use this component in a flow, do the following:
1. Create a test database called `test.db`.
```shell
sqlite3 test.db
```
2. Add values to the test 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 `test.db` has been created and contains your data.
```shell
sqlite3 test.db "SELECT * FROM users;"
```
Result:
```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
```
4. In the **SQL Database** component's **Database URL** field, add the connection string for `test.db`, such as `sqlite:///test.db`.
With this connection established, the **SQL Query** field now accepts SQL queries.
Instead of manually entering SQL queries, connect this database to an agent as a **Tool** to query it with natural language.
5. In the **SQL Database** component, enable **Tool Mode**, and then connect it to an **Agent** component.
The flow looks like the following:
![SQL database connected to agent](/img/component-sql-database.png)
6. In the **Agent** component, in the **OpenAI API Key** field, add your OpenAI API key.
7. Open the **Playground** and ask `What users are in my database?`
The Agent uses the `run_sql_query` tool to retrieve the information, and additionally identifies the duplicate `users` entries.
Result:
```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.
> Finished chain.
```
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| database_url | Database URL | The SQLAlchemy-compatible database connection URL. |
| query | SQL Query | The SQL query to execute. |
| include_columns | Include Columns | If enabled, includes column names in the result. Default: `true`. |
| add_error | Add Error | If enabled, adds any error messages to the result. Default: `false`. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| run_sql_query | Result Table | The query results as a DataFrame. |
</details>
## Web search
This component performs web searches using DuckDuckGo's HTML interface, and returns the search results as a [DataFrame](/concepts-objects#dataframe-object) containing the key columns `title`, `links`, and `snippets`. The component can also be used in **Tool Mode** with a connected **Agent**.
To use this component in a flow, do the following:
1. Add the **Web search** component to the [Basic prompting](/basic-prompting) flow. In the **Search Query** field, enter a query, such as `environmental news`.
2. Connect the **Web search** component's output to a component that accepts the DataFrame input.
3. Connect a **Type Convert** component to convert the DataFrame to a Message.
4. In the **Type Convert** component, in the **Output Type** field, select **Message**.
Your flow looks like the following:
![Type convert web search output to chat](/img/component-type-convert-and-web-search.png)
5. In the **Language Model** component, in the **OpenAI API Key** field, add your OpenAI API key.
6. Click **Playground**, and then ask about `latest news`.
The search results are returned to the Playground as a message.
Result:
```text
Latest news
AI
gpt-4o-mini
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
...
```
:::note
This component uses web scraping and may be subject to rate limits. For production use, consider using an official search API.
:::
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| query | Search Query | Keywords to search for. |
| timeout | Timeout | Timeout for the web search request in seconds. Default: `5`. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| results | Search Results | A DataFrame containing search results with titles, links, and snippets. |
</details>
@ -202,8 +376,6 @@ In the component's **URLs** field, enter the URL you want to load. To add multip
1. To use this component in a flow, connect the **DataFrame** output to a component that accepts the input.
For example, connect the **URL** component to a **Chat Output** component.
![URL request into a chat output component](/img/component-url.png)
2. In the URL component's **URLs** field, enter the URL for your request.
This example uses `langflow.org`.
@ -216,22 +388,7 @@ The component crawls by link traversal, not by URL path depth.
The text contents of the URL are returned to the Playground as a structured DataFrame.
5. In the **URL** component, change the output port to **Message**, and then run the flow again.
The text contents of the URL are returned as unstructured raw text, which you can extract patterns from with the **Regex Extractor** tool.
6. Connect the **URL** component to a **Regex Extractor** and **Chat Output**.
![Regex extractor connected to url component](/img/component-url-regex.png)
7. In the **Regex Extractor** tool, enter a pattern to extract text from the **URL** component's raw output.
This example extracts the first paragraph from the "In the News" section of `https://en.wikipedia.org/wiki/Main_Page`.
```
In the news\s*\n(.*?)(?=\n\n)
```
Result:
```
Peruvian writer and Nobel Prize in Literature laureate Mario Vargas Llosa (pictured) dies at the age of 89.
```
The text contents of the URL are returned as unstructured raw text, which you can extract patterns with the [Parser](/components-processing#parser) component.
<details>
<summary>Parameters</summary>
@ -292,6 +449,7 @@ To troubleshoot a flow with a **Webhook** component and verify that the componen
7. Send the POST request to trigger the flow.
8. Click **Playground** to verify that the **Chat Output** component printed the JSON data from your POST request.
For more information, see [Trigger flows with webhooks](/webhook).
<details>
<summary>Parameters</summary>

View file

@ -1,546 +1,74 @@
---
title: Embeddings
title: Embedding models
slug: /components-embedding-models
---
import Icon from "@site/src/components/icon";
# Embeddings models in Langflow
Embeddings models convert text into numerical vectors. These embeddings capture the semantic meaning of the input text, and allow LLMs to understand context.
Refer to your specific component's documentation for more information on parameters.
## Use an embeddings model component in a flow
In this example of a document ingestion pipeline, the **OpenAI** embeddings model is connected to a vector database. The component converts the text chunks into vectors and stores them in the vector database. The vectorized data can be used to inform AI workloads like chatbots, similarity searches, and agents.
This embeddings component uses an OpenAI API key for authentication. Refer to your specific embeddings component's documentation for more information on authentication.
![URL component in a data ingestion pipeline](/img/url-component.png)
## AI/ML
This component generates embeddings using the [AI/ML API](https://docs.aimlapi.com/api-overview/embeddings).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| model_name | String | The name of the AI/ML embedding model to use. |
| aiml_api_key | SecretString | The API key required for authenticating with the AI/ML service. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| embeddings | Embeddings | An instance of `AIMLEmbeddingsImpl` for generating embeddings. |
</details>
## Amazon Bedrock Embeddings
This component is used to load embedding models from [Amazon Bedrock](https://aws.amazon.com/bedrock/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| credentials_profile_name | String | The name of the AWS credentials profile in `~/.aws/credentials` or `~/.aws/config`, which has access keys or role information. |
| model_id | String | The ID of the model to call, such as `amazon.titan-embed-text-v1`. This is equivalent to the `modelId` property in the `list-foundation-models` API. |
| endpoint_url | String | The URL to set a specific service endpoint other than the default AWS endpoint. |
| region_name | String | The AWS region to use, such as `us-west-2`. Falls back to the `AWS_DEFAULT_REGION` environment variable or region specified in `~/.aws/config` if not provided. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| embeddings | Embeddings | An instance for generating embeddings using Amazon Bedrock. |
</details>
## Astra DB vectorize
:::important
This component is deprecated as of Langflow version 1.1.2.
Instead, use the [Astra DB vector store component](/components-vector-stores#astra-db-vector-store).
In [Langflow version 1.5](/release-notes), the singular **Embedding model** component replaces many provider-specific embedding models components. Any provider-specific embedding model components that weren't incorporated into the singular component were moved to [**Bundles**](/components-bundle-components).
:::
Connect this component to the **Embeddings** port of the [Astra DB vector store component](/components-vector-stores#astra-db-vector-store) to generate embeddings.
Embedding model components in Langflow generate text embeddings using the selected Large Language Model (LLM). The core **Embedding model** component supports many LLM providers, models, and use cases. For additional providers and models not supported by the core **Embedding model** component, see [Bundles](/components-bundle-components).
This component requires that your Astra DB database has a collection that uses a vectorize embedding provider integration.
For more information and instructions, see [Embedding Generation](https://docs.datastax.com/en/astra-db-serverless/databases/embedding-generation.html).
The core **Language Model** and **Embedding Model** components are adequate for most use cases.
## Use an Embedding Model component in a flow
Create a semantic search system with the **Embedding model** component.
1. Add the **Embedding model** component to your flow.
The default model is OpenAI's `text-embedding-3-small`, which is a balanced model, based on [OpenAI's recommendations](https://platform.openai.com/docs/guides/embeddings#embedding-models).
2. In the **OpenAI API Key** field, enter your OpenAI API key.
3. Add a [Split text](/components-processing#split-text) component to your flow.
This component splits your input text into smaller chunks to be processed into embeddings.
4. Add a [Chroma DB](/components-vector-stores#chroma-db) vector store component to your flow.
This component stores your text embeddings for later retrieval.
5. Connect the **Text Splitter** component's **Chunks** output to the **Chroma DB** component's **Ingest Data** input.
6. Connect the **Embedding model** component's **Embeddings** output to the **Chroma DB** component's **Embeddings** input.
This flow loads a file from the File loader, splits the text, and embeds the split text into the local Chroma vector store using the `text-embedding-3-small` model.
![Embeddings connected to Chroma DB vector store with a file loader and a split text component](/img/component-embedding-models.png)
To query the vector store, include [Chat Input](/components-io#chat-input) and [Chat Output](/components-io#chat-output) components.
7. Connect a [Chat Input](/components-io#chat-input) component to the **Search Query** input of the Chroma DB vector store.
8. Connect a [Chat Output](/components-io#chat-output) component to the **Search Results** port of the Chroma DB vector store.
Your flow looks like the following:
![A simple semantic search flow using Embedding model](/img/component-embedding-models-add-chat.png)
9. Open the **Playground** and enter a search query.
The Playground returns the most semantically similar text chunks.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| provider | Embedding Provider | The embedding provider to use. |
| model_name | Model Name | The embedding model to use. |
| authentication | Authentication | The name of the API key in Astra that stores your [vectorize embedding provider credentials](https://docs.datastax.com/en/astra-db-serverless/databases/embedding-generation.html#embedding-provider-authentication). (Not required if using an [Astra-hosted embedding provider](https://docs.datastax.com/en/astra-db-serverless/databases/embedding-generation.html#supported-embedding-providers).) |
| provider_api_key | Provider API Key | As an alternative to `authentication`, directly provide your embedding provider credentials. |
| model_parameters | Model Parameters | Additional model parameters. |
| Name | Display Name | Type | Description |
|------|--------------|------|-------------|
| provider | Model Provider | Dropdown | Select the embedding model provider. |
| model | Model Name | Dropdown | Select the embedding model to use.|
| api_key | OpenAI API Key | SecretString | The API key required for authenticating with the provider. |
| api_base | API Base URL | String | Base URL for the API. Leave empty for default. |
| dimensions | Dimensions | Integer | The number of dimensions for the output embeddings. |
| chunk_size | Chunk Size | Integer | The size of text chunks to process. Default: `1000`. |
| request_timeout | Request Timeout | Float | Timeout for API requests |
| max_retries | Max Retries | Integer | Maximum number of retry attempts. Default: `3`. |
| show_progress_bar | Show Progress Bar | Boolean | Whether to display a progress bar during embedding generation. |
| model_kwargs | Model Kwargs | Dictionary | Additional keyword arguments to pass to the model. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| embeddings | Embeddings | An instance for generating embeddings using Astra vectorize. |
| embeddings | Embeddings | An instance for generating embeddings using the selected provider. |
</details>
## Azure OpenAI Embeddings
This component generates embeddings using Azure OpenAI models.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| Model | String | The name of the model to use. Default: `text-embedding-3-small`. |
| Azure Endpoint | String | Your Azure endpoint, including the resource, such as `https://example-resource.azure.openai.com/`. |
| Deployment Name | String | The name of the deployment. |
| API Version | String | The API version to use, with options including various dates. |
| API Key | String | The API key required to access the Azure OpenAI service. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| embeddings | Embeddings | An instance for generating embeddings using Azure OpenAI. |
</details>
## Cloudflare Workers AI Embeddings
This component generates embeddings using [Cloudflare Workers AI models](https://developers.cloudflare.com/workers-ai/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| account_id | Cloudflare account ID | [Find your Cloudflare account ID](https://developers.cloudflare.com/fundamentals/setup/find-account-and-zone-ids/#find-account-id-workers-and-pages). |
| api_token | Cloudflare API token | [Create an API token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/). |
| model_name | Model Name | [List of supported models](https://developers.cloudflare.com/workers-ai/models/#text-embeddings). |
| strip_new_lines | Strip New Lines | Whether to strip new lines from the input text. |
| batch_size | Batch Size | The number of texts to embed in each batch. |
| api_base_url | Cloudflare API base URL | The base URL for the Cloudflare API. |
| headers | Headers | Additional request headers. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| embeddings | Embeddings | An instance for generating embeddings using Cloudflare Workers. |
</details>
## Cohere Embeddings
This component is used to load embedding models from [Cohere](https://cohere.com/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| cohere_api_key | String | The API key required to authenticate with the Cohere service. |
| model | String | The language model used for embedding text documents and performing queries. Default: `embed-english-v2.0`. |
| truncate | Boolean | Whether to truncate the input text to fit within the model's constraints. Default: `False`. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| embeddings | Embeddings | An instance for generating embeddings using Cohere. |
</details>
## Embedding similarity
This component computes selected forms of similarity between two embedding vectors.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| embedding_vectors | Embedding Vectors | A list containing exactly two data objects with embedding vectors to compare. |
| similarity_metric | Similarity Metric | Select the similarity metric to use. Options: "Cosine Similarity", "Euclidean Distance", "Manhattan Distance". |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| similarity_data | Similarity Data | A data object containing the computed similarity score and additional information. |
</details>
## Google generative AI embeddings
This component connects to Google's generative AI embedding service using the GoogleGenerativeAIEmbeddings class from the `langchain-google-genai` package.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| api_key | API Key | The secret API key for accessing Google's generative AI service. Required. |
| model_name | Model Name | The name of the embedding model to use. Default: "models/text-embedding-004". |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| embeddings | Embeddings | The built GoogleGenerativeAIEmbeddings object. |
</details>
## Hugging Face Embeddings
:::note
This component is deprecated as of Langflow version 1.0.18.
Instead, use the [Hugging Face Embeddings Inference component](#hugging-face-embeddings-inference).
:::
This component loads embedding models from HuggingFace.
Use this component to generate embeddings using locally downloaded Hugging Face models. Ensure you have sufficient computational resources to run the models.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| Cache Folder | Cache Folder | The folder path to cache HuggingFace models. |
| Encode Kwargs | Encoding Arguments | Additional arguments for the encoding process. |
| Model Kwargs | Model Arguments | Additional arguments for the model. |
| Model Name | Model Name | The name of the HuggingFace model to use. |
| Multi Process | Multi-Process | Whether to use multiple processes. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| embeddings | Embeddings | The generated embeddings. |
</details>
## Hugging Face embeddings inference
This component generates embeddings using [Hugging Face Inference API models](https://huggingface.co/) and requires a [Hugging Face API token](https://huggingface.co/docs/hub/security-tokens) to authenticate. Local inference models do not require an API key.
Use this component to create embeddings with Hugging Face's hosted models, or to connect to your own locally hosted models.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| API Key | API Key | The API key for accessing the Hugging Face Inference API. |
| API URL | API URL | The URL of the Hugging Face Inference API. |
| Model Name | Model Name | The name of the model to use for embeddings. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| embeddings | Embeddings | The generated embeddings. |
</details>
### Connect the Hugging Face component to a local embeddings model
To run an embeddings inference locally, see the [HuggingFace documentation](https://huggingface.co/docs/text-embeddings-inference/local_cpu).
To connect the local Hugging Face model to the **Hugging Face embeddings inference** component and use it in a flow, follow these steps:
1. Create a [Vector store RAG flow](/vector-store-rag).
There are two embeddings models in this flow that you can replace with **Hugging Face** embeddings inference components.
2. Replace both **OpenAI** embeddings model components with **Hugging Face** model components.
3. Connect both **Hugging Face** components to the **Embeddings** ports of the **Astra DB vector store** components.
4. In the **Hugging Face** components, set the **Inference Endpoint** field to the URL of your local inference model. **The **API Key** field is not required for local inference.**
5. Run the flow. The local inference models generate embeddings for the input text.
## IBM watsonx embeddings
This component generates text using [IBM watsonx.ai](https://www.ibm.com/watsonx) foundation models.
To use **IBM watsonx.ai** embeddings components, replace an embeddings component with the IBM watsonx.ai component in a flow.
An example document processing flow looks like the following:
![IBM watsonx embeddings model loading a chroma-db with split text](/img/component-watsonx-embeddings-chroma.png)
This flow loads a PDF file from local storage and splits the text into chunks.
The **IBM watsonx** embeddings component converts the text chunks into embeddings, which are then stored in a Chroma DB vector store.
The values for **API endpoint**, **Project ID**, **API key**, and **Model Name** are found in your IBM watsonx.ai deployment.
For more information, see the [Langchain documentation](https://python.langchain.com/docs/integrations/text_embedding/ibm_watsonx/).
### Default models
The component supports several default models with the following vector dimensions:
- `sentence-transformers/all-minilm-l12-v2`: 384-dimensional embeddings
- `ibm/slate-125m-english-rtrvr-v2`: 768-dimensional embeddings
- `ibm/slate-30m-english-rtrvr-v2`: 768-dimensional embeddings
- `intfloat/multilingual-e5-large`: 1024-dimensional embeddings
The component automatically fetches and updates the list of available models from your watsonx.ai instance when you provide your API endpoint and credentials.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| url | watsonx API Endpoint | The base URL of the API. |
| project_id | watsonx project id | The project ID for your watsonx.ai instance. |
| api_key | API Key | The API Key to use for the model. |
| model_name | Model Name | The name of the embedding model to use. |
| truncate_input_tokens | Truncate Input Tokens | The maximum number of tokens to process. Default: `200`. |
| input_text | Include the original text in the output | Determines if the original text is included in the output. Default: `True`. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| embeddings | Embeddings | An instance for generating embeddings using watsonx.ai. |
</details>
## LM Studio Embeddings
This component generates embeddings using [LM Studio](https://lmstudio.ai/docs) models.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| model | Model | The LM Studio model to use for generating embeddings. |
| base_url | LM Studio Base URL | The base URL for the LM Studio API. |
| api_key | LM Studio API Key | The API key for authentication with LM Studio. |
| temperature | Model Temperature | The temperature setting for the model. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| embeddings | Embeddings | The generated embeddings. |
</details>
## MistralAI
This component generates embeddings using [MistralAI](https://docs.mistral.ai/) models.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| model | String | The MistralAI model to use. Default: "mistral-embed". |
| mistral_api_key | SecretString | The API key for authenticating with MistralAI. |
| max_concurrent_requests | Integer | The maximum number of concurrent API requests. Default: 64. |
| max_retries | Integer | The maximum number of retry attempts for failed requests. Default: 5. |
| timeout | Integer | The request timeout in seconds. Default: 120. |
| endpoint | String | The custom API endpoint URL. Default: `https://api.mistral.ai/v1/`). |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| embeddings | Embeddings | A MistralAIEmbeddings instance for generating embeddings. |
</details>
## NVIDIA
This component generates embeddings using [NVIDIA models](https://docs.nvidia.com).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| model | String | The NVIDIA model to use for embeddings, such as `nvidia/nv-embed-v1`. |
| base_url | String | The base URL for the NVIDIA API. Default: `https://integrate.api.nvidia.com/v1`. |
| nvidia_api_key | SecretString | The API key for authenticating with NVIDIA's service. |
| temperature | Float | The model temperature for embedding generation. Default: `0.1`. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| embeddings | Embeddings | A NVIDIAEmbeddings instance for generating embeddings. |
</details>
## Ollama embeddings
This component generates embeddings using [Ollama models](https://ollama.com/).
For a list of Ollama embeddings models, see the [Ollama documentation](https://ollama.com/search?c=embedding).
To use this component in a flow, connect Langflow to your locally running Ollama server and select an embeddings model.
1. In the Ollama component, in the **Ollama Base URL** field, enter the address for your locally running Ollama server.
This value is set as the `OLLAMA_HOST` environment variable in Ollama. The default base URL is `http://localhost:11434`.
2. To refresh the server's list of models, click <Icon name="RefreshCw" aria-hidden="true"/> **Refresh**.
3. In the **Ollama Model** field, select an embeddings model. This example uses `all-minilm:latest`.
4. Connect the **Ollama** embeddings component to a flow.
For example, this flow connects a local Ollama server running a `all-minilm:latest` embeddings model to a [Chroma DB](/components-vector-stores#chroma-db) vector store to generate embeddings for split text.
![Ollama embeddings connected to Chroma DB](/img/component-ollama-embeddings-chromadb.png)
For more information, see the [Ollama documentation](https://ollama.com/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| Ollama Model | String | The name of the Ollama model to use. Default: `llama2`. |
| Ollama Base URL | String | The base URL of the Ollama API. Default: `http://localhost:11434`. |
| Model Temperature | Float | The temperature parameter for the model. Adjusts the randomness in the generated embeddings. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| embeddings | Embeddings | An instance for generating embeddings using Ollama. |
</details>
## OpenAI Embeddings
This component is used to load embedding models from [OpenAI](https://openai.com/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| OpenAI API Key | String | The API key to use for accessing the OpenAI API. |
| Default Headers | Dict | The default headers for the HTTP requests. |
| Default Query | NestedDict | The default query parameters for the HTTP requests. |
| Allowed Special | List | The special tokens allowed for processing. Default: `[]`. |
| Disallowed Special | List | The special tokens disallowed for processing. Default: `["all"]`. |
| Chunk Size | Integer | The chunk size for processing. Default: `1000`. |
| Client | Any | The HTTP client for making requests. |
| Deployment | String | The deployment name for the model. Default: `text-embedding-3-small`. |
| Embedding Context Length | Integer | The length of embedding context. Default: `8191`. |
| Max Retries | Integer | The maximum number of retries for failed requests. Default: `6`. |
| Model | String | The name of the model to use. Default: `text-embedding-3-small`. |
| Model Kwargs | NestedDict | Additional keyword arguments for the model. |
| OpenAI API Base | String | The base URL of the OpenAI API. |
| OpenAI API Type | String | The type of the OpenAI API. |
| OpenAI API Version | String | The version of the OpenAI API. |
| OpenAI Organization | String | The organization associated with the API key. |
| OpenAI Proxy | String | The proxy server for the requests. |
| Request Timeout | Float | The timeout for the HTTP requests. |
| Show Progress Bar | Boolean | Whether to show a progress bar for processing. Default: `False`. |
| Skip Empty | Boolean | Whether to skip empty inputs. Default: `False`. |
| TikToken Enable | Boolean | Whether to enable TikToken. Default: `True`. |
| TikToken Model Name | String | The name of the TikToken model. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| embeddings | Embeddings | An instance for generating embeddings using OpenAI. |
</details>
## Text embedder
This component generates embeddings for a given message using a specified embedding model.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| embedding_model | Embedding Model | The embedding model to use for generating embeddings. |
| message | Message | The message for which to generate embeddings. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| embeddings | Embedding Data | A data object containing the original text and its embedding vector. |
</details>
## VertexAI Embeddings
This component is a wrapper around [Google Vertex AI](https://cloud.google.com/vertex-ai) [Embeddings API](https://cloud.google.com/vertex-ai/docs/generative-ai/embeddings/get-text-embeddings).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| credentials | Credentials | The default custom credentials to use. |
| location | String | The default location to use when making API calls. Default: `us-central1`. |
| max_output_tokens | Integer | The token limit determines the maximum amount of text output from one prompt. Default: `128`. |
| model_name | String | The name of the Vertex AI large language model. Default: `text-bison`. |
| project | String | The default GCP project to use when making Vertex API calls. |
| request_parallelism | Integer | The amount of parallelism allowed for requests issued to VertexAI models. Default: `5`. |
| temperature | Float | Tunes the degree of randomness in text generations. Should be a non-negative value. Default: `0`. |
| top_k | Integer | How the model selects tokens for output. The next token is selected from the top `k` tokens. Default: `40`. |
| top_p | Float | Tokens are selected from the most probable to least until the sum of their probabilities exceeds the top `p` value. Default: `0.95`. |
| tuned_model_name | String | The name of a tuned model. If provided, `model_name` is ignored. |
| verbose | Boolean | This parameter controls the level of detail in the output. When set to `True`, it prints internal states of the chain to help debug. Default: `False`. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| embeddings | Embeddings | An instance for generating embeddings using VertexAI. |
</details>
## Embedding models bundles
If your provider or model isn't supported by the core **Embedding model** component, see [Bundles](/components-bundle-components) for additional language model and embedding model components developed by third-party contributors.

View file

@ -5,72 +5,26 @@ slug: /components-helpers
import Icon from "@site/src/components/icon";
# Helper components in Langflow
Helper components provide utility functions to help manage data, tasks, and other components in your flow.
## Use a helper component in a flow
## Calculator
Chat memory in Langflow is stored either in local Langflow tables with `LCBufferMemory`, or connected to an external database.
The Calculator component performs basic arithmetic operations on mathematical expressions. It supports addition, subtraction, multiplication, division, and exponentiation operations.
The **Store Message** helper component stores chat memories as [Data](/concepts-objects) objects, and the **Message History** helper component retrieves chat messages as data objects or strings.
This example flow stores and retrieves chat history from an [AstraDBChatMemory](/components-memories#astradbchatmemory-component) component with **Store Message** and **Chat Memory** components.
![Sample Flow storing Chat Memory in AstraDB](/img/astra_db_chat_memory_rounded.png)
## Batch Run
The **Batch Run** component runs a language model over **each row** of a [DataFrame](/concepts-objects#dataframe-object) text column and returns a new DataFrame with the original text and an LLM response.
The response contains the following columns:
* `text_input`: The original text from the input DataFrame.
* `model_response`: The model's response for each input.
* `batch_index`: The processing order, with a `0`-based index.
* `metadata` (optional): Additional information about the processing.
These columns, when connected to a **Parser** component, can be used as variables within curly braces.
To use the Batch Run component with a **Parser** component, do the following:
1. Connect a **Model** component to the **Batch Run** component's **Language model** port.
2. Connect a component that outputs DataFrame, like **File** component, to the **Batch Run** component's **DataFrame** input.
3. Connect the **Batch Run** component's **Batch Results** output to a **Parser** component's **DataFrame** input.
The flow looks like this:
![A batch run component connected to OpenAI and a Parser](/img/component-batch-run.png)
4. In the **Column Name** field of the **Batch Run** component, enter a column name based on the data you're loading from the **File** loader. For example, to process a column of `name`, enter `name`.
5. Optionally, in the **System Message** field of the **Batch Run** component, enter a **System Message** to instruct the connected LLM on how to process your file. For example, `Create a business card for each name.`
6. In the **Template** field of the **Parser** component, enter a template for using the **Batch Run** component's new DataFrame columns.
To use all three columns from the **Batch Run** component, include them like this:
```text
record_number: {batch_index}, name: {text_input}, summary: {model_response}
```
7. To run the flow, in the **Parser** component, click <Icon name="Play" aria-hidden="true"/> **Run component**.
8. To view your created DataFrame, in the **Parser** component, click <Icon name="TextSearch" aria-hidden="true"/>.
9. Optionally, connect a **Chat Output** component, and open the **Playground** to see the output.
For an example of using this component in a flow, see the [Python interpreter](/components-processing#python-interpreter) component.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| model | HandleInput | Connect the 'Language Model' output from your LLM component here. Required. |
| system_message | MultilineInput | A multi-line system instruction for all rows in the DataFrame. |
| df | DataFrameInput | The DataFrame whose column is treated as text messages, as specified by 'column_name'. Required. |
| column_name | MessageTextInput | The name of the DataFrame column to treat as text messages. If empty, all columns are formatted in TOML. |
| output_column_name | MessageTextInput | Name of the column where the model's response is stored. Default=`model_response`. |
| enable_metadata | BoolInput | If True, add metadata to the output DataFrame. |
| expression | String | The arithmetic expression to evaluate, such as `4*4*(33/22)+12-20`. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| batch_results | DataFrame | A DataFrame with all original columns plus the model's response column. |
| result | Data | The calculation result as a Data object containing the evaluated expression. |
</details>
@ -95,46 +49,41 @@ The Current Date component returns the current date and time in a selected timez
</details>
## ID Generator
This component generates a unique ID.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| unique_id | String | The generated unique ID. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| id | String | The generated unique ID. |
</details>
## Message history
:::info
Prior to Langflow 1.1, this component was known as the Chat Memory component.
Prior to Langflow 1.5, this component was two separate components called **Chat History** and **Message Store**.
:::
This component retrieves chat messages from Langflow tables or external memory.
This component provides combined chat history and message store functionality. This component can use Langflow's SQLite database or external memory to store and retrieve chat messages.
In this example, the **Message Store** component stores the complete chat history in a local Langflow table, which the **Message History** component retrieves as context for the LLM to answer each question.
Chat memory is distinct from vector store memory, because it is built specifically for storing and retrieving chat messages from databases.
Memory components provide access to their respective external databases **as memory**. This allows Large Language Models (LLMs) or [agents](/agents) to access external memory for persistence and context retention.
In **Retrieve** mode, this component retrieves chat messages from Langflow tables or external memory.
In **Store** mode, this component stores chat messages in Langflow tables or external memory.
In this example, one **Message History** component stores the complete chat history in a local Langflow table, which the other **Message History** component retrieves as context for the LLM to answer each question.
![Message store and history components](/img/component-message-history-message-store.png)
To configure Langflow to store and retrieve messages from an external database instead of local Langflow memory, follow these steps.
1. Add two **Memory** components to your flow.
This example uses **Redit Chat Memory**.
2. To enable external memory ports, in both **Memory** components, click <Icon name="SlidersHorizontal" aria-hidden="true"/> **Controls**, and then enable **External Memory**.
3. Connect the **Memory** ports to the **Message History** components.
The flow looks like this:
![Message store and history components with external memory](/img/component-message-history-external-memory.png)
4. In the **Redis Chat Memory** components, add your connection information. These values are found in your Redis deployment. For more information, see the [Redis documentation](https://redis.io/docs/latest/).
For more information on configuring memory in Langflow, see [Memory](/memory).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| memory | Memory | Retrieve messages from an external memory. If empty, the Langflow tables are used. |
@ -146,7 +95,6 @@ For more information on configuring memory in Langflow, see [Memory](/memory).
| template | String | The template to use for formatting the data. It can contain the keys `{text}`, `{sender}` or any other key in the message data. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| messages | Data | The retrieved messages as Data objects. |
@ -155,81 +103,6 @@ For more information on configuring memory in Langflow, see [Memory](/memory).
</details>
## Message store
This component stores chat messages or text in Langflow tables or external memory.
In this example, the **Message Store** component stores the complete chat history in a local Langflow table, which the **Message History** component retrieves as context for the LLM to answer each question.
![Message store and history components](/img/component-message-history-message-store.png)
For more information on configuring memory in Langflow, see [Memory](/memory).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| message | String | The chat message to be stored. (Required) |
| memory | Memory | The external memory to store the message. If empty, the Langflow tables are used. |
| sender | String | The sender of the message. Can be Machine or User. If empty, the current sender parameter is used. |
| sender_name | String | The name of the sender. Can be AI or User. If empty, the current sender parameter is used. |
| session_id | String | The session ID of the chat. If empty, the current session ID parameter is used. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| stored_messages | List[Data] | The list of stored messages after the current message has been added. |
</details>
## Structured output
This component transforms LLM responses into structured data formats.
In this example from the **Financial Report Parser** template, the **Structured Output** component transforms unstructured financial reports into structured data.
![Structured output example](/img/component-structured-output.png)
The connected LLM model is prompted by the **Structured Output** component's `Format Instructions` parameter to extract structured output from the unstructured text. `Format Instructions` is utilized as the system prompt for the **Structured Output** component.
In the **Structured Output** component, click the **Open table** button to view the `Output Schema` table.
The `Output Schema` parameter defines the structure and data types for the model's output using a table with the following fields:
* **Name**: The name of the output field.
* **Description**: The purpose of the output field.
* **Type**: The data type of the output field. The available types are `str`, `int`, `float`, `bool`, `list`, or `dict`. The default is `text`.
* **Multiple**: This feature is deprecated. Currently, it is set to `True` by default if you expect multiple values for a single field. For example, a `list` of `features` is set to `True` to contain multiple values, such as `["waterproof", "durable", "lightweight"]`. Default: `True`.
The **Parser** component parses the structured output into a template for orderly presentation in chat output. The template receives the values from the `output_schema` table with curly braces.
For example, the template `EBITDA: {EBITDA} , Net Income: {NET_INCOME} , GROSS_PROFIT: {GROSS_PROFIT}` presents the extracted values in the **Playground** as `EBITDA: 900 million , Net Income: 500 million , GROSS_PROFIT: 1.2 billion`.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| llm | LanguageModel | The language model to use to generate the structured output. |
| input_value | String | The input message to the language model. |
| system_prompt | String | The instructions to the language model for formatting the output. |
| schema_name | String | The name for the output data schema. |
| output_schema | Table | The structure and data types for the model's output. |
| multiple | Boolean | [Deprecated] Always set to `True`. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| structured_output | Data | The structured output is a Data object based on the defined schema. |
</details>
## Legacy components
Legacy components are available for use but are no longer supported.
@ -256,6 +129,27 @@ This component dynamically creates a record with a specified number of fields.
</details>
### ID Generator
This component generates a unique ID.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| unique_id | String | The generated unique ID. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| id | String | The generated unique ID. |
</details>
### Output Parser
This component transforms the output of a language model into a specified format. It supports CSV format parsing, which converts LLM responses into comma-separated lists using Langchain's `CommaSeparatedListOutputParser`.
@ -297,8 +191,4 @@ Please list three fruits.
| format_instructions | String | Pass to a prompt template to include formatting instructions for LLM responses. |
| output_parser | Parser | The constructed output parser that can be used to parse LLM responses. |
</details>
## See also
- [Session ID](/session-id)
</details>

View file

@ -153,53 +153,53 @@ The output does not appear in the **Playground**.
1. To use the **Chat Input** and **Chat Output** components in a flow, connect them to components that accept or send the [Message](/concepts-objects#message-object) type.
For this example, connect a **Chat Input** component to an **OpenAI** model component's **Input** port, and then connect the **OpenAI** model component's **Message** port to the **Chat Output** component.
For this example, connect a **Chat Input** component to an **OpenAI** model component's **Input** port, and then connect the **OpenAI** model component's **Message** port to the **Chat Output** component.
2. In the **OpenAI** model component, in the **OpenAI API Key** field, add your **OpenAI API key**.
The flow looks like this:
The flow looks like this:
![Chat input and output components connected to an OpenAI model](/img/component-chat-io.png)
![Chat input and output components connected to an OpenAI model](/img/component-chat-io.png)
3. To send a message to your flow, open the **Playground**, and then enter a message.
The **OpenAI** model component responds.
Optionally, in the **OpenAI** model component, enter a **System Message** to control the model's response.
4. In the Langflow UI, click your flow name, and then click **Logs**.
The **Logs** pane opens.
Here, you can inspect your component logs.
![Logs pane](/img/logs.png)
The **OpenAI** model component responds.
Optionally, in the **OpenAI** model component, enter a **System Message** to control the model's response.
4. In the Langflow UI, click **Logs**.
The **Logs** pane opens.
Here, you can inspect your component logs.
![Logs pane](/img/logs.png)
5. Your first message was sent by the **Chat Input** component to the **OpenAI** model component.
Click **Outputs** to view the sent message:
```text
"messages": [
{
"message": "What's the recommended way to install Docker on Mac M1?",
"sender": "User",
"sender_name": "User",
"session_id": "Session Apr 21, 17:37:04",
"stream_url": null,
"component_id": "ChatInput-4WKag",
"files": [],
"type": "text"
}
],
```
Click **Outputs** to view the sent message:
```text
"messages": [
{
"message": "What's the recommended way to install Docker on Mac M1?",
"sender": "User",
"sender_name": "User",
"session_id": "Session Apr 21, 17:37:04",
"stream_url": null,
"component_id": "ChatInput-4WKag",
"files": [],
"type": "text"
}
],
```
6. Your second message was sent by the **OpenAI** model component to the **Chat Output** component.
This is the raw text output of the model's response.
The **Chat Output** component accepts this text as input and presents it as a formatted message.
Click **Outputs** to view the sent message:
```text
"outputs":
"text_output":
"message": "To install Docker on a Mac with an M1 chip, you should use Docker Desktop for Mac, which is optimized for Apple Silicon. Here's a step-by-step guide to installing Docker on your M1 Mac:\n\n1.
...
"type": "text"
```
This is the raw text output of the model's response.
The **Chat Output** component accepts this text as input and presents it as a formatted message.
Click **Outputs** to view the sent message:
```text
"outputs":
"text_output":
"message": "To install Docker on a Mac with an M1 chip, you should use Docker Desktop for Mac, which is optimized for Apple Silicon. Here's a step-by-step guide to installing Docker on your M1 Mac:\n\n1.
...
"type": "text"
```
:::tip
Optionally, to view the outputs of each component in the flow, click <Icon name="TextSearch" aria-hidden="true"/> **Inspect output**.
:::
:::tip
Optionally, to view the outputs of each component in the flow, click <Icon name="TextSearch" aria-hidden="true"/> **Inspect output**.
:::
### Send chat messages with the API
@ -208,34 +208,34 @@ To send the same example messages programmatically to your Langflow server, do t
1. To get your Langflow endpoint, click **Publish**, and then click **API access**.
2. Copy the command from the **cURL** tab, and then paste it in your terminal.
It looks similar to this:
```text
curl --request POST \
--url 'http://localhost:7860/api/v1/run/51eed711-4530-4fdc-9bce-5db4351cc73a?stream=false' \
--header 'Content-Type: application/json' \
--data '{
"input_value": "What's the recommended way to install Docker on Mac M1?",
"output_type": "chat",
"input_type": "chat"
}'
```
It looks similar to this:
```text
curl --request POST \
--url 'http://localhost:7860/api/v1/run/51eed711-4530-4fdc-9bce-5db4351cc73a?stream=false' \
--header 'Content-Type: application/json' \
--data '{
"input_value": "What's the recommended way to install Docker on Mac M1?",
"output_type": "chat",
"input_type": "chat"
}'
```
3. Modify `input_value` so it contains the question, `What's the recommended way to install Docker on Mac M1?`.
Note the `output_type` and `input_type` parameters that are passed with the message. The `chat` type provides additional configuration options, and the messages appear in the **Playground**. The `text` type returns only text strings, and does not appear in the **Playground**.
Note the `output_type` and `input_type` parameters that are passed with the message. The `chat` type provides additional configuration options, and the messages appear in the **Playground**. The `text` type returns only text strings, and does not appear in the **Playground**.
4. Add a custom `session_id` to the message's `data` object.
```text
curl --request POST \
--url 'http://localhost:7860/api/v1/run/51eed711-4530-4fdc-9bce-5db4351cc73a?stream=false' \
--header 'Content-Type: application/json' \
--data '{
"input_value": "Whats the recommended way to install Docker on Mac M1",
"session_id": "docker-question-on-m1",
"output_type": "chat",
"input_type": "chat"
}'
```
The custom `session_id` value starts a new chat session between your client and the Langflow server, and can be useful in keeping conversations and AI context separate.
```text
curl --request POST \
--url 'http://localhost:7860/api/v1/run/51eed711-4530-4fdc-9bce-5db4351cc73a?stream=false' \
--header 'Content-Type: application/json' \
--data '{
"input_value": "Whats the recommended way to install Docker on Mac M1",
"session_id": "docker-question-on-m1",
"output_type": "chat",
"input_type": "chat"
}'
```
The custom `session_id` value starts a new chat session between your client and the Langflow server, and can be useful in keeping conversations and AI context separate.
5. Send the POST request.
Your request is answered.
@ -243,26 +243,22 @@ Your request is answered.
A new chat session called `docker-question-on-m1` has appeared, using your unique `session_id`.
7. To modify additional parameters with **Tweaks** for your **Chat Input** and **Chat Output** components, click **Publish**, and then click **API access**.
8. Click **Tweaks** to modify parameters in the component's `data` object.
For example, disabling storing messages from the **Chat Input** component adds a **Tweak** to your command:
```text
curl --request POST \
--url 'http://localhost:7860/api/v1/run/51eed711-4530-4fdc-9bce-5db4351cc73a?stream=false' \
--header 'Content-Type: application/json' \
--data '{
"input_value": "Text to input to the flow",
"output_type": "chat",
"input_type": "chat",
"tweaks": {
"ChatInput-4WKag": {
"should_store_message": false
}
}
}'
```
For example, disabling storing messages from the **Chat Input** component adds a **Tweak** to your command:
```text
curl --request POST \
--url 'http://localhost:7860/api/v1/run/51eed711-4530-4fdc-9bce-5db4351cc73a?stream=false' \
--header 'Content-Type: application/json' \
--data '{
"input_value": "Text to input to the flow",
"output_type": "chat",
"input_type": "chat",
"tweaks": {
"ChatInput-4WKag": {
"should_store_message": false
}
}
}'
```
To confirm your command is using the tweak, navigate to the **Logs** pane and view the request from the **Chat Input** component.
The value for `should_store_message` is `false`.
## See also
- [Session ID](/session-id)
To confirm your command is using the tweak, navigate to the **Logs** pane and view the request from the **Chat Input** component.
The value for `should_store_message` is `false`.

View file

@ -7,33 +7,6 @@ slug: /components-logic
Logic components provide functionalities for routing, conditional processing, and flow management.
## Use a logic component in a flow
This flow creates a summarizing "for each" loop with the [Loop](/components-logic#loop) component.
The component iterates over a list of [Data](/concepts-objects#data-object) objects until it's completed, and then the **Done** loop aggregates the results.
The **File** component loads text files from your local machine, and then the **Parser** component parses them into a list of structured `Data` objects.
The **Loop** component passes each `Data` object to a **Prompt** to be summarized.
When the **Loop** component runs out of `Data`, the **Done** loop activates, which counts the number of pages and summarizes their tone with another **Prompt**.
This is represented in Langflow by connecting the Parser component's **Data List** output to the Loop component's `Data` loop input.
![Sample Flow looping summarizer](/img/loop-text-summarizer.png)
The output is similar to this:
```text
Document Summary
Total Pages Processed
Total Pages: 2
Overall Tone of Document
Tone: Informative and Instructional
The documentation outlines microservices architecture patterns and best practices.
It emphasizes service isolation and inter-service communication protocols.
The use of asynchronous messaging patterns is recommended for system scalability.
It includes code examples of REST and gRPC implementations to demonstrate integration approaches.
```
## Conditional router (If-Else component)
This component routes messages by comparing two strings.
@ -120,27 +93,6 @@ All options respect the `case_sensitive` setting except **regex**.
- **ends with**: Checks if input_text ends with match_text.
- **regex**: Performs regular expression matching. It is always case sensitive and ignores the case_sensitive setting.
## Listen
This component listens for a notification and retrieves its associated state.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|--------|------------------------------------------------|
| name | String | The name of the notification to listen for. |
**Outputs**
| Name | Type | Description |
|--------|------|--------------------------------------------|
| output | Data | The state associated with the notification. |
</details>
## Loop
:::tip
@ -183,51 +135,6 @@ Follow along with this step-by-step video guide for creating this flow and addin
</details>
## Notify
This component generates a notification for the Listen component to use.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|--------|---------|-------------------------------------------------------------------|
| name | String | The name of the notification. |
| data | Data | The data to store in the notification. |
| append | Boolean | When set to true, the record is added to the existing notification. |
**Outputs**
| Name | Type | Description |
|--------|------|-----------------------------------------|
| output | Data | The data stored in the notification. |
</details>
## Pass
This component forwards the input message, unchanged.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| input_message | Input Message | The message to forward. |
| ignored_message | Ignored Message | A second message that is ignored. Used as a workaround for continuity. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| output_message | Output Message | The forwarded message from the input. |
</details>
## Run flow
This component allows you to run any flow stored in your Langflow database without opening the flow editor.
@ -315,6 +222,32 @@ The following actions occur when processing a list of Data objects:
- Objects not meeting the condition go to false_output
- If all objects go to one output, the other output is empty
### Pass
:::important
This component is in **Legacy**, which means it is available for use but no longer in active development.
:::
This component forwards the input message, unchanged.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| input_message | Input Message | The message to forward. |
| ignored_message | Ignored Message | A second message that is ignored. Used as a workaround for continuity. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| output_message | Output Message | The forwarded message from the input. |
</details>
## Deprecated components
Deprecated components have been replaced by newer alternatives and should not be used in new projects.

View file

@ -5,152 +5,23 @@ slug: /components-memories
# Memory components in Langflow
Memory components store and retrieve chat messages by [`session_id`](/session-id).
Components in the **Memories** category are moved to [Bundles](/components-bundle-components) as of Langflow 1.5.
**Bundles** are third-party components grouped by provider.
For more information on bundled components, see the component provider's documentation.
## Use a memory component in a flow
Memory components store and retrieve chat messages by `session_id`.
They are distinct from vector store components, because they are built specifically for storing and retrieving chat messages from external databases.
Memory components provide access to their respective external databases **as memory**. This allows Large Language Models (LLMs) or [agents](/components-agents) to access external memory for persistence and context retention.
## Use a memory component in a flow
This example flow stores and retrieves chat history from an **Astra DB Chat Memory** component with **Store Message** and **Message history** components.
This example flow stores and retrieves chat history with an **Redis Chat Memory** component connected to **Store Message** and **Message history** components.
The **Store Message** helper component stores chat memories as [Data](/concepts-objects) objects, and the **Message History** helper component retrieves chat messages as [Data](/concepts-objects) objects or strings.
![Sample Flow storing Message history in AstraDB](/img/astra_db_chat_memory_rounded.png)
![Sample Flow storing Message history in Redis](/img/component-message-history-external-memory.png)
## AstraDBChatMemory Component
This component creates an `AstraDBChatMessageHistory` instance, which stores and retrieves chat messages using Astra DB, a cloud-native database service.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------------------|---------------|-----------------------------------------------------------------------|
| collection_name | String | The name of the Astra DB collection for storing messages. Required. |
| token | SecretString | The authentication token for Astra DB access. Required. |
| api_endpoint | SecretString | The API endpoint URL for the Astra DB service. Required. |
| namespace | String | The optional namespace within Astra DB for the collection. |
| session_id | MessageText | The unique identifier for the chat session. Uses the current session ID if not provided. |
**Outputs**
| Name | Type | Description |
|-----------------|-------------------------|-----------------------------------------------------------|
| message_history | BaseChatMessageHistory | An instance of AstraDBChatMessageHistory for the session. |
</details>
## CassandraChatMemory Component
This component creates a `CassandraChatMessageHistory` instance, enabling storage and retrieval of chat messages using Apache Cassandra or DataStax Astra DB.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|----------------|---------------|-------------------------------------------------------------------------------|
| database_ref | MessageText | The contact points for the Cassandra database or Astra DB database ID. Required. |
| username | MessageText | The username for Cassandra. Leave empty for Astra DB. |
| token | SecretString | The password for Cassandra or the token for Astra DB. Required. |
| keyspace | MessageText | The keyspace in Cassandra or namespace in Astra DB. Required. |
| table_name | MessageText | The name of the table or collection for storing messages. Required. |
| session_id | MessageText | The unique identifier for the chat session. Optional. |
| cluster_kwargs | Dictionary | Additional keyword arguments for the Cassandra cluster configuration. Optional. |
**Outputs**
| Name | Type | Description |
|-----------------|-------------------------|--------------------------------------------------------------|
| message_history | BaseChatMessageHistory | An instance of CassandraChatMessageHistory for the session. |
</details>
## Mem0 Chat Memory
The Mem0 Chat Memory component retrieves and stores chat messages using Mem0 memory storage.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| mem0_config | Mem0 Configuration | The configuration dictionary for initializing the Mem0 memory instance. |
| ingest_message | Message to Ingest | The message content to be ingested into Mem0 memory. |
| existing_memory | Existing Memory Instance | An optional existing Mem0 memory instance. |
| user_id | User ID | The identifier for the user associated with the messages. |
| search_query | Search Query | The input text for searching related memories in Mem0. |
| mem0_api_key | Mem0 API Key | The API key for the Mem0 platform. Leave empty to use the local version. |
| metadata | Metadata | The additional metadata to associate with the ingested message. |
| openai_api_key | OpenAI API Key | The API key for OpenAI. Required when using OpenAI embeddings without a provided configuration. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| memory | Mem0 Memory | The resulting Mem0 Memory object after ingesting data. |
| search_results | Search Results | The search results from querying Mem0 memory. |
</details>
## Redis Chat Memory
This component retrieves and stores chat messages from Redis.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| host | hostname | The IP address or hostname. |
| port | port | The Redis Port Number. |
| database | database | The Redis database. |
| username | Username | The Redis username. |
| password | Password | The password for the username. |
| key_prefix | Key prefix | The key prefix. |
| session_id | Session ID | The unique session identifier for the message. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| memory | Memory | The Redis chat message history object. |
</details>
## Legacy components
**Legacy** components are available for use but are no longer supported.
### ZepChatMemory Component
This component creates a `ZepChatMessageHistory` instance, enabling storage and retrieval of chat messages using Zep, a memory server for Large Language Models (LLMs).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|---------------|---------------|-----------------------------------------------------------|
| url | MessageText | The URL of the Zep instance. Required. |
| api_key | SecretString | The API Key for authentication with the Zep instance. |
| api_base_path | Dropdown | The API version to use. Options include api/v1 or api/v2. |
| session_id | MessageText | The unique identifier for the chat session. Optional. |
**Outputs**
| Name | Type | Description |
|-----------------|-------------------------|-------------------------------------------------------|
| message_history | BaseChatMessageHistory | An instance of ZepChatMessageHistory for the session. |
</details>

View file

@ -1,31 +1,80 @@
---
title: Models
title: Language models
slug: /components-models
---
import Icon from "@site/src/components/icon";
# Model components in Langflow
:::important
In [Langflow version 1.5](/release-notes), the singular **Language model** component replaces many provider-specific model components. Any provider-specific model components that weren't incorporated into the singular component were moved to [Bundles](/components-bundle-components).
:::
Model components generate text using large language models.
Language components in Langflow generate text using the selected Large Language Model (LLM). The core **Language model** component supports many LLM providers, models, and use cases. For additional providers and models not supported by the core **Language model** component, see [**Bundles**](/components-bundle-components).
Refer to your specific component's documentation for more information on parameters.
Most use cases can be performed with the **Language Model** and **Embedding Model** components.
## Use a model component in a flow
If you want to try additional providers not supported by the new components, the single-provider LLM components of both the **Language Model** and **Embedding Model** types are now found in **Bundles**, and are still available for use.
### Use a Language Model component in a flow
Use a **Language Model** component in your flow anywhere you would use an LLM.
Model components receive inputs and prompts for generating text, and the generated text is sent to an output component.
The model output can also be sent to the **Language Model** port and on to a **Parse Data** component, where the output can be parsed into structured [Data](/concepts-objects) objects.
This example has the OpenAI model in a chatbot flow. For more information, see the [Basic prompting flow](/basic-prompting).
![](/img/starter-flow-basic-prompting.png)
1. Add the **Language Model** component to your flow.
The default model is OpenAI's GPT-4.1 mini model. Based on [OpenAI's recommendations](https://platform.openai.com/docs/models/gpt-4.1-mini), this model is a good, balanced starter model.
2. In the **OpenAI API Key** field, enter your OpenAI API key.
3. Add a [Prompt](/components-prompts) component to your flow.
4. To connect the [Prompt](/components-prompts) component to the **Language Model** component, on the **Language Model** component, click **Controls**.
5. Enable the **System Message** setting.
On the **Language Model** component, a new **System Message** port opens.
6. Connect the **Prompt** port to the **System Message** port.
7. Add [Chat input](/components-io#chat-input) and [Chat output](/components-io#chat-output) components to your flow.
Your flow looks like this:
![A Language Model component for basic prompting](/img/component-language-model.png)
## AIML
8. Open the **Playground**, and ask a question.
The bot responds to your question with sources.
This component creates a ChatOpenAI model instance using the AIML API.
```
What is the capital of Utah?
For more information, see [AIML documentation](https://docs.aimlapi.com/).
AI
gpt-4o-mini
The capital of Utah is Salt Lake City. It is not only the largest city in the state but also serves as the cultural and economic center of Utah. Salt Lake City was founded in 1847 by Mormon pioneers and is known for its proximity to the Great Salt Lake and its role in the history of the Church of Jesus Christ of Latter-day Saints. For more information, you can refer to sources such as the U.S. Geological Survey or the official state website of Utah.
```
9. Try an alternate model provider, and test how the response differs.
In the **Language Model** component, in the **Model Provider** field, select **Anthropic**.
10. In the **Model Name** field, select your Anthropic model.
This model uses Claude 3.5 Haiku, based on [Anthropic's recommendation](https://docs.anthropic.com/en/docs/about-claude/models/choosing-a-model) for a fast and cost-effective model.
11. In the **Anthropic API Key** field, enter your Anthropic API key.
12. Open the **Playground**, and ask the same question as you did before.
```
User
What is the capital of Utah?
AI
claude-3-5-haiku-latest
The capital of Utah is Salt Lake City. It is also the most populous city in the state. Salt Lake City has been the capital of Utah since 1896, when Utah became a state.
Sources:
Utah State Government Official Website (utah.gov)
U.S. Census Bureau
Encyclopedia Britannica
```
The response from the Anthropic model is less verbose, and lists its sources outside of the informative paragraph.
For more information, see your LLM provider's documentation.
### Use the LanguageModel output
The default output of the language model is the model's response as a `Message`, but it also supports a `LanguageModel` output.
Select the Language Model's **LanguageModel** output to connect it to components that require an LLM.
For an example, see the [Smart function component](/components-processing#smart-function), which requires an LLM connected through this port to create a function from your natural language.
<details>
<summary>Parameters</summary>
@ -34,722 +83,22 @@ For more information, see [AIML documentation](https://docs.aimlapi.com/).
| Name | Type | Description |
|------|------|-------------|
| max_tokens | Integer | The maximum number of tokens to generate. Set to 0 for unlimited tokens. Range: 0-128000. |
| model_kwargs | Dictionary | Additional keyword arguments for the model. |
| model_name | String | The name of the AIML model to use. Options are predefined in `AIML_CHAT_MODELS`. |
| aiml_api_base | String | The base URL of the AIML API. Defaults to `https://api.aimlapi.com`. |
| api_key | SecretString | The AIML API Key to use for the model. |
| temperature | Float | Controls randomness in the output. Default: `0.1`. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatOpenAI configured with the specified parameters. |
</details>
## Amazon Bedrock
This component generates text using Amazon Bedrock LLMs.
For more information, see [Amazon Bedrock documentation](https://docs.aws.amazon.com/bedrock).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| model_id | String | The ID of the Amazon Bedrock model to use. Options include various models. |
| aws_access_key | SecretString | AWS Access Key for authentication. |
| aws_secret_key | SecretString | AWS Secret Key for authentication. |
| aws_session_token | SecretString | The session key for your AWS account.
| credentials_profile_name | String | Name of the AWS credentials profile to use. |
| region_name | String | AWS region name. Default: `us-east-1`. |
| model_kwargs | Dictionary | Additional keyword arguments for the model. |
| endpoint_url | String | Custom endpoint URL for the Bedrock service. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatBedrock configured with the specified parameters. |
</details>
## Anthropic
This component allows the generation of text using Anthropic Chat and Language models.
For more information, see the [Anthropic documentation](https://docs.anthropic.com/en/docs/welcome).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| max_tokens | Integer | The maximum number of tokens to generate. Set to 0 for unlimited tokens. Default: `4096`. |
| model | String | The name of the Anthropic model to use. Options include various Claude 3 models. |
| anthropic_api_key | SecretString | Your Anthropic API key for authentication. |
| temperature | Float | Controls randomness in the output. Default: `0.1`. |
| anthropic_api_url | String | Endpoint of the Anthropic API. Defaults to `https://api.anthropic.com` if not specified (advanced). |
| prefill | String | Prefill text to guide the model's response (advanced). |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatAnthropic configured with the specified parameters. |
</details>
## Azure OpenAI
This component generates text using Azure OpenAI LLM.
For more information, see the [Azure OpenAI documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| Model Name | String | Specifies the name of the Azure OpenAI model to be used for text generation. |
| Azure Endpoint | String | Your Azure endpoint, including the resource. |
| Deployment Name | String | Specifies the name of the deployment. |
| API Version | String | Specifies the version of the Azure OpenAI API to be used. |
| API Key | SecretString | Your Azure OpenAI API key. |
| Temperature | Float | Specifies the sampling temperature. Defaults to `0.7`. |
| Max Tokens | Integer | Specifies the maximum number of tokens to generate. Defaults to `1000`. |
| Input Value | String | Specifies the input text for text generation. |
| Stream | Boolean | Specifies whether to stream the response from the model. Defaults to `False`. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of AzureOpenAI configured with the specified parameters. |
</details>
## Cohere
This component generates text using Cohere's language models.
For more information, see the [Cohere documentation](https://cohere.ai/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| Cohere API Key | SecretString | Your Cohere API key. |
| Max Tokens | Integer | Specifies the maximum number of tokens to generate. Defaults to `256`. |
| Temperature | Float | Specifies the sampling temperature. Defaults to `0.75`. |
| Input Value | String | Specifies the input text for text generation. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of the Cohere model configured with the specified parameters. |
</details>
## DeepSeek
This component generates text using DeepSeek's language models.
For more information, see the [DeepSeek documentation](https://api-docs.deepseek.com/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| max_tokens | Integer | Maximum number of tokens to generate. Set to `0` for unlimited. Range: `0-128000`. |
| model_kwargs | Dictionary | Additional keyword arguments for the model. |
| json_mode | Boolean | If `True`, outputs JSON regardless of passing a schema. |
| model_name | String | The DeepSeek model to use. Default: `deepseek-chat`. |
| api_base | String | Base URL for API requests. Default: `https://api.deepseek.com`. |
| api_key | SecretString | Your DeepSeek API key for authentication. |
| temperature | Float | Controls randomness in responses. Range: `[0.0, 2.0]`. Default: `1.0`. |
| seed | Integer | Number initialized for random number generation. Use the same seed integer for more reproducible results, and use a different seed number for more random results. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatOpenAI configured with the specified parameters. |
</details>
## Google Generative AI
This component generates text using Google's Generative AI models.
For more information, see the [Google Generative AI documentation](https://cloud.google.com/vertex-ai/docs/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| Google API Key | SecretString | Your Google API key to use for the Google Generative AI. |
| Model | String | The name of the model to use, such as `"gemini-pro"`. |
| Max Output Tokens | Integer | The maximum number of tokens to generate. |
| Temperature | Float | Run inference with this temperature. |
| Top K | Integer | Consider the set of top K most probable tokens. |
| Top P | Float | The maximum cumulative probability of tokens to consider when sampling. |
| N | Integer | Number of chat completions to generate for each prompt. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatGoogleGenerativeAI configured with the specified parameters. |
</details>
## Groq
This component generates text using Groq's language models.
1. To use this component in a flow, connect it as a **Model** in a flow like the [Basic prompting flow](/basic-prompting), or select it as the **Model Provider** if you're using an **Agent** component.
![Groq component in a basic prompting flow](/img/component-groq.png)
2. In the **Groq API Key** field, paste your Groq API key.
The Groq model component automatically retrieves a list of the latest models.
To refresh your list of models, click <Icon name="RefreshCw" aria-hidden="true"/> **Refresh**.
3. In the **Model** field, select the model you want to use for your LLM.
This example uses [llama-3.1-8b-instant](https://console.groq.com/docs/model/llama-3.1-8b-instant), which Groq recommends for real-time conversational interfaces.
4. In the **Prompt** component, enter:
```text
You are a helpful assistant who supports their claims with sources.
```
5. Click **Playground** and ask your Groq LLM a question.
The responses include a list of sources.
For more information, see the [Groq documentation](https://groq.com/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| groq_api_key | SecretString | API key for the Groq API. |
| groq_api_base | String | Base URL path for API requests. Default: `https://api.groq.com`. |
| max_tokens | Integer | The maximum number of tokens to generate. |
| temperature | Float | Controls randomness in the output. Range: `[0.0, 1.0]`. Default: `0.1`. |
| n | Integer | Number of chat completions to generate for each prompt. |
| model_name | String | The name of the Groq model to use. Options are dynamically fetched from the Groq API. |
| tool_mode_enabled | Bool | If enabled, the component only displays models that work with tools. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatGroq configured with the specified parameters. |
</details>
## Hugging Face API
This component sends requests to the Hugging Face API to generate text using the model specified in the **Model ID** field.
The Hugging Face API is a hosted inference API for models hosted on Hugging Face, and requires a [Hugging Face API token](https://huggingface.co/docs/hub/security-tokens) to authenticate.
In this example based on the [Basic prompting flow](/basic-prompting), the **Hugging Face API** model component replaces the **Open AI** model. By selecting different hosted models, you can see how different models return different results.
1. Create a [Basic prompting flow](/basic-prompting).
2. Replace the **OpenAI** model component with a **Hugging Face API** model component.
3. In the **Hugging Face API** component, add your Hugging Face API token to the **API Token** field.
4. Open the **Playground** and ask a question to the model, and see how it responds.
5. Try different models, and see how they perform differently.
For more information, see the [Hugging Face documentation](https://huggingface.co/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| model_id | String | The model ID from Hugging Face Hub. For example, "gpt2", "facebook/bart-large". |
| huggingfacehub_api_token | SecretString | Your Hugging Face API token for authentication. |
| temperature | Float | Controls randomness in the output. Range: [0.0, 1.0]. Default: 0.7. |
| max_new_tokens | Integer | Maximum number of tokens to generate. Default: 512. |
| top_p | Float | Nucleus sampling parameter. Range: [0.0, 1.0]. Default: 0.95. |
| top_k | Integer | Top-k sampling parameter. Default: 50. |
| model_kwargs | Dictionary | Additional keyword arguments to pass to the model. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of HuggingFaceHub configured with the specified parameters. |
</details>
## IBM watsonx.ai
This component generates text using [IBM watsonx.ai](https://www.ibm.com/watsonx) foundation models.
To use **IBM watsonx.ai** model components, replace a model component with the IBM watsonx.ai component in a flow.
An example flow looks like the following:
![IBM watsonx model component in a basic prompting flow](/img/component-watsonx-model.png)
The values for **API endpoint**, **Project ID**, **API key**, and **Model Name** are found in your IBM watsonx.ai deployment.
For more information, see the [Langchain documentation](https://python.langchain.com/docs/integrations/chat/ibm_watsonx/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| url | String | The base URL of the watsonx API. |
| project_id | String | Your watsonx Project ID. |
| api_key | SecretString | Your IBM watsonx API Key. |
| model_name | String | The name of the watsonx model to use. Options are dynamically fetched from the API. |
| max_tokens | Integer | The maximum number of tokens to generate. Default: `1000`. |
| stop_sequence | String | The sequence where generation should stop. |
| temperature | Float | Controls randomness in the output. Default: `0.1`. |
| top_p | Float | Controls nucleus sampling, which limits the model to tokens whose probability is below the `top_p` value. Range: Default: `0.9`. |
| frequency_penalty | Float | Controls frequency penalty. A positive value decreases the probability of repeating tokens, and a negative value increases the probability. Range: Default: `0.5`. |
| presence_penalty | Float | Controls presence penalty. A positive value increases the likelihood of new topics being introduced. Default: `0.3`. |
| seed | Integer | A random seed for the model. Default: `8`. |
| logprobs | Boolean | Whether to return log probabilities of output tokens or not. Default: `True`. |
| top_logprobs | Integer | The number of most likely tokens to return at each position. Default: `3`. |
| logit_bias | String | A JSON string of token IDs to bias or suppress. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of [ChatWatsonx](https://python.langchain.com/docs/integrations/chat/ibm_watsonx/) configured with the specified parameters. |
</details>
## Language model
This component generates text using either OpenAI or Anthropic language models.
Use this component as a drop-in replacement for LLM models to switch between different model providers and models.
Instead of swapping out model components when you want to try a different provider, like switching between OpenAI and Anthropic components, change the provider dropdown in this single component. This makes it easier to experiment with and compare different models while keeping the rest of your flow intact.
For more information, see the [OpenAI documentation](https://platform.openai.com/docs) and [Anthropic documentation](https://docs.anthropic.com/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| provider | String | The model provider to use. Options: "OpenAI", "Anthropic". Default: "OpenAI". |
| provider | String | The model provider to use. |
| model_name | String | The name of the model to use. Options depend on the selected provider. |
| api_key | SecretString | The API Key for authentication with the selected provider. |
| input_value | String | The input text to send to the model. |
| system_message | String | A system message that helps set the behavior of the assistant (advanced). |
| stream | Boolean | Whether to stream the response. Default: `False` (advanced). |
| temperature | Float | Controls randomness in responses. Range: `[0.0, 1.0]`. Default: `0.1` (advanced). |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatOpenAI or ChatAnthropic configured with the specified parameters. |
</details>
## LMStudio
This component generates text using LM Studio's local language models.
For more information, see [LM Studio documentation](https://lmstudio.ai/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| base_url | String | The URL where LM Studio is running. Default: `"http://localhost:1234"`. |
| max_tokens | Integer | Maximum number of tokens to generate in the response. Default: `512`. |
| temperature | Float | Controls randomness in the output. Range: `[0.0, 2.0]`. Default: `0.7`. |
| top_p | Float | Controls diversity via nucleus sampling. Range: `[0.0, 1.0]`. Default: `1.0`. |
| stop | List[String] | List of strings that stop generation when encountered. |
| system_message | String | A system message that helps set the behavior of the assistant. |
| stream | Boolean | Whether to stream the response. Default: `False`. |
| presence_penalty | Float | Penalizes repeated tokens. Range: `[-2.0, 2.0]`. Default: `0.0`. |
| frequency_penalty | Float | Penalizes frequent tokens. Range: `[-2.0, 2.0]`. Default: `0.0`. |
| temperature | Float | Controls randomness in responses. Range: `[0.0, 1.0]`. Default: `0.1`. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of LMStudio configured with the specified parameters. |
</details>
## Maritalk
This component generates text using Maritalk LLMs.
For more information, see [Maritalk documentation](https://www.maritalk.com/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| max_tokens | Integer | The maximum number of tokens to generate. Set to `0` for unlimited tokens. Default: `512`. |
| model_name | String | The name of the Maritalk model to use. Options: `sabia-2-small`, `sabia-2-medium`. Default: `sabia-2-small`. |
| api_key | SecretString | The Maritalk API Key to use for authentication. |
| temperature | Float | Controls randomness in the output. Range: `[0.0, 1.0]`. Default: `0.5`. |
| endpoint_url | String | The Maritalk API endpoint. Default: `https://api.maritalk.com`. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatMaritalk configured with the specified parameters. |
</details>
## Mistral
This component generates text using MistralAI LLMs.
For more information, see [Mistral AI documentation](https://docs.mistral.ai/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| max_tokens | Integer | The maximum number of tokens to generate. Set to 0 for unlimited tokens (advanced). |
| model_name | String | The name of the Mistral AI model to use. Options include `open-mixtral-8x7b`, `open-mixtral-8x22b`, `mistral-small-latest`, `mistral-medium-latest`, `mistral-large-latest`, and `codestral-latest`. Default: `codestral-latest`. |
| mistral_api_base | String | The base URL of the Mistral API. Defaults to `https://api.mistral.ai/v1` (advanced). |
| api_key | SecretString | The Mistral API Key to use for authentication. |
| temperature | Float | Controls randomness in the output. Default: 0.5. |
| max_retries | Integer | Maximum number of retries for API calls. Default: 5 (advanced). |
| timeout | Integer | Timeout for API calls in seconds. Default: 60 (advanced). |
| max_concurrent_requests | Integer | Maximum number of concurrent API requests. Default: 3 (advanced). |
| top_p | Float | Nucleus sampling parameter. Default: 1 (advanced). |
| random_seed | Integer | Seed for random number generation. Default: 1 (advanced). |
| safe_mode | Boolean | Enables safe mode for content generation (advanced). |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatMistralAI configured with the specified parameters. |
</details>
## Novita AI
This component generates text using Novita AI's language models.
For more information, see [Novita AI documentation](https://novita.ai/docs/model-api/reference/llm/llm.html?utm_source=github_langflow&utm_medium=github_readme&utm_campaign=link).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| api_key | SecretString | Your Novita AI API Key. |
| model | String | The id of the Novita AI model to use. |
| max_tokens | Integer | The maximum number of tokens to generate. Set to 0 for unlimited tokens. |
| temperature | Float | Controls randomness in the output. Range: [0.0, 1.0]. Default: 0.7. |
| top_p | Float | Controls the nucleus sampling. Range: [0.0, 1.0]. Default: 1.0. |
| frequency_penalty | Float | Controls the frequency penalty. Range: [0.0, 2.0]. Default: 0.0. |
| presence_penalty | Float | Controls the presence penalty. Range: [0.0, 2.0]. Default: 0.0. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of Novita AI model configured with the specified parameters. |
</details>
## NVIDIA
This component generates text using NVIDIA LLMs.
For more information, see [NVIDIA AI documentation](https://developer.nvidia.com/generative-ai).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| max_tokens | Integer | The maximum number of tokens to generate. Set to `0` for unlimited tokens (advanced). |
| model_name | String | The name of the NVIDIA model to use. Default: `mistralai/mixtral-8x7b-instruct-v0.1`. |
| base_url | String | The base URL of the NVIDIA API. Default: `https://integrate.api.nvidia.com/v1`. |
| nvidia_api_key | SecretString | The NVIDIA API Key for authentication. |
| temperature | Float | Controls randomness in the output. Default: `0.1`. |
| seed | Integer | The seed controls the reproducibility of the job (advanced). Default: `1`. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatNVIDIA configured with the specified parameters. |
</details>
## Ollama
This component generates text using Ollama's language models.
To use this component in a flow, connect Langflow to your locally running Ollama server and select a model.
1. In the Ollama component, in the **Base URL** field, enter the address for your locally running Ollama server.
This value is set as the `OLLAMA_HOST` environment variable in Ollama.
The default base URL is `http://localhost:11434`.
2. To refresh the server's list of models, click <Icon name="RefreshCw" aria-hidden="true"/> **Refresh**.
3. In the **Model Name** field, select a model. This example uses `llama3.2:latest`.
4. Connect the **Ollama** model component to a flow. For example, this flow connects a local Ollama server running a Llama 3.2 model as the custom model for an [Agent](/components-agents) component.
![Ollama model as Agent custom model](/img/component-ollama-model.png)
For more information, see the [Ollama documentation](https://ollama.com/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| Base URL | String | Endpoint of the Ollama API. |
| Model Name | String | The model name to use. |
| Temperature | Float | Controls the creativity of model responses. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of an Ollama model configured with the specified parameters. |
</details>
## OpenAI
This component generates text using OpenAI's language models.
For more information, see [OpenAI documentation](https://beta.openai.com/docs/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| api_key | SecretString | Your OpenAI API Key. |
| model | String | The name of the OpenAI model to use. Options include "gpt-3.5-turbo" and "gpt-4". |
| max_tokens | Integer | The maximum number of tokens to generate. Set to 0 for unlimited tokens. |
| temperature | Float | Controls randomness in the output. Range: [0.0, 1.0]. Default: 0.7. |
| top_p | Float | Controls the nucleus sampling. Range: [0.0, 1.0]. Default: 1.0. |
| frequency_penalty | Float | Controls the frequency penalty. Range: [0.0, 2.0]. Default: 0.0. |
| presence_penalty | Float | Controls the presence penalty. Range: [0.0, 2.0]. Default: 0.0. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of OpenAI model configured with the specified parameters. |
</details>
## OpenRouter
This component generates text using OpenRouter's unified API for multiple AI models from different providers.
For more information, see [OpenRouter documentation](https://openrouter.ai/docs).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| api_key | SecretString | Your OpenRouter API key for authentication. |
| site_url | String | Your site URL for OpenRouter rankings (advanced). |
| app_name | String | Your app name for OpenRouter rankings (advanced). |
| provider | String | The AI model provider to use. |
| model_name | String | The specific model to use for chat completion. |
| temperature | Float | Controls randomness in the output. Range: [0.0, 2.0]. Default: 0.7. |
| max_tokens | Integer | The maximum number of tokens to generate (advanced). |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatOpenAI configured with the specified parameters. |
</details>
## Perplexity
This component generates text using Perplexity's language models.
For more information, see [Perplexity documentation](https://perplexity.ai/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| model_name | String | The name of the Perplexity model to use. Options include various Llama 3.1 models. |
| max_output_tokens | Integer | The maximum number of tokens to generate. |
| api_key | SecretString | The Perplexity API Key for authentication. |
| temperature | Float | Controls randomness in the output. Default: 0.75. |
| top_p | Float | The maximum cumulative probability of tokens to consider when sampling (advanced). |
| n | Integer | Number of chat completions to generate for each prompt (advanced). |
| top_k | Integer | Number of top tokens to consider for top-k sampling. Must be positive (advanced). |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatPerplexity configured with the specified parameters. |
</details>
## Qianfan
This component generates text using Qianfan's language models.
For more information, see [Qianfan documentation](https://github.com/baidubce/bce-qianfan-sdk).
## SambaNova
This component generates text using SambaNova LLMs.
For more information, see [Sambanova Cloud documentation](https://cloud.sambanova.ai/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| sambanova_url | String | Base URL path for API requests. Default: `https://api.sambanova.ai/v1/chat/completions`. |
| sambanova_api_key | SecretString | Your SambaNova API Key. |
| model_name | String | The name of the Sambanova model to use. Options include various Llama models. |
| max_tokens | Integer | The maximum number of tokens to generate. Set to 0 for unlimited tokens. |
| temperature | Float | Controls randomness in the output. Range: [0.0, 1.0]. Default: 0.07. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of SambaNova model configured with the specified parameters. |
</details>
## VertexAI
This component generates text using Vertex AI LLMs.
For more information, see [Google Vertex AI documentation](https://cloud.google.com/vertex-ai).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| credentials | File | JSON credentials file. Leave empty to fall back to environment variables. File type: JSON. |
| model_name | String | The name of the Vertex AI model to use. Default: "gemini-1.5-pro". |
| project | String | The project ID (advanced). |
| location | String | The location for the Vertex AI API. Default: "us-central1" (advanced). |
| max_output_tokens | Integer | The maximum number of tokens to generate (advanced). |
| max_retries | Integer | Maximum number of retries for API calls. Default: 1 (advanced). |
| temperature | Float | Controls randomness in the output. Default: 0.0. |
| top_k | Integer | The number of highest probability vocabulary tokens to keep for top-k-filtering (advanced). |
| top_p | Float | The cumulative probability of parameter highest probability vocabulary tokens to keep for nucleus sampling. Default: 0.95 (advanced). |
| verbose | Boolean | Whether to print verbose output. Default: False (advanced). |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatVertexAI configured with the specified parameters. |
</details>
## xAI
This component generates text using xAI models like [Grok](https://x.ai/grok).
For more information, see the [xAI documentation](https://x.ai/).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| max_tokens | Integer | Maximum number of tokens to generate. Set to `0` for unlimited. Range: `0-128000`. |
| model_kwargs | Dictionary | Additional keyword arguments for the model. |
| json_mode | Boolean | If `True`, outputs JSON regardless of passing a schema. |
| model_name | String | The xAI model to use. Default: `grok-2-latest`. |
| base_url | String | Base URL for API requests. Default: `https://api.x.ai/v1`. |
| api_key | SecretString | Your xAI API key for authentication. |
| temperature | Float | Controls randomness in the output. Range: `[0.0, 2.0]`. Default: `0.1`. |
| seed | Integer | Controls reproducibility of the job. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| model | LanguageModel | An instance of ChatOpenAI configured with the specified parameters. |
| model | LanguageModel | An instance of Chat configured with the specified parameters. |
</details>
## Language models bundles
If your provider or model isn't supported by the core **Language model** component, see [Bundles](/components-bundle-components) for additional language model and embedding model components developed by third-party contributors.

View file

@ -5,15 +5,151 @@ slug: /components-processing
import Icon from "@site/src/components/icon";
Processing components process and transform data within a flow.
Processing components process and transform data within a flow, like converting `Data` to text with a [Parser](#parser) component, filtering data with natural language with the [Smart function](#smart-function), or saving data to your local machine with [Save File](#save-file).
## Use a processing component in a flow
## Batch Run
The **Split Text** processing component in this flow splits the incoming [Data](/concepts-objects) into chunks to be embedded into the vector store component.
The **Batch Run** component runs a language model over **each row** of a [DataFrame](/concepts-objects#dataframe-object) text column and returns a new DataFrame with the original text and an LLM response.
The component offers control over chunk size, overlap, and separator, which affect context and granularity in vector store retrieval results.
The response contains the following columns:
![](/img/vector-store-document-ingestion.png)
* `text_input`: The original text from the input DataFrame.
* `model_response`: The model's response for each input.
* `batch_index`: The processing order, with a `0`-based index.
* `metadata` (optional): Additional information about the processing.
These columns, when connected to a **Parser** component, can be used as variables within curly braces.
To use the Batch Run component with a **Parser** component, do the following:
1. Connect a **Model** component to the **Batch Run** component's **Language model** port.
2. Connect a component that outputs DataFrame, like **File** component, to the **Batch Run** component's **DataFrame** input.
3. Connect the **Batch Run** component's **Batch Results** output to a **Parser** component's **DataFrame** input.
The flow looks like this:
![A batch run component connected to OpenAI and a Parser](/img/component-batch-run.png)
4. In the **Column Name** field of the **Batch Run** component, enter a column name based on the data you're loading from the **File** loader. For example, to process a column of `name`, enter `name`.
5. Optionally, in the **System Message** field of the **Batch Run** component, enter a **System Message** to instruct the connected LLM on how to process your file. For example, `Create a business card for each name.`
6. In the **Template** field of the **Parser** component, enter a template for using the **Batch Run** component's new DataFrame columns.
To use all three columns from the **Batch Run** component, include them like this:
```text
record_number: {batch_index}, name: {text_input}, summary: {model_response}
```
7. To run the flow, in the **Parser** component, click <Icon name="Play" aria-hidden="True" /> **Run component**.
8. To view your created DataFrame, in the **Parser** component, click <Icon name="TextSearch" aria-hidden="True" /> **Inspect output**.
9. Optionally, connect a **Chat Output** component, and open the **Playground** to see the output.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| model | HandleInput | Connect the 'Language Model' output from your LLM component here. Required. |
| system_message | MultilineInput | A multi-line system instruction for all rows in the DataFrame. |
| df | DataFrameInput | The DataFrame whose column is treated as text messages, as specified by 'column_name'. Required. |
| column_name | MessageTextInput | The name of the DataFrame column to treat as text messages. If empty, all columns are formatted in TOML. |
| output_column_name | MessageTextInput | Name of the column where the model's response is stored. Default=`model_response`. |
| enable_metadata | BoolInput | If True, add metadata to the output DataFrame. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| batch_results | DataFrame | A DataFrame with all original columns plus the model's response column. |
</details>
## Data operations
This component performs operations on [Data](/concepts-objects#data-object) objects, including selecting keys, evaluating literals, combining data, filtering values, appending/updating data, removing keys, and renaming keys.
1. To use this component in a flow, connect a component that outputs [Data](/concepts-objects#data-object) to the **Data Operations** component's input.
All operations in the component require at least one [Data](/concepts-objects#data-object) input.
2. In the **Operations** field, select the operation you want to perform.
For example, send this request to the **Webhook** component.
Replace `YOUR_FLOW_ID` with your flow ID.
```bash
curl -X POST "http://127.0.0.1:7860/api/v1/webhook/YOUR_FLOW_ID" \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
}'
```
3. In the **Data Operations** component, select the **Select Keys** operation to extract specific user information.
To add additional keys, click <Icon name="Plus" aria-hidden="True" /> **Add more**.
![A webhook and data operations component](/img/component-data-operations-select-key.png)
4. Filter by `name`, `username`, and `email` to select the values from the request.
```json
{
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz"
}
```
### Operations
The component supports the following operations.
All operations in the **Data operations** component require at least one [Data](/concepts-objects#data-object) input.
| Operation | Required Inputs | Info |
|-----------|----------------|-------------|
| 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. |
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| data | Data | The [Data](/concepts-objects#data-object) object to operate on. |
| operations | Operations | The operation to perform on the data. |
| select_keys_input | Select Keys | A list of keys to select from the data. |
| filter_key | Filter Key | The key to filter by. |
| operator | Comparison Operator | The operator to apply for comparing values. |
| filter_values | Filter Values | A list of values to filter by. |
| append_update_data | Append or Update | The data to append or update the existing data with. |
| remove_keys_input | Remove Keys | A list of keys to remove from the data. |
| rename_keys_input | Rename Keys | A list of keys to rename in the data. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| data_output | Data | The resulting Data object after the operation. |
</details>
## DataFrame operations
@ -21,15 +157,15 @@ This component performs operations on [DataFrame](https://pandas.pydata.org/docs
To use this component in a flow, connect a component that outputs [DataFrame](/concepts-objects#dataframe-object) to the **DataFrame Operations** component.
This example fetches JSON data from an API. The **Smart function** component extracts and flattens the results into a tabular DataFrame. The **DataFrame Operations** component can then work with the retrieved data.
This example fetches JSON data from an API. The **Smart Filter** component extracts and flattens the results into a tabular DataFrame. The **DataFrame Operations** component can then work with the retrieved data.
![Dataframe operations with flattened dataframe](/img/component-dataframe-operations.png)
1. The **API Request** component retrieves data with only `source` and `result` fields.
For this example, the desired data is nested within the `result` field.
2. Connect a **Smart function** to the API request component, and a **Language model** to the **Smart function**. This example connects a **Groq** model component.
2. Connect a **Smart Filter** to the API request component, and a **Language model** to the **Smart Filter**. This example connects a **Groq** model component.
3. In the **Groq** model component, add your **Groq** API key.
4. To filter the data, in the **Smart function** component, in the **Instructions** field, use natural language to describe how the data should be filtered.
4. To filter the data, in the **Smart filter** component, in the **Instructions** field, use natural language to describe how the data should be filtered.
For this example, enter:
```
I want to explode the result column out into a Data object
@ -37,8 +173,8 @@ I want to explode the result column out into a Data object
:::tip
Avoid punctuation in the **Instructions** field, as it can cause errors.
:::
5. To run the flow, in the **Smart function** component, click <Icon name="Play" aria-hidden="true"/> **Run component**.
6. To inspect the filtered data, in the **Smart function** component, click <Icon name="TextSearch" aria-hidden="true"/> **Inspect output**.
5. To run the flow, in the **Smart Filter** component, click <Icon name="Play" aria-hidden="true" /> **Run component**.
6. To inspect the filtered data, in the **Smart Filter** component, click <Icon name="TextSearch" aria-hidden="true" /> **Inspect output**.
The result is a structured DataFrame.
```text
id | name | company | username | email | address | zip
@ -102,170 +238,45 @@ This component can perform the following operations on Pandas [DataFrame](https:
</details>
## Data operations
This component performs operations on [Data](/concepts-objects#data-object) objects, including selecting keys, evaluating literals, combining data, filtering values, appending/updating data, removing keys, and renaming keys.
1. To use this component in a flow, connect a component that outputs [Data](/concepts-objects#data-object) to the **Data Operations** component's input.
All operations in the component require at least one [Data](/concepts-objects#data-object) input.
2. In the **Operations** field, select the operation you want to perform.
For example, send this request to the **Webhook** component.
Replace `YOUR_FLOW_ID` with your flow ID.
```bash
curl -X POST "http://localhost:7860/api/v1/webhook/YOUR_FLOW_ID" \
-H 'Content-Type: application/json' \
-d '{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
}'
```
3. In the **Data Operations** component, select the **Select Keys** operation to extract specific user information.
To add additional keys, click <Icon name="Plus" aria-hidden="true"/> **Add More**.
![A webhook and data operations component](/img/component-data-operations-select-key.png)
4. Filter by `name`, `username`, and `email` to select the values from the request.
```json
{
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz"
}
```
### Operations
The component supports the following operations.
All operations in the **Data operations** component require at least one [Data](/concepts-objects#data-object) input.
| Operation | Required Inputs | Info |
|-----------|----------------|-------------|
| 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. |
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| data | Data | The [Data](/concepts-objects#data-object) object to operate on. |
| operations | Operations | The operation to perform on the data. |
| select_keys_input | Select Keys | A list of keys to select from the data. |
| filter_key | Filter Key | The key to filter by. |
| operator | Comparison Operator | The operator to apply for comparing values. |
| filter_values | Filter Values | A list of values to filter by. |
| append_update_data | Append or Update | The data to append or update the existing data with. |
| remove_keys_input | Remove Keys | A list of keys to remove from the data. |
| rename_keys_input | Rename Keys | A list of keys to rename in the data. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| data_output | Data | The resulting Data object after the operation. |
</details>
## Data to DataFrame
This component converts one or multiple [Data](/concepts-objects#data-object) objects into a [DataFrame](/concepts-objects#dataframe-object). Each Data object corresponds to one row in the resulting DataFrame. Fields from the `.data` attribute become columns, and the `.text` field (if present) is placed in a 'text' column.
1. To use this component in a flow, connect a component that outputs [Data](/concepts-objects#data-object) to the **Data to Dataframe** component's input.
This example connects a **Webhook** component to convert `text` and `data` into a DataFrame.
2. To view the flow's output, connect a **Chat Output** component to the **Data to Dataframe** component.
![A webhook and data to dataframe](/img/component-data-to-dataframe.png)
3. Send a POST request to the **Webhook** containing your JSON data.
Replace `YOUR_FLOW_ID` with your flow ID.
This example uses the default Langflow server address.
```text
curl -X POST "http://localhost:7860/api/v1/webhook/YOUR_FLOW_ID" \
-H 'Content-Type: application/json' \
-d '{
"text": "Alex Cruz - Employee Profile",
"data": {
"Name": "Alex Cruz",
"Role": "Developer",
"Department": "Engineering"
}
}'
```
4. In the **Playground**, view the output of your flow.
The **Data to DataFrame** component converts the webhook request into a `DataFrame`, with `text` and `data` fields as columns.
```text
| text | data |
|:-----------------------------|:------------------------------------------------------------------------|
| Alex Cruz - Employee Profile | {'Name': 'Alex Cruz', 'Role': 'Developer', 'Department': 'Engineering'} |
```
5. Send another employee data object.
```text
curl -X POST "http://localhost:7860/api/v1/webhook/YOUR_FLOW_ID" \
-H 'Content-Type: application/json' \
-d '{
"text": "Kalani Smith - Employee Profile",
"data": {
"Name": "Kalani Smith",
"Role": "Designer",
"Department": "Design"
}
}'
```
6. In the **Playground**, this request is also converted to `DataFrame`.
```text
| text | data |
|:--------------------------------|:---------------------------------------------------------------------|
| Kalani Smith - Employee Profile | {'Name': 'Kalani Smith', 'Role': 'Designer', 'Department': 'Design'} |
```
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| data_list | Data or Data List | One or multiple Data objects to transform into a DataFrame. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| dataframe | DataFrame | A DataFrame built from each Data object's fields plus a text column. |
</details>
## LLM router
This component routes requests to the most appropriate LLM based on OpenRouter model specifications.
This component routes requests to the most appropriate LLM based on [OpenRouter](https://openrouter.ai/docs/quickstart) model specifications.
The judge LLM analyzed your input message to understand the evaluation context, and then selects the most appropriate model from your LLM pool.
The selected model processes your input and returns the response.
To use the **LLM Router** component in a flow, do the following:
1. Connect multiple **Language Model** components to the **LLM Router**'s **Language Models** input.
2. Connect a **Judge LLM** component to the **Judge LLM** input.
3. Connect **Chat Input** and **Chat Output** components to the **LLM Router**.
The flow looks like this:
![LLM router component](/img/component-llm-router.png)
4. In the LLM Router component, set your **Optimization** preference:
- **Quality**: Prioritizes the highest quality response.
- **Speed**: Prioritizes the fastest response time.
- **Cost**: Prioritizes the most cost-effective option.
- **Balanced**: Strikes a balance between quality, speed, and cost.
5. Run the flow.
Your input is the task that the LLM router evaluates the models against, such as `Write a story about horses` or `How do I parse data objects out of JSON?`.
6. In the LLM Router component, select the **Model Selection Decision** output to view the router's reasoning.
```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
```
<details>
<summary>Parameters</summary>
@ -288,27 +299,6 @@ This component routes requests to the most appropriate LLM based on OpenRouter m
</details>
## Message to data
This component converts [Message](/concepts-objects#message-object) objects to [Data](/concepts-objects#data-object) objects.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| message | Message | The Message object to convert to a Data object. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| data | Data | The converted Data object. |
</details>
## Parser
This component formats `DataFrame` or `Data` objects into text using templates, with an option to convert inputs directly to strings using `stringify`.
@ -367,28 +357,91 @@ For an additional example of using the **Parser** component to format a DataFram
</details>
## Regex extractor
## Python interpreter
This component extracts patterns from text using regular expressions. It can be used to find and extract specific patterns or information from text data.
This component allows you to execute Python code with imported packages.
To use this component in a flow:
1. Connect the **Regex Extractor** to a **URL** component and a **Chat Output** component.
![Regex extractor connected to url component](/img/component-url-regex.png)
2. In the **Regex Extractor** tool, enter a pattern to extract text from the **URL** component's raw output.
This example extracts the first paragraph from the "In the News" section of `https://en.wikipedia.org/wiki/Main_Page`:
```
In the news\s*\n(.*?)(?=\n\n)
```
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. Optionally, enable **Tool Mode** and connect the interpreter to an **Agent** as a tool.
For example, connect a **Python Interpreter** and a [Calculator](/components-helpers#calculator) as tools for an Agent, and test how it chooses different tools to solve math problems.
The flow looks like this:
![Python Interpreter and calculator connected to Agent](/img/component-python-interpreter.png)
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:
```
Peruvian writer and Nobel Prize in Literature laureate Mario Vargas Llosa (pictured) dies at the age of 89.
```text
Executed evaluate_expression
Input:
{
"expression": "2+5"
}
Output:
{
"result": "7"
}
```
## Save to File
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.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| global_imports | String | A comma-separated list of modules to import globally, such as `math,pandas,numpy`. |
| python_code | Code | The Python code to execute. Only modules specified in Global Imports can be used. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| results | Data | The output of the executed Python code, including any printed results or errors. |
</details>
## Save file
This component saves [DataFrames, Data, or Messages](/concepts-objects) to various file formats.
@ -412,7 +465,7 @@ For example, if the selected `file_format` is `csv`, and you enter `file_path` a
Replace `YOUR_FLOW_ID` with your flow ID.
This example uses the default Langflow server address.
```text
curl -X POST "http://localhost:7860/api/v1/webhook/YOUR_FLOW_ID" \
curl -X POST "http://127.0.0.1:7860/api/v1/webhook/YOUR_FLOW_ID" \
-H 'Content-Type: application/json' \
-d '{
"Name": ["Alex Cruz", "Kalani Smith", "Noam Johnson"],
@ -473,15 +526,19 @@ For `Message` inputs, the component can create:
## Smart function
This component uses an LLM to generate a Lambda function for filtering or transforming structured data.
:::tip
Prior to Langflow 1.5, this component was named the Lambda filter.
:::
To use the **Smart function** component, you must connect it to a [Language Model](/components-models#language-model) component, which the component uses to generate a function based on the natural language instructions in the **Instructions** field.
This component uses an LLM to generate a function for filtering or transforming structured data.
To use the **Smart function** component, you must connect it to a [Language Model](/components-models) component, which the component uses to generate a function based on the natural language instructions in the **Instructions** field.
This example gets JSON data from the `https://jsonplaceholder.typicode.com/users` API endpoint.
The **Instructions** field in the **Smart function** component specifies the task `extract emails`.
The connected LLM creates a filter based on the instructions, and successfully extracts a list of email addresses from the JSON data.
![](/img/component-lambda-filter.png)
![Smart function connected to an LLM](/img/component-lambda-filter.png)
<details>
<summary>Parameters</summary>
@ -578,9 +635,108 @@ Third chunk: "s of Artificial Intelligence and its applications"
</details>
## Update data
## Structured output
This component dynamically updates or appends data with specified fields.
This component transforms LLM responses into structured data formats.
In this example from the **Financial Support Parser** template, the **Structured Output** component transforms unstructured financial reports into structured data.
![Structured output example](/img/component-structured-output.png)
The connected LLM model is prompted by the **Structured Output** component's `Format Instructions` parameter to extract structured output from the unstructured text. `Format Instructions` is utilized as the system prompt for the **Structured Output** component.
In the **Structured Output** component, click the **Open table** button to view the `Output Schema` table.
The `Output Schema` parameter defines the structure and data types for the model's output using a table with the following fields:
* **Name**: The name of the output field.
* **Description**: The purpose of the output field.
* **Type**: The data type of the output field. The available types are `str`, `int`, `float`, `bool`, `list`, or `dict`. The default is `text`.
* **Multiple**: This feature is deprecated. Currently, it is set to `True` by default if you expect multiple values for a single field. For example, a `list` of `features` is set to `True` to contain multiple values, such as `["waterproof", "durable", "lightweight"]`. Default: `True`.
The **Parse DataFrame** component parses the structured output into a template for orderly presentation in chat output. The template receives the values from the `output_schema` table with curly braces.
For example, the template `EBITDA: {EBITDA} , Net Income: {NET_INCOME} , GROSS_PROFIT: {GROSS_PROFIT}` presents the extracted values in the **Playground** as `EBITDA: 900 million , Net Income: 500 million , GROSS_PROFIT: 1.2 billion`.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| llm | LanguageModel | The language model to use to generate the structured output. |
| input_value | String | The input message to the language model. |
| system_prompt | String | The instructions to the language model for formatting the output. |
| schema_name | String | The name for the output data schema. |
| output_schema | Table | The structure and data types for the model's output. |
| multiple | Boolean | [Deprecated] Always set to `True`. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| structured_output | Data | The structured output is a Data object based on the defined schema. |
</details>
## Type convert
This component converts data types between different formats. It can transform data between [Data](/concepts-objects#data-object), [DataFrame](/concepts-objects#dataframe-object), and [Message](/concepts-objects#message-object) objects.
* **Data**: A structured object that contains both text and metadata.
```json
{
"text": "User Profile",
"data": {
"name": "John Smith",
"age": 30,
"email": "john@example.com"
}
}
```
* **DataFrame**: A tabular data structure with rows and columns.
Keys are columns, and each dictionary (a collection of key-value pairs) in the list is a row.
```json
[
{
"name": "John Smith",
"age": 30,
"email": "john@example.com"
},
{
"name": "Jane Doe",
"age": 25,
"email": "jane@example.com"
}
]
```
* **Message**: A string, such as`"Name: John Smith, Age: 30, Email: john@example.com"`.
To use this component in a flow, do the following:
1. Add the **Web search** component to the [Basic prompting](/basic-prompting) flow. In the **Search Query** field, enter a query, such as `environmental news`.
2. Connect the **Web search** component's output to a component that accepts the DataFrame input.
This example uses a **Prompt** component to give the chatbot context, so you must convert the **Web search** component's DataFrame output to a Message type.
3. Connect a **Type Convert** component to convert the DataFrame to a Message.
4. In the **Type Convert** component, in the **Output Type** field, select **Message**.
Your flow looks like this:
![Type convert web search output to chat](/img/component-type-convert-and-web-search.png)
5. In the **Language Model** component, in the **OpenAI API Key** field, add your OpenAI API key.
6. Click **Playground**, and then ask about `latest news`.
The search results are returned to the Playground as a message.
Result:
```text
Latest news
AI
gpt-4o-mini
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>
<summary>Parameters</summary>
@ -589,16 +745,14 @@ This component dynamically updates or appends data with specified fields.
| Name | Display Name | Info |
|------|--------------|------|
| old_data | Data | The records to update. |
| number_of_fields | Number of Fields | The number of fields to add. The maximum is 15. |
| text_key | Text Key | The key for text content. |
| text_key_validator | Text Key Validator | Validates the text key presence. |
| input_data | Input Data | The data to convert. Accepts Data, DataFrame, or Message objects. |
| output_type | Output Type | The desired output type. Options: Data, DataFrame, or Message. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| data | Data | The updated Data objects. |
| output | Output | The converted data in the specified format. |
</details>
@ -736,6 +890,80 @@ This component dynamically creates a [Data](/concepts-objects#data-object) objec
</details>
### Data to DataFrame
:::important
This component is in **Legacy**, which means it is available for use but no longer in active development.
:::
This component converts one or multiple [Data](/concepts-objects#data-object) objects into a [DataFrame](/concepts-objects#dataframe-object). Each Data object corresponds to one row in the resulting DataFrame. Fields from the `.data` attribute become columns, and the `.text` field (if present) is placed in a 'text' column.
1. To use this component in a flow, connect a component that outputs [Data](/concepts-objects#data-object) to the **Data to Dataframe** component's input.
This example connects a **Webhook** component to convert `text` and `data` into a DataFrame.
2. To view the flow's output, connect a **Chat Output** component to the **Data to Dataframe** component.
![A webhook and data to dataframe](/img/component-data-to-dataframe.png)
3. Send a POST request to the **Webhook** containing your JSON data.
Replace `YOUR_FLOW_ID` with your flow ID.
This example uses the default Langflow server address.
```text
curl -X POST "http://127.0.0.1:7860/api/v1/webhook/YOUR_FLOW_ID" \
-H 'Content-Type: application/json' \
-d '{
"text": "Alex Cruz - Employee Profile",
"data": {
"Name": "Alex Cruz",
"Role": "Developer",
"Department": "Engineering"
}
}'
```
4. In the **Playground**, view the output of your flow.
The **Data to DataFrame** component converts the webhook request into a `DataFrame`, with `text` and `data` fields as columns.
```text
| text | data |
|:-----------------------------|:------------------------------------------------------------------------|
| Alex Cruz - Employee Profile | {'Name': 'Alex Cruz', 'Role': 'Developer', 'Department': 'Engineering'} |
```
5. Send another employee data object.
```text
curl -X POST "http://127.0.0.1:7860/api/v1/webhook/YOUR_FLOW_ID" \
-H 'Content-Type: application/json' \
-d '{
"text": "Kalani Smith - Employee Profile",
"data": {
"Name": "Kalani Smith",
"Role": "Designer",
"Department": "Design"
}
}'
```
6. In the **Playground**, this request is also converted to `DataFrame`.
```text
| text | data |
|:--------------------------------|:---------------------------------------------------------------------|
| Kalani Smith - Employee Profile | {'Name': 'Kalani Smith', 'Role': 'Designer', 'Department': 'Design'} |
```
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| data_list | Data or Data List | One or multiple Data objects to transform into a DataFrame. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| dataframe | DataFrame | A DataFrame built from each Data object's fields plus a text column. |
</details>
### Filter data
@ -820,6 +1048,27 @@ The JSON cleaner component cleans JSON strings to ensure they are fully complian
</details>
### Message to data
This component converts [Message](/concepts-objects#message-object) objects to [Data](/concepts-objects#data-object) objects.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| message | Message | The Message object to convert to a Data object. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| data | Data | The converted Data object. |
</details>
### Parse DataFrame
:::important
@ -874,6 +1123,29 @@ This component converts and extracts JSON fields using JQ queries.
</details>
### Regex extractor
:::important
This component is in **Legacy**, which means it is available for use but no longer in active development.
:::
This component extracts patterns from text using regular expressions. It can be used to find and extract specific patterns or information from text data.
To use this component in a flow:
1. Connect the **Regex Extractor** to a **URL** component and a **Chat Output** component.
2. In the **Regex Extractor** tool, enter a pattern to extract text from the **URL** component's raw output.
This example extracts the first paragraph from the "In the News" section of `https://en.wikipedia.org/wiki/Main_Page`:
```
In the news\s*\n(.*?)(?=\n\n)
```
Result:
```
Peruvian writer and Nobel Prize in Literature laureate Mario Vargas Llosa (pictured) dies at the age of 89.
```
### Select data
:::important
@ -899,3 +1171,32 @@ This component selects a single [Data](/concepts-objects#data-object) item from
| selected_data | Selected Data | The selected [Data](/concepts-objects#data-object) object. |
</details>
### Update data
:::important
This component is in **Legacy**, which means it is available for use but no longer in active development.
:::
This component dynamically updates or appends data with specified fields.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Display Name | Info |
|------|--------------|------|
| old_data | Data | The records to update. |
| number_of_fields | Number of Fields | The number of fields to add. The maximum is 15. |
| text_key | Text Key | The key for text content. |
| text_key_validator | Text Key Validator | Validates the text key presence. |
**Outputs**
| Name | Display Name | Info |
|------|--------------|------|
| data | Data | The updated Data objects. |
</details>

View file

@ -13,9 +13,7 @@ Prompts are a combination of natural language and variables created with curly b
## Use a prompt component in a flow
An example of modifying a prompt can be found in [Vector RAG starter flow](/vector-store-rag), where a basic chatbot flow is extended to include a full vector RAG pipeline.
![Vector RAG connected to a chatbot](/img/starter-flow-vector-rag.png)
An example of modifying a prompt can be found in the [Basic prompting starter flow](/basic-prompting).
The default prompt in the **Prompt** component is `Answer the user as if you were a GenAI expert, enthusiastic about helping them get started building something fresh.`
@ -30,7 +28,7 @@ Answer the question
{user_question}
```
When variables are added to a prompt template, new fields are automatically created in the component. These fields can be connected to receive text input from other components to automate prompting, or to output instructions to other components. An example of prompts controlling agents behavior is available in the [sequential tasks agent starter flow](/sequential-agent).
When variables are added to a prompt template, new fields are automatically created in the component. These fields can be connected to receive text input from other components to automate prompting, or to output instructions to other components.
<details>
<summary>Parameters</summary>

View file

@ -5,30 +5,24 @@ slug: /components-tools
import Icon from "@site/src/components/icon";
# Tool components in Langflow
The **Tools** category in Langflow is removed as of Langflow 1.5.
Tools are typically connected to agent components at the **Tools** port. Agents use LLMs as a reasoning engine to decide which of the connected tool components to use to solve a problem.
Most components from the **Tools** category have been moved to other categories or bundles.
Tools in agentic functions are, essentially, functions that the agent can call to perform tasks or access external resources.
A function is wrapped as a `Tool` object, with a common interface the agent understands.
Agents become aware of tools through tool registration, where the agent is provided a list of available tools, typically at agent initialization. The `Tool` object's description tells the agent what the tool can do.
* The [MCP Tools](/components-agents#mcp-connection) component is available in **Agent components**.
* The [calculator](/components-helpers#calculator) component is available in **Helpers**.
* The [Astra DB JSON](/components-tools#astra-db-tool) and [Astra DB CQL](#astra-db-cql-tool) tools are available in the **DataStax** bundle.
* The [Python Interpreter](/components-processing#python-interpreter) component is available in **Processing**.
The agent then uses a connected LLM to reason through the problem to decide which tool is best for the job.
## Use a tool in a flow
Tools are typically connected to agent components at the **Tools** port.
The [simple agent starter project](/simple-agent) uses URL and Calculator tools connected to an [agent component](/components-agents#agent-component) to answer a user's questions. The OpenAI LLM acts as a brain for the agent to decide which tool to use.
![Simple agent starter flow](/img/starter-flow-simple-agent.png)
To make a component into a tool that an agent can use, enable **Tool Mode** in the component. Enabling tool mode modifies a component input to accept calls from an agent.
If the component you want to connect to an agent doesn't have a **Tool Mode** option, you can modify the component's inputs to become a tool.
For an example, see [Make any component a tool](/agents-tools#make-any-component-a-tool).
The remaining tools listed below are moved to a **Bundle** or in **Legacy**.
Legacy components are available for use but are no longer supported.
## arXiv
:::important
As of Langflow 1.5, this component is available in the **Search** bundle.
:::
This component searches and retrieves papers from [arXiv.org](https://arXiv.org).
<details>
@ -52,6 +46,10 @@ This component searches and retrieves papers from [arXiv.org](https://arXiv.org)
## Astra DB tool
:::important
As of Langflow 1.5, this component is available in the **DataStax** bundle.
:::
This component allows agents to query data from Astra DB collections.
To use this tool in a flow, connect it to an **Agent** component.
@ -130,6 +128,10 @@ The **Data** output is used when directly querying Astra DB, while the **Tool**
## Astra DB CQL Tool
:::important
As of Langflow 1.5, this component is available in the **DataStax** bundle.
:::
The `Astra DB CQL Tool` allows agents to query data from CQL tables in Astra DB.
<details>
@ -162,6 +164,10 @@ The `Astra DB CQL Tool` allows agents to query data from CQL tables in Astra DB.
## Bing Search API
:::important
As of Langflow 1.5, this component is available in the **Search** bundle.
:::
This component allows you to call the Bing Search API.
<details>
@ -187,6 +193,10 @@ This component allows you to call the Bing Search API.
## Combinatorial Reasoner
:::important
This component is available in the **Components** menu under **Bundles**.
:::
This component runs Icosa's Combinatorial Reasoning (CR) pipeline on an input to create an optimized prompt with embedded reasons. For more information, see [Icosa computing](https://www.icosacomputing.com/).
<details>
@ -213,6 +223,10 @@ This component runs Icosa's Combinatorial Reasoning (CR) pipeline on an input to
## DuckDuckGo search
:::important
As of Langflow 1.5, this component is available in the **Search** bundle.
:::
This component performs web searches using the [DuckDuckGo](https://www.duckduckgo.com) search engine with result-limiting capabilities.
<details>
@ -237,6 +251,10 @@ This component performs web searches using the [DuckDuckGo](https://www.duckduck
## Exa Search
:::important
As of Langflow 1.5, this component is available in the **Search** bundle.
:::
This component provides an [Exa Search](https://exa.ai/) toolkit for search and content retrieval.
<details>
@ -261,6 +279,10 @@ This component provides an [Exa Search](https://exa.ai/) toolkit for search and
## Glean Search API
:::important
As of Langflow 1.5, this component is available in the **Search** bundle.
:::
This component allows you to call the Glean Search API.
<details>
@ -285,8 +307,41 @@ This component allows you to call the Glean Search API.
</details>
### Google Search API
:::important
As of Langflow 1.5, this component is available in the **Search** bundle.
:::
This component allows you to call the Google Search API.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| google_api_key | SecretString | A Google API key for authentication. |
| google_cse_id | SecretString | A Google Custom Search Engine ID. |
| input_value | String | The search query input. |
| k | Integer | The number of search results to return. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| results | List[Data] | A list of search results. |
| tool | Tool | A Google Search tool for use in LangChain. |
</details>
## Google Serper API
:::important
As of Langflow 1.5, this component is available in the **Search** bundle.
:::
This component allows you to call the Serper.dev Google Search API.
<details>
@ -311,15 +366,82 @@ This component allows you to call the Serper.dev Google Search API.
## MCP connection
The **MCP connection** component exposes Model Context Protocol (MCP) servers, including your other flows, as tools for Langflow agents. For information about this component, see [Use Langflow as an MCP client](/mcp-client).
:::important
As of Langflow 1.5, this component is called the **MCP Tools** component.
:::
The **MCP tools** component exposes Model Context Protocol (MCP) servers, including your other flows, as tools for Langflow agents. For information about this component, see [Use Langflow as an MCP client](/mcp-client).
### MCP Tools (deprecated)
The **MCP Tools (stdio)** and **MCP Tools (SSE)** components are deprecated as of Langflow version 1.3.
They are replaced by the [MCP connection component](/mcp-client).
They are replaced by a single [MCP tools](/mcp-client) component.
## Search API
:::important
As of Langflow 1.5, this component is available in the **Search** bundle.
:::
This component calls the `searchapi.io` API. It can be used to search the web for information.
For more information, see the [SearchAPI documentation](https://www.searchapi.io/docs/google).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| engine | String | The search engine to use. Default: `google`. |
| api_key | SecretString | The API key for authenticating with SearchAPI. |
| input_value | String | The search query or input for the API call. |
| search_params | Dict | Additional parameters for customizing the search. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| data | List[Data] | A list of Data objects containing search results. |
| tool | Tool | A Tool object for use in LangChain workflows. |
</details>
## SearXNG Search Tool
:::important
As of Langflow 1.5, this component is available in the **Search** bundle.
:::
This component creates a tool for searching using SearXNG, a metasearch engine.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| url | String | The URL of the SearXNG instance. |
| max_results | Integer | The maximum number of results to return. |
| categories | List[String] | The categories to search in. |
| language | String | The language for the search results. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| result_tool | Tool | A SearXNG search tool for use in LangChain. |
</details>
## Wikidata
:::important
As of Langflow 1.5, this component is available in the **Search** bundle.
:::
This component performs a search using the Wikidata API.
<details>
@ -340,12 +462,46 @@ This component performs a search using the Wikidata API.
</details>
## Wikipedia API
:::important
As of Langflow 1.5, this component is available in the **Search** bundle.
:::
This component creates a tool for searching and retrieving information from Wikipedia.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| input_value | String | The search query input. |
| lang | String | The language code for Wikipedia. Default: `en`. |
| k | Integer | The number of results to return. |
| load_all_available_meta | Boolean | Whether to load all available metadata. |
| doc_content_chars_max | Integer | The maximum number of characters for document content. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| results | List[Data] | A list of Wikipedia search results. |
| tool | Tool | A Wikipedia search tool for use in LangChain. |
</details>
## Legacy components
Legacy components are available for use but are no longer supported.
### Calculator Tool
:::important
This component is now available in [Helper components](/components-helpers#calculator).
:::
This component allows you to evaluate basic arithmetic expressions. It supports addition, subtraction, multiplication, division, and exponentiation.
<details>
@ -365,33 +521,13 @@ This component allows you to evaluate basic arithmetic expressions. It supports
</details>
### Google Search API
This component allows you to call the Google Search API.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| google_api_key | SecretString | A Google API key for authentication. |
| google_cse_id | SecretString | A Google Custom Search Engine ID. |
| input_value | String | The search query input. |
| k | Integer | The number of search results to return. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| results | List[Data] | A list of search results. |
| tool | Tool | A Google Search tool for use in LangChain. |
</details>
### Python Code Structured Tool
:::important
This component is in **Legacy**, which means it is available for use but no longer in active development.
Instead, use the [Python Interpreter](/components-processing#python-interpreter).
:::
This component creates a structured tool from Python code using a dataclass.
The component dynamically updates its configuration based on the provided Python code, allowing for custom function arguments and descriptions.
@ -420,6 +556,10 @@ The component dynamically updates its configuration based on the provided Python
### Python REPL Tool
:::important
The Python REPL tool is available in **Processing** and re-named the [Python Interpreter](/components-processing#python-interpreter)
:::
This component creates a Python REPL (Read-Eval-Print Loop) tool for executing Python code.
<details>
@ -462,81 +602,4 @@ This component creates a tool for interacting with a retriever in LangChain.
|------|------|-------------|
| tool | Tool | A retriever tool for use in LangChain. |
</details>
### Search API
This component calls the `searchapi.io` API. It can be used to search the web for information.
For more information, see the [SearchAPI documentation](https://www.searchapi.io/docs/google).
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| engine | String | The search engine to use. Default: `google`. |
| api_key | SecretString | The API key for authenticating with SearchAPI. |
| input_value | String | The search query or input for the API call. |
| search_params | Dict | Additional parameters for customizing the search. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| data | List[Data] | A list of Data objects containing search results. |
| tool | Tool | A Tool object for use in LangChain workflows. |
</details>
### SearXNG Search Tool
This component creates a tool for searching using SearXNG, a metasearch engine.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| url | String | The URL of the SearXNG instance. |
| max_results | Integer | The maximum number of results to return. |
| categories | List[String] | The categories to search in. |
| language | String | The language for the search results. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| result_tool | Tool | A SearXNG search tool for use in LangChain. |
</details>
### Wikipedia API
This component creates a tool for searching and retrieving information from Wikipedia.
<details>
<summary>Parameters</summary>
**Inputs**
| Name | Type | Description |
|------|------|-------------|
| input_value | String | The search query input. |
| lang | String | The language code for Wikipedia. Default: `en`. |
| k | Integer | The number of results to return. |
| load_all_available_meta | Boolean | Whether to load all available metadata. |
| doc_content_chars_max | Integer | The maximum number of characters for document content. |
**Outputs**
| Name | Type | Description |
|------|------|-------------|
| results | List[Data] | A list of Wikipedia search results. |
| tool | Tool | A Wikipedia search tool for use in LangChain. |
</details>

View file

@ -11,23 +11,21 @@ Vector databases store vector data, which backs AI workloads like chatbots and R
Vector database components establish connections to existing vector databases or create in-memory vector stores for storing and retrieving vector data.
Vector database components are distinct from [memory components](/components-memories), which are built specifically for storing and retrieving chat messages from external databases.
Vector database components are distinct from [memory components](/components-memories), which are built specifically for storing and retrieving chat messages from internal Langflow memory or external databases. For more information, see [Memory management options](/memory).
## Use a vector store component in a flow
This example uses the **Astra DB vector store** component. Your vector store component's parameters and authentication may be different, but the document ingestion workflow is the same. A document is loaded from a local machine and chunked. The Astra DB vector store generates embeddings with the connected [model](/components-models) component, and stores them in the connected Astra DB database.
This example uses the **Chroma DB** vector store component. Your vector store component's parameters and authentication may be different, but the document ingestion workflow is the same. A document is loaded from a local machine and chunked. The vector store component generates embeddings with the connected [model](/components-models) component, and stores them in the connected vector database.
This vector data can then be retrieved for workloads like Retrieval Augmented Generation.
![](/img/vector-store-retrieval.png)
![Embedding data into a vector store](/img/vector-store-document-ingestion.png)
The user's chat input is embedded and compared to the vectors embedded during document ingestion for a similarity search.
The results are output from the vector database component as a [Data](/concepts-objects) object and parsed into text.
This text fills the `{context}` variable in the **Prompt** component, which informs the **Open AI model** component's responses.
Alternatively, connect the vector database component's **Retriever** port to a [retriever tool](components-tools#retriever-tool), and then to an [agent](/components-agents) component. This enables the agent to use your vector database as a tool and make decisions based on the available data.
![](/img/vector-store-agent-retrieval-tool.png)
![Retrieval from a vector store](/img/vector-store-retrieval.png)
## Astra DB Vector Store

View file

@ -9,76 +9,81 @@ import Icon from "@site/src/components/icon";
Langflow integrates with the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) as both an MCP server and an MCP client.
This page describes how to use Langflow as an MCP client with the **MCP connection** component.
This page describes how to use Langflow as an MCP client with the [MCP Tools](#use-the-mcp-tools-component) component and the [MCP servers](#manage-mcp-connections) page in **Settings**.
For information about using Langflow as an MCP server, see [Use Langflow as an MCP server](/mcp-server).
## Use the MCP connection component
## Use the MCP tools component
The **MCP connection** component connects to a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server and exposes the MCP server's tools as tools for [Langflow agents](/agents).
The **MCP Tools** component connects to a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction) server and exposes the MCP server's tools as tools for [Langflow agents](/agents).
This component has two modes, depending on the type of server you want to access:
* To access tools provided by external, non-Langflow MCP servers, [use Stdio mode](#mcp-stdio-mode).
* To access tools provided by external, non-Langflow MCP servers, [use JSON](#mcp-stdio-mode) or [Stdio mode](#mcp-stdio-mode).
* To use flows from your [Langflow projects](/concepts-overview#projects) as MCP tools, [use SSE mode](#mcp-sse-mode).
### Use Stdio mode {#mcp-stdio-mode}
1. Add an **MCP connection** component to your flow.
1. Add an **MCP Tools** component to your flow.
2. In the **MCP Command** field, enter the command to start the MCP server. For example, to start a [Fetch](https://github.com/modelcontextprotocol/servers/tree/main/src/fetch) server, the command is `uvx mcp-server-fetch`.
2. In the **MCP Server** field, select the server you want to add, or click <Icon name="Plus" aria-hidden="true"/> **Add MCP Server**.
There are multiple ways to add a new server.
* In the **JSON** pane, paste the MCP server's JSON configuration file, and then click **Add Server**.
* In the **STDIO** pane, enter the MCP server's **Name**, **Command**, and any **Arguments** or **Environment Variables** the server uses, and then click **Add Server**.
For example, to start a [Fetch](https://github.com/modelcontextprotocol/servers/tree/main/src/fetch) server, the **Command** is `uvx mcp-server-fetch`.
* In the **SSE** pane, enter your Langflow MCP server's **Name**, **SSE URL**, and any **Headers** or **Environment Variables** the server uses, and then click **Add Server**.
The default **SSE URL** is `http://localhost:7860/api/v1/mcp/sse`. For more information, see [Use SSE mode](#mcp-sse-mode).
`uvx` is included with `uv` in the Langflow package.
To use `npx` server commands, you must first install an LTS release of [Node.js](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).
For an example of an `npx` MCP server in Langflow, see [Connect an Astra DB MCP server to Langflow](/mcp-component-astra).
3. To use environment variables in your server command, enter each variable in the **Env** fields as you would define them in a script, such as `VARIABLE=value`. If the **Env** field isn't shown, enable it in the component's **Controls** in the [component's header menu](/concepts-components#component-menus).
3. To use environment variables in your server command, enter each variable in the **Env** fields as you would define them in a script, such as `VARIABLE=value`.
:::important
Langflow passes environment variables from the `.env` file to MCP, but it doesn't pass global variables declared in the Langflow UI.
Langflow passes environment variables from the `.env` file to MCP, but it doesn't pass global variables declared in the Langflow UI.
To define an MCP server environment variable as a global variable, add it to Langflow's `.env` file at startup.
For more information, see [global variables](/configuration-global-variables).
:::
1. Click <Icon name="RefreshCw" aria-hidden="true"/> **Refresh** to test the command and retrieve the list of tools provided by the MCP server.
4. In the **Tool** field, select a tool that you want this component to use, or leave the field blank to allow access to all tools provided by the MCP server.
If you select a specific tool, you might need to configure additional tool-specific fields. For information about tool-specific fields, see your MCP server's documentation.
At this point, the **MCP connection** component is serving a tool, but nothing is using the tool. The next steps explain how to make the tool available to an [**Agent** component](/components-agents) so that the agent can use the tool in its responses.
At this point, the **MCP Tools** component is serving a tool, but nothing is using the tool. The next steps explain how to make the tool available to an [**Agent** component](/components-agents) so that the agent can use the tool in its responses.
6. In the [component's header menu](/concepts-components#component-menus), enable **Tool Mode** so you can use the component with an agent.
5. In the [component menu](/concepts-components#component-menus), enable **Tool mode** so you can use the component with an agent.
7. Connect the **MCP connection** component's **Toolset** port to an **Agent** component's **Tools** port.
6. Connect the **MCP Tools** component's **Toolset** port to an **Agent** component's **Tools** port.
If not already present in your flow, make sure you also attach **Chat input** and **Chat output** components to the **Agent** component.
![MCP connection component](/img/component-mcp-stdio.png)
![MCP tools component in stdio mode](/img/component-mcp-stdio.png)
8. Test your flow to make sure the MCP server is connected and the selected tool is used by the agent: Click **Playground**, and then enter a prompt that uses the tool you connected through the **MCP connection** component.
7. Test your flow to make sure the MCP server is connected and the selected tool is used by the agent: Click **Playground**, and then enter a prompt that uses the tool you connected through the **MCP Tools** component.
For example, if you use `mcp-server-fetch` with the `fetch` tool, you could ask the agent to summarize recent tech news. The agent calls the MCP server function `fetch`, and then returns the response.
1. If you want the agent to be able to use more tools, repeat these steps to add more **MCP connection** components with different servers or tools.
8. If you want the agent to be able to use more tools, repeat these steps to add more **Tools** components with different servers or tools.
### Use SSE mode {#mcp-sse-mode}
Every Langflow project runs a separate MCP server that exposes the project's flows as MCP tools.
For more information about your projects' MCP servers, including how to manage exposed flows, see [Use Langflow as an MCP server](/mcp-server).
To leverage flows-as-tools, use the **MCP connection** component in **Server-Sent Events (SSE)** mode to connect to a project's `/api/v1/mcp/sse` endpoint:
To leverage flows-as-tools, use the **MCP Tools** component in **Server-Sent Events (SSE)** mode to connect to a project's `/api/v1/mcp/sse` endpoint:
1. Add an **MCP connection** component to your flow, and then select **SSE** mode.
A default address appears in the **MCP SSE URL** field.
1. In the **MCP SSE URL** field, modify the default address to point at your Langflow server's SSE endpoint. The default value for Langflow Desktop is `http://localhost:7868/`. The default value for other Langflow installations is `http://localhost:7860/api/v1/mcp/sse`.
1. Click <Icon name="RefreshCw" aria-label="Refresh"/> to test the endpoint and refresh the **Tools** list.
1. Add an **MCP Tools** component to your flow, click <Icon name="Plus" aria-hidden="true"/> **Add MCP Server**, and then select **SSE** mode.
2. In the **MCP SSE URL** field, modify the default address to point at your Langflow server's SSE endpoint. The default value for other Langflow installations is `http://localhost:7860/api/v1/mcp/sse`.
In SSE mode, all flows available from the targeted server are treated as tools.
1. In the **Tool** field, select a flow that you want this component to use, or leave the field blank to allow access to all flows available from the targeted Langflow server.
2. In the [component's header menu](/concepts-components#component-menus), enable **Tool Mode** so you can use the component with an agent.
3. Connect the **MCP connection** component's **Toolset** port to an **Agent** component's **Tools** port. If not already present in your flow, make sure you also attach **Chat input** and **Chat output** components to the **Agent** component.
3. In the [component menu](/concepts-components#component-menus), enable **Tool mode** so you can use the component with an agent.
4. Connect the **MCP Tools** component's **Toolset** port to an **Agent** component's **Tools** port. If not already present in your flow, make sure you also attach **Chat input** and **Chat output** components to the **Agent** component.
![MCP component with SSE mode enabled](/img/component-mcp-sse-mode.png)
1. Test your flow to make sure the agent uses your flows to respond to queries: Click **Playground**, and then enter a prompt that uses a flow that you connected through the **MCP connection** component.
2. If you want the agent to be able to use more flows, repeat these steps to add more **MCP connection** components with different servers or tools selected.
5. Test your flow to make sure the agent uses your flows to respond to queries: Click **Playground**, and then enter a prompt that uses a flow that you connected through the **MCP Tools** component.
6. If you want the agent to be able to use more flows, repeat these steps to add more **MCP Tools** components with different servers or tools selected.
## MCP connection component parameters
## MCP tools component parameters
**Inputs**
@ -93,7 +98,15 @@ In SSE mode, all flows available from the targeted server are treated as tools.
|------|------|-------------|
| tools | List[Tool] | A list of tools exposed by the MCP server. |
## Manage connected MCP servers
The **Settings > MCP Servers** page manages the MCP servers connected to the Langflow client.
To add a new MCP server, click <Icon name="Plus" aria-hidden="true"/> **Add MCP Server** to open the configuration pane, and follow the steps in [Use the MCP Tools component](#use-the-mcp-tools-component).
Click <Icon name="Ellipsis" aria-hidden="true"/> **More** to configure or delete the MCP server.
## See also
- [Use Langflow as an MCP server](/mcp-server)
- [Use a DataStax Astra DB MCP server with the MCP connection component](/mcp-component-astra)
- [Use a DataStax Astra DB MCP server with the MCP tools component](/mcp-component-astra)

View file

@ -80,12 +80,20 @@ Circular port icons (<Icon name="Circle" size="16" aria-label="Circular componen
![Prompt component with multiple inputs](/img/prompt-component.png)
<!--### Dynamic ports
### Dynamic ports
Some components have ports that are dynamically added or removed.
For example, the **Prompt** component accepts inputs within curly braces, and new ports are opened when a value within curly braces is detected in the **Template** field.
![Prompt component with multiple inputs](/img/prompt-component-with-multiple-inputs.png)-->
![Prompt component with multiple inputs](/img/prompt-component-with-multiple-inputs.png)
### Output type selection
Some components include dropdown menus to select the type of output sent to the next component.
For example, the **Language Model** component includes **Model Response** or **Language Model** outputs.
The **Model Response** output sends a [Message](/concepts-objects#message) output on to another Message port.
The **Language Model** output can be connected to components like [Structured output](/components-processing#structured-output) to use the LLM to power the component's reasoning.
### Port colors
@ -219,4 +227,4 @@ Grouped components are configured and managed as a single component, including t
To ungroup the components, click the component in the **Workspace** to expose the component's header menu, click <Icon name="Ellipsis" aria-hidden="true" /> **Show More**, and then select **Ungroup**.
If you want to reuse this grouping in other flows, click the component in the **Workspace** to expose the component's header menu, click <Icon name="Ellipsis" aria-hidden="true" /> **Show More**, and then select **Save** to save the component to the **Components** menu.
If you want to reuse this grouping in other flows, click the component in the **Workspace** to expose the component's header menu, click <Icon name="Ellipsis" aria-hidden="true" /> **Show More**, and then select **Save** to save the component to the **Components** menu.

View file

@ -3,13 +3,13 @@ title: Flows
slug: /concepts-flows
---
import Icon from "@site/src/components/icon";
Flows in Langflow are fully serializable and can be saved and loaded from the file system. In this guide, we'll explore how to import and export flows.
## Import Flow
## Import flow
If you've already got a Langflow JSON file, import it into Langflow by clicking on the project name and choosing **Import Flow**.
![Import Flow](../../static/img/flows/import.gif)
If you already have a Langflow JSON file on your local machine, from the **Projects** page, click <Icon name="Upload" aria-hidden="true"/> **Upload a flow**.
Once imported, your flow is ready to use.
@ -17,9 +17,31 @@ Once imported, your flow is ready to use.
You can drag and drop Langflow JSON files directly from your file system into the Langflow window to import a flow, even into the initial Langflow splash screen.
:::
## Export Flow
## Export a flow
You can export flows to transfer flows between Langflow instances or save backups of your flows.
An exported flow is downloaded to your local machine as a JSON file named `FLOW_NAME.json`.
There are three ways to export a flow:
* From the **Projects** page, find the flow you want to export, click <Icon name="Ellipsis" aria-hidden="true" /> **More**, and then select **Export**.
* When editing a flow, click **Share**, and then click **Export**.
* Use the Langflow API [`/flows/download`](/api-flows#export-flows) endpoint.
When exporting from the Langflow UI, you can select **Save with my API keys** to export the flow _and_ any defined API key variables.
:::warning
If you directly entered the key value into a component's API key field, then **Save with my API keys** exports the literal key value.
If your key is stored in a Langflow global variable, **Save with my API keys** exports only the variable name.
:::
Non-API key variables are included in the export regardless of the **Save with my API keys** setting.
When you or another user import the flow to another Langflow instance, that instance must have Langflow global variables with the same names and a valid values in order to run the flow successfully.
If any variables are missing or invalid, those variables must be created or edited after importing the flow.
The option to export a flow is available in the same menu as shown above. Once exported as JSON, you can import your flow into another Langflow instance.
## Langflow JSON file contents

View file

@ -29,6 +29,7 @@ Flows are stored on local disk at the following default locations:
- **Linux and WSL**: `home/<username>/.cache/langflow/`
- **macOS**: `/Users/<username>/Library/Caches/langflow/`
- **Windows**: `%LOCALAPPDATA%\langflow\langflow\Cache`
The flow storage location can be customized with the [LANGFLOW_CONFIG_DIR](/environment-variables#LANGFLOW_CONFIG_DIR) environment variable.
@ -36,7 +37,7 @@ The flow storage location can be customized with the [LANGFLOW_CONFIG_DIR](/envi
If you're new to Langflow, it's OK to feel a bit lost at first. Well take you on a tour, so you can orient yourself and start creating applications quickly.
Langflow has four distinct regions: the [workspace](#workspace) is the main area where you build your flows. The **Components** menu is on the left, and lists the available [components](#components). The [playground](#playground) and [publish pane](#publish-pane) are available in the upper right corner.
Langflow has four distinct regions: the [workspace](#workspace) is the main area where you build your flows. The **Components** menu is on the left, and lists the available [components](#components). The [playground](#playground) and [publish pane](#share-menu) are available in the upper right corner.
## Workspace
@ -45,8 +46,8 @@ The **workspace** is where you create AI applications by connecting and running
- Click and drag the workspace to move it left, right, up, and down.
- Scroll up and down to zoom in and out of the workspace, or use the <Icon name="ZoomIn" aria-hidden="true"/> **Zoom In** and <Icon name="ZoomOut" aria-hidden="true"/> **Zoom Out** controls.
- Click <Icon name="Maximize" aria-hidden="true"/> **Fit To Zoom** to center the workspace on the current flow.
- Click <Icon name="LockOpen" aria-hidden="true"/> **Lock** to lock the workspace in place, preventing accidental movement.
- Click <Icon name="StickyNote" aria-hidden="true"/> **Add Note** to add a note to your flow, similar to commenting in code.
- Click <Icon name="LockOpen" aria-hidden="true"/> **Lock** to lock the workspace in place, preventing accidental movement.
![Empty langflow workspace](/img/workspace.png)
@ -55,35 +56,46 @@ The **workspace** is where you create AI applications by connecting and running
Components are the building blocks of your flows.
For more information, see [Components overview](/concepts-components).
<img src="/img/prompt-component.png" alt="Prompt component" style={{display: 'block', margin: 'auto', width: 300}} />
![Chat input and output connected to Language model component](/img/connect-component.png)
**Message** handles send text strings between components, so these components send text to each other.
Additional data types include **Data** (<Icon name="Circle" size="16" aria-label="A red circle on the side of a component" style={{ color: '#ef4444', fill: '#ef4444' }}/>) and **DataFrame** (<Icon name="Circle" size="16" aria-label="A red circle on the side of a component" style={{ color: '#d72670', fill: '#d72670' }}/>).
For more information, see [Components](/concepts-components).
## Playground
The **Playground** executes the current flow in the workspace.
If a **Chat Input** component is in your current flow, the **Playground** enables you to run your flow, chat with your flow, view inputs and outputs, and modify your AI's memories to tune your responses in real time.
Chat with your flow, view inputs and outputs, and modify your AI's memories to tune your responses in real time.
For example, click <Icon name="Play" aria-hidden="true"/> **Playground** in a flow that includes **Chat Input**, **Language Model**, and **Chat Output** components to chat with the LLM.
Either the **Chat Input** or **Chat Output** component can be opened in the **Playground** and tested in real time.
![Playground window](/img/playground.png)
For more information, see the [Playground](/concepts-playground).
If you have an **Agent** in your flow, the **Playground** displays its tool calls and outputs, so you can monitor the agent's tool use and understand how it came to the answer it returns.
![](/img/playground.png)
![Playground window with agent response](/img/playground-with-agent.png)
## Publish pane {#publish-pane}
For more information, see [Playground](/concepts-playground).
The **Publish** pane provides code templates to integrate your flows into external applications.
## Share {#share-menu}
For more information, see the [Publish pane](/concepts-publish).
The **Share** menu provides options for integrating your flow into external applications.
![](/img/api-pane.png)
For more information, see the links below.
* [API access](/concepts-publish#api-access) - Integrate your flow into your applications with Python, JavaScript, or curl templates.
* [Export](/concepts-publish#export) - Export your flow to your local machine as a JSON file.
* [MCP Server](/mcp-server) - Expose your flow as a tool for MCP-compatible clients.
* [Embed into site](/embedded-chat-widget) - Embed your flow in HTML, React, or Angular applications.
* [Shareable playground](/concepts-publish#shareable-playground) - Share your **Playground** interface with another user.
## View logs
The **Logs** pane provides a detailed record of all component executions within a workspace.
To access the **Logs** pane, click your **Flow Name**, and then select **Logs**.
To access the **Logs** pane, click **Logs**.
![](/img/logs.png)
![Logs pane](/img/logs.png)
Langflow stores logs at the location specified in the `LANGFLOW_CONFIG_DIR` environment variable.
@ -120,19 +132,6 @@ Upload, store, and manage files in Langflow's **File management** system.
For more on managing your files, see [Manage files](/concepts-file-management).
## Options menu
The dropdown menu labeled with the project name offers several management and customization options for the current flow in the Langflow workspace:
- <Icon name="Plus" aria-hidden="true"/> **New**: Create a new flow from scratch.
- <Icon name="SquarePen" aria-hidden="true"/> **Edit Details**: Adjust settings specific to the current flow, such as its name, description, and endpoint name.
- <Icon name="ScrollText" aria-hidden="true"/> **Logs**: View logs for the current project, including execution history, errors, and other runtime events.
- <Icon name="FileUp" aria-hidden="true"/> **Import**: Import a flow or component from a JSON file into the workspace.
- <Icon name="FileDown" aria-hidden="true"/> **Export**: Export the current flow as a JSON file.
- <Icon name="Undo" aria-hidden="true"/> **Undo**: Revert the last action taken in the project. Keyboard shortcut: <kbd>Control+Z</kbd> (or <kbd>Command+Z</kbd> on macOS).
- <Icon name="Redo" aria-hidden="true"/> **Redo**: Reapply a previously undone action. Keyboard shortcut: <kbd>Control+Y</kbd> (or <kbd>Command+Y</kbd> on macOS).
- <Icon name="RefreshCcw" aria-hidden="true"/> **Refresh All**: Refresh all components and delete cache.
## Settings
In the Langflow header, click your profile icon, and then select **Settings** to access general Langflow settings, including global variables, Langflow API keys, keyboard shortcuts, and log messages.
In the Langflow header, click your profile icon, and then select **Settings** to access general Langflow settings, including global variables, Langflow API keys, keyboard shortcuts, and log messages.

View file

@ -7,53 +7,64 @@ import Icon from "@site/src/components/icon";
The **Playground** is a dynamic interface designed for real-time interaction with LLMs, allowing users to chat, access memories, and monitor inputs and outputs. Here, users can directly prototype their models, making adjustments and observing different outcomes.
As long as you have an [Input or Output](/components-io) component working, you can open it by clicking the **Playground** button.
The Playground's window arrangement changes depending on what components are being used.
As long as you have a [Chat Input](/components-io) component in your flow, you can run and chat with your flow by clicking the **Playground** button.
![](/img/playground.png)
## Run a flow in the playground
## Run a flow in the playgound
To run a flow in the **Playground**, click **Playground**.
When you run a flow in the **Playground**, Langflow calls the `/build/$FLOW_ID/flow` endpoint in [chat.py](https://github.com/langflow-ai/langflow/blob/main/src/backend/base/langflow/api/v1/chat.py#L162). This call retrieves the flow data, builds a graph, and executes the graph. As each component (or node) is executed, the `build_vertex` function calls `build_and_run`, which may call the individual components' `def_build` method, if it exists. If a component doesn't have a `def_build` function, the build still returns a component.
For example, click **Playground** in a flow that includes connected **Chat Input**, **Language Model**, and **Chat Output** components to chat with the LLM.
![Playground window](/img/playground.png)
If you have an **Agent** in your flow, the **Playground** displays its tool calls and outputs, so you can monitor the agent's tool use and understand how it came to the answer it returns.
This agent used a connected `fetch_content` tool to perform a web search.
![Playground window with agent response](/img/playground-with-agent.png)
When you run a flow in the **Playground**, Langflow calls the `/build/{flow_id}/flow` endpoint in [chat.py](https://github.com/langflow-ai/langflow/blob/main/src/backend/base/langflow/api/v1/chat.py#L143). This call retrieves the flow data, builds a graph, and executes the graph. As each component (or node) is executed, the `build_vertex` function calls `build_and_run`, which may call the individual components' `def_build` method, if it exists. If a component doesn't have a `def_build` function, the build still returns a component.
The `build` function allows components to execute logic at runtime. For example, the [Recursive character text splitter](https://github.com/langflow-ai/langflow/blob/main/src/backend/base/langflow/components/langchain_utilities/recursive_character.py) is a child of the `LCTextSplitterComponent` class. When text needs to be processed, the parent class's `build` method is called, which creates a `RecursiveCharacterTextSplitter` object and uses it to split the text according to the defined parameters. The split text is then passed on to the next component. This all occurs when the component is built.
## View playground messages by session ID
When you send a message from the **Playground** interface, the interactions are stored in the **Message Logs** by `session_id`.
A single flow can have multiple chats, and different flows can share the same chat. Each chat will have a different `session_id`.
A single flow can have multiple chats, and different flows can share the same chat. Each chat session has a different `session_id`.
To view messages by `session_id` within the Playground, click the <Icon name="Ellipsis" aria-hidden="true"/> **Options** menu of any chat session, and then select **Message Logs**.
![](/img/messages-logs.png)
![Playground logs](/img/messages-logs.png)
Individual messages in chat memory can be edited or deleted. Modifying these memories influences the behavior of the chatbot responses.
To learn more about chat memories in Langflow, see [Memory components](/components-memories).
To learn more about managing sessions in Langflow, see [Session ID](/session-id).
## Use custom Session IDs for multiple user interactions
To learn more about how chat memory is stored in Langflow, see [Memory components](/memory).
## Use custom session IDs for multiple user interactions
`session_id` values are used to track user interactions in a flow.
By default, if the `session_id` value is empty, it is set to the same value as the `flow_id`. In this case, every chat call uses the same `session_id`, and you effectively have one chat session.
The `session_id` value can be configured in the **Advanced Settings** of the **Chat Input** and **Chat Output** components.
The `session_id` value can be configured in the **Controls** of the **Chat Input** and **Chat Output** components.
To have more than one session in a single flow, pass a specific session ID to a flow with the `session_id` parameter in the URL. All the components in the flow will automatically use this `session_id` value.
To post a message to a flow with a specific Session ID with curl, enter the following command:
To post a message to a flow with a specific session ID with curl, enter the following command.
Replace `CUSTOM_SESSION_VALUE` with the session ID you want to send the request to.
```bash
curl -X POST "http://localhost:7860/api/v1/run/$FLOW_ID" \
-H 'Content-Type: application/json' \
-d '{
"session_id": "custom_session_123",
"session_id": "CUSTOM_SESSION_VALUE",
"input_value": "message",
"input_type": "chat",
"output_type": "chat"
}'
```
Check your flow's **Playground**. In addition to the messages stored for the Default Session, a new session is started with your custom Session ID.
Check your flow's **Playground**. In addition to the messages stored for the default session, a new session is started with your custom session ID.
## Work with images in the Playground
@ -87,8 +98,4 @@ curl -X POST "http://localhost:7860/api/v1/run/$FLOW_ID" \
}'
```
The image is displayed in the chat interface and can be processed by your flow components.
## See also
- [Session ID](/session-id)
The image is displayed in the chat interface and can be processed by your flow components.

View file

@ -1,81 +1,72 @@
---
title: Publish flows
title: Share flows
slug: /concepts-publish
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import ChatWidget from '@site/src/components/ChatWidget';
Langflow provides several ways to publish and integrate your flows into external applications. Whether you want to expose your flow as an API endpoint, embed it as a chat widget in your website, or share it as a public playground, this guide covers the options available for making your flows accessible to users.
## API access
The **API access** pane presents code templates for integrating your flow into external applications.
Langflow provides code snippets to help you get started with the Langflow API.
![](/img/api-pane.png)
To access the **API access** pane, click **Share**, and then click **API access**.
<Tabs>
![API pane](/img/api-pane.png)
<TabItem value="Python" label="Python">
For more information, see [Run your flows from external applications](/get-started-quickstart#run-your-flows-from-external-applications).
The **Python** tab displays code to interact with your flow using the Python `requests` library.
### Input schema
1. Copy and paste the code into a Python script.
2. Run the script.
Tweaks are added to the `payload` of requests to Langflow's `/run` endpoint to temporarily change component parameters within your flow.
They don't modify the underlying flow configuration or persist between runs.
To assist with formatting, you can define tweaks in Langflow's **Input Schema** pane before copying the code snippet.
```python
python3 python-test-script.py --message="tell me about something interesting"
```
For more information, see [Use tweaks to apply temporary overrides to a flow run](/get-started-quickstart#use-tweaks-to-apply-temporary-overrides-to-a-flow-run).
The response content depends on your flow. Make sure the endpoint returns a successful response.
Additionally, you can re-name your flow's API endpoint from the default UUID to a more memorable and user-friendly name.
</TabItem>
To set a custom endpoint name:
1. In the **Input Schema** pane, locate the **Endpoint Name** field.
2. Enter a name using only letters, numbers, hyphens, and underscores.
The endpoint name is automatically saved with your flow.
<TabItem value="JavaScript" label="JavaScript" default>
## Export
The **JavaScript API** tab displays code to interact with your flow in JavaScript.
**Export** a flow to download it as a JSON file to your local machine.
1. Copy and paste the code into a JavaScript file.
2. Run the script.
1. To **Export** your flow, in the **Playground**, click **Share**, and then click **Export**.
2. To save your API keys with the flow, select **Save with my API keys**.
Your flow is saved with any Global variables included.
```text
node test-script.js "tell me about something interesting"
```
:::important
If your key is saved as a Global variable, only the global variable you created to contain the value is saved. If your key value is manually entered into a component field, the actual key value is saved in the JSON file.
:::
The response content depends on your flow. Make sure the endpoint returns a successful response.
When you share your flow file with another user who has the same global variables populated, the flow runs without requiring keys to be added again.
</TabItem>
<TabItem value="curl" label="curl" default>
The `FLOW_NAME.json` file is downloaded to your local machine.
The **cURL** tab displays sample code for posting a query to your flow.
You can then **Import** the downloaded flow into another Langflow instance.
Copy the code and run it to post a query to your flow and get the result.
## MCP server
The response content depends on your flow. Make sure the endpoint returns a successful response.
**MCP server** exposes your flows as [tools](https://modelcontextprotocol.io/docs/concepts/tools) that [MCP clients](https://modelcontextprotocol.io/clients) can use to take actions.
</TabItem>
</Tabs>
For more information, see [MCP server](/mcp-server).
### Temporary overrides
The **Temporary overrides** tab displays the available parameters for your flow.
Modifying the parameters changes the code parameters across all windows.
For example, changing the **Chat Input** component's `input_value` changes that value across all API calls to the `/run` endpoint of this flow.
### Send files to your flow with the API
For information on sending files to the Langflow API, see [Files endpoint](/api-files).
## Shareable playground
The **Shareable playground** exposes your Langflow application's **Playground** at the `/public_flow/$FLOW_ID` endpoint.
You can share this endpoint publicly using a sharing platform like [Ngrok](https://ngrok.com/docs/getting-started/?os=macos) or [zrok](https://docs.zrok.io/docs/getting-started).
If you're using **Datastax Langflow**, you can share the URL with any users within your **Organization**.
For information about using Langflow as an *MCP client*, see [MCP client](/mcp-client).
## Embed into site
The **Embed into site** tab displays code that can be inserted in the `<body>` of your HTML to interact with your flow.
For more information, see [Embedded chat widget](/embedded-chat-widget).
## Shareable playground
The **Shareable playground** exposes your Langflow application's **Playground** at the `/public_flow/$FLOW_ID` endpoint.
You can share this endpoint publicly using a sharing platform like [ngrok](https://ngrok.com/docs/getting-started/?os=macos) or [zrok](https://docs.zrok.io/docs/getting-started).

View file

@ -32,32 +32,32 @@ All of the flows in a project are exposed by default.
To expose only specific flows and optionally rename them for agentic use, follow these steps:
1. From the Langflow dashboard, select the project that contains the flows you want to serve as tools, and then click the **MCP Server** tab.
Alternatively, you can quickly access the **MCP Server** tab from within any flow by selecting **Publish > MCP Server**.
Alternatively, you can quickly access the **MCP Server** tab from within any flow by selecting **Share > MCP Server**.
The **MCP Server** tab displays a code template that you can use to connect MCP clients to the the project's MCP server.
The **Auto install** and **JSON** tabs display options for connecting MCP clients to the the project's MCP server.
The **Flows/Actions** section lists the flows that are currently being served as tools.
The **Flows/Tools** section lists the flows that are currently being served as tools.
![MCP server projects page](/img/mcp-server.png)
2. Click <Icon name="Settings2" aria-hidden="true"/> **Edit Actions**.
2. Click <Icon name="Settings2" aria-hidden="true"/> **Edit Tools**.
3. In the **MCP Server Actions** window, select the flows that you want exposed as tools.
3. In the **MCP Server Tools** window, select the flows that you want exposed as tools.
![MCP server actions](/img/mcp-server-actions.png)
![MCP server tools](/img/mcp-server-tools.png)
4. Optional: Edit the **Flow Name** and **Flow Description**.
- **Flow Name**: Enter a name thats makes it clear what the flow does.
- **Tool Name**: Enter a name that makes it clear what the flow does.
- **Flow Description**: Enter a description that accurately describes the specific action(s) the flow performs.
- **Tool Description**: Enter a description that accurately describes the specific action(s) the flow performs.
:::important
MCP clients use the **Flow Name** and **Flow Description** to determine which action to use.
For more information about naming and describing your flows, see [Name and describe your flows for agentic use](#name-and-describe-your-flows).
:::
5. Close the **MCP Server Actions** window to save your changes.
5. Close the **MCP Server Tools** window to save your changes.
{/* The anchor on this section (connect-clients-to-use-the-servers-actions) is currently a link target in the Langflow UI. Do not change. */}
## Connect clients to Langflow's MCP server {#connect-clients-to-use-the-servers-actions}
@ -65,14 +65,26 @@ Alternatively, you can quickly access the **MCP Server** tab from within any flo
The following procedure describes how to connect [Cursor](https://www.cursor.com/) to your Langflow project's MCP server to consume your flows as tools.
However, you can connect any [MCP-compatible client](https://modelcontextprotocol.io/clients) following similar steps.
1. Install [Cursor](https://docs.cursor.com/get-started/installation).
<Tabs>
<TabItem value="Auto install" label="Auto install" default>
1. Install [Cursor](https://docs.cursor.com/get-started/installation).
2. In the Langflow dashboard, select the project that contains the flows you want to serve, and then click the **MCP Server** tab.
3. To auto install your current Langflow project as an MCP server, click <Icon name="Plus" aria-hidden="True"/> **Add**.
The installation adds the server's configuration file to Cursor's `mcp.json` configuration file.
:::important
Auto installation only works if your HTTP client and Langflow server are on the same local machine.
In this is not the case, configure the client with the code in the **JSON** tab.
:::
</TabItem>
<TabItem value="JSON" label="JSON">
1. Install [Cursor](https://docs.cursor.com/get-started/installation).
2. In Cursor, go to **Cursor Settings > MCP**, and then click **Add New Global MCP Server**.
This opens Cursor's global MCP configuration file, `mcp.json`.
3. In the Langflow dashboard, select the project that contains the flows you want to serve, and then click the **MCP Server** tab.
4. Copy the code template from the **MCP Server** tab, and then paste it into `mcp.json` in Cursor.
4. Copy the code template from the **JSON** tab, and then paste it into `mcp.json` in Cursor.
For example:
```json
@ -91,6 +103,7 @@ For example:
The **MCP Server** tab automatically includes the correct `PROJECT_NAME`, `LANGFLOW_SERVER_ADDRESS`, and `PROJECT_ID` values.
The default Langflow server address is `http://localhost:7860`.
If you have [deployed a public Langflow server](/deployment-public-server), the address is automatically included.
:::important
@ -106,6 +119,9 @@ Cursor determines when to use tools based on your queries, and requests permissi
For more information, see the [Cursor's MCP documentation](https://docs.cursor.com/context/model-context-protocol).
</TabItem>
</Tabs>
### MCP server authentication and environment variables {#authentication}
If your Langflow server [requires authentication](/configuration-authentication) ([`LANGFLOW_AUTO_LOGIN`](/environment-variables#LANGFLOW_AUTO_LOGIN) is set to `false`), then you must supply a [Langflow API key](/configuration-api-keys) in your MCP client configuration.
@ -170,9 +186,9 @@ It's helpful to think of the names and descriptions as function names and code c
For example, let's say you have a [Document Q&A](/document-qa) flow that loads a sample resume for an LLM to chat with, and that you've given it the following name and description:
- **Flow Name**: `document_qa_for_resume`
- **Tool Name**: `document_qa_for_resume`
- **Flow Description**: `A flow for analyzing Emily's resume.`
- **Tool Description**: `A flow for analyzing Emily's resume.`
If you ask Cursor a question specifically about the resume, such as `What job experience does Emily have?`, the agent asks to call the MCP tool `document_qa_for_resume`.
That's because your name and description provided the agent with a clear purpose for the tool.

View file

@ -43,18 +43,17 @@ For more information, see the database models in the [source code](https://githu
## Store messages in local memory
To store messages in local Langflow memory, add a [Message store](/components-helpers#message-store) component to your flow.
To store and retrieve messages in local Langflow memory, add a [Message history](/components-helpers#message-history) component to your flow.
To retrieve messages from local Langflow memory, add a [Message history](/components-helpers#message-history) component to your flow.
To store or retrieve chat messages from external memory, connect the **External memory** port of the **Message history** component to a **Memory** component.
An example flow looks like this:
For an example of using local chat memory, see the [Memory chatbot](/memory-chatbot) starter flow.
To store or retrieve chat messages from external memory, connect the **External memory** port of the **Message store** or **Message history** component to a **Memory** component, like the [Astra DB chat memory](components-memories#astradbchatmemory-component) component. An example flow looks like this:
![Sample Flow storing Chat Memory in AstraDB](/img/astra_db_chat_memory_rounded.png)
![Sample Flow storing Chat Memory in Redit](/img/component-message-history-external-memory.png)
If external storage is connected to a memory helper component, no chat messages are stored in local Langflow memory.
For an example of using local chat memory, see the [Memory chatbot](/memory-chatbot) starter flow.
## Configure external memory
To replace the default Langflow SQLite database with another database, modify the `LANGFLOW_DATABASE_URL` and start Langflow with this value.

View file

@ -3,7 +3,7 @@ title: Integrate Google Cloud Vertex AI with Langflow
slug: /integrations-setup-google-cloud-vertex-ai-langflow
---
Langflow integrates with the [Google Vertex AI API](https://console.cloud.google.com/marketplace/product/google/aiplatform.googleapis.com) for authenticating the [Vertex AI embeddings model](/components-embedding-models#vertexai-embeddings) and [Vertex AI](/components-models#vertexai) components.
Langflow integrates with the [Google Vertex AI API](https://console.cloud.google.com/marketplace/product/google/aiplatform.googleapis.com) for authenticating the [Vertex AI embeddings model](/components-bundle-components#vertexai-embeddings) and [Vertex AI](/components-bundle-components#vertexai) components.
Learn how to create a service account JSON in Google Cloud to authenticate Langflows Vertex AI components.

View file

@ -4,6 +4,7 @@ slug: /integrations-setup-google-oauth-langflow
---
import TOCInline from '@theme/TOCInline';
import Icon from "@site/src/components/icon";
Langflow integrates with [Google OAuth](https://developers.google.com/identity/protocols/oauth2) for authenticating the [Gmail loader](/components-data#gmail-loader), [Google Drive loader](components-data#google-drive-loader), and [Google Drive Search](/components-data#google-drive-search) components.
@ -45,7 +46,7 @@ With your OAuth application configured and your credentials JSON file created, f
4. In the **Scopes** field of the Google Oauth Token component, enter the scope required to access your resources.
For example, to allow your Langflow application to access a user's Google Drive, the scope is `https://www.googleapis.com/auth/drive`.
For more information, see the [Google documentation](https://developers.google.com/identity/protocols/oauth2/scopes).
5. To authenticate your application, in the **Google OAuth Token** component, click **Play**.
5. To authenticate your application, in the **Google OAuth Token** component, click <Icon name="Play" aria-hidden="True" /> **Run component**.
A new tab opens in the browser to authenticate your application using your Google Cloud account. You must authenticate the application with the same Google account that created the OAuth credentials.
:::info

View file

@ -3,6 +3,8 @@ title: Notion Meeting Notes Agent
slug: /integrations/notion/notion-agent-meeting-notes
---
import Icon from "@site/src/components/icon";
The Notion Agent for Meeting Notes is an AI-powered tool that automatically processes meeting transcripts and updates your Notion workspace. It identifies tasks, action items, and key points from your meetings, then creates new tasks or updates existing ones in Notion without manual input.
## Prerequisites
@ -144,7 +146,7 @@ To run the Notion Agent for Meeting Notes:
3. Connect the components as shown in the flow diagram.
4. Input the Notion and OpenAI API keys in their respective components.
5. Paste your meeting transcript into the Meeting Transcript component.
6. Run the flow by clicking **Play** on the **Chat Output** component.
6. Run the flow by clicking <Icon name="Play" aria-hidden="True" /> **Run component** on the **Chat Output** component.
7. Review the output in the Chat Output component, which will summarize the actions taken in your Notion workspace.
For optimal results, use detailed meeting transcripts. The quality of the output depends on the comprehensiveness of the input provided.

View file

@ -3,7 +3,7 @@ title: AssemblyAI
slug: /integrations-assemblyai
---
import Icon from "@site/src/components/icon";
# AssemblyAI
@ -137,10 +137,8 @@ To run the Transcription and Speech AI Flow:
3. Connect the components as shown in the flow diagram. **Tip**: Freeze the path of the *Start Transcript* component to only submit the file once.
4. Input the AssemblyAI API key in in all components that require the key (Start Transcript, Poll Transcript, Get Subtitles, LeMUR, List Transcripts).
5. Select an audio or video file in the *Start Transcript* component.
6. Run the flow by clicking **Play** on the *Parse Data* component. Make sure that the specified template is `{text}`.
7. To generate subtitles, click **Play** on the *Get Subtitles* component.
8. To apply an LLM to your audio file, click **Play** on the *LeMUR* component. Note that you need an upgraded AssemblyAI account to use LeMUR.
9. To list all transcripts, click **Play** on the *List Transcript* component.
6. Run the flow by clicking <Icon name="Play" aria-hidden="True" /> **Run component** on the *Parse Data* component. Make sure that the specified template is `{text}`.
7. To generate subtitles, click <Icon name="Play" aria-hidden="True" /> **Run component** on the *List Transcript* component.
## Customization

View file

@ -7,7 +7,7 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Icon from "@site/src/components/icon";
Use the [MCP connection component](/mcp-client) to connect Langflow to a [Datastax Astra DB MCP server](https://github.com/datastax/astra-db-mcp).
Use the [MCP Tools component](/mcp-client) to connect Langflow to a [Datastax Astra DB MCP server](https://github.com/datastax/astra-db-mcp).
1. Install an LTS release of [Node.js](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm).
@ -19,18 +19,18 @@ Use the [MCP connection component](/mcp-client) to connect Langflow to a [Datast
5. Create a [Simple agent starter project](/simple-agent) if you want to follow along with this guide. Otherwise, you can use an existing flow or create a new, blank flow.
6. Remove the **URL** tool, and then replace it with an [MCP connection component](/mcp-client).
6. Remove the **URL** tool, and then replace it with an [MCP Tools component](/mcp-client).
The flow should look like this:
![MCP connection component connecting to Astra](/img/component-mcp-astra-db.png)
![MCP Tools component connecting to Astra](/img/component-mcp-astra-db.png)
7. In the **MCP connection** component, in the **MCP server** field, add the following code to connect to an Astra DB MCP server:
7. In the **MCP Tools** component, in the **MCP server** field, add the following code to connect to an Astra DB MCP server:
```bash
npx -y @datastax/astra-db-mcp
```
8. In the **MCP connection** component, in the **Env** fields, add variables for `ASTRA_DB_APPLICATION_TOKEN` and `ASTRA_DB_API_ENDPOINT` with the values from your Astra database.
8. In the **MCP Tools** component, in the **Env** fields, add variables for `ASTRA_DB_APPLICATION_TOKEN` and `ASTRA_DB_API_ENDPOINT` with the values from your Astra database.
:::important
Langflow passes environment variables from the `.env` file to MCP, but not global variables declared in the UI.

View file

@ -0,0 +1,124 @@
---
title: Langflow release notes
slug: /release-notes
---
This page summarizes significant changes to Langflow in each release.
For all changes, see the [Changelog](https://github.com/langflow-ai/langflow/releases/latest).
## Prepare to upgrade
To avoid the impact of potential breaking changes and test new versions, the Langflow team recommends the following:
1. [Export your projects](/api-projects#export-a-project) to create backups of your flows:
```bash
curl -X GET \
"$LANGFLOW_SERVER_URL/api/v1/projects/download/$PROJECT_ID" \
-H "accept: application/json" \
-H "x-api-key: $LANGFLOW_API_KEY"
```
2. Install the new version:
* **Langflow OSS Python package**: Install the new version in a new virtual environment, and then [import your flows](/concepts-flows) to test them in the new version.
* **Langflow Docker image**: Run the new image in a separate container, and then [import your flows](/concepts-flows) to the version of Langflow running in the new container.
* **Langflow Desktop**: Upgrade Langflow Desktop, as explained in [Manage your version of Langflow Desktop](/get-started-installation#manage-your-version-of-langflow-desktop). If you want to isolate the new version, you must install Langflow Desktop on a separate physical or virtual machine, and then [import your flows](/concepts-flows) to the new installation.
4. Test your flows in the new version, [upgrading components](/concepts-components#component-versions) as needed.
When upgrading components, you can use the **Create backup flow before updating** option if you didn't previously export your flows.
5. If you installed the new version in isolation, upgrade your primary installation after testing the new version.
If you made changes to your flows in the isolated installation, you might want to export and import those flows back to your upgraded primary installation so you don't have to repeat the component upgrade process.
## 1.5.0
The following updates are included in this version:
### New features and enhancements
- Authentication changes
All API endpoints now require a Langflow API key to function, even when [LANGFLOW_AUTO_LOGIN](/environment-variables#LANGFLOW_AUTO_LOGIN) is enabled. This change enhances security by ensuring that automatic login features are properly authenticated.
The only exceptions are for the MCP endpoints at `/v1/mcp`, `/v1/mcp-projects`, and `/v2/mcp`, which will not require API keys.
For more information, see [API keys](/configuration-api-keys).
- New Language Model and Embedding Model components
The **Language Model** and **Embedding Model** components have been promoted to be the main components for your LLM and embeddings flows. They support multiple models and model providers, and allow you to experiment without swapping out single-provider components.
The single-provider components are still available for your flows in the components sidebar under [Bundles](/components-bundle-components).
For more information, see the [Language model](/components-models) and [Embedding model](/components-embedding-models) components.
- MCP one-click installation
In the **MCP server** page, click **Auto install** to install your Langflow MCP server to MCP clients with just one click.
The option to install with a JSON configuration file is available for macOS, Windows, and WSL.
For more information, see [MCP server](/mcp-server).
- MCP server management
Add, remove, and edit your MCP servers in the **MCP Tools** and **Settings** page.
For more information, see [MCP client](/mcp-client).
- Input schema replaces temporary overrides
The **Input schema** pane replaces the need to manage tweak values in the **API access** pane. When you enable a parameter in the **Input schema** pane, the parameter is automatically added to your flows code snippets, providing ready-to-use templates for making requests in your preferred programming language.
- Tools category is now legacy
All components in the **Tools** category are now **Legacy** or have moved to [Bundles](/components-bundle-components).
The [MCP Tools](/mcp-client) component is available in the components sidebar under **Agents**.
Many of the **Tools** components performed the same functions, like web search and API requests, so we combined this functionality into single components:
* To replace legacy search components, use the [Web search](/components-data#web-search) component.
* To replace legacy news aggregation components, use the [News search](/components-data#news-search) component.
- Stability improvements
General stability improvements and bug fixes for enhanced reliability.
See an issue? [Raise it on GitHub](https://github.com/langflow-ai/langflow/issues).
### New integrations and bundles
- [Cleanlab integration](/integrations-cleanlab)
## 1.4.2
The following updates are included in this version:
### New features and enhancements
- Enhanced file and flow management system with improved bulk capabilities.
### New integrations and bundles
- BigQuery component for connecting to BQ datasets.
- Twelve Labs integration bundle.
- NVIDIA system assistant component.
### Deprecated features
- Deprecated the Combine text component.
## 1.4.1
The following updates are included in this version:
### New features and enhancements
- Added an enhanced "Breaking Changes" feature to help update components during version updates without breaking flows.
## 1.4.0
The following updates are included in this version:
### New features and enhancements
- Introduced MCP server functionality to serve Langflow tools to MCP-compatible clients.
- Renamed "Folders" to "Projects". The `/folders` endpoints now redirect to `/projects`.
### Deprecated features
- Deprecated the Google Gmail, Drive, and Search components.

View file

@ -5,13 +5,13 @@ slug: /basic-prompting
import Icon from "@site/src/components/icon";
This flow is a starting point for understanding Langflow.
The flow demonstrates how to chat with an LLM, and how modifying the prompt can affect your outcomes.
Prompts serve as the inputs to a large language model (LLM), acting as the interface between human instructions and computational tasks.
By submitting natural language requests in a prompt to an LLM, you can obtain answers, generate text, and solve problems.
This article demonstrates how to use Langflow's prompt tools to issue basic prompts to an LLM, and how various prompting strategies can affect your outcomes.
## Prerequisites
- [A running Langflow instance](/get-started-installation)
@ -25,18 +25,15 @@ This article demonstrates how to use Langflow's prompt tools to issue basic prom
3. The **Basic Prompting** flow is created.
![Basic prompting flow](/img/starter-flow-basic-prompting.png)
![](/img/starter-flow-basic-prompting.png)
This flow allows you to chat with the **OpenAI model** component.
The model will respond according to the prompt constructed in the **Prompt** component.
This flow allows you to chat with the **OpenAI model** component.
The model will respond according to the prompt constructed in the **Prompt** component.
4. To examine the **Template**, in the **Prompt** component, click the **Template** field.
```text
Answer the user as if you were a GenAI expert, enthusiastic about helping them get started building something fresh.
```
```text
Answer the user as if you were a GenAI expert, enthusiastic about helping them get started building something fresh.
```
5. To create an environment variable for the **OpenAI** component, in the **OpenAI API Key** field, click the <Icon name="Globe" aria-hidden="true"/> **Globe** button, and then click **Add New Variable**.

View file

@ -3,11 +3,11 @@ title: Blog writer
slug: /blog-writer
---
Build a Blog Writer flow for a one-shot application using OpenAI.
import Icon from "@site/src/components/icon";
This flow extends the Basic Prompting flow with the **URL** and **Parser** components that fetch content from multiple URLs and convert the loaded data into plain text.
This flow demonstrates adding an additional `{references}` input to the [Prompt](/components-prompts) component to capture input from the [URL](/components-data#url) and [Parser](/components-processing#parser) components.
OpenAI uses this loaded data to generate a blog post, as instructed by the **Text Input** and **Prompt** components.
The [Language model](/components-models) component uses this input to generate a blog post according to the `{instructions}` received by the [Prompt](/components-prompts) component.
## Prerequisites
@ -20,34 +20,40 @@ OpenAI uses this loaded data to generate a blog post, as instructed by the **Tex
2. Select **Blog Writer**.
3. The **Blog Writer** flow is created.
![](/img/starter-flow-blog-writer.png)
![Blog writer starter flow](/img/starter-flow-blog-writer.png)
This flow creates a blog article generator with **Prompt**, **Language Model**, and **Chat Output** components, augmented with reference content and instructions from the **URL** and **Text Input** components.
This flow creates a blog article generator with **Prompt**, **OpenAI**, and **Chat Output** components, augmented with reference content and instructions from the **URL** and **Text Input** components.
The **URL** component extracts raw text and metadata from one or more web links.
The **Parser** component converts the data coming from the **URL** component into plain text to feed the prompt.
The **URL** component extracts raw text and metadata from one or more web links.
The **Parser** component converts the data coming from the **URL** component into plain text to feed the prompt.
To examine the flow's prompt, click the **Template** field of the **Prompt** component.
To examine the flow's prompt, click the **Template** field of the **Prompt** component.
```text
Reference 1:
```text
Reference 1:
{references}
{references}
---
---
{instructions}
{instructions}
Blog:
```
Blog:
```
The `{instructions}` value is received from the **Text Input** component, and one or more `{references}` are received from a list of URLs parsed from the **URL** component.
The `{instructions}` value is received from the **Text Input** component, and one or more `{references}` are received from a list of URLs parsed from the **URL** component.
### Run the blog writer flow
1. Click the **Playground** button, and then click **Run Flow**.
A blog post about Langflow is generated, with content sourced from `langflow.org` and `docs.langflow.org`.
2. To write about something different, change the values in the **URL** component and adjust the instructions on the left side bar of the **Playground**. Try again and see what the LLM constructs.
1. Add your **OpenAI API key** to the **Language model** model component.
Optionally, create a [global variable](/configuration-global-variables) for the **OpenAI API key**.
1. In the **OpenAI API Key** field, click <Icon name="Globe" aria-hidden="True" /> **Globe**, and then click **Add New Variable**.
2. In the **Variable Name** field, enter `openai_api_key`.
3. In the **Value** field, paste your OpenAI API Key (`sk-...`).
4. Click **Save Variable**.
2. To run the flow, click <Icon name="Play" aria-hidden="true"/> **Playground**, and then click **Run Flow**.
A blog post about Langflow is generated, with content sourced from `langflow.org` and `docs.langflow.org`.
3. To write about something different, change the values in the **URL** component and adjust the instructions in the **Text input** component. Try again and see what the LLM constructs.

View file

@ -1,9 +1,12 @@
---
title: Document QA
slug: /document-qa
description: Build a question-and-answer chatbot with document analysis capabilities using a document loaded from local memory.
---
Build a question-and-answer chatbot with a document loaded from local memory.
import Icon from "@site/src/components/icon";
This flow demonstrates adding a file to the [File](/components-data#file) component to load a document from your local machine into your flow.
## Prerequisites
@ -12,21 +15,27 @@ Build a question-and-answer chatbot with a document loaded from local memory.
## Create the document QA flow
1. From the Langflow dashboard, click **New Flow**.
2. Select **Document QA**.
3. The **Document QA** flow is created.
1. From the Langflow dashboard, click **New Flow**.
2. Select **Document QA**.
3. The **Document QA** flow is created.
![](/img/starter-flow-document-qa.png)
![Document QA starter flow](/img/starter-flow-document-qa.png)
This flow is composed of a chatbot with the **Chat Input**, **Prompt**, **OpenAI**, and **Chat Output** components, but also incorporates a **File** component, which loads a file from your local machine. The **Parser** component converts the data from the **File** component into the **Prompt** component as `{Document}`.
This flow is composed of a chatbot with the **Chat Input**, **Prompt**, **Language model**, and **Chat Output** components, but also incorporates a **File** component, which loads a file from your local machine. The **Parser** component converts the data from the **File** component into the **Prompt** component as `{Document}`.
The **Prompt** component is instructed to answer questions based on the contents of `{Document}`. This gives the **OpenAI** component context it would not otherwise have access to.
### Run the document QA flow
1. Add your **OpenAI API key** to the **Open AI** model component.
1. Add your **OpenAI API key** to the **Language model** model component.
Optionally, create a [global variable](/configuration-global-variables) for the **OpenAI API key**.
1. In the **OpenAI API Key** field, click <Icon name="Globe" aria-hidden="True" /> **Globe**, and then click **Add New Variable**.
2. In the **Variable Name** field, enter `openai_api_key`.
3. In the **Value** field, paste your OpenAI API Key (`sk-...`).
4. Click **Save Variable**.
2. To select a document to load, in the **File** component, click the **Select files** button. Select a local file or a file loaded with [File management](/concepts-file-management), and then click **Select file**. The file name appears in the component.
3. Click the **Playground** button. Enter a question about the loaded document's content. You should receive a contextual response indicating that the AI has read your document.
3. To run the flow, click <Icon name="Play" aria-hidden="true"/> **Playground**. Enter a question about the loaded document's content. You should receive a contextual response indicating that the LLM has read your document.

View file

@ -5,9 +5,10 @@ slug: /financial-report-parser
import Icon from "@site/src/components/icon";
Build a **Financial Report Parser** flow with the [Structured output](/components-helpers#structured-output) and [Parser](/components-processing#parser) components to parse LLM responses into a structured format.
This flow demonstrates how to parse LLM responses into a structured format.
In this example, the **Chat Input** component is pre-loaded with a sample financial report to demonstrate extracting `Gross Profit`, `EBITDA`, and `Net Income`.
In this example, the [Chat Input](/components-io#chat-input) component is pre-loaded with a sample financial report to demonstrate extracting `Gross Profit`, `EBITDA`, and `Net Income`.
The [Structured output](/components-processing#structured-output) component is used to extract the financial data from the report, and the [Parser](/components-processing#parser) component is used to convert the extracted data into a structured format.
## Prerequisites
@ -21,14 +22,20 @@ In this example, the **Chat Input** component is pre-loaded with a sample financ
The **Financial Report Parser** flow is created.
![](/img/starter-flow-financial-report-parser.png)
![Financial report parser flow](/img/starter-flow-financial-report-parser.png)
## Run the memory chatbot flow
## Run the financial report parser flow
1. Add your OpenAI API key to the OpenAI model.
2. Click the **Playground** button, and then click **Send**.
1. Add your **OpenAI API key** to the **Language model** model component.
Optionally, create a [global variable](/configuration-global-variables) for the **OpenAI API key**.
1. In the **OpenAI API Key** field, click <Icon name="Globe" aria-hidden="True" /> **Globe**, and then click **Add New Variable**.
2. In the **Variable Name** field, enter `openai_api_key`.
3. In the **Value** field, paste your OpenAI API Key (`sk-...`).
4. Click **Save Variable**.
2. To run the flow, click <Icon name="Play" aria-hidden="true"/> **Playground**, and then click **Send**.
The **Chat Input** component is pre-loaded with a sample financial report for demonstration purposes.
The chat returns a structured response:
The **Playground** returns a structured response:
```text
EBITDA: $900 million , Net Income: $500 million , GROSS_PROFIT: $1.2 billion
@ -46,7 +53,7 @@ The **Structured Output** component uses the attached **OpenAI** model component
| GROSS_PROFIT | description of field | text | False |
```
4. To inspect the template that contains the extracted data, in the **Parser** component, click the <Icon name="Scan" aria-hidden="true"/> **Scan** icon in the **Template** field.
4. To inspect the template that contains the extracted data, in the **Parser** component, click <Icon name="Scan" aria-hidden="true"/> **Scan** in the **Template** field.
The **Parser** component converts the extracted data into formatted messages for chat consumption.
Each variable receives its value from the structured outputs.
```text

View file

@ -9,7 +9,7 @@ import Icon from "@site/src/components/icon";
The **Chat memory** component is also known as the **Message history** component.
:::
This flow extends the [basic prompting flow](/basic-prompting) with a **Message history** component that stores up to 100 previous chat messages and uses them to provide context for the current conversation.
This flow extends the [basic prompting flow](/basic-prompting) with a [Message history](/components-helpers#message-history) component that stores previous chat messages and uses them to provide context for the current conversation.
## Prerequisites
@ -22,13 +22,13 @@ This flow extends the [basic prompting flow](/basic-prompting) with a **Message
2. Select **Memory Chatbot**.
3. The **Memory Chatbot** flow is created.
![](/img/starter-flow-memory-chatbot.png)
![Memory chatbot flow](/img/starter-flow-memory-chatbot.png)
This flow adds a **Message history** component to the Basic Prompting flow.
This component retrieves previous messages and sends them to the **Prompt** component to fill a part of the **Template** with context.
To examine the template, click the **Template** field in the **Prompt** component.
The **Prompt** tells the **OpenAI model** component how to respond to input.
The **Prompt** instructs the **Language model** component how to respond to input.
```text
You are a helpful assistant that answers questions.
@ -41,7 +41,7 @@ History:
```
The `{memory}` code in the prompt creates a new input port in the component called **memory**.
The **Message history** component is connected to this port to store chat messages from the **Playground**, and provide the **OpenAI** component with a memory of previous chat messages.
The **Message history** component is connected to this port to store chat messages from the **Playground**, and provide the **Language model** component with a memory of previous chat messages.
## Run the memory chatbot flow
@ -57,10 +57,10 @@ What is the second subject I asked you about?
The chatbot remembers your name and previous questions.
3. To view the **Message Logs** pane, click <Icon name="Ellipsis" aria-hidden="true"/> **Options**, and then click **Message Logs**.
The **Message Logs** pane displays all previous messages, with each conversation sorted by `session_id`.
3. To view the **Message Logs** pane, in the **Playground** pane, click <Icon name="Ellipsis" aria-hidden="true"/> **Options**, and then click **Message logs**.
The **Message Logs** pane displays all previous messages.
![](/img/messages-logs.png)
![Message logs pane](/img/messages-logs.png)
## Use Session ID with the memory chatbot flow
@ -69,10 +69,7 @@ The **Message Logs** pane displays all previous messages, with each conversation
In the **Memory Chatbot** flow you created, the **Message history** component references past interactions by **Session ID**. You can demonstrate this by modifying the **Session ID** value to switch between conversation histories.
1. In the **Session ID** field of the **Message history** and **Chat Input** components, add a **Session ID** value like `MySessionID`.
2. Now, once you send a new message the **Playground**, you should have a new memory created in the **Message Logs** pane.
3. Notice how your conversation is being stored in different memory sessions.
2. Now, once you send a new message the **Playground**, you should have a new session created in the **Message Logs** pane.
3. Note how your conversation is being stored in different memory sessions.
## See also
- [Memory components](/components-memories)
- [Session ID](/session-id)
To learn more about memory in Langflow, see [Memory](/memory).

View file

@ -3,9 +3,9 @@ title: Sequential tasks agent
slug: /sequential-agent
---
Build a **Sequential Tasks Agent** flow for a multi-agent application using multiple **Agent** components.
This flow demonstrates using multiple [Agent](/agents) components in a single flow.
Each agent has an LLM model and a unique set of tools at its disposal, with **Prompt** components connected to the **Agent Instructions** fields to control the agent's behavior. For example, the **Researcher Agent** has a **Tavily AI Search** component connected as a tool. The **Prompt** instructs the agent how to answer your query, format the response, and pass the query and research results on to the next agent in the flow.
Each agent is connected to a unique tool, with **Prompt** components connected to the **Agent Instructions** fields to control the agent's behavior.
Each successive agent in the flow builds on the work of the previous agent, creating a chain of reasoning for solving complex problems.

View file

@ -3,12 +3,13 @@ title: Simple agent
slug: /simple-agent
---
Build a **Simple Agent** flow for an agentic application using the [Agent](/agents) component.
import Icon from "@site/src/components/icon";
An **agent** uses an LLM as its "brain" to select among the connected tools and complete its tasks.
This flow demonstrates using an [Agent](/agents) in a flow.
An **Agent** uses an LLM as its "brain" to select among the connected tools and complete its tasks.
In this flow, the **Tool-calling agent** reasons using an **Open AI** LLM.
The agent selects the **Calculator** tool for simple math problems and the **URL** tool to search a URL for content.
In this flow, the **Agent** reasons using a connected [Language model](/components-models) component.
The **Agent** selects the [Calculator](/components-helpers#calculator) tool for simple math problems, and the [URL](/components-data#url) tool to search a URL for content.
## Prerequisites
@ -17,49 +18,49 @@ The agent selects the **Calculator** tool for simple math problems and the **URL
## Open Langflow and start a new flow
Click **New Flow**, and then select the **Simple Agent** flow.
1. From the Langflow dashboard, click **New Flow**.
This opens a starter flow with the necessary components to run an agentic application using the Tool-calling agent.
2. Select **Simple Agent**.
## Simple Agent flow
The **Simple Agent** flow is created.
![Simple agent starter flow](/img/starter-flow-simple-agent.png)
![Simple agent starter flow](/img/quickstart-simple-agent-flow.png)
The **Simple Agent** flow consists of these components:
## Run the simple agent flow
* The **Tool calling agent** component uses the connected LLM to reason through the user's input and select among the connected tools to complete its task.
* The **URL** tool component searches a list of URLs for content.
* The **Calculator** component performs basic arithmetic operations.
* The **Chat Input** component accepts user input to the chat.
* The **Chat Output** component prints the flow's output to the chat.
1. Add your **OpenAI API key** to the **Agent** component.
## Run the Simple Agent flow
Optionally, create a [global variable](/configuration-global-variables) for the **OpenAI API key**.
1. Add your credentials to the **Agent** component.
2. Click **Playground** to start a chat session.
1. In the **OpenAI API Key** field, click <Icon name="Globe" aria-hidden="True" /> **Globe**, and then click **Add New Variable**.
2. In the **Variable Name** field, enter `openai_api_key`.
3. In the **Value** field, paste your OpenAI API Key (`sk-...`).
4. Click **Save Variable**.
2. To run the flow, click <Icon name="Play" aria-hidden="true"/> **Playground**.
3. To confirm the tools are connected, ask the agent, `What tools are available to you?`
The response is similar to the following:
```text
I have access to the following tools:
Calculator: Perform basic arithmetic operations.
fetch_content: Load and retrieve data from specified URLs.
fetch_content_text: Load and retrieve text data from specified URLs.
as_dataframe: Load and retrieve data in a structured format (dataframe) from specified URLs.
get_current_date: Returns the current date and time in a selected timezone.
```
The response is similar to the following:
```text
I have access to the following tools:
Calculator: Perform basic arithmetic operations.
fetch_content: Load and retrieve data from specified URLs.
fetch_content_text: Load and retrieve text data from specified URLs.
as_dataframe: Load and retrieve data in a structured format (dataframe) from specified URLs.
get_current_date: Returns the current date and time in a selected timezone.
```
4. Ask the agent a question. For example, ask it to create a tabletop character using your favorite rules set.
The agent tells you when it's using the `URL-fetch_content_text` tool to search for rules information, and when it's using `CalculatorComponent-evaluate_expression` to generate attributes with dice rolls.
The final output should be similar to this:
The agent tells you when it's using the `URL-fetch_content_text` tool to search for rules information, and when it's using `CalculatorComponent-evaluate_expression` to generate attributes with dice rolls.
The final output should be similar to this:
```text
Final Attributes
Strength (STR): 10
Constitution (CON): 12
Size (SIZ): 14
Dexterity (DEX): 9
Intelligence (INT): 11
Power (POW): 13
Charisma (CHA): 8
```
```text
Final Attributes
Strength (STR): 10
Constitution (CON): 12
Size (SIZ): 14
Dexterity (DEX): 9
Intelligence (INT): 11
Power (POW): 13
Charisma (CHA): 8
```
Now that your query has completed the journey from **Chat input** to **Chat output**, you have completed the **Simple Agent** flow.

View file

@ -3,15 +3,15 @@ title: Travel planning agent
slug: /travel-planning-agent
---
Build a **Travel Planning Agent** flow for an agentic application using the multiple Tool-calling agents.
import Icon from "@site/src/components/icon";
An **agent** uses an LLM as its "brain" to select among the connected tools and complete its tasks.
In this flow, multiple **Tool-calling agents** reason using an **Open AI** LLM to plan a travel journey. Each agent is given a different responsibility defined by its **System Prompt** field.
This flow demonstrates using multiple [Agent](/agents) components in a single flow.
In this flow, multiple **Agents** plan a travel journey.
Each agent is given a different responsibility defined by its **System Prompt** field.
The **Chat input** defines where the user wants to go, and passes the result to the **City Selection** agent. The **Local Expert** agent then adds information based on the selected cities, and the **Travel Concierge** assembles a seven day travel plan in Markdown.
All agents have access to the **Search API** and **URL Content Fetcher** components, while only the Travel Concierge can use the **Calculator** for computing the trip costs.
All agents have access to the **Search API** and **URL Content Fetcher** components, while only the **Travel Concierge** agent can use the **Calculator** for computing the trip costs.
## Prerequisites
@ -41,7 +41,7 @@ The **Travel Planning Agent** flow consists of these components:
## Run the travel planning agent flow
1. Add your credentials to the Open AI and Search API components.
2. Click **Playground** to start a chat session.
2. To run the flow, click <Icon name="Play" aria-hidden="true"/> **Playground**.
You should receive a detailed, helpful answer to the journey defined in the **Chat input** component.
Now that your query has completed the journey from **Chat input** to **Chat output**, you have completed the **Travel Planning Agent** flow.

View file

@ -7,13 +7,10 @@ import Icon from "@site/src/components/icon";
Retrieval Augmented Generation, or RAG, is a pattern for training LLMs on your data and querying it.
RAG is backed by a **vector store**, a vector database which stores embeddings of the ingested data.
This enables **vector search**, a more powerful and context-aware search.
We've chosen [Astra DB](https://astra.datastax.com/signup?utm_source=langflow-pre-release&utm_medium=referral&utm_campaign=langflow-announcement&utm_content=create-a-free-astra-db-account) as the vector database for this starter flow, but you can follow along with any of Langflow's vector database options.
@ -36,24 +33,27 @@ We've chosen [Astra DB](https://astra.datastax.com/signup?utm_source=langflow-pr
The vector store RAG flow is built of two separate flows for ingestion and query.
![](/img/starter-flow-vector-rag.png)
![Vector RAG starter flow with Astra DB](/img/starter-flow-vector-rag.png)
The **Load Data Flow** (bottom of the screen) creates a searchable index to be queried for contextual similarity.
This flow populates the vector store with data from a local file.
It ingests data from a local file, splits it into chunks, indexes it in Astra DB, and computes embeddings for the chunks using the OpenAI embeddings model.
It ingests data from a local file, splits it into chunks, indexes it in Astra DB, and computes embeddings for the chunks using the **Embeddings model** component.
The **Retriever Flow** (top of the screen) embeds the user's queries into vectors, which are compared to the vector store data from the **Load Data Flow** for contextual similarity.
- **Chat Input** receives user input from the **Playground**.
- **OpenAI Embeddings** converts the user query into vector form.
- **Embeddings model** converts the user query into vector form.
- **Astra DB** performs similarity search using the query vector.
- **Parser** processes the retrieved chunks.
- **Prompt** combines the user query with relevant context.
- **OpenAI** generates the response using the prompt.
- **Language model** generates the response using the prompt and the OpenAI LLM.
- **Chat Output** returns the response to the **Playground**.
1. Configure the **OpenAI** model component.
1. To create a global variable for the **OpenAI** component, in the **OpenAI API Key** field, click the <Icon name="Globe" aria-hidden="True" /> **Globe** button, and then click **Add New Variable**.
1. Add your **OpenAI API key** to the **Language model** component.
Optionally, create a [global variable](/configuration-global-variables) for the **OpenAI API key**.
1. In the **OpenAI API Key** field, click <Icon name="Globe" aria-hidden="True" /> **Globe**, and then click **Add New Variable**.
2. In the **Variable Name** field, enter `openai_api_key`.
3. In the **Value** field, paste your OpenAI API Key (`sk-...`).
4. Click **Save Variable**.
@ -85,6 +85,7 @@ If you used Langflow's **Global Variables** feature, the RAG application flow co
## Run the Vector Store RAG flow
1. Click **Playground**. Here you can chat with the AI that uses context from the database you created.
2. Type a message and press Enter. (Try something like "What topics do you know about?")
3. The bot will respond with a summary of the data you've embedded.
1. To run the flow, click <Icon name="Play" aria-hidden="true"/> **Playground**.
In the **Playground**, you can chat with the LLM that uses context from the database you created.
2. Enter a message and press <kbd>Enter</kbd>. Try something like, "What topics do you know about?"
3. The bot will respond with a summary of the data you've embedded.

View file

@ -352,12 +352,12 @@ module.exports = {
},
{
type: "category",
label: "Changelog",
label: "Release notes",
items: [
{
type: "link",
label: "Changelog",
href: "https://github.com/langflow-ai/langflow/releases/latest",
type: "doc",
id: "Support/release-notes",
label: "Release notes",
},
],
},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 476 KiB

After

Width:  |  Height:  |  Size: 599 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 KiB

After

Width:  |  Height:  |  Size: 771 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 312 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 956 KiB

After

Width:  |  Height:  |  Size: 475 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 202 KiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 415 KiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 KiB

After

Width:  |  Height:  |  Size: 1,011 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 KiB

After

Width:  |  Height:  |  Size: 823 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

BIN
docs/static/img/component-llm-router.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 KiB

After

Width:  |  Height:  |  Size: 813 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 971 KiB

After

Width:  |  Height:  |  Size: 1,005 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 954 KiB

After

Width:  |  Height:  |  Size: 1 MiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,018 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 KiB

After

Width:  |  Height:  |  Size: 731 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 KiB

After

Width:  |  Height:  |  Size: 987 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 KiB

After

Width:  |  Height:  |  Size: 817 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 KiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 978 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 KiB

After

Width:  |  Height:  |  Size: 835 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 921 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 KiB

After

Width:  |  Height:  |  Size: 468 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 233 KiB

After

Width:  |  Height:  |  Size: 745 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 335 KiB

BIN
docs/static/img/mcp-server-tools.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 KiB

After

Width:  |  Height:  |  Size: 539 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 320 KiB

After

Width:  |  Height:  |  Size: 669 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 KiB

After

Width:  |  Height:  |  Size: 747 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 521 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 KiB

After

Width:  |  Height:  |  Size: 924 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 434 KiB

After

Width:  |  Height:  |  Size: 806 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 389 KiB

After

Width:  |  Height:  |  Size: 891 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1,023 KiB

After

Width:  |  Height:  |  Size: 934 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 KiB

After

Width:  |  Height:  |  Size: 968 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 404 KiB

After

Width:  |  Height:  |  Size: 925 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 438 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 KiB

After

Width:  |  Height:  |  Size: 1.7 MiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 KiB

After

Width:  |  Height:  |  Size: 849 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 611 KiB

After

Width:  |  Height:  |  Size: 657 KiB

Before After
Before After