traceAI-livekit 0.1.0__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: traceAI-livekit
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: OpenTelemetry instrumentation for LiveKit
5
5
  Author: Future AGI
6
6
  Author-email: no-reply@futureagi.com
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "traceAI-livekit"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "OpenTelemetry instrumentation for LiveKit"
5
5
  authors = ["Future AGI <no-reply@futureagi.com>"]
6
6
  readme = "README.md"
@@ -105,7 +105,7 @@ def _map_attributes_to_fi_conventions(attributes: Dict[str, Any]) -> Dict[str, A
105
105
 
106
106
  # 1. LLM & Model Info
107
107
  if ATTR_GEN_AI_REQUEST_MODEL in attributes:
108
- mapped[SpanAttributes.LLM_MODEL_NAME] = attributes.get(ATTR_GEN_AI_REQUEST_MODEL)
108
+ mapped[SpanAttributes.GEN_AI_REQUEST_MODEL] = attributes.get(ATTR_GEN_AI_REQUEST_MODEL)
109
109
 
110
110
  # 2. Inputs & Outputs
111
111
  # LiveKit separates User Input (in Assistant Turn) vs LLM Response vs TTS Input
@@ -171,10 +171,10 @@ def _map_attributes_to_fi_conventions(attributes: Dict[str, Any]) -> Dict[str, A
171
171
 
172
172
  # --- Set Input/Output Attributes ---
173
173
  if raw_input_val is not None:
174
- mapped[SpanAttributes.RAW_INPUT] = _ensure_json_string(raw_input_val)
174
+ mapped[SpanAttributes.INPUT_VALUE] = _ensure_json_string(raw_input_val)
175
175
 
176
176
  if raw_output_val is not None:
177
- mapped[SpanAttributes.RAW_OUTPUT] = _ensure_json_string(raw_output_val)
177
+ mapped[SpanAttributes.OUTPUT_VALUE] = _ensure_json_string(raw_output_val)
178
178
 
179
179
  if input_val is not None and SpanAttributes.INPUT_VALUE not in mapped:
180
180
  mime_type = _detect_mime_type(input_val)
@@ -193,31 +193,31 @@ def _map_attributes_to_fi_conventions(attributes: Dict[str, Any]) -> Dict[str, A
193
193
 
194
194
  # 3. Token Usage
195
195
  if ATTR_GEN_AI_USAGE_INPUT_TOKENS in attributes:
196
- mapped[SpanAttributes.LLM_TOKEN_COUNT_PROMPT] = attributes.get(ATTR_GEN_AI_USAGE_INPUT_TOKENS)
196
+ mapped[SpanAttributes.GEN_AI_USAGE_INPUT_TOKENS] = attributes.get(ATTR_GEN_AI_USAGE_INPUT_TOKENS)
197
197
  if ATTR_GEN_AI_USAGE_OUTPUT_TOKENS in attributes:
198
- mapped[SpanAttributes.LLM_TOKEN_COUNT_COMPLETION] = attributes.get(ATTR_GEN_AI_USAGE_OUTPUT_TOKENS)
198
+ mapped[SpanAttributes.GEN_AI_USAGE_OUTPUT_TOKENS] = attributes.get(ATTR_GEN_AI_USAGE_OUTPUT_TOKENS)
199
199
 
200
200
  # Calculate total if not present
201
201
  try:
202
- prompt_tokens = mapped.get(SpanAttributes.LLM_TOKEN_COUNT_PROMPT)
203
- completion_tokens = mapped.get(SpanAttributes.LLM_TOKEN_COUNT_COMPLETION)
202
+ prompt_tokens = mapped.get(SpanAttributes.GEN_AI_USAGE_INPUT_TOKENS)
203
+ completion_tokens = mapped.get(SpanAttributes.GEN_AI_USAGE_OUTPUT_TOKENS)
204
204
  if isinstance(prompt_tokens, (int, float)) and isinstance(completion_tokens, (int, float)):
205
- mapped[SpanAttributes.LLM_TOKEN_COUNT_TOTAL] = int(prompt_tokens) + int(completion_tokens)
205
+ mapped[SpanAttributes.GEN_AI_USAGE_TOTAL_TOKENS] = int(prompt_tokens) + int(completion_tokens)
206
206
  except Exception:
207
207
  pass
208
208
 
209
209
  # 4. Tools
210
210
  if LK_FUNCTION_TOOL_NAME in attributes:
211
- mapped[SpanAttributes.TOOL_NAME] = attributes.get(LK_FUNCTION_TOOL_NAME)
211
+ mapped[SpanAttributes.GEN_AI_TOOL_NAME] = attributes.get(LK_FUNCTION_TOOL_NAME)
212
212
  mapped["tool_call.function.name"] = attributes.get(LK_FUNCTION_TOOL_NAME) # Standardize
213
213
 
214
214
  if LK_FUNCTION_TOOLS in attributes:
215
215
  # List of available tools provided to LLM
216
- mapped[SpanAttributes.LLM_TOOLS] = _ensure_json_string(attributes.get(LK_FUNCTION_TOOLS))
216
+ mapped[SpanAttributes.GEN_AI_TOOL_DEFINITIONS] = _ensure_json_string(attributes.get(LK_FUNCTION_TOOLS))
217
217
 
218
218
  # 5. Session & User Info
219
219
  if LK_ROOM_NAME in attributes:
220
- mapped[SpanAttributes.SESSION_ID] = attributes.get(LK_ROOM_NAME)
220
+ mapped[SpanAttributes.GEN_AI_CONVERSATION_ID] = attributes.get(LK_ROOM_NAME)
221
221
 
222
222
  if LK_PARTICIPANT_IDENTITY in attributes:
223
223
  mapped[SpanAttributes.USER_ID] = attributes.get(LK_PARTICIPANT_IDENTITY)
@@ -258,7 +258,7 @@ def _map_attributes_to_fi_conventions(attributes: Dict[str, Any]) -> Dict[str, A
258
258
  mapped[SpanAttributes.METADATA] = _ensure_json_string(metadata)
259
259
 
260
260
  # 7. Span Kind Determination (fi.span.kind)
261
- if SpanAttributes.FI_SPAN_KIND not in mapped:
261
+ if SpanAttributes.GEN_AI_SPAN_KIND not in mapped:
262
262
  span_kind = "UNKNOWN"
263
263
 
264
264
  # Check based on attribute presence or span name (if available in attributes? No, span name is on the Span object)
@@ -278,7 +278,7 @@ def _map_attributes_to_fi_conventions(attributes: Dict[str, Any]) -> Dict[str, A
278
278
  # Session Start -> AGENT
279
279
  span_kind = "AGENT"
280
280
 
281
- mapped[SpanAttributes.FI_SPAN_KIND] = span_kind
281
+ mapped[SpanAttributes.GEN_AI_SPAN_KIND] = span_kind
282
282
 
283
283
  return mapped
284
284