refactor: rename tracing span attribute "system" to "system_instructions"
Align with the OpenTelemetry GenAI semantic convention gen_ai.system_instructions for system prompts. The old "system" attribute name was unrelated to gen_ai.system (which is for provider name).
This commit is contained in:
1
changelog/3449.changed.md
Normal file
1
changelog/3449.changed.md
Normal file
@@ -0,0 +1 @@
|
||||
- Renamed tracing span attribute `system` to `system_instructions` to align with the OpenTelemetry GenAI semantic conventions.
|
||||
@@ -193,7 +193,7 @@ def add_llm_span_attributes(
|
||||
tools: Optional[str] = None,
|
||||
tool_count: Optional[int] = None,
|
||||
tool_choice: Optional[str] = None,
|
||||
system: Optional[str] = None,
|
||||
system_instructions: Optional[str] = None,
|
||||
parameters: Optional[Dict[str, Any]] = None,
|
||||
extra_parameters: Optional[Dict[str, Any]] = None,
|
||||
ttfb: Optional[float] = None,
|
||||
@@ -211,7 +211,7 @@ def add_llm_span_attributes(
|
||||
tools: JSON-serialized tools configuration.
|
||||
tool_count: Number of tools available.
|
||||
tool_choice: Tool selection configuration.
|
||||
system: System message.
|
||||
system_instructions: System instructions.
|
||||
parameters: Service parameters.
|
||||
extra_parameters: Additional parameters.
|
||||
ttfb: Time to first byte in seconds.
|
||||
@@ -240,8 +240,8 @@ def add_llm_span_attributes(
|
||||
if tool_choice:
|
||||
span.set_attribute("tool_choice", tool_choice)
|
||||
|
||||
if system:
|
||||
span.set_attribute("system", system)
|
||||
if system_instructions:
|
||||
span.set_attribute("system_instructions", system_instructions)
|
||||
|
||||
if ttfb is not None:
|
||||
span.set_attribute("metrics.ttfb", ttfb)
|
||||
|
||||
@@ -538,7 +538,7 @@ def traced_llm(func: Optional[Callable] = None, *, name: Optional[str] = None) -
|
||||
if hasattr(self, "_settings"):
|
||||
for key, value in self._settings.given_fields().items():
|
||||
# system_instruction is already captured as the
|
||||
# "system" span attribute above.
|
||||
# "system_instructions" span attribute above.
|
||||
if key == "system_instruction":
|
||||
continue
|
||||
if isinstance(value, (int, float, bool, str)):
|
||||
@@ -561,7 +561,7 @@ def traced_llm(func: Optional[Callable] = None, *, name: Optional[str] = None) -
|
||||
attribute_kwargs["tools"] = serialized_tools
|
||||
attribute_kwargs["tool_count"] = tool_count
|
||||
if system_message:
|
||||
attribute_kwargs["system"] = system_message
|
||||
attribute_kwargs["system_instructions"] = system_message
|
||||
|
||||
# Add all gathered attributes to the span
|
||||
add_llm_span_attributes(span=current_span, **attribute_kwargs)
|
||||
|
||||
Reference in New Issue
Block a user