|
18 | 18 |
|
19 | 19 | from typing import Any |
20 | 20 |
|
| 21 | +from opentelemetry import trace |
21 | 22 | from pydantic import BaseModel |
22 | 23 |
|
23 | 24 | from ..._utils import Endpoint |
@@ -202,7 +203,7 @@ async def embeddings( |
202 | 203 |
|
203 | 204 | return TextEmbedding.model_validate(response.json()) |
204 | 205 |
|
205 | | - @traced(name="llm_chat_completions", run_type="uipath") |
| 206 | + @traced(name="LLM call", run_type="uipath") |
206 | 207 | async def chat_completions( |
207 | 208 | self, |
208 | 209 | messages: list[dict[str, str]], |
@@ -288,6 +289,10 @@ class Country(BaseModel): |
288 | 289 | When using a Pydantic BaseModel as response_format, it will be automatically |
289 | 290 | converted to the appropriate JSON schema format for the LLM Gateway. |
290 | 291 | """ |
| 292 | + span = trace.get_current_span() |
| 293 | + span.set_attribute("model", model) |
| 294 | + span.set_attribute("uipath.custom_instrumentation", True) |
| 295 | + |
291 | 296 | endpoint = EndpointManager.get_passthrough_endpoint().format( |
292 | 297 | model=model, api_version=api_version |
293 | 298 | ) |
@@ -347,7 +352,7 @@ def __init__( |
347 | 352 | ) -> None: |
348 | 353 | super().__init__(config=config, execution_context=execution_context) |
349 | 354 |
|
350 | | - @traced(name="llm_chat_completions", run_type="uipath") |
| 355 | + @traced(name="LLM call", run_type="uipath") |
351 | 356 | async def chat_completions( |
352 | 357 | self, |
353 | 358 | messages: list[dict[str, str]] | list[tuple[str, str]], |
@@ -480,6 +485,10 @@ class Country(BaseModel): |
480 | 485 | This service uses UiPath's normalized API format which provides consistent |
481 | 486 | behavior across different underlying model providers and enhanced enterprise features. |
482 | 487 | """ |
| 488 | + span = trace.get_current_span() |
| 489 | + span.set_attribute("model", model) |
| 490 | + span.set_attribute("uipath.custom_instrumentation", True) |
| 491 | + |
483 | 492 | converted_messages = [] |
484 | 493 |
|
485 | 494 | for message in messages: |
|
0 commit comments