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.
- {traceai_livekit-0.1.0 → traceai_livekit-0.1.1}/PKG-INFO +2 -2
- {traceai_livekit-0.1.0 → traceai_livekit-0.1.1}/pyproject.toml +1 -1
- {traceai_livekit-0.1.0 → traceai_livekit-0.1.1}/traceai_livekit/exporters/base_exporter.py +13 -13
- {traceai_livekit-0.1.0 → traceai_livekit-0.1.1}/README.md +0 -0
- {traceai_livekit-0.1.0 → traceai_livekit-0.1.1}/traceai_livekit/__init__.py +0 -0
- {traceai_livekit-0.1.0 → traceai_livekit-0.1.1}/traceai_livekit/exporters/__init__.py +0 -0
- {traceai_livekit-0.1.0 → traceai_livekit-0.1.1}/traceai_livekit/exporters/grpc_exporter.py +0 -0
- {traceai_livekit-0.1.0 → traceai_livekit-0.1.1}/traceai_livekit/exporters/http_exporter.py +0 -0
- {traceai_livekit-0.1.0 → traceai_livekit-0.1.1}/traceai_livekit/integration.py +0 -0
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
203
|
-
completion_tokens = mapped.get(SpanAttributes.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
281
|
+
mapped[SpanAttributes.GEN_AI_SPAN_KIND] = span_kind
|
|
282
282
|
|
|
283
283
|
return mapped
|
|
284
284
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|