🐛 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:
Gabriel Luiz Freitas Almeida 2023-10-25 18:13:58 -03:00
commit 229717a98a
3 changed files with 11 additions and 18 deletions

View file

@ -54,9 +54,10 @@ def get_all(
logger.debug("Building langchain types dict")
try:
return get_all_types_dict(settings_service)
types_dict = get_all_types_dict(settings_service)
except Exception as exc:
raise HTTPException(status_code=500, detail=str(exc)) from exc
return types_dict
# For backwards compatibility we will keep the old endpoint

View file

@ -5,6 +5,7 @@ from langchain.agents.load_tools import (
_EXTRA_OPTIONAL_TOOLS,
_LLM_TOOLS,
)
from langchain.tools.python.tool import PythonInputs
from langflow.custom import customs
from langflow.interface.base import LangChainTypeCreator
@ -161,8 +162,14 @@ class ToolCreator(LangChainTypeCreator):
template = Template(fields=fields, type_name=tool_type)
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 {
"template": util.format_dict(template.to_dict()),
"template": util.format_dict(template_dict),
**tool_params,
"base_classes": base_classes,
}

View file

@ -75,28 +75,13 @@ def test_prompt_template(client: TestClient, logged_in_headers):
"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"] == {
"required": False,
"dynamic": False,
"placeholder": "",
"show": False,
"multiline": False,
"value": True,
"value": False,
"password": False,
"name": "validate_template",
"type": "bool",