openlit 1.22.2__py3-none-any.whl → 1.22.4__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/__init__.py +9 -1
- openlit/instrumentation/langchain/langchain.py +2 -2
- {openlit-1.22.2.dist-info → openlit-1.22.4.dist-info}/METADATA +1 -1
- {openlit-1.22.2.dist-info → openlit-1.22.4.dist-info}/RECORD +6 -6
- {openlit-1.22.2.dist-info → openlit-1.22.4.dist-info}/LICENSE +0 -0
- {openlit-1.22.2.dist-info → openlit-1.22.4.dist-info}/WHEEL +0 -0
openlit/__init__.py
CHANGED
@@ -130,6 +130,13 @@ class OpenlitConfig:
|
|
130
130
|
cls.trace_content = trace_content
|
131
131
|
cls.disable_metrics = disable_metrics
|
132
132
|
|
133
|
+
def module_exists(module_name):
|
134
|
+
"""Check if nested modules exist, addressing the dot notation issue."""
|
135
|
+
parts = module_name.split(".")
|
136
|
+
for i in range(1, len(parts) + 1):
|
137
|
+
if find_spec(".".join(parts[:i])) is None:
|
138
|
+
return False
|
139
|
+
return True
|
133
140
|
|
134
141
|
def instrument_if_available(
|
135
142
|
instrumentor_name,
|
@@ -150,7 +157,7 @@ def instrument_if_available(
|
|
150
157
|
return
|
151
158
|
|
152
159
|
try:
|
153
|
-
if
|
160
|
+
if module_exists(module_name):
|
154
161
|
instrumentor_instance.instrument(
|
155
162
|
environment=config.environment,
|
156
163
|
application_name=config.application_name,
|
@@ -167,6 +174,7 @@ def instrument_if_available(
|
|
167
174
|
except Exception as e:
|
168
175
|
logger.error("Failed to instrument %s: %s", instrumentor_name, e)
|
169
176
|
|
177
|
+
|
170
178
|
def init(environment="default", application_name="default", tracer=None, otlp_endpoint=None,
|
171
179
|
otlp_headers=None, disable_batch=False, trace_content=True, disabled_instrumentors=None,
|
172
180
|
meter=None, disable_metrics=False, pricing_json=None, collect_gpu_stats=False):
|
@@ -619,8 +619,8 @@ def achat(gen_ai_endpoint, version, environment, application_name,
|
|
619
619
|
response = await wrapped(*args, **kwargs)
|
620
620
|
|
621
621
|
try:
|
622
|
-
input_tokens = response.response_metadata
|
623
|
-
output_tokens = response.response_metadata
|
622
|
+
input_tokens = response.response_metadata.get("prompt_eval_count", 0)
|
623
|
+
output_tokens = response.response_metadata.get("eval_count", 0)
|
624
624
|
|
625
625
|
# Calculate cost of the operation
|
626
626
|
cost = get_chat_model_cost(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: openlit
|
3
|
-
Version: 1.22.
|
3
|
+
Version: 1.22.4
|
4
4
|
Summary: OpenTelemetry-native Auto instrumentation library for monitoring LLM Applications and GPUs, facilitating the integration of observability into your GenAI-driven projects
|
5
5
|
Home-page: https://github.com/openlit/openlit/tree/main/openlit/python
|
6
6
|
Keywords: OpenTelemetry,otel,otlp,llm,tracing,openai,anthropic,claude,cohere,llm monitoring,observability,monitoring,gpt,Generative AI,chatGPT,gpu
|
@@ -1,5 +1,5 @@
|
|
1
1
|
openlit/__helpers.py,sha256=lrn4PBs9owDudiCY2NBoVbAi7AU_HtUpyOj0oqPBsPY,5545
|
2
|
-
openlit/__init__.py,sha256=
|
2
|
+
openlit/__init__.py,sha256=iuYE-acp7ScvxzA9P3f8obfOLLLrNMYkLbyKRz8Liec,16049
|
3
3
|
openlit/instrumentation/anthropic/__init__.py,sha256=oaU53BOPyfUKbEzYvLr1DPymDluurSnwo4Hernf2XdU,1955
|
4
4
|
openlit/instrumentation/anthropic/anthropic.py,sha256=y7CEGhKOGHWt8G_5Phr4qPJTfPGRJIAr9Yk6nM3CcvM,16775
|
5
5
|
openlit/instrumentation/anthropic/async_anthropic.py,sha256=Zz1KRKIG9wGn0quOoLvjORC-49IvHQpJ6GBdB-4PfCQ,16816
|
@@ -29,7 +29,7 @@ openlit/instrumentation/groq/groq.py,sha256=m4gFPbYzjUUIgjXZ0Alu2Zy1HcO5takCFA2X
|
|
29
29
|
openlit/instrumentation/haystack/__init__.py,sha256=QK6XxxZUHX8vMv2Crk7rNBOc64iOOBLhJGL_lPlAZ8s,1758
|
30
30
|
openlit/instrumentation/haystack/haystack.py,sha256=oQIZiDhdp3gnJnhYQ1OouJMc9YT0pQ-_31cmNuopa68,3891
|
31
31
|
openlit/instrumentation/langchain/__init__.py,sha256=0AI2Dnqw81IcJw3jM--gGkv_HRh2GtosOGJjvOpw7Zk,3431
|
32
|
-
openlit/instrumentation/langchain/langchain.py,sha256=
|
32
|
+
openlit/instrumentation/langchain/langchain.py,sha256=Mk1XldgcbRDjLC_beORgV7P3aDaSAld6-q84yJsaUKM,35738
|
33
33
|
openlit/instrumentation/llamaindex/__init__.py,sha256=vPtK65G6b-TwJERowVRUVl7f_nBSlFdwPBtpg8dOGos,1977
|
34
34
|
openlit/instrumentation/llamaindex/llamaindex.py,sha256=uiIigbwhonSbJWA7LpgOVI1R4kxxPODS1K5wyHIQ4hM,4048
|
35
35
|
openlit/instrumentation/milvus/__init__.py,sha256=qi1yfmMrvkDtnrN_6toW8qC9BRL78bq7ayWpObJ8Bq4,2961
|
@@ -59,7 +59,7 @@ openlit/instrumentation/vllm/vllm.py,sha256=lDzM7F5pgxvh8nKL0dcKB4TD0Mc9wXOWeXOs
|
|
59
59
|
openlit/otel/metrics.py,sha256=O7NoaDz0bY19mqpE4-0PcKwEe-B-iJFRgOCaanAuZAc,4291
|
60
60
|
openlit/otel/tracing.py,sha256=vL1ifMbARPBpqK--yXYsCM6y5dSu5LFIKqkhZXtYmUc,3712
|
61
61
|
openlit/semcov/__init__.py,sha256=wpAarrnkndbgvP8VSudi8IRInYtD02hkewqjyiC0dMk,7614
|
62
|
-
openlit-1.22.
|
63
|
-
openlit-1.22.
|
64
|
-
openlit-1.22.
|
65
|
-
openlit-1.22.
|
62
|
+
openlit-1.22.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
63
|
+
openlit-1.22.4.dist-info/METADATA,sha256=AhFHGMlt7_YQugl86aBGhnOawsMijutbM3dirJKk_f4,15710
|
64
|
+
openlit-1.22.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
65
|
+
openlit-1.22.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|