mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 06:10:49 +08:00
142 lines
45 KiB
HTML
142 lines
45 KiB
HTML
<!doctype html>
|
||
<html lang="en" dir="ltr" class="docs-wrapper plugin-docs plugin-id-default docs-version-current docs-doc-page docs-doc-id-Components/components-helpers" data-has-hydrated="false">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="generator" content="Docusaurus v3.7.0">
|
||
<title data-rh="true">Helpers | Langflow Documentation</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:url" content="https://docs.langflow.org/components-helpers"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="Helpers | Langflow Documentation"><meta data-rh="true" name="description" content="Helper components provide utility functions to help manage data, tasks, and other components in your flow."><meta data-rh="true" property="og:description" content="Helper components provide utility functions to help manage data, tasks, and other components in your flow."><link data-rh="true" rel="icon" href="/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://docs.langflow.org/components-helpers"><link data-rh="true" rel="alternate" href="https://docs.langflow.org/components-helpers" hreflang="en"><link data-rh="true" rel="alternate" href="https://docs.langflow.org/components-helpers" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://UZK6BDPCVY-dsn.algolia.net" crossorigin="anonymous"><link rel="preconnect" href="https://www.google-analytics.com">
|
||
<link rel="preconnect" href="https://www.googletagmanager.com">
|
||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-SLQFLQ3KPT"></script>
|
||
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-SLQFLQ3KPT",{})</script>
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="search" type="application/opensearchdescription+xml" title="Langflow Documentation" href="/opensearch.xml">
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@550;600&display=swap">
|
||
<script>!function(){window.semaphore=window.semaphore||[],window.ketch=function(){window.semaphore.push(arguments)};var e=document.createElement("script");e.type="text/javascript",e.src="https://global.ketchcdn.com/web/v3/config/datastax/langflow_org_web/boot.js",e.defer=e.async=!0,document.getElementsByTagName("head")[0].appendChild(e)}()</script>
|
||
<script defer="true">!function(){const e=e=>{if(window.gtag&&e.purposes&&"analytics"in e.purposes&&"targeted_advertising"in e.purposes){const n=!0===e.purposes.analytics?"granted":"denied",t=!0===e.purposes.targeted_advertising?"granted":"denied",a={analytics_storage:n,ad_personalization:t,ad_storage:t,ad_user_data:t};window.gtag("consent","update",a)}};window.ketch&&window.ketch("on","consent",e)}()</script><link rel="stylesheet" href="/assets/css/styles.556d0cc8.css">
|
||
<script src="/assets/js/runtime~main.36d0d05a.js" defer="defer"></script>
|
||
<script src="/assets/js/main.01cab6af.js" defer="defer"></script>
|
||
</head>
|
||
<body class="navigation-with-keyboard">
|
||
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return window.localStorage.getItem("theme")}catch(t){}}();null!==e?t(e):window.matchMedia("(prefers-color-scheme: dark)").matches?t("dark"):(window.matchMedia("(prefers-color-scheme: light)").matches,t("light"))}(),function(){try{const c=new URLSearchParams(window.location.search).entries();for(var[t,e]of c)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}()</script><div id="__docusaurus"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top navbarHideable_m1mJ"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/lf-docs-light.svg" alt="Langflow" class="themedComponent_mlkZ themedComponent--light_NVdE"><img src="/img/lf-docs-dark.svg" alt="Langflow" class="themedComponent_mlkZ themedComponent--dark_xIcU"></div></a></div><div class="navbar__items navbar__items--right"><a href="https://github.com/langflow-ai/langflow" target="_blank" class="navbar__item navbar__link header-github-link"></a><a href="https://twitter.com/langflow_ai" target="_blank" class="navbar__item navbar__link header-twitter-link"></a><a href="https://discord.gg/EqksyE2EX9" target="_blank" class="navbar__item navbar__link header-discord-link"></a><div class="toggle_vylO colorModeToggle_DEke"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite" aria-pressed="false"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"></path></svg><svg viewBox="0 0 24 24" width="24" height="24" class="darkToggleIcon_wfgR"><path fill="currentColor" d="M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"></path></svg></button></div><div class="navbarSearchContainer_Bca1"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search (Command+K)"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20" aria-hidden="true"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0"><div class="docsWrapper_hBAB"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docRoot_UBD9"><aside class="theme-doc-sidebar-container docSidebarContainer_YfHR"><div class="sidebarViewport_aRkj"><div class="sidebar_njMd sidebarWithHideableNavbar_wUlq"><a tabindex="-1" class="sidebarLogo_isFc" href="/"><img src="/img/lf-docs-light.svg" alt="Langflow" class="themedComponent_mlkZ themedComponent--light_NVdE"><img src="/img/lf-docs-dark.svg" alt="Langflow" class="themedComponent_mlkZ themedComponent--dark_xIcU"></a><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/">Welcome to Langflow</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/get-started-installation">Get started</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/basic-prompting">Templates</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/concepts-overview">Concepts</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" role="button" aria-expanded="true" href="/components-agents">Components</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/components-agents">Agents</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/components-bundle-components">Bundles</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/components-custom-components">Create custom Python components</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/components-data">Data</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/components-embedding-models">Embeddings</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/components-helpers">Helpers</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/components-io">Inputs and outputs</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/components-logic">Logic</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/components-memories">Memories</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/components-models">Models</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/components-processing">Processing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/components-prompts">Prompts</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/components-tools">Tools</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/components-vector-stores">Vector stores</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/agents-overview">Agents</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/mcp-server">Model Context Protocol (MCP)</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/configuration-api-keys">Configuration</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/develop-overview">Develop</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/deployment-overview">Deployment</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/api">API reference</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/integrations-apify">Integrations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/contributing-community">Contributing</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a href="https://github.com/langflow-ai/langflow/releases/latest" target="_blank" rel="noopener noreferrer" class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false">Changelog</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/luna-for-langflow">Support</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 sidebar-ad">
|
||
<a href="https://astra.datastax.com/signup?type=langflow" target="_blank" class="menu__link">
|
||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-cloud"><path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"/></svg>
|
||
<div class="sidebar-ad-text-container">
|
||
<span class="sidebar-ad-text">Use Langflow in the cloud</span>
|
||
<span class="sidebar-ad-text sidebar-ad-text-gradient">Sign up for DataStax Langflow</span>
|
||
</div>
|
||
</a>
|
||
</li></ul></nav></div></div></aside><main class="docMainContainer_TBSr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_YNFT"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Components</span><meta itemprop="position" content="1"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Helpers</span><meta itemprop="position" content="2"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><style>[data-ch-theme="github-dark"] { --ch-t-colorScheme: dark;--ch-t-foreground: #c9d1d9;--ch-t-background: #0d1117;--ch-t-lighter-inlineBackground: #0d1117e6;--ch-t-editor-background: #0d1117;--ch-t-editor-foreground: #c9d1d9;--ch-t-editor-lineHighlightBackground: #6e76811a;--ch-t-editor-rangeHighlightBackground: #ffffff0b;--ch-t-editor-infoForeground: #3794FF;--ch-t-editor-selectionBackground: #264F78;--ch-t-focusBorder: #1f6feb;--ch-t-tab-activeBackground: #0d1117;--ch-t-tab-activeForeground: #c9d1d9;--ch-t-tab-inactiveBackground: #010409;--ch-t-tab-inactiveForeground: #8b949e;--ch-t-tab-border: #30363d;--ch-t-tab-activeBorder: #0d1117;--ch-t-editorGroup-border: #30363d;--ch-t-editorGroupHeader-tabsBackground: #010409;--ch-t-editorLineNumber-foreground: #6e7681;--ch-t-input-background: #0d1117;--ch-t-input-foreground: #c9d1d9;--ch-t-input-border: #30363d;--ch-t-icon-foreground: #8b949e;--ch-t-sideBar-background: #010409;--ch-t-sideBar-foreground: #c9d1d9;--ch-t-sideBar-border: #30363d;--ch-t-list-activeSelectionBackground: #6e768166;--ch-t-list-activeSelectionForeground: #c9d1d9;--ch-t-list-hoverBackground: #6e76811a;--ch-t-list-hoverForeground: #c9d1d9; }</style>
|
||
<!-- -->
|
||
<header><h1>Helper components in Langflow</h1></header>
|
||
<p>Helper components provide utility functions to help manage data, tasks, and other components in your flow.</p>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="use-a-helper-component-in-a-flow">Use a helper component in a flow<a href="#use-a-helper-component-in-a-flow" class="hash-link" aria-label="Direct link to Use a helper component in a flow" title="Direct link to Use a helper component in a flow"></a></h2>
|
||
<p>Chat memory in Langflow is stored either in local Langflow tables with <code>LCBufferMemory</code>, or connected to an external database.</p>
|
||
<p>The <strong>Store Message</strong> helper component stores chat memories as <a href="/concepts-objects">Data</a> objects, and the <strong>Message History</strong> helper component retrieves chat messages as data objects or strings.</p>
|
||
<p>This example flow stores and retrieves chat history from an <a href="/components-memories#astradbchatmemory-component">AstraDBChatMemory</a> component with <strong>Store Message</strong> and <strong>Chat Memory</strong> components.</p>
|
||
<p><img decoding="async" loading="lazy" alt="Sample Flow storing Chat Memory in AstraDB" src="/assets/images/astra_db_chat_memory_rounded-9746ca2bb69d3b07ac0a071f4b9471b3.png" width="3178" height="1228" class="img_ev3q"></p>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="batch-run">Batch Run<a href="#batch-run" class="hash-link" aria-label="Direct link to Batch Run" title="Direct link to Batch Run"></a></h2>
|
||
<p>The <strong>Batch Run</strong> component runs a language model over <strong>each row</strong> of a <a href="/concepts-objects#dataframe-object">DataFrame</a> text column and returns a new DataFrame with the original text and an LLM response.</p>
|
||
<p>The response contains the following columns:</p>
|
||
<ul>
|
||
<li><code>text_input</code>: The original text from the input DataFrame.</li>
|
||
<li><code>model_response</code>: The model's response for each input.</li>
|
||
<li><code>batch_index</code>: The processing order, with a <code>0</code>-based index.</li>
|
||
<li><code>metadata</code> (optional): Additional information about the processing.</li>
|
||
</ul>
|
||
<p>These columns, when connected to a <strong>Parser</strong> component, can be used as variables within curly braces.</p>
|
||
<p>To use the Batch Run component with a <strong>Parser</strong> component, do the following:</p>
|
||
<ol>
|
||
<li>Connect a <strong>Model</strong> component to the <strong>Batch Run</strong> component's <strong>Language model</strong> port.</li>
|
||
<li>Connect a component that outputs DataFrame, like <strong>File</strong> component, to the <strong>Batch Run</strong> component's <strong>DataFrame</strong> input.</li>
|
||
<li>Connect the <strong>Batch Run</strong> component's <strong>Batch Results</strong> output to a <strong>Parser</strong> component's <strong>DataFrame</strong> input.
|
||
The flow looks like this:</li>
|
||
</ol>
|
||
<p><img decoding="async" loading="lazy" alt="A batch run component connected to OpenAI and a Parser" src="/assets/images/component-batch-run-0ad3fa6f082eb01504dae7df3cc4daad.png" width="1776" height="1370" class="img_ev3q"></p>
|
||
<ol start="4">
|
||
<li>In the <strong>Column Name</strong> field of the <strong>Batch Run</strong> component, enter a column name based on the data you're loading from the <strong>File</strong> loader. For example, to process a column of <code>name</code>, enter <code>name</code>.</li>
|
||
<li>Optionally, in the <strong>System Message</strong> field of the <strong>Batch Run</strong> component, enter a <strong>System Message</strong> to instruct the connected LLM on how to process your file. For example, <code>Create a business card for each name.</code></li>
|
||
<li>In the <strong>Template</strong> field of the <strong>Parser</strong> component, enter a template for using the <strong>Batch Run</strong> component's new DataFrame columns.
|
||
To use all three columns from the <strong>Batch Run</strong> component, include them like this:</li>
|
||
</ol>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>record_number: {batch_index}, name: {text_input}, summary: {model_response}</span></div></div><br></code></div></div>
|
||
<ol start="7">
|
||
<li>To run the flow, in the <strong>Parser</strong> component, click <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-play" aria-label="Play icon"><polygon points="6 3 20 12 6 21 6 3"></polygon></svg>.</li>
|
||
<li>To view your created DataFrame, in the <strong>Parser</strong> component, click <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-text-search" aria-label="Inspect icon"><path d="M21 6H3"></path><path d="M10 12H3"></path><path d="M10 18H3"></path><circle cx="17" cy="15" r="3"></circle><path d="m21 19-1.9-1.9"></path></svg>.</li>
|
||
<li>Optionally, connect a <strong>Chat Output</strong> component, and open the <strong>Playground</strong> to see the output.</li>
|
||
</ol>
|
||
<details class="details_lb9f alert alert--info details_b_Ee" data-collapsed="true"><summary>Parameters</summary><div><div class="collapsibleContent_i85q"><p><strong>Inputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>model</td><td>HandleInput</td><td>Connect the 'Language Model' output from your LLM component here. Required.</td></tr><tr><td>system_message</td><td>MultilineInput</td><td>A multi-line system instruction for all rows in the DataFrame.</td></tr><tr><td>df</td><td>DataFrameInput</td><td>The DataFrame whose column is treated as text messages, as specified by 'column_name'. Required.</td></tr><tr><td>column_name</td><td>MessageTextInput</td><td>The name of the DataFrame column to treat as text messages. If empty, all columns are formatted in TOML.</td></tr><tr><td>output_column_name</td><td>MessageTextInput</td><td>Name of the column where the model's response is stored. Default=<code>model_response</code>.</td></tr><tr><td>enable_metadata</td><td>BoolInput</td><td>If True, add metadata to the output DataFrame.</td></tr></tbody></table><p><strong>Outputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>batch_results</td><td>DataFrame</td><td>A DataFrame with all original columns plus the model's response column.</td></tr></tbody></table></div></div></details>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="current-date">Current date<a href="#current-date" class="hash-link" aria-label="Direct link to Current date" title="Direct link to Current date"></a></h2>
|
||
<p>The Current Date component returns the current date and time in a selected timezone. This component provides a flexible way to obtain timezone-specific date and time information within a Langflow pipeline.</p>
|
||
<details class="details_lb9f alert alert--info details_b_Ee" data-collapsed="true"><summary>Parameters</summary><div><div class="collapsibleContent_i85q"><p><strong>Inputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>timezone</td><td>String</td><td>The timezone for the current date and time.</td></tr></tbody></table><p><strong>Outputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>current_date</td><td>String</td><td>The resulting current date and time in the selected timezone.</td></tr></tbody></table></div></div></details>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="id-generator">ID Generator<a href="#id-generator" class="hash-link" aria-label="Direct link to ID Generator" title="Direct link to ID Generator"></a></h2>
|
||
<p>This component generates a unique ID.</p>
|
||
<details class="details_lb9f alert alert--info details_b_Ee" data-collapsed="true"><summary>Parameters</summary><div><div class="collapsibleContent_i85q"><p><strong>Inputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>unique_id</td><td>String</td><td>The generated unique ID.</td></tr></tbody></table><p><strong>Outputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>The generated unique ID.</td></tr></tbody></table></div></div></details>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="message-history">Message history<a href="#message-history" class="hash-link" aria-label="Direct link to Message history" title="Direct link to Message history"></a></h2>
|
||
<div class="theme-admonition theme-admonition-info admonition_xJq3 alert alert--info"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg></span>info</div><div class="admonitionContent_BuS1"><p>Prior to Langflow 1.1, this component was known as the Chat Memory component.</p></div></div>
|
||
<p>This component retrieves chat messages from Langflow tables or external memory.</p>
|
||
<p>In this example, the <strong>Message Store</strong> component stores the complete chat history in a local Langflow table, which the <strong>Message History</strong> component retrieves as context for the LLM to answer each question.</p>
|
||
<p><img decoding="async" loading="lazy" alt="Message store and history components" src="/assets/images/component-message-history-message-store-be0396aefa69496e8bc21452d240e04d.png" width="2778" height="1166" class="img_ev3q"></p>
|
||
<p>For more information on configuring memory in Langflow, see <a href="/memory">Memory</a>.</p>
|
||
<details class="details_lb9f alert alert--info details_b_Ee" data-collapsed="true"><summary>Parameters</summary><div><div class="collapsibleContent_i85q"><p><strong>Inputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>memory</td><td>Memory</td><td>Retrieve messages from an external memory. If empty, the Langflow tables are used.</td></tr><tr><td>sender</td><td>String</td><td>Filter by sender type.</td></tr><tr><td>sender_name</td><td>String</td><td>Filter by sender name.</td></tr><tr><td>n_messages</td><td>Integer</td><td>The number of messages to retrieve.</td></tr><tr><td>session_id</td><td>String</td><td>The session ID of the chat. If empty, the current session ID parameter is used.</td></tr><tr><td>order</td><td>String</td><td>The order of the messages.</td></tr><tr><td>template</td><td>String</td><td>The template to use for formatting the data. It can contain the keys <code>{text}</code>, <code>{sender}</code> or any other key in the message data.</td></tr></tbody></table><p><strong>Outputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>messages</td><td>Data</td><td>The retrieved messages as Data objects.</td></tr><tr><td>messages_text</td><td>Message</td><td>The retrieved messages formatted as text.</td></tr><tr><td>dataframe</td><td>DataFrame</td><td>A DataFrame containing the message data.</td></tr></tbody></table></div></div></details>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="message-store">Message store<a href="#message-store" class="hash-link" aria-label="Direct link to Message store" title="Direct link to Message store"></a></h2>
|
||
<p>This component stores chat messages or text in Langflow tables or external memory.</p>
|
||
<p>In this example, the <strong>Message Store</strong> component stores the complete chat history in a local Langflow table, which the <strong>Message History</strong> component retrieves as context for the LLM to answer each question.</p>
|
||
<p><img decoding="async" loading="lazy" alt="Message store and history components" src="/assets/images/component-message-history-message-store-be0396aefa69496e8bc21452d240e04d.png" width="2778" height="1166" class="img_ev3q"></p>
|
||
<p>For more information on configuring memory in Langflow, see <a href="/memory">Memory</a>.</p>
|
||
<details class="details_lb9f alert alert--info details_b_Ee" data-collapsed="true"><summary>Parameters</summary><div><div class="collapsibleContent_i85q"><p><strong>Inputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>message</td><td>String</td><td>The chat message to be stored. (Required)</td></tr><tr><td>memory</td><td>Memory</td><td>The external memory to store the message. If empty, the Langflow tables are used.</td></tr><tr><td>sender</td><td>String</td><td>The sender of the message. Can be Machine or User. If empty, the current sender parameter is used.</td></tr><tr><td>sender_name</td><td>String</td><td>The name of the sender. Can be AI or User. If empty, the current sender parameter is used.</td></tr><tr><td>session_id</td><td>String</td><td>The session ID of the chat. If empty, the current session ID parameter is used.</td></tr></tbody></table><p><strong>Outputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>stored_messages</td><td>List[Data]</td><td>The list of stored messages after the current message has been added.</td></tr></tbody></table></div></div></details>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="structured-output">Structured output<a href="#structured-output" class="hash-link" aria-label="Direct link to Structured output" title="Direct link to Structured output"></a></h2>
|
||
<p>This component transforms LLM responses into structured data formats.</p>
|
||
<p>In this example from the <strong>Financial Report Parser</strong> template, the <strong>Structured Output</strong> component transforms unstructured financial reports into structured data.</p>
|
||
<p><img decoding="async" loading="lazy" alt="Structured output example" src="/assets/images/component-structured-output-7bb5a996464cb83d4c94a893419bb176.png" width="2554" height="1548" class="img_ev3q"></p>
|
||
<p>The connected LLM model is prompted by the <strong>Structured Output</strong> component's <code>Format Instructions</code> parameter to extract structured output from the unstructured text. <code>Format Instructions</code> is utilized as the system prompt for the <strong>Structured Output</strong> component.</p>
|
||
<p>In the <strong>Structured Output</strong> component, click the <strong>Open table</strong> button to view the <code>Output Schema</code> table.
|
||
The <code>Output Schema</code> parameter defines the structure and data types for the model's output using a table with the following fields:</p>
|
||
<ul>
|
||
<li><strong>Name</strong>: The name of the output field.</li>
|
||
<li><strong>Description</strong>: The purpose of the output field.</li>
|
||
<li><strong>Type</strong>: The data type of the output field. The available types are <code>str</code>, <code>int</code>, <code>float</code>, <code>bool</code>, <code>list</code>, or <code>dict</code>. The default is <code>text</code>.</li>
|
||
<li><strong>Multiple</strong>: This feature is deprecated. Currently, it is set to <code>True</code> by default if you expect multiple values for a single field. For example, a <code>list</code> of <code>features</code> is set to <code>True</code> to contain multiple values, such as <code>["waterproof", "durable", "lightweight"]</code>. Default: <code>True</code>.</li>
|
||
</ul>
|
||
<p>The <strong>Parser</strong> component parses the structured output into a template for orderly presentation in chat output. The template receives the values from the <code>output_schema</code> table with curly braces.</p>
|
||
<p>For example, the template <code>EBITDA: {EBITDA} , Net Income: {NET_INCOME} , GROSS_PROFIT: {GROSS_PROFIT}</code> presents the extracted values in the <strong>Playground</strong> as <code>EBITDA: 900 million , Net Income: 500 million , GROSS_PROFIT: 1.2 billion</code>.</p>
|
||
<details class="details_lb9f alert alert--info details_b_Ee" data-collapsed="true"><summary>Parameters</summary><div><div class="collapsibleContent_i85q"><p><strong>Inputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>llm</td><td>LanguageModel</td><td>The language model to use to generate the structured output.</td></tr><tr><td>input_value</td><td>String</td><td>The input message to the language model.</td></tr><tr><td>system_prompt</td><td>String</td><td>The instructions to the language model for formatting the output.</td></tr><tr><td>schema_name</td><td>String</td><td>The name for the output data schema.</td></tr><tr><td>output_schema</td><td>Table</td><td>The structure and data types for the model's output.</td></tr><tr><td>multiple</td><td>Boolean</td><td>[Deprecated] Always set to <code>True</code>.</td></tr></tbody></table><p><strong>Outputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>structured_output</td><td>Data</td><td>The structured output is a Data object based on the defined schema.</td></tr></tbody></table></div></div></details>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="legacy-components">Legacy components<a href="#legacy-components" class="hash-link" aria-label="Direct link to Legacy components" title="Direct link to Legacy components"></a></h2>
|
||
<p>Legacy components are available for use but are no longer supported.</p>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="create-list">Create List<a href="#create-list" class="hash-link" aria-label="Direct link to Create List" title="Direct link to Create List"></a></h3>
|
||
<p>This component dynamically creates a record with a specified number of fields.</p>
|
||
<details class="details_lb9f alert alert--info details_b_Ee" data-collapsed="true"><summary>Parameters</summary><div><div class="collapsibleContent_i85q"><p><strong>Inputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>n_fields</td><td>Integer</td><td>The number of fields to be added to the record.</td></tr><tr><td>text_key</td><td>String</td><td>The key used as text.</td></tr></tbody></table><p><strong>Outputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>list</td><td>List</td><td>The dynamically created list with the specified number of fields.</td></tr></tbody></table></div></div></details>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="output-parser">Output Parser<a href="#output-parser" class="hash-link" aria-label="Direct link to Output Parser" title="Direct link to Output Parser"></a></h3>
|
||
<p>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 <code>CommaSeparatedListOutputParser</code>.</p>
|
||
<div class="theme-admonition theme-admonition-note admonition_xJq3 alert alert--secondary"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 14 16"><path fill-rule="evenodd" d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"></path></svg></span>note</div><div class="admonitionContent_BuS1"><p>This component only provides formatting instructions and parsing functionality. It does not include a prompt. You'll need to connect it to a separate Prompt component to create the actual prompt template for the LLM to use.</p></div></div>
|
||
<p>Both the <strong>Output Parser</strong> and <strong>Structured Output</strong> components format LLM responses, but they have different use cases.
|
||
The <strong>Output Parser</strong> is simpler and focused on converting responses into comma-separated lists. Use this when you just need a list of items, for example <code>["item1", "item2", "item3"]</code>.
|
||
The <strong>Structured Output</strong> is more complex and flexible, and allows you to define custom schemas with multiple fields of different types. Use this when you need to extract structured data with specific fields and types.</p>
|
||
<p>To use this component:</p>
|
||
<ol>
|
||
<li>Create a Prompt component and connect the Output Parser's <code>format_instructions</code> output to it. This ensures the LLM knows how to format its response.</li>
|
||
<li>Write your actual prompt text in the Prompt component, including the <code>{format_instructions}</code> variable.
|
||
For example, in your Prompt component, the template might look like:</li>
|
||
</ol>
|
||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>{format_instructions}</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>Please list three fruits.</span></div></div><br></code></div></div>
|
||
<ol start="3">
|
||
<li>
|
||
<p>Connect the <code>output_parser</code> output to your LLM model.</p>
|
||
</li>
|
||
<li>
|
||
<p>The output parser converts this into a Python list: <code>["apple", "banana", "orange"]</code>.</p>
|
||
</li>
|
||
</ol>
|
||
<details class="details_lb9f alert alert--info details_b_Ee" data-collapsed="true"><summary>Parameters</summary><div><div class="collapsibleContent_i85q"><p><strong>Inputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>parser_type</td><td>String</td><td>The parser type. Currently supports "CSV".</td></tr></tbody></table><p><strong>Outputs</strong></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>format_instructions</td><td>String</td><td>Pass to a prompt template to include formatting instructions for LLM responses.</td></tr><tr><td>output_parser</td><td>Parser</td><td>The constructed output parser that can be used to parse LLM responses.</td></tr></tbody></table></div></div></details></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages"><a class="pagination-nav__link pagination-nav__link--prev" href="/components-embedding-models"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Embeddings</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/components-io"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Inputs and outputs</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#use-a-helper-component-in-a-flow" class="table-of-contents__link toc-highlight">Use a helper component in a flow</a></li><li><a href="#batch-run" class="table-of-contents__link toc-highlight">Batch Run</a></li><li><a href="#current-date" class="table-of-contents__link toc-highlight">Current date</a></li><li><a href="#id-generator" class="table-of-contents__link toc-highlight">ID Generator</a></li><li><a href="#message-history" class="table-of-contents__link toc-highlight">Message history</a></li><li><a href="#message-store" class="table-of-contents__link toc-highlight">Message store</a></li><li><a href="#structured-output" class="table-of-contents__link toc-highlight">Structured output</a></li><li><a href="#legacy-components" class="table-of-contents__link toc-highlight">Legacy components</a><ul><li><a href="#create-list" class="table-of-contents__link toc-highlight">Create List</a></li><li><a href="#output-parser" class="table-of-contents__link toc-highlight">Output Parser</a></li></ul></li></ul></div></div></div></div></main></div></div></div><footer class="footer"><div class="container container-fluid"><div class="row footer__links"><div class="col footer__col"><div class="footer__title"></div><ul class="footer__items clean-list"><li class="footer__item"><div class="footer-links">
|
||
<span>© 2025 Langflow</span>
|
||
<span id="preferenceCenterContainer"> · <a href="https://langflow.org/preferences">Manage Privacy Choices</a></span>
|
||
</div></li></ul></div></div><div class="footer__bottom text--center"><div class="margin-bottom--sm"><img src="/img/lf-docs-light.svg" alt="Langflow" class="footer__logo themedComponent_mlkZ themedComponent--light_NVdE" width="160" height="40"><img src="/img/lf-docs-dark.svg" alt="Langflow" class="footer__logo themedComponent_mlkZ themedComponent--dark_xIcU" width="160" height="40"></div></div></div></footer><div style="position:fixed;right:20px;bottom:20px;z-index:100;display:flex;align-items:center;gap:10px;cursor:pointer"><div style="background-color:#f6f6f6;border-radius:50%;width:48px;height:48px;display:flex;align-items:center;justify-content:center;box-shadow:0 2px 4px rgba(0,0,0,0.1)"><img src="/img/langflow-icon-black-transparent.svg" style="width:40px" alt="Search"></div></div></div>
|
||
</body>
|
||
</html> |