-
Notifications
You must be signed in to change notification settings - Fork 9.3k
feat: unify JSON/Table/Text operations into a single Operations component #13743
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
erichare
wants to merge
4
commits into
release-1.11.0
Choose a base branch
from
feat/operations-component
base: release-1.11.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c3a79d5
feat: unify JSON/Table/Text operations into a single Operations compo…
erichare 4e7399c
Merge branch 'release-1.11.0' into feat/operations-component
erichare efa398a
fix(operations): resolve CI failures and CodeRabbit review
erichare a3757ee
Merge branch 'release-1.11.0' into feat/operations-component
erichare File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| --- | ||
| title: Operations | ||
| slug: /operations | ||
| --- | ||
|
|
||
| import Icon from "@site/src/components/icon"; | ||
|
|
||
| The **Operations** component performs operations on all three of Langflow's main data types — [`JSON`](/data-types#json), [`Table`](/data-types#table), and [`Message`](/data-types#message) (text) — from a single component. | ||
|
|
||
| It replaces three separate components that were each scoped to one data type: | ||
|
|
||
| - [**JSON Operations**](/data-operations) | ||
| - [**Table Operations**](/dataframe-operations) | ||
| - [**Text Operations**](/text-operations) | ||
|
|
||
| Those three components are now legacy. Existing flows that use them continue to work, but new flows should use the **Operations** component. | ||
|
|
||
| ## Use the Operations component in a flow | ||
|
|
||
| 1. Add an **Operations** component to your flow. | ||
|
|
||
| 2. In the **Operation** field, select the operation you want to perform. | ||
| The list contains every operation across all three data types. | ||
|
|
||
| 3. When you select an operation, the component reveals the matching input — **JSON**, **Table**, or **Text** — along with any fields the operation needs, and sets the output to the appropriate type. | ||
| Connect the matching input to the component that produces that data type. | ||
|
|
||
| :::tip | ||
| You can select only one operation per component. | ||
| To perform multiple operations, chain multiple **Operations** components together. | ||
| ::: | ||
|
|
||
| ## Available operations | ||
|
|
||
| The **Operation** field groups operations by the data type they act on. | ||
| Selecting an operation reveals the input and fields it needs. | ||
|
|
||
| ### JSON operations | ||
|
|
||
| These operations take a `JSON` input and return a `JSON` output. | ||
|
|
||
| | Operation | Description | | ||
| |---|---| | ||
| | Select Keys | Keep only the specified top-level keys. | | ||
| | Literal Eval | Evaluate string values that look like Python literals (lists, dicts, numbers, booleans). | | ||
| | Combine | Merge multiple `JSON` objects into one. | | ||
| | Append or Update | Add or overwrite top-level key-value pairs. | | ||
| | Remove Keys | Recursively remove the specified keys. | | ||
| | Rename Keys | Recursively rename keys using an old-to-new mapping. | | ||
| | Path Selection | Explore the structure of a `JSON` example and extract a value at a selected path. | | ||
| | JQ Expression | Filter or transform the data with a [jq](https://jqlang.github.io/jq/) expression. | | ||
|
|
||
| ### Table operations | ||
|
|
||
| These operations take a `Table` input and return a `Table` output. | ||
|
|
||
| | Operation | Description | | ||
| |---|---| | ||
| | Add Column | Add a new column populated with a fixed value. | | ||
| | Concatenate | Stack multiple tables vertically (append rows). | | ||
| | Drop Column | Remove a column. | | ||
| | Filter | Keep rows where a column matches a value using a comparison operator. | | ||
| | Head | Return the first N rows. | | ||
| | Merge | Join two tables on a shared column. | | ||
| | Rename Column | Rename a column. | | ||
| | Replace Value | Replace a value within a column. | | ||
| | Select Columns | Keep only the specified columns. | | ||
| | Sort | Sort rows by a column, ascending or descending. | | ||
| | Tail | Return the last N rows. | | ||
| | Drop Duplicates | Remove duplicate rows based on a column. | | ||
|
|
||
| ### Text operations | ||
|
|
||
| These operations take a `Text` input. Most return a `Message`; **Word Count** returns `JSON` and **Text to DataFrame** returns a `Table`. | ||
|
|
||
| | Operation | Description | Output | | ||
| |---|---|---| | ||
| | Word Count | Count words, characters, and lines. | `JSON` | | ||
| | Case Conversion | Convert text to uppercase, lowercase, title, capitalize, or swapcase. | `Message` | | ||
| | Text Replace | Replace text, optionally using a regular expression. | `Message` | | ||
| | Text Extract | Extract substrings matching a regular expression. | `Message` | | ||
| | Text Head | Return the first N characters. | `Message` | | ||
| | Text Tail | Return the last N characters. | `Message` | | ||
| | Text Strip | Strip whitespace or specified characters from the edges of the text. | `Message` | | ||
| | Text Join | Join two text inputs with a line break. | `Text` and `Message` | | ||
| | Text Clean | Remove extra spaces, special characters, or empty lines. | `Message` | | ||
| | Text to DataFrame | Convert a delimited table in text into a `Table`. | `Table` | | ||
|
|
||
| ## Operations parameters | ||
|
|
||
| The **Operations** component's inputs and outputs are dynamic: they change based on the selected operation. | ||
|
|
||
| The main inputs are **JSON**, **Table**, and **Text**. When no operation is selected, all three are available so you can pre-wire the component. After you choose an operation, only the input for that operation's data type remains. | ||
|
|
||
| The output type matches the selected operation: `JSON`, `Table`, or `Message`, as listed in [Available operations](#available-operations). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.