From 25d77eaf87b9e778b235626841e036f046fcf2e8 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Wed, 31 May 2023 11:44:12 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(custom.py):=20fix=20JsonAgen?= =?UTF-8?q?t.from=5Ftoolkit=5Fand=5Fllm=20method=20to=20handle=20both=20li?= =?UTF-8?q?st=20and=20JsonToolkit=20input=20=F0=9F=94=A5=20chore(test=5Fgr?= =?UTF-8?q?aph.py):=20remove=20unused=20openapi=5Fgraph=20parameter=20from?= =?UTF-8?q?=20test=5Fbuild=20method=20The=20JsonAgent.from=5Ftoolkit=5Fand?= =?UTF-8?q?=5Fllm=20method=20was=20failing=20when=20a=20list=20was=20passe?= =?UTF-8?q?d=20as=20input=20instead=20of=20a=20JsonToolkit=20object.=20The?= =?UTF-8?q?=20fix=20now=20handles=20both=20cases.=20The=20openapi=5Fgraph?= =?UTF-8?q?=20parameter=20was=20removed=20from=20the=20test=5Fbuild=20meth?= =?UTF-8?q?od=20as=20it=20was=20unused.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/langflow/interface/agents/custom.py | 2 +- tests/test_graph.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/backend/langflow/interface/agents/custom.py b/src/backend/langflow/interface/agents/custom.py index 4654ef7cb..3aaa132d4 100644 --- a/src/backend/langflow/interface/agents/custom.py +++ b/src/backend/langflow/interface/agents/custom.py @@ -69,7 +69,7 @@ class JsonAgent(CustomAgentExecutor): @classmethod def from_toolkit_and_llm(cls, toolkit: JsonToolkit, llm: BaseLanguageModel): - tools = toolkit.get_tools() + tools = toolkit if isinstance(toolkit, list) else toolkit.get_tools() tool_names = {tool.name for tool in tools} prompt = ZeroShotAgent.create_prompt( tools, diff --git a/tests/test_graph.py b/tests/test_graph.py index a0f5945fc..b92457b81 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -237,11 +237,10 @@ def test_build_params(basic_graph): assert "memory" in root.params -def test_build(basic_graph, complex_graph, openapi_graph): +def test_build(basic_graph, complex_graph): """Test Node's build method""" assert_agent_was_built(basic_graph) assert_agent_was_built(complex_graph) - assert_agent_was_built(openapi_graph) def assert_agent_was_built(graph):