Update CSVAgent.py: handle_parsing_errors and agent_type options

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-03-25 15:44:15 -03:00
commit fec3451d93

View file

@ -13,20 +13,21 @@ class CSVAgentComponent(CustomComponent):
return {
"llm": {"display_name": "LLM", "type": BaseLanguageModel},
"path": {"display_name": "Path", "field_type": "file", "suffixes": [".csv"], "file_types": [".csv"]},
"handle_parse_errors": {"display_name": "Handle Parse Errors", "advanced": True},
"handle_parsing_errors": {"display_name": "Handle Parse Errors", "advanced": True},
"agent_type": {
"display_name": "Agent Type",
"options": ["zero-shot-react-description", "openai-functions", "openai-tools"],
"advanced": True,
},
}
def build(
self, llm: BaseLanguageModel, path: str, handle_parse_errors: bool = True, agent_type: str = "openai-tools"
self, llm: BaseLanguageModel, path: str, handle_parsing_errors: bool = True, agent_type: str = "openai-tools"
) -> AgentExecutor:
# Instantiate and return the CSV agent class with the provided llm and path
return create_csv_agent(
llm=llm,
path=path,
agent_type=agent_type,
agent_executor_kwargs=dict(handle_parse_errors=handle_parse_errors),
agent_executor_kwargs=dict(handle_parsing_errors=handle_parsing_errors, verbose=True),
)