Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #475 +/- ##
==========================================
+ Coverage 82.61% 82.71% +0.09%
==========================================
Files 96 96
Lines 9147 9159 +12
==========================================
+ Hits 7557 7576 +19
+ Misses 1590 1583 -7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| ) | ||
|
|
||
|
|
||
| def _set_tool_span_attributes(span: trace.Span, galileo_span: ToolSpan) -> None: |
There was a problem hiding this comment.
Please add:
gen_ai.tool.name
gen_ai.tool.description
gen_ai.tool.call.arguments
gen_ai.tool.call.result
Reference: https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-spans/#execute-tool-span
There was a problem hiding this comment.
Commit 3f3a0f9 addressed this comment by adding several of the requested GenAI tool span semantic convention attributes in _set_tool_span_attributes, including gen_ai.tool.name, gen_ai.tool.call.arguments, and gen_ai.tool.call.result, and by updating the tool call id attribute to gen_ai.tool.call.id.
This change adds support for setting additional attributes on OpenTelemetry spans when processing ToolSpan objects from the galileo-core library. Specifically, the following attributes are now set on the span: - gen_ai.input.messages: JSON array with the tool's input data - gen_ai.output.messages: JSON array with the tool's output data (if available) - gen_ai.tool.call_id: the unique identifier for the tool call (if available) This provides more detailed observability into the usage of AI/ML tools within the Galileo platform.
This change adds two new test cases for the start_galileo_span context manager: 1. Test that start_galileo_span correctly sets the expected attributes on the generated OpenTelemetry span when provided a fully populated ToolSpan. 2. Test that start_galileo_span handles a ToolSpan with a None output and tool_call_id gracefully. The tests ensure the context manager is properly dispatching the ToolSpan attributes to the underlying OpenTelemetry span, which is crucial for providing meaningful tracing data.
- Renames `gen_ai.tool.call_id` to `gen_ai.tool.call.id` for consistency - Adds `gen_ai.tool.call.arguments` and `gen_ai.tool.call.result` attributes - Updates tests to cover the new attribute set
This change adds the 'gen_ai.operation.name' attribute to the OpenTelemetry spans created for tool execution. The operation name is set to 'execute_tool' to provide more context about the purpose of the span.
3f3a0f9 to
94a180c
Compare
Shortcut:
Description:
This change adds support for setting additional attributes on OpenTelemetry spans when processing ToolSpan objects from the galileo-core library.
Specifically, the following attributes are now set on the span:
This provides more detailed observability into the usage of AI/ML tools within the Galileo platform.
The following
ToolSpanfields are now mapped to OpenTelemetry semantic convention attributes:inputgen_ai.input.messagesoutputgen_ai.output.messagestool_call_idgen_ai.tool.call_idAttribute Format Details:
gen_ai.input.messages(always set):[{"role": "tool", "content": "<input_string>"}]"tool"(identifies this as a tool/function call)ToolSpan.inputgen_ai.output.messages(conditional):[{"role": "tool", "content": "<output_string>"}]ToolSpan.outputis not None"tool"indicates this is tool outputToolSpan.outputgen_ai.tool.call_id(conditional):ToolSpan.tool_call_idis not NoneTests:
Evidences
I've created a demo script called tool_span_demo.py to test this changes. To run this script we need to export a couple of credentials:
Inside the galileo-python directory I've started a new
virtualenvironmentso we can install the project locally:Then I installed the dependencies:
After all this, I've ran the
tool_span_demo.pyPython script and got this as a result:What it demonstrates:
✅ All
ToolSpanfields correctly map to OTel semantic conventions✅ Manual span creation works via
start_galileo_span()✅ Conditional attribute setting for None values
✅ Comprehensive demo script provided with 5 test cases
✅ Unit tests covering all scenarios (3 test cases, all passing)
✅ Documentation and troubleshooting guide created
✅ OpenTelemetry semantic compliance verified