lmnr 0.7.7__py3-none-any.whl → 0.7.8__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.
- lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/__init__.py +9 -6
- lmnr/version.py +1 -1
- {lmnr-0.7.7.dist-info → lmnr-0.7.8.dist-info}/METADATA +1 -1
- {lmnr-0.7.7.dist-info → lmnr-0.7.8.dist-info}/RECORD +6 -6
- {lmnr-0.7.7.dist-info → lmnr-0.7.8.dist-info}/WHEEL +0 -0
- {lmnr-0.7.7.dist-info → lmnr-0.7.8.dist-info}/entry_points.txt +0 -0
@@ -375,6 +375,7 @@ def _build_from_streaming_response(
|
|
375
375
|
# total token count in every chunk is greater by prompt token count than it should be,
|
376
376
|
# thus this awkward logic here
|
377
377
|
if aggregated_usage_metadata.get("prompt_token_count") is None:
|
378
|
+
# or 0, not .get(key, 0), because sometimes the value is explicitly None
|
378
379
|
aggregated_usage_metadata["prompt_token_count"] = (
|
379
380
|
usage_dict.get("prompt_token_count") or 0
|
380
381
|
)
|
@@ -417,14 +418,15 @@ async def _abuild_from_streaming_response(
|
|
417
418
|
aggregated_usage_metadata = defaultdict(int)
|
418
419
|
model_version = None
|
419
420
|
async for chunk in response:
|
421
|
+
if chunk.model_version:
|
422
|
+
model_version = chunk.model_version
|
423
|
+
|
420
424
|
if chunk.candidates:
|
421
425
|
# Currently gemini throws an error if you pass more than one candidate
|
422
426
|
# with streaming
|
423
427
|
if chunk.candidates and len(chunk.candidates) > 0:
|
424
428
|
final_parts += chunk.candidates[0].content.parts or []
|
425
429
|
role = chunk.candidates[0].content.role or role
|
426
|
-
if chunk.model_version:
|
427
|
-
model_version = chunk.model_version
|
428
430
|
if chunk.usage_metadata:
|
429
431
|
usage_dict = to_dict(chunk.usage_metadata)
|
430
432
|
# prompt token count is sent in every chunk
|
@@ -432,11 +434,12 @@ async def _abuild_from_streaming_response(
|
|
432
434
|
# total token count in every chunk is greater by prompt token count than it should be,
|
433
435
|
# thus this awkward logic here
|
434
436
|
if aggregated_usage_metadata.get("prompt_token_count") is None:
|
435
|
-
|
436
|
-
|
437
|
+
# or 0, not .get(key, 0), because sometimes the value is explicitly None
|
438
|
+
aggregated_usage_metadata["prompt_token_count"] = (
|
439
|
+
usage_dict.get("prompt_token_count") or 0
|
437
440
|
)
|
438
|
-
aggregated_usage_metadata["total_token_count"] =
|
439
|
-
"total_token_count"
|
441
|
+
aggregated_usage_metadata["total_token_count"] = (
|
442
|
+
usage_dict.get("total_token_count") or 0
|
440
443
|
)
|
441
444
|
aggregated_usage_metadata["candidates_token_count"] += (
|
442
445
|
usage_dict.get("candidates_token_count") or 0
|
lmnr/version.py
CHANGED
@@ -13,7 +13,7 @@ lmnr/opentelemetry_lib/opentelemetry/instrumentation/anthropic/span_utils.py,sha
|
|
13
13
|
lmnr/opentelemetry_lib/opentelemetry/instrumentation/anthropic/streaming.py,sha256=7ca9f49e4d9a3bac292d13a8ee9827fdfb8a46d13ebdcbbfbac9c5584d11eaf3,13441
|
14
14
|
lmnr/opentelemetry_lib/opentelemetry/instrumentation/anthropic/utils.py,sha256=0044f02da8b99322fdbf3f8f6663f04ff5d1295ddae92a635fd16eb685d5fbb6,5386
|
15
15
|
lmnr/opentelemetry_lib/opentelemetry/instrumentation/anthropic/version.py,sha256=5aacde4ca55ef50ed07a239ad8a86889e0621b1cc72be19bd93be7c9e20910a9,23
|
16
|
-
lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/__init__.py,sha256=
|
16
|
+
lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/__init__.py,sha256=1eab6773a3c89c207fe0b508555062872cbf37674183a0eb4ed7e20785cef870,20701
|
17
17
|
lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/config.py,sha256=db9cdebc9ee0dccb493ffe608eede3047efec20ed26c3924b72b2e50edbd92c2,245
|
18
18
|
lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/schema_utils.py,sha256=857a6bc52f8bfd4da72786173615d31faaf3f9378f8f6150ffe8f6f9c4bb78f9,685
|
19
19
|
lmnr/opentelemetry_lib/opentelemetry/instrumentation/google_genai/utils.py,sha256=f1248196246826d899304e510c4c2df74088d8169d28f1d0aed578a7a6c3cbfd,7669
|
@@ -93,8 +93,8 @@ lmnr/sdk/laminar.py,sha256=24d680407ce694f1a7ec0e9c0524eae3deb7d638ad5caff3a591d
|
|
93
93
|
lmnr/sdk/log.py,sha256=9edfd83263f0d4845b1b2d1beeae2b4ed3f8628de941f371a893d72b79c348d4,2213
|
94
94
|
lmnr/sdk/types.py,sha256=f8a8368e225c4d2f82df54d92f029065afb60c3eff494c77c6e574963ed524ff,13454
|
95
95
|
lmnr/sdk/utils.py,sha256=0c5a81c305dcd3922f4b31c4f42cf83719c03888725838395adae167de92db76,5019
|
96
|
-
lmnr/version.py,sha256=
|
97
|
-
lmnr-0.7.
|
98
|
-
lmnr-0.7.
|
99
|
-
lmnr-0.7.
|
100
|
-
lmnr-0.7.
|
96
|
+
lmnr/version.py,sha256=fafd83a5d984558d181b537237ee4ba4e9ccbad408b74e243065597b77580152,1321
|
97
|
+
lmnr-0.7.8.dist-info/WHEEL,sha256=ab6157bc637547491fb4567cd7ddf26b04d63382916ca16c29a5c8e94c9c9ef7,79
|
98
|
+
lmnr-0.7.8.dist-info/entry_points.txt,sha256=abdf3411b7dd2d7329a241f2da6669bab4e314a747a586ecdb9f888f3035003c,39
|
99
|
+
lmnr-0.7.8.dist-info/METADATA,sha256=272987c3279723e7609210aef23cf45f706ecd6750fc45d6a0e08d409302acf0,14196
|
100
|
+
lmnr-0.7.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|