From d069ab5d6ddea88761c443673eefb0efc398b560 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Thu, 22 Jun 2023 22:31:13 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A8=20test(agents=5Ftemplate.py):=20ad?= =?UTF-8?q?d=20openai-multi-functions=20to=20the=20list=20of=20agents=20?= =?UTF-8?q?=F0=9F=90=9B=20fix(graph.py):=20change=20message=20variable=20t?= =?UTF-8?q?o=20a=20dictionary=20to=20match=20the=20expected=20input=20of?= =?UTF-8?q?=20get=5Fresult=5Fand=5Fthought=20function=20and=20update=20the?= =?UTF-8?q?=20assertion=20to=20check=20if=20the=20result=20is=20a=20dictio?= =?UTF-8?q?nary=20instead=20of=20a=20string=20The=20test=20for=20agents=5F?= =?UTF-8?q?template.py=20was=20updated=20to=20include=20the=20openai-multi?= =?UTF-8?q?-functions=20agent=20in=20the=20list=20of=20agents.=20This=20wa?= =?UTF-8?q?s=20done=20to=20ensure=20that=20the=20test=20coverage=20for=20t?= =?UTF-8?q?he=20agent=20is=20complete.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test for graph.py was updated to change the message variable to a dictionary to match the expected input of the get_result_and_thought function. The assertion was also updated to check if the result is a dictionary instead of a string. This was done to ensure that the test coverage for the function is complete. --- tests/test_agents_template.py | 1 + tests/test_graph.py | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/tests/test_agents_template.py b/tests/test_agents_template.py index 8ad5dc891..0497283b9 100644 --- a/tests/test_agents_template.py +++ b/tests/test_agents_template.py @@ -137,6 +137,7 @@ def test_initialize_agent(client: TestClient): "self-ask-with-search", "conversational-react-description", "openai-functions", + "openai-multi-functions", ], "name": "agent", "type": "str", diff --git a/tests/test_graph.py b/tests/test_graph.py index 16dd514b8..02bb180f2 100644 --- a/tests/test_graph.py +++ b/tests/test_graph.py @@ -336,7 +336,7 @@ def test_get_result_and_thought(basic_graph): responses = [ "Final Answer: I am a response", ] - message = "Hello" + message = {"input": "Hello"} # Find the node that is an LLMNode and change the # _built_object to a FakeListLLM llm_node = get_node_by_type(basic_graph, LLMVertex) @@ -349,8 +349,5 @@ def test_get_result_and_thought(basic_graph): # now build again and check if FakeListLLM was used # Get the result and thought - result, thought = get_result_and_thought(langchain_object, message) - # The result should be a str - assert isinstance(result, str) - # The thought should be a Thought - assert isinstance(thought, str) + result = get_result_and_thought(langchain_object, message) + assert isinstance(result, dict)