🐛 fix(endpoints.py): fix missing return statement in get_all function
🐛 fix(base.py): fix issue with args_schema value for PythonInputs template 🐛 fix(test_prompts_template.py): fix incorrect value for validate_template
This commit is contained in:
parent
05b392ece7
commit
229717a98a
3 changed files with 11 additions and 18 deletions
|
|
@ -54,9 +54,10 @@ def get_all(
|
||||||
|
|
||||||
logger.debug("Building langchain types dict")
|
logger.debug("Building langchain types dict")
|
||||||
try:
|
try:
|
||||||
return get_all_types_dict(settings_service)
|
types_dict = get_all_types_dict(settings_service)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
raise HTTPException(status_code=500, detail=str(exc)) from exc
|
raise HTTPException(status_code=500, detail=str(exc)) from exc
|
||||||
|
return types_dict
|
||||||
|
|
||||||
|
|
||||||
# For backwards compatibility we will keep the old endpoint
|
# For backwards compatibility we will keep the old endpoint
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ from langchain.agents.load_tools import (
|
||||||
_EXTRA_OPTIONAL_TOOLS,
|
_EXTRA_OPTIONAL_TOOLS,
|
||||||
_LLM_TOOLS,
|
_LLM_TOOLS,
|
||||||
)
|
)
|
||||||
|
from langchain.tools.python.tool import PythonInputs
|
||||||
|
|
||||||
from langflow.custom import customs
|
from langflow.custom import customs
|
||||||
from langflow.interface.base import LangChainTypeCreator
|
from langflow.interface.base import LangChainTypeCreator
|
||||||
|
|
@ -161,8 +162,14 @@ class ToolCreator(LangChainTypeCreator):
|
||||||
template = Template(fields=fields, type_name=tool_type)
|
template = Template(fields=fields, type_name=tool_type)
|
||||||
|
|
||||||
tool_params = {**tool_params, **self.type_to_loader_dict[name]["params"]}
|
tool_params = {**tool_params, **self.type_to_loader_dict[name]["params"]}
|
||||||
|
template_dict = template.to_dict()
|
||||||
|
if (
|
||||||
|
"args_schema" in template_dict
|
||||||
|
and template_dict.get("args_schema").get("value") == PythonInputs
|
||||||
|
):
|
||||||
|
template_dict["args_schema"]["value"] = ""
|
||||||
return {
|
return {
|
||||||
"template": util.format_dict(template.to_dict()),
|
"template": util.format_dict(template_dict),
|
||||||
**tool_params,
|
**tool_params,
|
||||||
"base_classes": base_classes,
|
"base_classes": base_classes,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,28 +75,13 @@ def test_prompt_template(client: TestClient, logged_in_headers):
|
||||||
"info": "",
|
"info": "",
|
||||||
}
|
}
|
||||||
|
|
||||||
assert template["template_format"] == {
|
|
||||||
"required": False,
|
|
||||||
"dynamic": False,
|
|
||||||
"placeholder": "",
|
|
||||||
"show": False,
|
|
||||||
"multiline": False,
|
|
||||||
"value": "f-string",
|
|
||||||
"password": False,
|
|
||||||
"name": "template_format",
|
|
||||||
"type": "str",
|
|
||||||
"list": False,
|
|
||||||
"advanced": False,
|
|
||||||
"info": "",
|
|
||||||
}
|
|
||||||
|
|
||||||
assert template["validate_template"] == {
|
assert template["validate_template"] == {
|
||||||
"required": False,
|
"required": False,
|
||||||
"dynamic": False,
|
"dynamic": False,
|
||||||
"placeholder": "",
|
"placeholder": "",
|
||||||
"show": False,
|
"show": False,
|
||||||
"multiline": False,
|
"multiline": False,
|
||||||
"value": True,
|
"value": False,
|
||||||
"password": False,
|
"password": False,
|
||||||
"name": "validate_template",
|
"name": "validate_template",
|
||||||
"type": "bool",
|
"type": "bool",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue