🐛 fix(vertex/base.py): fix vertex_type assignment to handle uppercase template types

🐛 fix(interface/loading.py): fix custom_node instantiation to handle classes without initialize method
✨ feat(template/frontend_node/prompts.py): change type_name to match class name
✨ feat(template/frontend_node/tools.py): change type_name to match class name
🔥 chore(test_agents_template.py): remove test_agents_settings and update initialize_agent test
The vertex_type assignment in the Vertex class was not handling uppercase template types correctly. This has been fixed to handle both uppercase and lowercase types. The custom_node instantiation in the instantiate_class function was not handling classes without an initialize method correctly. This has been fixed to instantiate the class directly if the initialize method is not present. The type_name in the ZeroShotPromptNode and PythonFunctionToolNode classes have been changed to match the class name. The test_agents_settings test has been removed as it is no longer necessary and the initialize_agent test has been updated to match the new AgentInitializer class name.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-07 21:36:40 -03:00
commit 81d231c632
5 changed files with 13 additions and 20 deletions

View file

@ -1,15 +1,4 @@
from fastapi.testclient import TestClient
from langflow.settings import settings
# check that all agents are in settings.agents
# are in json_response["agents"]
def test_agents_settings(client: TestClient):
response = client.get("api/v1/all")
assert response.status_code == 200
json_response = response.json()
agents = json_response["agents"]
assert set(agents.keys()) == set(settings.agents)
def test_zero_shot_agent(client: TestClient):
@ -131,7 +120,7 @@ def test_initialize_agent(client: TestClient):
json_response = response.json()
agents = json_response["agents"]
initialize_agent = agents["initialize_agent"]
initialize_agent = agents["AgentInitializer"]
assert initialize_agent["base_classes"] == ["AgentExecutor", "function"]
template = initialize_agent["template"]