From b07bd173b40ae982598c60a236104eb438945027 Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Thu, 19 Dec 2024 16:17:26 -0300 Subject: [PATCH] feat: Add Pandas kwargs support for CSV Agent (#5372) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ✨ (csv.py): Add support for passing Pandas kwargs to the CSV agent for more customization and flexibility. * 📝 (csv.py): mark 'is_list' attribute as True for the 'Pandas Kwargs' parameter to indicate it can accept a list of values --- .../langflow/components/langchain_utilities/csv.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/backend/base/langflow/components/langchain_utilities/csv.py b/src/backend/base/langflow/components/langchain_utilities/csv.py index 0bd4b7e6df0e..3e1e322410d6 100644 --- a/src/backend/base/langflow/components/langchain_utilities/csv.py +++ b/src/backend/base/langflow/components/langchain_utilities/csv.py @@ -3,7 +3,7 @@ from langflow.base.agents.agent import LCAgentComponent from langflow.field_typing import AgentExecutor from langflow.inputs import DropdownInput, FileInput, HandleInput -from langflow.inputs.inputs import MessageTextInput +from langflow.inputs.inputs import DictInput, MessageTextInput from langflow.schema.message import Message from langflow.template.field.base import Output @@ -44,6 +44,13 @@ class CSVAgentComponent(LCAgentComponent): display_name="Text", info="Text to be passed as input and extract info from the CSV File.", ), + DictInput( + name="pandas_kwargs", + display_name="Pandas Kwargs", + info="Pandas Kwargs to be passed to the agent.", + advanced=True, + is_list=True, + ), ] outputs = [ @@ -67,6 +74,7 @@ def build_agent_response(self) -> Message: path=self._path(), agent_type=self.agent_type, handle_parsing_errors=self.handle_parsing_errors, + pandas_kwargs=self.pandas_kwargs, **agent_kwargs, ) @@ -84,6 +92,7 @@ def build_agent(self) -> AgentExecutor: path=self._path(), agent_type=self.agent_type, handle_parsing_errors=self.handle_parsing_errors, + pandas_kwargs=self.pandas_kwargs, **agent_kwargs, )