langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
36.38k stars 4.28k forks source link

Flow as a Tool does not expose parameters correctly #4887

Open mieslep opened 3 days ago

mieslep commented 3 days ago

Bug Description

Using a flow with either a Chat Input/Output or a Text Input/Output in the "Flow as a Tool" component, the flow is invoked with a parameter chat_input or text_input, so the parameter is not used as it should be input_value.

Reproduction

Attached flows should reproduce:

  1. Import "Echo.json" flow : should echo the input string 3 times
  2. Import "Echo Agentic.json" flow : uses the "Flow as a Tool" component to echo user input

Console log is:

> Entering new None chain...

Invoking: `EchoTool` with `{'text_input': 'hello, world!'}`

Flow run output:

hello, world!

> Finished chain.

Expected behavior

Console log is:

> Entering new None chain...

Invoking: `EchoTool` with ....

Flow run output:

The output is: "hello, world!\nhello, world!\nhello, world!"

> Finished chain.

Who can help?

No response

Operating System

Windows

Langflow Version

1.1.1.dev1

Python Version

3.12

Screenshot

No response

Flow File

Echo.json Echo Agentic.json

dosubot[bot] commented 3 days ago

The issue you're encountering seems to be related to the parameter mapping in the "Flow as a Tool" component of Langflow. The flow is being invoked with parameters like chat_input or text_input, but it should be using input_value instead.

To address this, you might want to check how the input parameters are defined and mapped within your flow. Specifically, ensure that the input parameter names in your flow configuration match the expected names used by the "Flow as a Tool" component. The component should be configured to accept input_value as the parameter name for the input it processes.

If the component is not exposing parameters correctly, it could be due to a mismatch in the expected input parameter names. You may need to adjust the flow configuration or the component's parameter handling logic to align with the expected input names.

Additionally, reviewing the FlowToolComponent class and its methods for handling input parameters might provide insights into how parameters are validated and transformed. This class uses specific input classes like DropdownInput, StrInput, and BoolInput to manage inputs, and it validates them accordingly [1][2][3][4].

If the issue persists, consider checking for any recent changes in version 1.1.1.dev1 that might affect parameter handling, as this could also be a factor.

To continue talking to Dosu, mention @dosu.