Skip to content

Commit

Permalink
feat: Add Pandas kwargs support for CSV Agent (#5372)
Browse files Browse the repository at this point in the history
* ✨ (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
  • Loading branch information
Cristhianzl authored Dec 19, 2024
1 parent e657e9d commit b07bd17
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/backend/base/langflow/components/langchain_utilities/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 = [
Expand All @@ -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,
)

Expand All @@ -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,
)

Expand Down

0 comments on commit b07bd17

Please sign in to comment.