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.
- {telemetry_dev_litellm-0.2.5 → telemetry_dev_litellm-0.2.6}/PKG-INFO +1 -1
- {telemetry_dev_litellm-0.2.5 → telemetry_dev_litellm-0.2.6}/pyproject.toml +1 -1
- {telemetry_dev_litellm-0.2.5 → telemetry_dev_litellm-0.2.6}/pyproject.toml.orig +1 -1
- {telemetry_dev_litellm-0.2.5 → telemetry_dev_litellm-0.2.6}/src/telemetry_dev_litellm/__init__.py +13 -4
- {telemetry_dev_litellm-0.2.5 → telemetry_dev_litellm-0.2.6}/LICENSE +0 -0
- {telemetry_dev_litellm-0.2.5 → telemetry_dev_litellm-0.2.6}/README.md +0 -0
- {telemetry_dev_litellm-0.2.5 → telemetry_dev_litellm-0.2.6}/src/telemetry_dev_litellm/py.typed +0 -0
{telemetry_dev_litellm-0.2.5 → telemetry_dev_litellm-0.2.6}/src/telemetry_dev_litellm/__init__.py
RENAMED
|
@@ -17,7 +17,7 @@ import litellm
|
|
|
17
17
|
import telemetry_dev
|
|
18
18
|
from opentelemetry import trace
|
|
19
19
|
|
|
20
|
-
__version__ = "0.2.
|
|
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
|
|
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
|
|
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=
|
|
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:
|
|
File without changes
|
|
File without changes
|
{telemetry_dev_litellm-0.2.5 → telemetry_dev_litellm-0.2.6}/src/telemetry_dev_litellm/py.typed
RENAMED
|
File without changes
|