🐛 fix(custom.py): remove unnecessary type ignore comments

The type ignore comments are unnecessary as the code is already type annotated. Removing them improves code readability and maintainability.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-13 15:04:23 -03:00
commit 188fd4ad0a

View file

@ -83,8 +83,8 @@ class JsonAgent(CustomAgentExecutor):
prompt=prompt, prompt=prompt,
) )
agent = ZeroShotAgent( agent = ZeroShotAgent(
llm_chain=llm_chain, allowed_tools=tool_names llm_chain=llm_chain, allowed_tools=tool_names # type: ignore
) # type: ignore )
return cls.from_agent_and_tools(agent=agent, tools=tools, verbose=True) return cls.from_agent_and_tools(agent=agent, tools=tools, verbose=True)
def run(self, *args, **kwargs): def run(self, *args, **kwargs):
@ -132,8 +132,8 @@ class CSVAgent(CustomAgentExecutor):
) )
tool_names = {tool.name for tool in tools} tool_names = {tool.name for tool in tools}
agent = ZeroShotAgent( agent = ZeroShotAgent(
llm_chain=llm_chain, allowed_tools=tool_names, **kwargs llm_chain=llm_chain, allowed_tools=tool_names, **kwargs # type: ignore
) # type: ignore )
return cls.from_agent_and_tools(agent=agent, tools=tools, verbose=True) return cls.from_agent_and_tools(agent=agent, tools=tools, verbose=True)
@ -171,8 +171,8 @@ class VectorStoreAgent(CustomAgentExecutor):
) )
tool_names = {tool.name for tool in tools} tool_names = {tool.name for tool in tools}
agent = ZeroShotAgent( agent = ZeroShotAgent(
llm_chain=llm_chain, allowed_tools=tool_names, **kwargs llm_chain=llm_chain, allowed_tools=tool_names, **kwargs # type: ignore
) # type: ignore )
return AgentExecutor.from_agent_and_tools( return AgentExecutor.from_agent_and_tools(
agent=agent, tools=tools, verbose=True agent=agent, tools=tools, verbose=True
) )
@ -241,8 +241,8 @@ class SQLAgent(CustomAgentExecutor):
) )
tool_names = {tool.name for tool in tools} # type: ignore tool_names = {tool.name for tool in tools} # type: ignore
agent = ZeroShotAgent( agent = ZeroShotAgent(
llm_chain=llm_chain, allowed_tools=tool_names, **kwargs llm_chain=llm_chain, allowed_tools=tool_names, **kwargs # type: ignore
) # type: ignore )
return AgentExecutor.from_agent_and_tools( return AgentExecutor.from_agent_and_tools(
agent=agent, agent=agent,
tools=tools, # type: ignore tools=tools, # type: ignore
@ -286,8 +286,8 @@ class VectorStoreRouterAgent(CustomAgentExecutor):
) )
tool_names = {tool.name for tool in tools} tool_names = {tool.name for tool in tools}
agent = ZeroShotAgent( agent = ZeroShotAgent(
llm_chain=llm_chain, allowed_tools=tool_names, **kwargs llm_chain=llm_chain, allowed_tools=tool_names, **kwargs # type: ignore
) # type: ignore )
return AgentExecutor.from_agent_and_tools( return AgentExecutor.from_agent_and_tools(
agent=agent, tools=tools, verbose=True agent=agent, tools=tools, verbose=True
) )