Skip to content

Commit ee53172

Browse files
authored
fix: fix the llm chat completions span (#1191)
1 parent 3880bb6 commit ee53172

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "uipath"
3-
version = "2.5.37"
3+
version = "2.5.38"
44
description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools."
55
readme = { file = "README.md", content-type = "text/markdown" }
66
requires-python = ">=3.11"

src/uipath/platform/chat/_llm_gateway_service.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
from typing import Any
2020

21+
from opentelemetry import trace
2122
from pydantic import BaseModel
2223

2324
from ..._utils import Endpoint
@@ -202,7 +203,7 @@ async def embeddings(
202203

203204
return TextEmbedding.model_validate(response.json())
204205

205-
@traced(name="llm_chat_completions", run_type="uipath")
206+
@traced(name="LLM call", run_type="uipath")
206207
async def chat_completions(
207208
self,
208209
messages: list[dict[str, str]],
@@ -288,6 +289,10 @@ class Country(BaseModel):
288289
When using a Pydantic BaseModel as response_format, it will be automatically
289290
converted to the appropriate JSON schema format for the LLM Gateway.
290291
"""
292+
span = trace.get_current_span()
293+
span.set_attribute("model", model)
294+
span.set_attribute("uipath.custom_instrumentation", True)
295+
291296
endpoint = EndpointManager.get_passthrough_endpoint().format(
292297
model=model, api_version=api_version
293298
)
@@ -347,7 +352,7 @@ def __init__(
347352
) -> None:
348353
super().__init__(config=config, execution_context=execution_context)
349354

350-
@traced(name="llm_chat_completions", run_type="uipath")
355+
@traced(name="LLM call", run_type="uipath")
351356
async def chat_completions(
352357
self,
353358
messages: list[dict[str, str]] | list[tuple[str, str]],
@@ -480,6 +485,10 @@ class Country(BaseModel):
480485
This service uses UiPath's normalized API format which provides consistent
481486
behavior across different underlying model providers and enhanced enterprise features.
482487
"""
488+
span = trace.get_current_span()
489+
span.set_attribute("model", model)
490+
span.set_attribute("uipath.custom_instrumentation", True)
491+
483492
converted_messages = []
484493

485494
for message in messages:

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)