refactor(loading.py): change instantiate_prompt function signature to include class_object parameter and use it to instantiate the prompt object (#302)
This commit is contained in:
commit
8c93b9264a
2 changed files with 4 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "langflow"
|
name = "langflow"
|
||||||
version = "0.0.70"
|
version = "0.0.71"
|
||||||
description = "A Python package with a built-in web application"
|
description = "A Python package with a built-in web application"
|
||||||
authors = ["Logspace <contact@logspace.ai>"]
|
authors = ["Logspace <contact@logspace.ai>"]
|
||||||
maintainers = [
|
maintainers = [
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ def instantiate_based_on_type(class_object, base_type, node_type, params):
|
||||||
if base_type == "agents":
|
if base_type == "agents":
|
||||||
return instantiate_agent(class_object, params)
|
return instantiate_agent(class_object, params)
|
||||||
elif base_type == "prompts":
|
elif base_type == "prompts":
|
||||||
return instantiate_prompt(node_type, params)
|
return instantiate_prompt(class_object, node_type, params)
|
||||||
elif base_type == "tools":
|
elif base_type == "tools":
|
||||||
return instantiate_tool(node_type, class_object, params)
|
return instantiate_tool(node_type, class_object, params)
|
||||||
elif base_type == "toolkits":
|
elif base_type == "toolkits":
|
||||||
|
|
@ -77,12 +77,12 @@ def instantiate_agent(class_object, params):
|
||||||
return load_agent_executor(class_object, params)
|
return load_agent_executor(class_object, params)
|
||||||
|
|
||||||
|
|
||||||
def instantiate_prompt(node_type, params):
|
def instantiate_prompt(class_object, node_type, params):
|
||||||
if node_type == "ZeroShotPrompt":
|
if node_type == "ZeroShotPrompt":
|
||||||
if "tools" not in params:
|
if "tools" not in params:
|
||||||
params["tools"] = []
|
params["tools"] = []
|
||||||
return ZeroShotAgent.create_prompt(**params)
|
return ZeroShotAgent.create_prompt(**params)
|
||||||
return None # Or some other default action
|
return class_object(**params)
|
||||||
|
|
||||||
|
|
||||||
def instantiate_tool(node_type, class_object, params):
|
def instantiate_tool(node_type, class_object, params):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue