mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 17:37:02 +08:00
* langflow-webhook-auth-enable
* add-not-contains-filter-operator
* does-not-contains-operator
* less-redundant-explanation
* docs: add jq and path selection to data operations (#10083)
add-jq-and-path-to-data-operations
* smart transform historical names
* change back to smart transform
* jq expression capitalization/package name
* small edit for clarity of not contains operator
* read/write file component name changes
* docs: add smart router component (#10097)
* init
* add-to-release-notes
* remove-dynamic-output-as-parameter
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: screenshot audit (#10166)
* remove-unused
* agent-examples
* main-ui-screenshots
* components-screenshots
* combine-web-search-components
* simple-agent-flow-in-playground
* round-screenshots
* my-projects
* combine-data-components
* docs: component paths updates for lfx (#10130)
* contributing-bundles-path
* api-monitor-example
* concepts-components-page
* contribute-components-path
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: auto-add projects as MCP servers (#10096)
* add-mcp-auto-auth-as-default-behavior
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
* docs: amazon bedrock converse (#10289)
* use-bedrock-converse
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* Update docs/docs/Components/bundles-amazon.mdx
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs 1.7 release: add mock data component (#10288)
* add-component-and-release-note
* Apply suggestion from @aimurphy
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: update custom component docs (#10323)
* add-partial
* update-lfx-component-paths
* move-partial
* completed-quickstart
* clean up intro
* try-docker-with-custom-mount
* up-to-typed-annotations
* typed-annotations
* dynamic-fields
* end-of-file
* bundles-naming
* chore: update component index
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* docs: add cometapi back for 1.7 release (#10445)
* add-comet-bundle-back-for-1.7
* add-comet-to-release-notes
* docs: add back docling remote vlm for release 1.7 (#10489)
* add-back-docling-vlm-content
* add-release-note
* docs: ALTK component (#10511)
* broken-anchor
* sidebar-and-page
* add-release-note
* add-context-on-output
* docs: SSRF warning (#10573)
* add-ssrf-protection-env-var
* api-request-component
* Update docs/docs/Components/components-data.mdx
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* move-note-to-table
* release-note
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: dynamic create data component (#10517)
* add-dynamic-create-data-component-and-release-note
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* clarify-message-types
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: cuga component bundle (#10589)
* initlal-content
* cuga-specific-component-connections
* cleanup
* use-the-same-name
* add-lite-mode-remove-api-flag-and-mode
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* public-or-private-internet
* agent-doesnt-check-urls
* peer-review
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: remove docling vlm component from 1.7 release branch (#10630)
remove-vlm-component
* docs: rename component categories and make all components single pages (#10648)
* docs: OpenAPI spec version upgraded from 1.6.5 to 1.6.8 (#10627)
Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com>
Co-authored-by: Mendon Kissling <59585235+mendonk@users.noreply.github.com>
* up to models and agents
* sidebars
* fix-broken-links
* chore: Fix indentation on bundles-docling.mdx (#10640)
* sidebars
* redo-intros
* link-to-models
* data-components
* files-components-no-kb
* io-components
* helper-utility-components
* llm-ops-components
* logic-components
* processing-pages
* sidebars
* combine-legacy-components-into-one-page
* update-links
* remove-overview-pages-and-redirect
* make-mcp-tools-page
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* no-cap
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com>
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: combined web search component (#10664)
* combine-pages
* remove-rss-and-news-search-and-update-links
* remove-vlm-link
* leave-old-release-note-but-remove-link
* docs: add altk reflection component (#10660)
* add-new-component
* differentiate-components
* docs: mcp streamable http client (#10621)
* release note
* mcp-client-changes
* update-astra-example
* icons-and-copy
* order-of-names
* docs: add cuga decomposition strategy as advanced parameter (#10672)
* update-component-link
* init
* add-decomp-as-advanced-param
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
* [autofix.ci] apply automated fixes (attempt 3/3)
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* update-component-index
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
* [autofix.ci] apply automated fixes (attempt 3/3)
---------
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: datastax bundles page (#10686)
* init
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: llm router changed to llm selector (#10663)
* update-component-name
* previous-name-and-release-note
* [autofix.ci] apply automated fixes
* [autofix.ci] apply automated fixes (attempt 2/3)
* [autofix.ci] apply automated fixes (attempt 3/3)
* docs: log alembic to stdout (#10711)
* docs-alembic-log-env-var
* cleanup
* remove-legacy-component-link
* docs: configure s3 for file storage backend (#10678)
* configure-file-storage-s3
* 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: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* clarify-s3-credentials
* add-storage-tags-and-cleanup-creds-seciton
* role-link-name
* fix-parse-error
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: clarify docling components (#10722)
* clarify-what-docling-components-do
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* component-name
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: legacy processing components for 1.7 (#10661)
* make-components-legacy
* remove-broken-link
* remove-outdated-components
* release-notes
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* add-back-dynamic-create-data
* fix-broken-link-in-smart-router
* remove-release-note
* Apply suggestions from code review
* legacy
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: remove dataframe to toolset component (#10854)
remove-df-to-toolset-component
* docs: clarify superuser flow run behavior (#10865)
superuser-clarification
* docs: add composio components (#10868)
more-composio-components
* docs: additional dependencies for running Docling in Linux-based Docker environments (#10861)
* initial-partial-and-troubleshooting
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: change component h3 headings to h2 (#10886)
bump-headings
* docs: include webhook request example with auth (#10885)
* include-webhook-request-examples
* fix-build-error
* docs: configurable api key validation (#10882)
* initial-content
* clarify-differences
* typo
* docs: langflow server supports streamable http (#10891)
* initial-updates
* check-params
* server-params
* peer-review
* update-release-note
* remove-delete-endpoint-for-legacy
* Revert "docs: langflow server supports streamable http (#10891)"
This reverts commit e1dbefc21d.
* docs: new registration endpoints, email form, and telemetry events (#10816)
* add-email-telemetry
* add-registration-v2-endpoints-and-telemetry
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* changes-from-peer-review
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: more info on smart router component (#10916)
* continue-example
* remove-duplicate-info
* match-by-route-name
* docs: sidebars release notes (#10949)
* move-to-support-section
* support
* docs: update comet api component parameters (#10950)
update-parameters
* docs: mcp server streamable http (#10955)
* content
* transport
* add-back-webhook-env-var
* Update docs/docs/Components/bundles-cuga.mdx
* docs: use bootstrap instead of deprecated launchctl load (#10951)
use-bootstrap-and-semicolons
* docs: lfx serve and lfx run (#10498)
* add-content
* add-entry-to-release-notes
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* partial-for-dependencies
* clarify-api-key-and-uvx
* lfx-included
* add-lfx-schema-and-cleanup-table
* install-nightly-curl-flow-json-clarify-dependencies-create-local-api-key
* not-automatic
* code-review
* work-in-progress
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: authorization changes (#10992)
* files-superuser
* get-config-endpoint-requires-api-key
* config-endpoint
* remove-parentheticals
* docs: custom components input types (#11027)
* io-links-and-update-paths
* remove-unncessary-sentence
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* docs: cuga bundle updates (#10998)
* change-policies-to-instructions
* new-screenshot
* Apply suggestions from code review
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
---------
Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com>
* files-when-knowldge-is-not-enabled
* docs: revert lfx (#11065)
revert-lfx
* docs: cuga model limits (#11064)
* add-warning
* remove-params
* add-watsonx-model
* bump-api-version
---------
Co-authored-by: April M <36110273+aimurphy@users.noreply.github.com>
Co-authored-by: Edwin Jose <edwin.jose@datastax.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-merge-queue <118344674+github-merge-queue@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
121 lines
7.4 KiB
Plaintext
121 lines
7.4 KiB
Plaintext
---
|
|
title: Structured Output
|
|
slug: /structured-output
|
|
---
|
|
|
|
import Icon from "@site/src/components/icon";
|
|
import Tabs from '@theme/Tabs';
|
|
import TabItem from '@theme/TabItem';
|
|
import PartialParams from '@site/docs/_partial-hidden-params.mdx';
|
|
import PartialDevModeWindows from '@site/docs/_partial-dev-mode-windows.mdx';
|
|
|
|
The **Structured Output** component uses an LLM to transform any input into structured data (`Data` or `DataFrame`) using natural language formatting instructions and an output schema definition.
|
|
For example, you can extract specific details from documents, like email messages or scientific papers.
|
|
|
|
## Use the Structured Output component in a flow
|
|
|
|
To use the **Structured Output** component in a flow, do the following:
|
|
|
|
1. Provide an **Input Message**, which is the source material from which you want to extract structured data.
|
|
This can come from practically any component, but it is typically a **Chat Input**, **Read File**, or other component that provides some unstructured or semi-structured input.
|
|
|
|
:::tip
|
|
Not all source material has to become structured output.
|
|
The power of the **Structured Output** component is that you can specify the information you want to extract, even if that data isn't explicitly labeled or an exact keyword match.
|
|
Then, the LLM can use your instructions to analyze the source material, extract the relevant data, and format it according to your specifications.
|
|
Any irrelevant source material isn't included in the structured output.
|
|
:::
|
|
|
|
2. Define **Format Instructions** and an **Output Schema** to specify the data to extract from the source material and how to structure it in the final `Data` or `DataFrame` output.
|
|
|
|
The instructions are a prompt that tell the LLM what data to extract, how to format it, how to handle exceptions, and any other instructions relevant to preparing the structured data.
|
|
|
|
The schema is a table that defines the fields (keys) and data types to organize the data extracted by the LLM into a structured `Data` or `DataFrame` object.
|
|
For more information, see [Output Schema options](#output-schema-options)
|
|
|
|
3. Attach a [language model component](/components-models) that is set to emit [`LanguageModel`](/data-types#languagemodel) output.
|
|
|
|
The LLM uses the **Input Message** and **Format Instructions** from the **Structured Output** component to extract specific pieces of data from the input text.
|
|
The output schema is applied to the model's response to produce the final `Data` or `DataFrame` structured object.
|
|
|
|
4. Optional: Typically, the structured output is passed to downstream components that use the extracted data for other processes, such as the **Parser** or **Data Operations** components.
|
|
|
|

|
|
|
|
<details>
|
|
<summary>Structured Output example: Financial Report Parser template</summary>
|
|
|
|
The **Financial Report Parser** template provides an example of how the **Structured Output** component can be used to extract structured data from unstructured text.
|
|
|
|
The template's **Structured Output** component has the following configuration:
|
|
|
|
* The **Input Message** comes from a **Chat Input** component that is preloaded with quotes from sample financial reports
|
|
|
|
* The **Format Instructions** are as follows:
|
|
|
|
```text
|
|
You are an AI that extracts structured JSON objects from unstructured text.
|
|
Use a predefined schema with expected types (str, int, float, bool, dict).
|
|
Extract ALL relevant instances that match the schema - if multiple patterns exist, capture them all.
|
|
Fill missing or ambiguous values with defaults: null for missing values.
|
|
Remove exact duplicates but keep variations that have different field values.
|
|
Always return valid JSON in the expected format, never throw errors.
|
|
If multiple objects can be extracted, return them all in the structured format.
|
|
```
|
|
|
|
* The **Output Schema** includes keys for `EBITDA`, `NET_INCOME`, and `GROSS_PROFIT`.
|
|
|
|
The structured `Data` object is passed to a **Parser** component that produces a text string by mapping the schema keys to variables in the parsing template:
|
|
|
|
```text
|
|
EBITDA: {EBITDA} , Net Income: {NET_INCOME} , GROSS_PROFIT: {GROSS_PROFIT}
|
|
```
|
|
|
|
When printed to the **Playground**, the resulting `Message` replaces the variables with the actual values extracted by the **Structured Output** component. For example:
|
|
|
|
```text
|
|
EBITDA: 900 million , Net Income: 500 million , GROSS_PROFIT: 1.2 billion
|
|
```
|
|
|
|
</details>
|
|
|
|
## Structured Output parameters
|
|
|
|
<PartialParams />
|
|
|
|
| Name | Type | Description |
|
|
|------|------|-------------|
|
|
| Language Model (`llm`) | `LanguageModel` | Input parameter. The [`LanguageModel`](/data-types#languagemodel) output from a **Language Model** component that defines the LLM to use to analyze, extract, and prepare the structured output. |
|
|
| Input Message (`input_value`) | String | Input parameter. The input message containing source material for extraction. |
|
|
| Format Instructions (`system_prompt`) | String | Input parameter. The instructions to the language model for extracting and formatting the output. |
|
|
| Schema Name (`schema_name`) | String | Input parameter. An optional title for the **Output Schema**. |
|
|
| Output Schema (`output_schema`)| Table | Input parameter. A table describing the schema of the desired structured output, ultimately determining the content of the `Data` or `DataFrame` output. See [Output Schema options](#output-schema-options). |
|
|
| Structured Output (`structured_output`) | `Data` or `DataFrame` | Output parameter. The final structured output produced by the component. Near the component's output port, you can select the output data type as either **Structured Output Data** or **Structured Output DataFrame**. The specific content and structure of the output depends on the input parameters. |
|
|
|
|
#### Output Schema options {#output-schema-options}
|
|
|
|
After the LLM extracts the relevant data from the **Input Message** and **Format Instructions**, the data is organized according to the **Output Schema**.
|
|
|
|
The schema is a table that defines the fields (keys) and data types for the final `Data` or `DataFrame` output from the **Structured Output** component.
|
|
|
|
The default schema is a single `field` string.
|
|
|
|
To add a key to the schema, click <Icon name="Plus" aria-hidden="true"/> **Add a new row**, and then edit each column to define the schema:
|
|
|
|
* **Name**: The name of the output field. Typically a specific key for which you want to extract a value.
|
|
|
|
You can reference these keys as variables in downstream components, such as a **Parser** component's template.
|
|
For example, the schema key `NET_INCOME` could be referenced by the variable `{NET_INCOME}`.
|
|
|
|
* **Description**: An optional metadata description of the field's contents and purpose.
|
|
|
|
* **Type**: The data type of the value stored in the field.
|
|
Supported types are `str` (default), `int`, `float`, `bool`, and `dict`.
|
|
|
|
* **As List**: Enable this setting if you want the field to contain a list of values rather than a single value.
|
|
|
|
For simple schemas, you might only extract a few `string` or `int` fields.
|
|
For more complex schemas with lists and dictionaries, it might help to refer to the `Data` and `DataFrame` structures and attributes, as described in [Langflow data types](/data-types).
|
|
You can also emit a rough `Data` or `DataFrame`, and then use downstream components for further refinement, such as a **Data Operations** component.
|
|
|