mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 05:16:40 +08:00
116 lines
39 KiB
HTML
116 lines
39 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-logic" data-has-hydrated="false">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="generator" content="Docusaurus v3.7.0">
|
||
<title data-rh="true">Logic | 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-logic"><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="Logic | Langflow Documentation"><meta data-rh="true" name="description" content="Logic components provide functionalities for routing, conditional processing, and flow management."><meta data-rh="true" property="og:description" content="Logic components provide functionalities for routing, conditional processing, and flow management."><link data-rh="true" rel="icon" href="/img/favicon.ico"><link data-rh="true" rel="canonical" href="https://docs.langflow.org/components-logic"><link data-rh="true" rel="alternate" href="https://docs.langflow.org/components-logic" hreflang="en"><link data-rh="true" rel="alternate" href="https://docs.langflow.org/components-logic" 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-XHC7G628ZP"></script>
|
||
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-XHC7G628ZP",{anonymize_ip:!0})</script>
|
||
<link rel="preconnect" href="https://www.googletagmanager.com">
|
||
<script>window.dataLayer=window.dataLayer||[]</script>
|
||
<script>!function(e,t,a,n){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var g=t.getElementsByTagName(a)[0],m=t.createElement(a);m.async=!0,m.src="https://www.googletagmanager.com/gtm.js?id=GTM-NK5M4ZT8",g.parentNode.insertBefore(m,g)}(window,document,"script","dataLayer")</script>
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="search" type="application/opensearchdescription+xml" title="Langflow Documentation" href="/opensearch.xml"><link rel="stylesheet" href="/assets/css/styles.e5a88218.css">
|
||
<script src="/assets/js/runtime~main.222d37de.js" defer="defer"></script>
|
||
<script src="/assets/js/main.fa64d841.js" defer="defer"></script>
|
||
</head>
|
||
<body class="navigation-with-keyboard">
|
||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NK5M4ZT8" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||
|
||
|
||
|
||
|
||
<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/langflow-logo-black.svg" alt="Langflow" class="themedComponent_mlkZ themedComponent--light_NVdE"><img src="/img/langflow-logo-white.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/langflow-logo-black.svg" alt="Langflow" class="themedComponent_mlkZ themedComponent--light_NVdE"><img src="/img/langflow-logo-white.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="/starter-projects-basic-prompting">Starter projects</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="/tutorials-blog-writer">Tutorials</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-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" 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-loaders">Loaders</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-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="/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="/Deployment/deployment-docker">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></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">Logic</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>Logic components in Langflow</h1></header>
|
||
<p>Logic components provide functionalities for routing, conditional processing, and flow management.</p>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="use-a-logic-component-in-a-flow">Use a logic component in a flow<a href="#use-a-logic-component-in-a-flow" class="hash-link" aria-label="Direct link to Use a logic component in a flow" title="Direct link to Use a logic component in a flow"></a></h2>
|
||
<p>This flow creates a summarizing "for each" loop with the <a href="/components-logic#loop">Loop</a> component.</p>
|
||
<p>The component iterates over a list of <a href="/concepts-objects#data-object">Data</a> objects until it's completed, and then the <strong>Done</strong> loop aggregates the results.</p>
|
||
<p>The <strong>File</strong> component loads text files from your local machine, and then the <strong>Parse Data</strong> component parses them into a list of structured <code>Data</code> objects.
|
||
The <strong>Loop</strong> component passes each <code>Data</code> object to a <strong>Prompt</strong> to be summarized.</p>
|
||
<p>When the <strong>Loop</strong> component runs out of <code>Data</code>, the <strong>Done</strong> loop activates, which counts the number of pages and summarizes their tone with another <strong>Prompt</strong>.
|
||
This is represented in Langflow by connecting the Parse Data component's <strong>Data List</strong> output to the Loop component's <code>Data</code> loop input.</p>
|
||
<p><img decoding="async" loading="lazy" alt="Sample Flow looping summarizer" src="/assets/images/loop-text-summarizer-bd1d7be6d26bb47765931e3ab9f98dfa.png" width="2676" height="1512" class="img_ev3q"></p>
|
||
<p>The output will look similar to this:</p>
|
||
<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>Document Summary</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>Total Pages Processed</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>Total Pages: 2</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>Overall Tone of Document</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>Tone: Informative and Instructional</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>The documentation outlines microservices architecture patterns and best practices.</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>It emphasizes service isolation and inter-service communication protocols.</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>The use of asynchronous messaging patterns is recommended for system scalability.</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>It includes code examples of REST and gRPC implementations to demonstrate integration approaches.</span></div></div><br></code></div></div>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="conditional-router-if-else-component">Conditional router (If-Else component)<a href="#conditional-router-if-else-component" class="hash-link" aria-label="Direct link to Conditional router (If-Else component)" title="Direct link to Conditional router (If-Else component)"></a></h2>
|
||
<p>This component routes an input message to a corresponding output based on text comparison.</p>
|
||
<p>The ConditionalRouterComponent routes messages based on text comparison. It evaluates a condition by comparing two text inputs using a specified operator and routes the message accordingly.</p>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="inputs">Inputs<a href="#inputs" class="hash-link" aria-label="Direct link to Inputs" title="Direct link to Inputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>input_text</td><td>String</td><td>The primary text input for the operation.</td></tr><tr><td>match_text</td><td>String</td><td>The text input to compare against.</td></tr><tr><td>operator</td><td>Dropdown</td><td>The operator to apply for comparing the texts.</td></tr><tr><td>case_sensitive</td><td>Boolean</td><td>If true, the comparison will be case sensitive.</td></tr><tr><td>message</td><td>Message</td><td>The message to pass through either route.</td></tr><tr><td>max_iterations</td><td>Integer</td><td>The maximum number of iterations for the conditional router.</td></tr><tr><td>default_route</td><td>Dropdown</td><td>The default route to take when max iterations are reached.</td></tr></tbody></table>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="outputs">Outputs<a href="#outputs" class="hash-link" aria-label="Direct link to Outputs" title="Direct link to Outputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>true_result</td><td>Message</td><td>The output when the condition is true.</td></tr><tr><td>false_result</td><td>Message</td><td>The output when the condition is false.</td></tr></tbody></table>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="data-conditional-router">Data conditional router<a href="#data-conditional-router" class="hash-link" aria-label="Direct link to Data conditional router" title="Direct link to Data conditional router"></a></h2>
|
||
<p>This component routes <code>Data</code> objects based on a condition applied to a specified key, including boolean validation.</p>
|
||
<p>This component is particularly useful in workflows that require conditional routing of complex data structures, enabling dynamic decision-making based on data content.</p>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="inputs-1">Inputs<a href="#inputs-1" class="hash-link" aria-label="Direct link to Inputs" title="Direct link to Inputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>data_input</td><td>Data</td><td>The data object or list of data objects to process.</td></tr><tr><td>key_name</td><td>String</td><td>The name of the key in the data object to check.</td></tr><tr><td>operator</td><td>Dropdown</td><td>The operator to apply for comparing the values.</td></tr><tr><td>compare_value</td><td>String</td><td>The value to compare against (not used for boolean validator).</td></tr></tbody></table>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="outputs-1">Outputs<a href="#outputs-1" class="hash-link" aria-label="Direct link to Outputs" title="Direct link to Outputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>true_output</td><td>Data/List</td><td>Output when the condition is met.</td></tr><tr><td>false_output</td><td>Data/List</td><td>Output when the condition is not met.</td></tr></tbody></table>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="flow-as-tool">Flow as tool<a href="#flow-as-tool" class="hash-link" aria-label="Direct link to Flow as tool" title="Direct link to Flow as tool"></a></h2>
|
||
<div class="theme-admonition theme-admonition-important 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>important</div><div class="admonitionContent_BuS1"><p>This component is deprecated as of Langflow version 1.1.2.
|
||
Instead, use the <a href="/components-logic#run-flow">Run flow component</a></p></div></div>
|
||
<p>This component constructs a tool from a function that runs a loaded flow.</p>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="inputs-2">Inputs<a href="#inputs-2" class="hash-link" aria-label="Direct link to Inputs" title="Direct link to Inputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>flow_name</td><td>Dropdown</td><td>The name of the flow to run.</td></tr><tr><td>tool_name</td><td>String</td><td>The name of the tool.</td></tr><tr><td>tool_description</td><td>String</td><td>The description of the tool.</td></tr><tr><td>return_direct</td><td>Boolean</td><td>If true, returns the result directly from the tool.</td></tr></tbody></table>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="outputs-2">Outputs<a href="#outputs-2" class="hash-link" aria-label="Direct link to Outputs" title="Direct link to Outputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>api_build_tool</td><td>Tool</td><td>The constructed tool from the flow.</td></tr></tbody></table>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="listen">Listen<a href="#listen" class="hash-link" aria-label="Direct link to Listen" title="Direct link to Listen"></a></h2>
|
||
<p>This component listens for a notification and retrieves its associated state.</p>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="inputs-3">Inputs<a href="#inputs-3" class="hash-link" aria-label="Direct link to Inputs" title="Direct link to Inputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>name</td><td>String</td><td>The name of the notification to listen for.</td></tr></tbody></table>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="outputs-3">Outputs<a href="#outputs-3" class="hash-link" aria-label="Direct link to Outputs" title="Direct link to Outputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>output</td><td>Data</td><td>The state associated with the notification.</td></tr></tbody></table>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="loop">Loop<a href="#loop" class="hash-link" aria-label="Direct link to Loop" title="Direct link to Loop"></a></h2>
|
||
<p>This component iterates over a list of <a href="/concepts-objects#data-object">Data</a> objects, outputting one item at a time and aggregating results from loop inputs.</p>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="inputs-4">Inputs<a href="#inputs-4" class="hash-link" aria-label="Direct link to Inputs" title="Direct link to Inputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>data</td><td>Data/List</td><td>The initial list of Data objects to iterate over.</td></tr></tbody></table>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="outputs-4">Outputs<a href="#outputs-4" class="hash-link" aria-label="Direct link to Outputs" title="Direct link to Outputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>item</td><td>Data</td><td>Outputs one item at a time from the data list.</td></tr><tr><td>done</td><td>Data</td><td>Triggered when iteration complete, returns aggregated results.</td></tr></tbody></table>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="notify">Notify<a href="#notify" class="hash-link" aria-label="Direct link to Notify" title="Direct link to Notify"></a></h2>
|
||
<p>This component generates a notification for the Listen component to use.</p>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="inputs-5">Inputs<a href="#inputs-5" class="hash-link" aria-label="Direct link to Inputs" title="Direct link to Inputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>name</td><td>String</td><td>The name of the notification.</td></tr><tr><td>data</td><td>Data</td><td>The data to store in the notification.</td></tr><tr><td>append</td><td>Boolean</td><td>If true, the record will be appended to the existing notification.</td></tr></tbody></table>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="outputs-5">Outputs<a href="#outputs-5" class="hash-link" aria-label="Direct link to Outputs" title="Direct link to Outputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>output</td><td>Data</td><td>The data stored in the notification.</td></tr></tbody></table>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="pass-message">Pass message<a href="#pass-message" class="hash-link" aria-label="Direct link to Pass message" title="Direct link to Pass message"></a></h2>
|
||
<p>This component forwards the input message, unchanged.</p>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="inputs-6">Inputs<a href="#inputs-6" class="hash-link" aria-label="Direct link to Inputs" title="Direct link to Inputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Display Name</th><th>Info</th></tr></thead><tbody><tr><td>input_message</td><td>Input Message</td><td>The message to be passed forward.</td></tr><tr><td>ignored_message</td><td>Ignored Message</td><td>A second message to be ignored. Used as a workaround for continuity.</td></tr></tbody></table>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="outputs-6">Outputs<a href="#outputs-6" class="hash-link" aria-label="Direct link to Outputs" title="Direct link to Outputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Display Name</th><th>Info</th></tr></thead><tbody><tr><td>output_message</td><td>Output Message</td><td>The forwarded input message.</td></tr></tbody></table>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="run-flow">Run flow<a href="#run-flow" class="hash-link" aria-label="Direct link to Run flow" title="Direct link to Run flow"></a></h2>
|
||
<p>This component allows you to run any flow stored in your Langflow database without opening the flow editor.</p>
|
||
<p>The Run Flow component can also be used as a tool when connected to an <a href="/components-agents">Agent</a>. The <code>name</code> and <code>description</code> metadata that the Agent uses to register the tool are created automatically.</p>
|
||
<p>When you select a flow, the component fetches the flow's graph structure and uses it to generate the inputs and outputs for the Run Flow component.</p>
|
||
<p>To use the Run Flow component as a tool, do the following:</p>
|
||
<ol>
|
||
<li>Add the <strong>Run Flow</strong> component to the <a href="/starter-projects-simple-agent">Simple Agent</a> flow.</li>
|
||
<li>In the <strong>Flow Name</strong> menu, select the sub-flow you want to run.
|
||
The appearance of the <strong>Run Flow</strong> component changes to reflect the inputs and outputs of the selected flow.</li>
|
||
<li>On the <strong>Run Flow</strong> component, enable <strong>Tool Mode</strong>.</li>
|
||
<li>Connect the <strong>Run Flow</strong> component to the <strong>Toolset</strong> input of the Agent.
|
||
Your flow should now look like this:
|
||
<img decoding="async" loading="lazy" alt="Run Flow component" src="/assets/images/component-run-flow-78e94e2ede1b4b853f0e4de6b9561f6f.png" width="2036" height="1582" class="img_ev3q"></li>
|
||
<li>Run the flow. The Agent uses the Run Flow component as a tool to run the selected sub-flow.</li>
|
||
</ol>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="inputs-7">Inputs<a href="#inputs-7" class="hash-link" aria-label="Direct link to Inputs" title="Direct link to Inputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>flow_name_selected</td><td>Dropdown</td><td>The name of the flow to run.</td></tr><tr><td>flow_tweak_data</td><td>Dict</td><td>Dictionary of tweaks to customize the flow's behavior.</td></tr><tr><td>dynamic inputs</td><td>Various</td><td>Additional inputs that are generated based on the selected flow.</td></tr></tbody></table>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="outputs-7">Outputs<a href="#outputs-7" class="hash-link" aria-label="Direct link to Outputs" title="Direct link to Outputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>run_outputs</td><td>A <code>List</code> of types <code>Data</code>, <code>Message,</code> or <code>DataFrame</code></td><td>All outputs are generated from running the flow.</td></tr></tbody></table>
|
||
<h2 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="sub-flow">Sub flow<a href="#sub-flow" class="hash-link" aria-label="Direct link to Sub flow" title="Direct link to Sub flow"></a></h2>
|
||
<div class="theme-admonition theme-admonition-important 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>important</div><div class="admonitionContent_BuS1"><p>This component is deprecated as of Langflow version 1.1.2.
|
||
Instead, use the <a href="/components-logic#run-flow">Run flow component</a></p></div></div>
|
||
<p>This <code>SubFlowComponent</code> generates a component from a flow with all of its inputs and outputs.</p>
|
||
<p>This component can integrate entire flows as components within a larger workflow. It dynamically generates inputs based on the selected flow and executes the flow with provided parameters.</p>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="inputs-8">Inputs<a href="#inputs-8" class="hash-link" aria-label="Direct link to Inputs" title="Direct link to Inputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>flow_name</td><td>Dropdown</td><td>The name of the flow to run.</td></tr></tbody></table>
|
||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="outputs-8">Outputs<a href="#outputs-8" class="hash-link" aria-label="Direct link to Outputs" title="Direct link to Outputs"></a></h3>
|
||
<table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>flow_outputs</td><td>List[Data]</td><td>The outputs generated from the flow.</td></tr></tbody></table></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages"><a class="pagination-nav__link pagination-nav__link--prev" href="/components-loaders"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Loaders</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/components-memories"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Memories</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-logic-component-in-a-flow" class="table-of-contents__link toc-highlight">Use a logic component in a flow</a></li><li><a href="#conditional-router-if-else-component" class="table-of-contents__link toc-highlight">Conditional router (If-Else component)</a><ul><li><a href="#inputs" class="table-of-contents__link toc-highlight">Inputs</a></li><li><a href="#outputs" class="table-of-contents__link toc-highlight">Outputs</a></li></ul></li><li><a href="#data-conditional-router" class="table-of-contents__link toc-highlight">Data conditional router</a><ul><li><a href="#inputs-1" class="table-of-contents__link toc-highlight">Inputs</a></li><li><a href="#outputs-1" class="table-of-contents__link toc-highlight">Outputs</a></li></ul></li><li><a href="#flow-as-tool" class="table-of-contents__link toc-highlight">Flow as tool</a><ul><li><a href="#inputs-2" class="table-of-contents__link toc-highlight">Inputs</a></li><li><a href="#outputs-2" class="table-of-contents__link toc-highlight">Outputs</a></li></ul></li><li><a href="#listen" class="table-of-contents__link toc-highlight">Listen</a><ul><li><a href="#inputs-3" class="table-of-contents__link toc-highlight">Inputs</a></li><li><a href="#outputs-3" class="table-of-contents__link toc-highlight">Outputs</a></li></ul></li><li><a href="#loop" class="table-of-contents__link toc-highlight">Loop</a><ul><li><a href="#inputs-4" class="table-of-contents__link toc-highlight">Inputs</a></li><li><a href="#outputs-4" class="table-of-contents__link toc-highlight">Outputs</a></li></ul></li><li><a href="#notify" class="table-of-contents__link toc-highlight">Notify</a><ul><li><a href="#inputs-5" class="table-of-contents__link toc-highlight">Inputs</a></li><li><a href="#outputs-5" class="table-of-contents__link toc-highlight">Outputs</a></li></ul></li><li><a href="#pass-message" class="table-of-contents__link toc-highlight">Pass message</a><ul><li><a href="#inputs-6" class="table-of-contents__link toc-highlight">Inputs</a></li><li><a href="#outputs-6" class="table-of-contents__link toc-highlight">Outputs</a></li></ul></li><li><a href="#run-flow" class="table-of-contents__link toc-highlight">Run flow</a><ul><li><a href="#inputs-7" class="table-of-contents__link toc-highlight">Inputs</a></li><li><a href="#outputs-7" class="table-of-contents__link toc-highlight">Outputs</a></li></ul></li><li><a href="#sub-flow" class="table-of-contents__link toc-highlight">Sub flow</a><ul><li><a href="#inputs-8" class="table-of-contents__link toc-highlight">Inputs</a></li><li><a href="#outputs-8" class="table-of-contents__link toc-highlight">Outputs</a></li></ul></li></ul></div></div></div></div></main></div></div></div><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> |