Skip to content
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

[BUG] Rich removes all [] in errors #751

Open
aymeric-roucher opened this issue Feb 22, 2025 · 0 comments · May be fixed by #753
Open

[BUG] Rich removes all [] in errors #751

aymeric-roucher opened this issue Feb 22, 2025 · 0 comments · May be fixed by #753
Labels
bug Something isn't working

Comments

@aymeric-roucher
Copy link
Collaborator

aymeric-roucher commented Feb 22, 2025

Describe the bug
When code execution has an error and displays the offending code in red, any non-quoted string in a [] in the code line is not shown.

Code to reproduce the error

from smolagents import CodeAgent, OpenAIServerModel

agent=CodeAgent(model=OpenAIServerModel("gpt-4o"), tools=[])
agent.run("""Run this exact code:
index=3
['a', 'b'][index]""")

Error logs (if any)

Code execution failed at line
    index = 3
    result = ['a', 'b']

Expected behavior
The log should be:

Code execution failed at line
    index = 3
    result = ['a', 'b'][index]

Packages version:
smolagents==1.9.2

I think this is due to Rich recognizing "[any_string]" pattern as tags

@aymeric-roucher aymeric-roucher added the bug Something isn't working label Feb 22, 2025
@aymeric-roucher aymeric-roucher linked a pull request Feb 22, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant