Skip to content

Commit

Permalink
explain test case
Browse files Browse the repository at this point in the history
  • Loading branch information
sysradium committed Feb 26, 2025
1 parent cdeccd0 commit a4673a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ test = [
dev = [
"smolagents[quality,test]",
"sqlalchemy", # for ./examples
"mlx-lm",
]

[tool.pytest.ini_options]
Expand Down
6 changes: 5 additions & 1 deletion tests/test_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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()

Expand Down

0 comments on commit a4673a9

Please sign in to comment.