From 60b91d22d3304a0d0773a47c661be61762d91b18 Mon Sep 17 00:00:00 2001 From: sysradium Date: Sat, 15 Feb 2025 16:49:51 +0100 Subject: [PATCH] explain test case --- pyproject.toml | 1 + tests/test_agents.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 91d6fa3c1..e9f542cbe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,6 +83,7 @@ test = [ dev = [ "smolagents[quality,test]", "sqlalchemy", # for ./examples + "mlx-lm", ] [tool.pytest.ini_options] diff --git a/tests/test_agents.py b/tests/test_agents.py index 758e40ae4..da634ea53 100644 --- a/tests/test_agents.py +++ b/tests/test_agents.py @@ -747,7 +747,7 @@ def test_planning_step(self, step, expected_messages_list): for content, expected_content in zip(message["content"], expected_message["content"]): assert content == expected_content - def test_agent_memory_to_messages_suceeds_when_tool_fails_by_obeservation_is_set(self): + def test_agent_memory_to_messages_suceeds_when_tool_fails_but_obeservation_is_set(self): tool = PythonInterpreterTool() def _fake_callback(memory_step: ActionStep, agent: CodeAgent) -> None: @@ -758,8 +758,12 @@ def _fake_callback(memory_step: ActionStep, agent: CodeAgent) -> None: model=fake_no_valid_code_block, step_callbacks=[_fake_callback], ) + + # Perform a task. A tool call will fail since the fake model returns invalid response, but a _fake_callback + # sets an observation agent.run("some task") + # This should not fail, even though no tool call have been recorded, and observation came from a callback for s in agent.memory.steps: s.to_messages()