openinference-instrumentation-google-adk 0.1.8__py3-none-any.whl → 0.1.9__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 +29 -0
- openinference/instrumentation/google_adk/version.py +1 -1
- {openinference_instrumentation_google_adk-0.1.8.dist-info → openinference_instrumentation_google_adk-0.1.9.dist-info}/METADATA +1 -1
- openinference_instrumentation_google_adk-0.1.9.dist-info/RECORD +9 -0
- openinference_instrumentation_google_adk-0.1.8.dist-info/RECORD +0 -9
- {openinference_instrumentation_google_adk-0.1.8.dist-info → openinference_instrumentation_google_adk-0.1.9.dist-info}/WHEEL +0 -0
- {openinference_instrumentation_google_adk-0.1.8.dist-info → openinference_instrumentation_google_adk-0.1.9.dist-info}/entry_points.txt +0 -0
- {openinference_instrumentation_google_adk-0.1.8.dist-info → openinference_instrumentation_google_adk-0.1.9.dist-info}/licenses/LICENSE +0 -0
|
@@ -25,6 +25,7 @@ from google.adk.models.llm_request import LlmRequest
|
|
|
25
25
|
from google.adk.models.llm_response import LlmResponse
|
|
26
26
|
from google.adk.tools.base_tool import BaseTool
|
|
27
27
|
from google.genai import types
|
|
28
|
+
from google.genai.types import Blob
|
|
28
29
|
from opentelemetry import context as context_api
|
|
29
30
|
from opentelemetry import trace as trace_api
|
|
30
31
|
from opentelemetry.context import _SUPPRESS_INSTRUMENTATION_KEY
|
|
@@ -39,6 +40,7 @@ from openinference.instrumentation import (
|
|
|
39
40
|
using_user,
|
|
40
41
|
)
|
|
41
42
|
from openinference.semconv.trace import (
|
|
43
|
+
ImageAttributes,
|
|
42
44
|
MessageAttributes,
|
|
43
45
|
MessageContentAttributes,
|
|
44
46
|
OpenInferenceLLMProviderValues,
|
|
@@ -440,6 +442,27 @@ def _get_attributes_from_content(
|
|
|
440
442
|
)
|
|
441
443
|
|
|
442
444
|
|
|
445
|
+
def _get_attributes_from_inline_data(
|
|
446
|
+
inline_data: Blob, prefix: str = ""
|
|
447
|
+
) -> Iterator[tuple[str, AttributeValue]]:
|
|
448
|
+
# inline_data is typically a Blob-like object with `.data` (bytes)
|
|
449
|
+
# and `.mime_type` (str). Encode the bytes as base64 and record
|
|
450
|
+
# it as an image content attribute, along with the mime type.
|
|
451
|
+
try:
|
|
452
|
+
mime_type = inline_data.mime_type
|
|
453
|
+
data = inline_data.data
|
|
454
|
+
if data and mime_type and "image" in mime_type:
|
|
455
|
+
image_url = f"data:{inline_data.mime_type};base64,{base64.b64encode(data).decode()}"
|
|
456
|
+
yield (
|
|
457
|
+
f"{prefix}{MessageContentAttributes.MESSAGE_CONTENT_IMAGE}.{ImageAttributes.IMAGE_URL}",
|
|
458
|
+
image_url,
|
|
459
|
+
)
|
|
460
|
+
yield f"{prefix}{MessageContentAttributes.MESSAGE_CONTENT_TYPE}", "image"
|
|
461
|
+
|
|
462
|
+
except Exception:
|
|
463
|
+
logger.debug("Failed to extract file data attributes.")
|
|
464
|
+
|
|
465
|
+
|
|
443
466
|
@stop_on_exception
|
|
444
467
|
def _get_attributes_from_parts(
|
|
445
468
|
obj: Iterable[types.Part],
|
|
@@ -475,6 +498,9 @@ def _get_attributes_from_parts(
|
|
|
475
498
|
safe_json_dumps(function_response.response),
|
|
476
499
|
)
|
|
477
500
|
message_index += 1
|
|
501
|
+
elif inline_data := part.inline_data:
|
|
502
|
+
prefix = f"{span_attribute}.{message_index}.{MESSAGE_CONTENTS}.{i}."
|
|
503
|
+
yield from _get_attributes_from_inline_data(inline_data, prefix)
|
|
478
504
|
|
|
479
505
|
|
|
480
506
|
@stop_on_exception
|
|
@@ -555,3 +581,6 @@ def _default(obj: Any) -> Any:
|
|
|
555
581
|
if isinstance(obj, bytes):
|
|
556
582
|
return base64.b64encode(obj).decode()
|
|
557
583
|
return str(obj)
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
MESSAGE_CONTENTS = MessageAttributes.MESSAGE_CONTENTS
|
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.1.
|
|
1
|
+
__version__ = "0.1.9"
|
|
@@ -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.9
|
|
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=sCrItt4ilGC3u5hHbjw8papCk_yhUbdur0pzAEg0SIY,7012
|
|
2
|
+
openinference/instrumentation/google_adk/_wrappers.py,sha256=CWRgi4BqfmpkW04xd75xNRij_-8mdxiJz7eMrR5SOYM,22081
|
|
3
|
+
openinference/instrumentation/google_adk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
openinference/instrumentation/google_adk/version.py,sha256=XIaxbMbyiP-L3kguR1GhxirFblTXiHR1lMfDVITvHUI,22
|
|
5
|
+
openinference_instrumentation_google_adk-0.1.9.dist-info/METADATA,sha256=fwoPJQaJGApSy3HlP29NMVLWLdQ9_XK0Cd2r8dhPH68,5245
|
|
6
|
+
openinference_instrumentation_google_adk-0.1.9.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
7
|
+
openinference_instrumentation_google_adk-0.1.9.dist-info/entry_points.txt,sha256=SW0GBmqra9efyXhsKjeP6OX4vS7BFpzGeHZgrg_LUzw,211
|
|
8
|
+
openinference_instrumentation_google_adk-0.1.9.dist-info/licenses/LICENSE,sha256=x_Y7OX-lWxSUhmKoivlrD6WN3jWlIHxdug8BJv2SI34,10870
|
|
9
|
+
openinference_instrumentation_google_adk-0.1.9.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
openinference/instrumentation/google_adk/__init__.py,sha256=sCrItt4ilGC3u5hHbjw8papCk_yhUbdur0pzAEg0SIY,7012
|
|
2
|
-
openinference/instrumentation/google_adk/_wrappers.py,sha256=tQ5lg0KQyqjoBwlmb1ZDBtMet9vS2cljFc2tBbcNYAs,20861
|
|
3
|
-
openinference/instrumentation/google_adk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
openinference/instrumentation/google_adk/version.py,sha256=C69ADlbQREQlR15trneyA2sk8x0-oH4rDAX5fsv19_U,22
|
|
5
|
-
openinference_instrumentation_google_adk-0.1.8.dist-info/METADATA,sha256=tXh_G-vNKDAH2g8VbEKJ0wkHpZHRda5Jl714S8xDkE8,5245
|
|
6
|
-
openinference_instrumentation_google_adk-0.1.8.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
7
|
-
openinference_instrumentation_google_adk-0.1.8.dist-info/entry_points.txt,sha256=SW0GBmqra9efyXhsKjeP6OX4vS7BFpzGeHZgrg_LUzw,211
|
|
8
|
-
openinference_instrumentation_google_adk-0.1.8.dist-info/licenses/LICENSE,sha256=x_Y7OX-lWxSUhmKoivlrD6WN3jWlIHxdug8BJv2SI34,10870
|
|
9
|
-
openinference_instrumentation_google_adk-0.1.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|