telemetry-dev-litellm 0.2.5__tar.gz → 0.2.6__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
1
  Metadata-Version: 2.4
2
2
  Name: telemetry-dev-litellm
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: LiteLLM integration for telemetry.dev Python SDK
5
5
  Keywords: telemetry,opentelemetry,llm,genai,litellm,tracing
6
6
  Author: telemetry.dev
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "telemetry-dev-litellm"
3
- version = "0.2.5"
3
+ version = "0.2.6"
4
4
  description = "LiteLLM integration for telemetry.dev Python SDK"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "telemetry-dev-litellm"
3
- version = "0.2.5"
3
+ version = "0.2.6"
4
4
  description = "LiteLLM integration for telemetry.dev Python SDK"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -17,7 +17,7 @@ import litellm
17
17
  import telemetry_dev
18
18
  from opentelemetry import trace
19
19
 
20
- __version__ = "0.2.5"
20
+ __version__ = "0.2.6"
21
21
 
22
22
  RequestMapper = Callable[[tuple[Any, ...], Mapping[str, Any]], tuple[str, dict[str, Any]]]
23
23
  ResponseMapper = Callable[[Any], dict[str, Any]]
@@ -751,12 +751,21 @@ def _rerank_response(response: Any) -> dict[str, Any]:
751
751
  }
752
752
 
753
753
 
754
- def _response_error(response: Any) -> RuntimeError | None:
754
+ def _provider_failure(message: str, code: str | None, kind: str) -> Exception:
755
+ # A failure that the provider reports in a response body or a stream event, not as an HTTP
756
+ # error. The core SDK records its `code` in error.type, else its `type`, because a plain
757
+ # Exception names no cause; see _error_type in telemetry_dev/_spans.py.
758
+ error = Exception(message)
759
+ vars(error).update(code=code, type=kind)
760
+ return error
761
+
762
+
763
+ def _response_error(response: Any) -> Exception | None:
755
764
  if _string(_field(response, "status")) != "failed" and _field(response, "error") is None:
756
765
  return None
757
766
  raw_error = _field(response, "error")
758
767
  message = _string(_field(raw_error, "message")) or "LiteLLM Responses API request failed"
759
- return RuntimeError(message)
768
+ return _provider_failure(message, _string(_field(raw_error, "code")), "response.failed")
760
769
 
761
770
 
762
771
  def _responses_response(response: Any) -> dict[str, Any]:
@@ -1908,7 +1917,7 @@ class _InstrumentedResponsesStream:
1908
1917
  code = _string(_field(raw_error, "code")) or _string(_field(event, "code"))
1909
1918
  if code is not None:
1910
1919
  message = f"{message} ({code})"
1911
- self._finish(error=RuntimeError(message))
1920
+ self._finish(error=_provider_failure(message, code, "response.error"))
1912
1921
 
1913
1922
  def _finish(self, response: Any = None, error: BaseException | None = None) -> None:
1914
1923
  if self._finished: