refactor(loading.py): swap parameters order in instantiate_prompt function to match other functions

This commit is contained in:
Gabriel Almeida 2023-05-15 14:12:12 -03:00
commit eb86c8be64

View file

@ -54,7 +54,7 @@ def instantiate_based_on_type(class_object, base_type, node_type, params):
if base_type == "agents":
return instantiate_agent(class_object, params)
elif base_type == "prompts":
return instantiate_prompt(class_object, node_type, params)
return instantiate_prompt(node_type, class_object, params)
elif base_type == "tools":
return instantiate_tool(node_type, class_object, params)
elif base_type == "toolkits":
@ -77,7 +77,7 @@ def instantiate_agent(class_object, params):
return load_agent_executor(class_object, params)
def instantiate_prompt(class_object, node_type, params):
def instantiate_prompt(node_type, class_object, params):
if node_type == "ZeroShotPrompt":
if "tools" not in params:
params["tools"] = []
@ -96,7 +96,7 @@ def instantiate_tool(node_type, class_object, params):
raise ValueError("Function should be a string")
elif node_type.lower() == "tool":
return class_object(**params)
return None # Or some other default action
return class_object(**params)
def instantiate_toolkit(node_type, class_object, params):