openinference-instrumentation-google-adk 0.1.0__py3-none-any.whl → 0.1.1__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.
@@ -25,7 +25,6 @@ from google.adk.models.llm_response import LlmResponse
25
25
  from google.adk.telemetry import _build_llm_request_for_trace
26
26
  from google.adk.tools import BaseTool
27
27
  from google.genai import types
28
- from google.genai.types import MediaModality
29
28
  from opentelemetry import context as context_api
30
29
  from opentelemetry import trace as trace_api
31
30
  from opentelemetry.context import _SUPPRESS_INSTRUMENTATION_KEY
@@ -378,22 +377,44 @@ def _get_attributes_from_llm_response(
378
377
  def _get_attributes_from_usage_metadata(
379
378
  obj: types.GenerateContentResponseUsageMetadata,
380
379
  ) -> Iterator[tuple[str, AttributeValue]]:
381
- if obj.candidates_token_count:
382
- yield SpanAttributes.LLM_TOKEN_COUNT_COMPLETION, obj.candidates_token_count
380
+ if total := obj.total_token_count:
381
+ yield SpanAttributes.LLM_TOKEN_COUNT_TOTAL, total
382
+ if obj.prompt_tokens_details:
383
+ prompt_details_audio = 0
384
+ for modality_token_count in obj.prompt_tokens_details:
385
+ if (
386
+ modality_token_count.modality is types.MediaModality.AUDIO
387
+ and modality_token_count.token_count
388
+ ):
389
+ prompt_details_audio += modality_token_count.token_count
390
+ if prompt_details_audio:
391
+ yield (
392
+ SpanAttributes.LLM_TOKEN_COUNT_PROMPT_DETAILS_AUDIO,
393
+ prompt_details_audio,
394
+ )
395
+ if prompt := obj.prompt_token_count:
396
+ yield SpanAttributes.LLM_TOKEN_COUNT_PROMPT, prompt
383
397
  if obj.candidates_tokens_details:
384
398
  completion_details_audio = 0
385
399
  for modality_token_count in obj.candidates_tokens_details:
386
400
  if (
387
- modality_token_count.modality is MediaModality.AUDIO
401
+ modality_token_count.modality is types.MediaModality.AUDIO
388
402
  and modality_token_count.token_count
389
403
  ):
390
404
  completion_details_audio += modality_token_count.token_count
391
405
  if completion_details_audio:
392
- yield SpanAttributes.LLM_TOKEN_COUNT_COMPLETION_DETAILS_AUDIO, completion_details_audio
393
- if obj.prompt_token_count:
394
- yield SpanAttributes.LLM_TOKEN_COUNT_PROMPT, obj.prompt_token_count
395
- if obj.total_token_count:
396
- yield SpanAttributes.LLM_TOKEN_COUNT_TOTAL, obj.total_token_count
406
+ yield (
407
+ SpanAttributes.LLM_TOKEN_COUNT_COMPLETION_DETAILS_AUDIO,
408
+ completion_details_audio,
409
+ )
410
+ completion = 0
411
+ if candidates := obj.candidates_token_count:
412
+ completion += candidates
413
+ if thoughts := obj.thoughts_token_count:
414
+ yield SpanAttributes.LLM_TOKEN_COUNT_COMPLETION_DETAILS_REASONING, thoughts
415
+ completion += thoughts
416
+ if completion:
417
+ yield SpanAttributes.LLM_TOKEN_COUNT_COMPLETION, completion
397
418
 
398
419
 
399
420
  @stop_on_exception
@@ -1 +1 @@
1
- __version__ = "0.1.0"
1
+ __version__ = "0.1.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openinference-instrumentation-google-adk
3
- Version: 0.1.0
3
+ Version: 0.1.1
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=B-ORzJ7pkc-4IafoI7xzCZ8Mw_CtFQ6DXMbeZ3GTqzo,20162
3
+ openinference/instrumentation/google_adk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ openinference/instrumentation/google_adk/version.py,sha256=rnObPjuBcEStqSO0S6gsdS_ot8ITOQjVj_-P1LUUYpg,22
5
+ openinference_instrumentation_google_adk-0.1.1.dist-info/METADATA,sha256=sceuxu5UhQLSdL3M6g7F76vKpfZQVaoIFkhgyB0NXzs,5194
6
+ openinference_instrumentation_google_adk-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
7
+ openinference_instrumentation_google_adk-0.1.1.dist-info/entry_points.txt,sha256=SW0GBmqra9efyXhsKjeP6OX4vS7BFpzGeHZgrg_LUzw,211
8
+ openinference_instrumentation_google_adk-0.1.1.dist-info/licenses/LICENSE,sha256=x_Y7OX-lWxSUhmKoivlrD6WN3jWlIHxdug8BJv2SI34,10870
9
+ openinference_instrumentation_google_adk-0.1.1.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,,