fix: handle Message in path input in CSVAgentComponent (#4784)
* fixing problem handling path type * Add type check for 'path.text' in CSV utility function --------- Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
parent
4ee53f2ea1
commit
68a0b7d6c6
1 changed files with 7 additions and 2 deletions
|
|
@ -51,6 +51,11 @@ class CSVAgentComponent(LCAgentComponent):
|
|||
Output(display_name="Agent", name="agent", method="build_agent"),
|
||||
]
|
||||
|
||||
def _path(self) -> str:
|
||||
if isinstance(self.path, Message) and isinstance(self.path.text, str):
|
||||
return self.path.text
|
||||
return self.path
|
||||
|
||||
def build_agent_response(self) -> Message:
|
||||
agent_kwargs = {
|
||||
"verbose": self.verbose,
|
||||
|
|
@ -59,7 +64,7 @@ class CSVAgentComponent(LCAgentComponent):
|
|||
|
||||
agent_csv = create_csv_agent(
|
||||
llm=self.llm,
|
||||
path=self.path,
|
||||
path=self._path(),
|
||||
agent_type=self.agent_type,
|
||||
handle_parsing_errors=self.handle_parsing_errors,
|
||||
**agent_kwargs,
|
||||
|
|
@ -76,7 +81,7 @@ class CSVAgentComponent(LCAgentComponent):
|
|||
|
||||
agent_csv = create_csv_agent(
|
||||
llm=self.llm,
|
||||
path=self.path,
|
||||
path=self._path(),
|
||||
agent_type=self.agent_type,
|
||||
handle_parsing_errors=self.handle_parsing_errors,
|
||||
**agent_kwargs,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue