openlit 1.34.13__py3-none-any.whl → 1.34.15__py3-none-any.whl
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.
- openlit/instrumentation/litellm/__init__.py +7 -6
- openlit/instrumentation/litellm/async_litellm.py +89 -493
- openlit/instrumentation/litellm/litellm.py +87 -491
- openlit/instrumentation/litellm/utils.py +288 -0
- openlit/instrumentation/transformers/__init__.py +12 -5
- openlit/instrumentation/transformers/transformers.py +21 -28
- openlit/instrumentation/transformers/utils.py +126 -110
- {openlit-1.34.13.dist-info → openlit-1.34.15.dist-info}/METADATA +1 -1
- {openlit-1.34.13.dist-info → openlit-1.34.15.dist-info}/RECORD +11 -10
- {openlit-1.34.13.dist-info → openlit-1.34.15.dist-info}/LICENSE +0 -0
- {openlit-1.34.13.dist-info → openlit-1.34.15.dist-info}/WHEEL +0 -0
@@ -1,4 +1,3 @@
|
|
1
|
-
# pylint: disable=useless-return, bad-staticmethod-argument, disable=duplicate-code
|
2
1
|
"""Initializer of Auto Instrumentation of LiteLLM Functions"""
|
3
2
|
|
4
3
|
from typing import Collection
|
@@ -17,15 +16,15 @@ _instruments = ("litellm >= 1.52.6",)
|
|
17
16
|
|
18
17
|
class LiteLLMInstrumentor(BaseInstrumentor):
|
19
18
|
"""
|
20
|
-
An instrumentor for LiteLLM
|
19
|
+
An instrumentor for LiteLLM client library.
|
21
20
|
"""
|
22
21
|
|
23
22
|
def instrumentation_dependencies(self) -> Collection[str]:
|
24
23
|
return _instruments
|
25
24
|
|
26
25
|
def _instrument(self, **kwargs):
|
27
|
-
application_name = kwargs.get("application_name", "
|
28
|
-
environment = kwargs.get("environment", "
|
26
|
+
application_name = kwargs.get("application_name", "default")
|
27
|
+
environment = kwargs.get("environment", "default")
|
29
28
|
tracer = kwargs.get("tracer")
|
30
29
|
metrics = kwargs.get("metrics_dict")
|
31
30
|
pricing_info = kwargs.get("pricing_info", {})
|
@@ -33,7 +32,7 @@ class LiteLLMInstrumentor(BaseInstrumentor):
|
|
33
32
|
disable_metrics = kwargs.get("disable_metrics")
|
34
33
|
version = importlib.metadata.version("litellm")
|
35
34
|
|
36
|
-
#
|
35
|
+
# Chat completions
|
37
36
|
wrap_function_wrapper(
|
38
37
|
"litellm",
|
39
38
|
"completion",
|
@@ -41,6 +40,7 @@ class LiteLLMInstrumentor(BaseInstrumentor):
|
|
41
40
|
tracer, pricing_info, capture_message_content, metrics, disable_metrics),
|
42
41
|
)
|
43
42
|
|
43
|
+
# Async chat completions
|
44
44
|
wrap_function_wrapper(
|
45
45
|
"litellm",
|
46
46
|
"acompletion",
|
@@ -48,6 +48,7 @@ class LiteLLMInstrumentor(BaseInstrumentor):
|
|
48
48
|
tracer, pricing_info, capture_message_content, metrics, disable_metrics),
|
49
49
|
)
|
50
50
|
|
51
|
+
# Embeddings
|
51
52
|
wrap_function_wrapper(
|
52
53
|
"litellm",
|
53
54
|
"embedding",
|
@@ -55,6 +56,7 @@ class LiteLLMInstrumentor(BaseInstrumentor):
|
|
55
56
|
tracer, pricing_info, capture_message_content, metrics, disable_metrics),
|
56
57
|
)
|
57
58
|
|
59
|
+
# Async embeddings
|
58
60
|
wrap_function_wrapper(
|
59
61
|
"litellm",
|
60
62
|
"aembedding",
|
@@ -63,5 +65,4 @@ class LiteLLMInstrumentor(BaseInstrumentor):
|
|
63
65
|
)
|
64
66
|
|
65
67
|
def _uninstrument(self, **kwargs):
|
66
|
-
# Proper uninstrumentation logic to revert patched methods
|
67
68
|
pass
|