-
Notifications
You must be signed in to change notification settings - Fork 41
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
feat: working instrumentation with smolagents #1184
base: main
Are you sure you want to change the base?
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Excited to dig into this @aymeric-roucher! |
agent.model.last_input_token_count + agent.model.last_output_token_count | ||
) | ||
span.set_attribute("Observations", step_log.observations) | ||
# if step_log.error is not None: |
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.
@axiomofjoy As you can see I've commented out these 3 lines.
It is because currently their visualization in a platform like Arize Phoenix is unsatisfactory: having an error in one step shows the whole run as failing, when indeed I can have an error at one step but then the multi-step agent recovers in the next steps to successfully solve the task. Is there a way to display an error without upwards transmission of the error to the whole run?
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.
Interesting, can you give me a code snippet to reproduce this behavior?
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.
This is the code in script test.py
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.
Will take a look and get back to you!
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.
I think this might be a bug in Phoenix. I have filed an issue here.
Nice tomeet you @axiomofjoy! 🤗 This is ready for review. Final things to do are:
|
Great to meet you @aymeric-roucher and thanks so much for this contribution! I'm digging into the PR now. Let me know how I can help you get it over the line, e.g., if you need help writing tests. Our team would also love to dogfood the instrumentation once it's in a good state! |
python/instrumentation/openinference-instrumentation-smolagents/pyproject.toml
Outdated
Show resolved
Hide resolved
@axiomofjoy sorry for the issue above, I had been working on a specific branch of smolagents to make it compatible: now installing from main should work! |
@axiomofjoy one more problem that I just detected: detecting calls to Model.get_tool_call from within ToolCallingAgent does not work. I think this is because I actually use HfApiModel as my LLM: Is there a way to create a wrapper that works for Method |
I have read the CLA Document and I hereby sign the CLA |
…s/pyproject.toml Co-authored-by: Xander Song <axiomofjoy@gmail.com>
Got it, no worries! I just got it running from dev 😄 |
You need to our LLM message semantic conventions. These can be a bit tricky due to constraints on OTel attribute value types. You can see an example here. |
Good catch! My first thought is that you might try instrumenting each subclass individually in addition to the base class. This can be accomplished by iterating over subclasses. We do something similar in DSPy here. |
@aymeric-roucher It's looking really promising so far! A few findings from my initial testing.
If you don't mind, I'll open a PR against your branch including some of the examples I used! |
I've applied your suggestions @axiomofjoy and implemented a wrapper over all subclasses of Model, + done many other changes to mimick dspy implementation! Here's what my dashboard now looks like.
|
Hey @aymeric-roucher, awesome progress! I'm excited to test it out. I opened a PR to your fork that sets up CI and adds examples here. This enables the following commands:
You can read about how to get set up with I'll start dogfooding your changes and add some tests in a subsequent PR if you don't mind! |
Fixes #1182
cc @harrisonchu I've copied the work you did for crewAI, ended up working really well!
I've put a
test.py
file at the root to let you try out the instrumentation.Beware that I've not adapted the tests yet.