refactor(loading.py): use get method to set allowed_tools to an empty list if it is not present in params dictionary

This commit is contained in:
Gabriel Almeida 2023-05-02 15:04:28 -03:00
commit d79f655d88

View file

@ -193,7 +193,7 @@ def load_agent_executor_from_config(
def load_agent_executor(agent_class: type[agent_module.Agent], params, **kwargs):
"""Load agent executor from agent class, tools and chain"""
allowed_tools = params["allowed_tools"]
allowed_tools = params.get("allowed_tools", [])
llm_chain = params["llm_chain"]
# if allowed_tools is not a list or set, make it a list
if not isinstance(allowed_tools, (list, set)):