mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 23:34:12 +08:00
* 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>
44 lines
2.9 KiB
Plaintext
44 lines
2.9 KiB
Plaintext
---
|
|
title: Smart Transform
|
|
slug: /smart-transform
|
|
---
|
|
|
|
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';
|
|
|
|
This component has been renamed multiple times.
|
|
Its previous names include **Lambda Filter** and **Smart Function**.
|
|
|
|
The **Smart Transform** component uses an LLM to generate a Lambda function to filter or transform structured data based on natural language instructions.
|
|
You must connect this component to a [language model component](/components-models), which is used to generate a function based on the natural language instructions you provide in the **Instructions** parameter.
|
|
The LLM runs the function against the data input, and then outputs the results as [`Data`](/data-types#data).
|
|
|
|
:::tip
|
|
Provide brief, clear instructions, focusing on the desired outcome or specific actions, such as `Filter the data to only include items where the 'status' is 'active'`.
|
|
One sentence or less is preferred because end punctuation, like periods, can cause errors or unexpected behavior.
|
|
|
|
If you need to provide more details instructions that aren't directly relevant to the Lambda function, you can input them in the **Language Model** component's **Input** field or through a **Prompt Template** component.
|
|
:::
|
|
|
|
The following example uses the **API Request** endpoint to pass JSON data from the `https://jsonplaceholder.typicode.com/users` endpoint to the **Smart Transform** component.
|
|
Then, the **Smart Transform** component passes the data and the instruction `extract emails` to the attached **Language Model** component.
|
|
From there, the LLM generates a filter function that extracts email addresses from the JSON data, returning the filtered data as chat output.
|
|
|
|

|
|
|
|
### Smart Transform parameters
|
|
|
|
<PartialParams />
|
|
|
|
| Name | Display Name | Info |
|
|
|------|--------------|------|
|
|
| data | Data | Input parameter. The structured data to filter or transform using a Lambda function. |
|
|
| llm | Language Model | Input parameter. Connect [`LanguageModel`](/data-types#languagemodel) output from a **Language Model** component. |
|
|
| filter_instruction | Instructions | Input parameter. The natural language instructions for how to filter or transform the data. The LLM uses these instructions to create a Lambda function. |
|
|
| sample_size | Sample Size | Input parameter. For large datasets, the number of characters to sample from the dataset head and tail. Only applied if the dataset meets or exceeds `max_size`. Default: `1000`. |
|
|
| max_size | Max Size | Input parameter. The number of characters for the dataset to be considered large, which triggers sampling by the `sample_size` value. Default: `30000`. |
|
|
|