-
Notifications
You must be signed in to change notification settings - Fork 1k
Adding tool response in running tool spans #2081
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
current_span = get_current_span() | ||
if current_span.is_recording() and include_content: | ||
current_span.set_attribute( | ||
'gen_ai.tool.call.response', |
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.
https://opentelemetry.io/docs/specs/semconv/registry/attributes/gen-ai/
I could not find an attribute for tool response so went with this for now
if current_span.is_recording() and include_content: | ||
current_span.set_attribute( | ||
'gen_ai.tool.call.response', | ||
response_content if isinstance(response_content, str) else str(response_content), |
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.
Unsure about this part, should we retain the type of the tool response? Does that serve any useful case?
We could also have a helper function check against AttributeValue and fallback to str().
Hi @alexmojaki. I would appreciate it if could take a look. |
Hi @adtyavrdhn, thanks for giving this a go. The ideas were right but there were enough details that I felt iffy about that it seemed easier to just open #2109 instead. |
No problem, thanks for taking the time :) |
Fixes #2004