mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 03:21:47 +08:00
fix: Rename Component- Smart Function into Smart Transform (#10003)
* changes smart function to transform * [autofix.ci] apply automated fixes * [autofix.ci] apply automated fixes (attempt 2/3) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@ -13,7 +13,7 @@ This page describes the components that are available in the **AI/ML** bundle.
|
||||
## AI/ML API text generation
|
||||
|
||||
This component creates a `ChatOpenAI` model instance using the AI/ML API.
|
||||
The output is exclusively a **Language Model** ([`LanguageModel`](/data-types#languagemodel)) that you can connect to another LLM-driven component, such as a **Smart Function** component.
|
||||
The output is exclusively a **Language Model** ([`LanguageModel`](/data-types#languagemodel)) that you can connect to another LLM-driven component, such as a **Smart Transform** component.
|
||||
|
||||
For more information, see the [AI/ML API Langflow integration documentation](https://docs.aimlapi.com/integrations/langflow) and [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ This component generates text using [Amazon Bedrock LLMs](https://docs.aws.amazo
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
Specifically, the **Language Model** output is an instance of [`ChatBedrock`](https://python.langchain.com/docs/integrations/chat/bedrock/) configured according to the component's parameters.
|
||||
|
||||
Use the **Language Model** output when you want to use an Amazon Bedrock model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use an Amazon Bedrock model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ The **Anthropic** component generates text using Anthropic Chat and Language mod
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
Specifically, the **Language Model** output is an instance of [`ChatAnthropic`](https://python.langchain.com/docs/integrations/chat/anthropic/) configured according to the component's parameters.
|
||||
|
||||
Use the **Language Model** output when you want to use an Anthropic model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use an Anthropic model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ This component generates text using [Azure OpenAI LLMs](https://learn.microsoft.
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
Specifically, the **Language Model** output is an instance of [`AzureChatOpenAI`](https://python.langchain.com/docs/integrations/chat/azure_chat_openai/) configured according to the component's parameters.
|
||||
|
||||
Use the **Language Model** output when you want to use an Azure OpenAI model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use an Azure OpenAI model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -15,6 +15,6 @@ The **Qianfan** component generates text using Qianfan's language models.
|
||||
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use a Qianfan model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use a Qianfan model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models) and the [Qianfan documentation](https://github.com/baidubce/bce-qianfan-sdk).
|
||||
@ -18,7 +18,7 @@ This component generates text using Cohere's language models.
|
||||
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use a Cohere model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use a Cohere model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ The **DeepSeek** component generates text using DeepSeek's language models.
|
||||
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use a DeepSeek model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use a DeepSeek model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ This component generates text using Groq's language models.
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
Specifically, the **Language Model** output is an instance of [`ChatGroq`](https://python.langchain.com/docs/integrations/chat/groq/) configured according to the component's parameters.
|
||||
|
||||
Use the **Language Model** output when you want to use a Groq model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use a Groq model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ Authentication is required.
|
||||
This component can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
Specifically, the **Language Model** output is an instance of [`HuggingFaceHub`](https://python.langchain.com/docs/integrations/providers/huggingface/) configured according to the component's parameters.
|
||||
|
||||
Use the **Language Model** output when you want to use a Hugging Face model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use a Hugging Face model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ You can use the **IBM watsonx.ai** component anywhere you need a language model
|
||||
|
||||
The **IBM watsonx.ai** component can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use an IBM watsonx.ai model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use an IBM watsonx.ai model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
The `LanguageModel` output from the **IBM watsonx.ai** component is an instance of [ChatWatsonx](https://python.langchain.com/docs/integrations/chat/ibm_watsonx/) configured according to the [component's parameters](#ibm-watsonxai-parameters).
|
||||
|
||||
@ -17,7 +17,7 @@ The **LM Studio** component generates text using LM Studio's local language mode
|
||||
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use an LM Studio model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use an LM Studio model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ The **MariTalk** component generates text using MariTalk LLMs.
|
||||
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use a MariTalk model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use a MariTalk model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ The **MistralAI** component generates text using MistralAI LLMs.
|
||||
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use a MistralAI model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use a MistralAI model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ This component generates text using [Novita's language models](https://novita.ai
|
||||
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use a Novita model as the LLM for another LLM-driven component, such as a **Language Model** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use a Novita model as the LLM for another LLM-driven component, such as a **Language Model** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ To use the **Ollama** component in a flow, connect Langflow to your locally runn
|
||||
|
||||
5. Connect the **Ollama** component to other components in the flow, depending on how you want to use the model.
|
||||
|
||||
Language model components can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)). Use the **Language Model** output when you want to use an Ollama model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component. For more information, see [Language model components](/components-models).
|
||||
Language model components can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)). Use the **Language Model** output when you want to use an Ollama model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component. For more information, see [Language model components](/components-models).
|
||||
|
||||
In the following example, the flow uses `LanguageModel` output to use an Ollama model as the LLM for an [**Agent** component](/components-agents).
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ It provides access to the same OpenAI models that are available in the core **La
|
||||
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use a specific OpenAI model configuration as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use a specific OpenAI model configuration as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ This component generates text using OpenRouter's unified API for multiple AI mod
|
||||
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use an OpenRouter model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use an OpenRouter model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ This component generates text using Perplexity's language models.
|
||||
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use a Perplexity model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use a Perplexity model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ This component generates text using SambaNova LLMs.
|
||||
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use a SambaNova model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use a SambaNova model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ The **Vertex AI** component generates text using Google Vertex AI models.
|
||||
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use a Vertex AI model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use a Vertex AI model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ The **xAI** component generates text using xAI models like [Grok](https://x.ai/g
|
||||
|
||||
It can output either a **Model Response** ([`Message`](/data-types#message)) or a **Language Model** ([`LanguageModel`](/data-types#languagemodel)).
|
||||
|
||||
Use the **Language Model** output when you want to use an xAI model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Function** component.
|
||||
Use the **Language Model** output when you want to use an xAI model as the LLM for another LLM-driven component, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
For more information, see [Language model components](/components-models).
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ For example, if you are using the **Language Model** core component, you could t
|
||||
|
||||
Some components use a language model component to perform LLM-driven actions.
|
||||
Typically, these components prepare data for further processing by downstream components, rather than emitting direct chat output.
|
||||
For an example, see the [**Smart Function** component](/components-processing#smart-function).
|
||||
For an example, see the [**Smart Transform** component](/components-processing#smart-transform).
|
||||
|
||||
A component must accept a `LanguageModel` input to use a language model component as a driver, and you must set the language model component's output type to `LanguageModel`.
|
||||
For more information, see [Language Model output types](#language-model-output-types).
|
||||
@ -155,10 +155,10 @@ Language model components, including the core component and bundled components,
|
||||
* **Model Response**: The default output type emits the model's generated response as [`Message` data](/data-types#message).
|
||||
Use this output type when you want the typical LLM interaction where the LLM produces a text response based on given input.
|
||||
|
||||
* **Language Model**: Change the language model component's output type to [`LanguageModel`](/data-types#languagemodel) when you need to attach an LLM to another component in your flow, such as an **Agent** or **Smart Function** component.
|
||||
* **Language Model**: Change the language model component's output type to [`LanguageModel`](/data-types#languagemodel) when you need to attach an LLM to another component in your flow, such as an **Agent** or **Smart Transform** component.
|
||||
|
||||
With this configuration, the language model component supports an action completed by another component, rather than a direct chat interaction.
|
||||
For an example, the **Smart Function** component uses an LLM to create a function from natural language input.
|
||||
For an example, the **Smart Transform** component uses an LLM to create a function from natural language input.
|
||||
|
||||
## Additional language models
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ They have many uses, including:
|
||||
|
||||
* Feed instructions and context to your LLMs and agents with the [**Prompt Template** component](#prompt-template).
|
||||
* Extract content from larger chunks of data with a [**Parser** component](#parser).
|
||||
* Filter data with natural language with the [**Smart Function** component](#smart-function).
|
||||
* Filter data with natural language with the [**Smart Transform** component](#smart-transform).
|
||||
* Save data to your local machine with the [**Save File** component](#save-file).
|
||||
* Transform data into a different data type with the [**Type Convert** component](#type-convert) to pass it between incompatible components.
|
||||
|
||||
@ -100,7 +100,7 @@ For this example, select the **Select Keys** operation.
|
||||
:::tip
|
||||
You can select only one operation.
|
||||
If you need to perform multiple operations on the data, you can chain multiple **Data Operations** components together to execute each operation in sequence.
|
||||
For more complex multi-step operations, consider using a component like the **Smart Function** component.
|
||||
For more complex multi-step operations, consider using a component like the **Smart Transform** component.
|
||||
:::
|
||||
|
||||
3. Under **Select Keys**, add keys for `name`, `username`, and `email`.
|
||||
@ -203,7 +203,7 @@ The only requirement is that the preceding component must create `DataFrame` out
|
||||
The sixth component, **Chat Output**, is optional in this example.
|
||||
It only serves as a convenient way for you to view the final output in the **Playground**, rather than inspecting the component logs.
|
||||
|
||||

|
||||

|
||||
|
||||
If you want to use this example to test the **DataFrame Operations** component, do the following:
|
||||
|
||||
@ -211,19 +211,19 @@ The only requirement is that the preceding component must create `DataFrame` out
|
||||
|
||||
* **API Request**
|
||||
* **Language Model**
|
||||
* **Smart Function**
|
||||
* **Smart Transform**
|
||||
* **Type Convert**
|
||||
|
||||
2. Configure the [**Smart Function** component](#smart-function) and its dependencies:
|
||||
2. Configure the [**Smart Transform** component](#smart-transform) and its dependencies:
|
||||
|
||||
* **API Request**: Configure the [**API Request** component](/components-data#api-request) to get JSON data from an endpoint of your choice, and then connect the **API Response** output to the **Smart Function** component's **Data** input.
|
||||
* **API Request**: Configure the [**API Request** component](/components-data#api-request) to get JSON data from an endpoint of your choice, and then connect the **API Response** output to the **Smart Transform** component's **Data** input.
|
||||
* **Language Model**: Select your preferred provider and model, and then enter a valid API key.
|
||||
Change the output to **Language Model**, and then connect the `LanguageModel` output to the **Smart Function** component's **Language Model** input.
|
||||
* **Smart Function**: In the **Instructions** field, enter natural language instructions to extract data from the API response.
|
||||
Change the output to **Language Model**, and then connect the `LanguageModel` output to the **Smart Transform** component's **Language Model** input.
|
||||
* **Smart Transform**: In the **Instructions** field, enter natural language instructions to extract data from the API response.
|
||||
Your instructions depend on the response content and desired outcome.
|
||||
For example, if the response contains a large `result` field, you might provide instructions like `explode the result field out into a Data object`.
|
||||
|
||||
3. Convert the **Smart Function** component's `Data` output to `DataFrame`:
|
||||
3. Convert the **Smart Transform** component's `Data` output to `DataFrame`:
|
||||
|
||||
1. Connect the **Filtered Data** output to the **Type Convert** component's **Data** input.
|
||||
2. Set the **Type Convert** component's **Output Type** to **DataFrame**.
|
||||
@ -246,13 +246,13 @@ For example, the **Filter** operation filters the rows based on a specified colu
|
||||
:::tip
|
||||
You can select only one operation.
|
||||
If you need to perform multiple operations on the data, you can chain multiple **DataFrame Operations** components together to execute each operation in sequence.
|
||||
For more complex multi-step operations, like dramatic schema changes or pivots, consider using an LLM-powered component, like the **Structured Output** or **Smart Function** component, as a replacement or preparation for the **DataFrame Operations** component.
|
||||
For more complex multi-step operations, like dramatic schema changes or pivots, consider using an LLM-powered component, like the **Structured Output** or **Smart Transform** component, as a replacement or preparation for the **DataFrame Operations** component.
|
||||
:::
|
||||
|
||||
If you're following along with the example flow, select any operation that you want to apply to the data that was extracted by the **Smart Function** component.
|
||||
If you're following along with the example flow, select any operation that you want to apply to the data that was extracted by the **Smart Transform** component.
|
||||
To view the contents of the incoming `DataFrame`, click <Icon name="Play" aria-hidden="true" /> **Run component** on the **Type Convert** component, and then <Icon name="TextSearch" aria-hidden="true" /> **Inspect output**.
|
||||
If the `DataFrame` seems malformed, click <Icon name="TextSearch" aria-hidden="true" /> **Inspect output** on each upstream component to determine where the error occurs, and then modify your flow's configuration as needed.
|
||||
For example, if the **Smart Function** component didn't extract the expected fields, modify your instructions or verify that the given fields are present in the **API Response** output.
|
||||
For example, if the **Smart Transform** component didn't extract the expected fields, modify your instructions or verify that the given fields are present in the **API Response** output.
|
||||
|
||||
4. Configure the operation's parameters.
|
||||
The specific parameters depend on the selected operation.
|
||||
@ -550,7 +550,7 @@ There are several ways you can address these inconsistencies:
|
||||
|
||||
* Rectify the source data directly.
|
||||
* Use other components to amend or filter anomalies before passing the data to the **Parser** component.
|
||||
There are many components you can use for this depending on your goal, such as the **Data Operations**, **Structured Output**, and **Smart Function** components.
|
||||
There are many components you can use for this depending on your goal, such as the **Data Operations**, **Structured Output**, and **Smart Transform** components.
|
||||
* Enable the **Parser** component's **Clean Data** parameter to skip empty rows or lines.
|
||||
|
||||
## Python Interpreter
|
||||
@ -696,11 +696,11 @@ To configure the **Save File** component and use it in a flow, do the following:
|
||||
|
||||
5. Optional: If you want to use the saved file in a flow, you must use an API call or another component to retrieve the file from the given filepath.
|
||||
|
||||
## Smart Function
|
||||
## Smart Transform
|
||||
|
||||
In Langflow version 1.5, this component was renamed from **Lambda Filter** to **Smart Function**.
|
||||
In Langflow version 1.5, this component was renamed from **Lambda Filter** to **Smart Transform**.
|
||||
|
||||
The **Smart Function** component uses an LLM to generate a Lambda function to filter or transform structured data based on natural language instructions.
|
||||
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).
|
||||
|
||||
@ -711,13 +711,13 @@ One sentence or less is preferred because end punctuation, like periods, can cau
|
||||
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 Function** component.
|
||||
Then, the **Smart Function** component passes the data and the instruction `extract emails` to the attached **Language Model** 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 Function parameters
|
||||
### Smart Transform parameters
|
||||
|
||||
<PartialParams />
|
||||
|
||||
|
||||
@ -140,7 +140,7 @@ For information about the underlying Python classes that produce `Embeddings`, s
|
||||
The `LanguageModel` type is a specific data type that can be produced by language model components and accepted by components that use an LLM.
|
||||
|
||||
When you change a language model component's output type from **Model Response** to **Language Model**, the component's output port changes from a **Message** port to a **Language Model** port <Icon name="Circle" size="16" aria-label="Fuchsia language model port" style={{ color: '#c026d3', fill: '#c026d3' }} />.
|
||||
Then, you connect the outgoing **Language Model** port to a **Language Model** input port on a compatible component, such as a **Smart Function** component.
|
||||
Then, you connect the outgoing **Language Model** port to a **Language Model** input port on a compatible component, such as a **Smart Transform** component.
|
||||
|
||||
For more information about using these components in flows and toggling `LanguageModel` output, see [Language model components](/components-models#language-model-output-types).
|
||||
|
||||
|
||||
@ -117,7 +117,11 @@ class TestParserComponent(ComponentTestBaseWithoutClient):
|
||||
def test_clean_data_with_stringify(self, component_class):
|
||||
# Arrange
|
||||
data_frame = DataFrame(
|
||||
{"Name": ["John", "Jane\n", "\nBob"], "Age": [30, None, 25], "Notes": ["Good\n\nPerson", "", "Nice\n"]}
|
||||
{
|
||||
"Name": ["John", "Jane\n", "\nBob"],
|
||||
"Age": [30, None, 25],
|
||||
"Notes": ["Good\n\nPerson", "", "Nice\n"],
|
||||
}
|
||||
)
|
||||
kwargs = {
|
||||
"input_data": data_frame,
|
||||
@ -159,7 +163,8 @@ class TestParserComponent(ComponentTestBaseWithoutClient):
|
||||
|
||||
# Act & Assert
|
||||
with pytest.raises(
|
||||
ValueError, match=re.escape("Unsupported input type: <class 'int'>. Expected DataFrame or Data.")
|
||||
ValueError,
|
||||
match=re.escape("Unsupported input type: <class 'int'>. Expected DataFrame or Data."),
|
||||
):
|
||||
component.parse_combined_text()
|
||||
|
||||
@ -174,7 +179,8 @@ class TestParserComponent(ComponentTestBaseWithoutClient):
|
||||
|
||||
# Act & Assert
|
||||
with pytest.raises(
|
||||
ValueError, match=re.escape("Unsupported input type: <class 'NoneType'>. Expected DataFrame or Data.")
|
||||
ValueError,
|
||||
match=re.escape("Unsupported input type: <class 'NoneType'>. Expected DataFrame or Data."),
|
||||
):
|
||||
component.parse_combined_text()
|
||||
|
||||
|
||||
@ -14,11 +14,11 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
class LambdaFilterComponent(Component):
|
||||
display_name = "Smart Function"
|
||||
display_name = "Smart Transform"
|
||||
description = "Uses an LLM to generate a function for filtering or transforming structured data."
|
||||
documentation: str = "https://docs.langflow.org/components-processing#smart-function"
|
||||
documentation: str = "https://docs.langflow.org/components-processing#smart-transform"
|
||||
icon = "square-function"
|
||||
name = "Smart Function"
|
||||
name = "Smart Transform"
|
||||
|
||||
inputs = [
|
||||
DataInput(
|
||||
|
||||
Reference in New Issue
Block a user