-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix memory step model output in ToolCallingAgent #1156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Nice, thank you! Could you also test the |
I tried to add the test like shown below agent = ToolCallingAgent(tools=[PythonInterpreterTool()], model=FakeToolCallModel(), verbosity_level=0)
agent.run("What is 2 multiplied by 3.6452?")
with agent.logger.console.capture() as capture:
agent.replay()
output = capture.get().replace("\n", "")
assert "Called Tool" in output but captured output includes formatting codes.
|
@keetrap I see string |
@@ -160,7 +160,7 @@ def test_streaming_agent_image_output(self): | |||
) | |||
) | |||
|
|||
self.assertEqual(len(outputs), 5) | |||
self.assertEqual(len(outputs), 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have one extra ChatMessage in outputs here.
In this case it is ChatMessage(content="Called Tool: 'final_answer' with arguments: {'answer': 'image'}", role='assistant', metadata={}, options=[])
``
You can either remove ansi sequences before asserting, something like: def remove_ansi(text):
ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
return ansi_escape.sub('', text) or just disable them altogether by changing AgentLogger: logger = AgentLogger(2)
logger.console = Console(force_terminal=False)
# inject or monkeypatch the logger Actually I have no idea why |
@sysradium agree that being able to pass a console arg upon logger initialization would be better! If you have some time, it'd be great to make a PR for this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @keetrap !
Fixes #1143