openinference-instrumentation-google-adk 0.1.0__py3-none-any.whl → 0.1.2__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.
- openinference/instrumentation/google_adk/_wrappers.py +36 -17
- openinference/instrumentation/google_adk/version.py +1 -1
- {openinference_instrumentation_google_adk-0.1.0.dist-info → openinference_instrumentation_google_adk-0.1.2.dist-info}/METADATA +1 -1
- openinference_instrumentation_google_adk-0.1.2.dist-info/RECORD +9 -0
- openinference_instrumentation_google_adk-0.1.0.dist-info/RECORD +0 -9
- {openinference_instrumentation_google_adk-0.1.0.dist-info → openinference_instrumentation_google_adk-0.1.2.dist-info}/WHEEL +0 -0
- {openinference_instrumentation_google_adk-0.1.0.dist-info → openinference_instrumentation_google_adk-0.1.2.dist-info}/entry_points.txt +0 -0
- {openinference_instrumentation_google_adk-0.1.0.dist-info → openinference_instrumentation_google_adk-0.1.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import base64
|
|
1
2
|
import inspect
|
|
2
3
|
import json
|
|
3
4
|
import logging
|
|
@@ -25,7 +26,6 @@ from google.adk.models.llm_response import LlmResponse
|
|
|
25
26
|
from google.adk.telemetry import _build_llm_request_for_trace
|
|
26
27
|
from google.adk.tools import BaseTool
|
|
27
28
|
from google.genai import types
|
|
28
|
-
from google.genai.types import MediaModality
|
|
29
29
|
from opentelemetry import context as context_api
|
|
30
30
|
from opentelemetry import trace as trace_api
|
|
31
31
|
from opentelemetry.context import _SUPPRESS_INSTRUMENTATION_KEY
|
|
@@ -378,22 +378,44 @@ def _get_attributes_from_llm_response(
|
|
|
378
378
|
def _get_attributes_from_usage_metadata(
|
|
379
379
|
obj: types.GenerateContentResponseUsageMetadata,
|
|
380
380
|
) -> Iterator[tuple[str, AttributeValue]]:
|
|
381
|
-
if obj.
|
|
382
|
-
yield SpanAttributes.
|
|
381
|
+
if total := obj.total_token_count:
|
|
382
|
+
yield SpanAttributes.LLM_TOKEN_COUNT_TOTAL, total
|
|
383
|
+
if obj.prompt_tokens_details:
|
|
384
|
+
prompt_details_audio = 0
|
|
385
|
+
for modality_token_count in obj.prompt_tokens_details:
|
|
386
|
+
if (
|
|
387
|
+
modality_token_count.modality is types.MediaModality.AUDIO
|
|
388
|
+
and modality_token_count.token_count
|
|
389
|
+
):
|
|
390
|
+
prompt_details_audio += modality_token_count.token_count
|
|
391
|
+
if prompt_details_audio:
|
|
392
|
+
yield (
|
|
393
|
+
SpanAttributes.LLM_TOKEN_COUNT_PROMPT_DETAILS_AUDIO,
|
|
394
|
+
prompt_details_audio,
|
|
395
|
+
)
|
|
396
|
+
if prompt := obj.prompt_token_count:
|
|
397
|
+
yield SpanAttributes.LLM_TOKEN_COUNT_PROMPT, prompt
|
|
383
398
|
if obj.candidates_tokens_details:
|
|
384
399
|
completion_details_audio = 0
|
|
385
400
|
for modality_token_count in obj.candidates_tokens_details:
|
|
386
401
|
if (
|
|
387
|
-
modality_token_count.modality is MediaModality.AUDIO
|
|
402
|
+
modality_token_count.modality is types.MediaModality.AUDIO
|
|
388
403
|
and modality_token_count.token_count
|
|
389
404
|
):
|
|
390
405
|
completion_details_audio += modality_token_count.token_count
|
|
391
406
|
if completion_details_audio:
|
|
392
|
-
yield
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
407
|
+
yield (
|
|
408
|
+
SpanAttributes.LLM_TOKEN_COUNT_COMPLETION_DETAILS_AUDIO,
|
|
409
|
+
completion_details_audio,
|
|
410
|
+
)
|
|
411
|
+
completion = 0
|
|
412
|
+
if candidates := obj.candidates_token_count:
|
|
413
|
+
completion += candidates
|
|
414
|
+
if thoughts := obj.thoughts_token_count:
|
|
415
|
+
yield SpanAttributes.LLM_TOKEN_COUNT_COMPLETION_DETAILS_REASONING, thoughts
|
|
416
|
+
completion += thoughts
|
|
417
|
+
if completion:
|
|
418
|
+
yield SpanAttributes.LLM_TOKEN_COUNT_COMPLETION, completion
|
|
397
419
|
|
|
398
420
|
|
|
399
421
|
@stop_on_exception
|
|
@@ -509,14 +531,11 @@ def bind_args_kwargs(func: Any, *args: Any, **kwargs: Any) -> OrderedDict[str, A
|
|
|
509
531
|
return bound.arguments
|
|
510
532
|
|
|
511
533
|
|
|
512
|
-
def _default(obj: Any) ->
|
|
534
|
+
def _default(obj: Any) -> Any:
|
|
513
535
|
from pydantic import BaseModel
|
|
514
536
|
|
|
515
537
|
if isinstance(obj, BaseModel):
|
|
516
|
-
return
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
)
|
|
521
|
-
else:
|
|
522
|
-
return str(obj)
|
|
538
|
+
return obj.model_dump(exclude_none=True)
|
|
539
|
+
if isinstance(obj, bytes):
|
|
540
|
+
return base64.b64encode(obj).decode()
|
|
541
|
+
return str(obj)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.2"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openinference-instrumentation-google-adk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: OpenInference Google ADK Instrumentation
|
|
5
5
|
Project-URL: Homepage, https://github.com/Arize-ai/openinference/tree/main/python/instrumentation/openinference-instrumentation-google-adk
|
|
6
6
|
Author-email: OpenInference Authors <oss@arize.com>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
openinference/instrumentation/google_adk/__init__.py,sha256=HxZ58OnPWAfiCeyEnZom7TmxNKc1kHhuGWkrwFYba2c,6922
|
|
2
|
+
openinference/instrumentation/google_adk/_wrappers.py,sha256=qQA13xHO5qDD6mcTXl3WCEORRUTX4YYjLUwd0dYE9Gg,20152
|
|
3
|
+
openinference/instrumentation/google_adk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
openinference/instrumentation/google_adk/version.py,sha256=YvuYzWnKtqBb-IqG8HAu-nhIYAsgj9Vmc_b9o7vO-js,22
|
|
5
|
+
openinference_instrumentation_google_adk-0.1.2.dist-info/METADATA,sha256=DhOeXbKW2YrRY15khmhJqcLJomAlaY3UtptYhaXCT8c,5194
|
|
6
|
+
openinference_instrumentation_google_adk-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
+
openinference_instrumentation_google_adk-0.1.2.dist-info/entry_points.txt,sha256=SW0GBmqra9efyXhsKjeP6OX4vS7BFpzGeHZgrg_LUzw,211
|
|
8
|
+
openinference_instrumentation_google_adk-0.1.2.dist-info/licenses/LICENSE,sha256=x_Y7OX-lWxSUhmKoivlrD6WN3jWlIHxdug8BJv2SI34,10870
|
|
9
|
+
openinference_instrumentation_google_adk-0.1.2.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
openinference/instrumentation/google_adk/__init__.py,sha256=HxZ58OnPWAfiCeyEnZom7TmxNKc1kHhuGWkrwFYba2c,6922
|
|
2
|
-
openinference/instrumentation/google_adk/_wrappers.py,sha256=T48Dvxre-2vHLzWVpPU7QN2LJB2RCUE5yhgx-SwgbIw,19399
|
|
3
|
-
openinference/instrumentation/google_adk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
openinference/instrumentation/google_adk/version.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
|
|
5
|
-
openinference_instrumentation_google_adk-0.1.0.dist-info/METADATA,sha256=oXPdjGz6oXLaq8-_vajAPh5FKgQvp8aVw76EQQU3n2E,5194
|
|
6
|
-
openinference_instrumentation_google_adk-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
7
|
-
openinference_instrumentation_google_adk-0.1.0.dist-info/entry_points.txt,sha256=SW0GBmqra9efyXhsKjeP6OX4vS7BFpzGeHZgrg_LUzw,211
|
|
8
|
-
openinference_instrumentation_google_adk-0.1.0.dist-info/licenses/LICENSE,sha256=x_Y7OX-lWxSUhmKoivlrD6WN3jWlIHxdug8BJv2SI34,10870
|
|
9
|
-
openinference_instrumentation_google_adk-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|