openinference-instrumentation-google-adk 0.1.7__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 +30 -0
- openinference/instrumentation/google_adk/version.py +1 -1
- {openinference_instrumentation_google_adk-0.1.7.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.7.dist-info/RECORD +0 -9
- {openinference_instrumentation_google_adk-0.1.7.dist-info → openinference_instrumentation_google_adk-0.1.9.dist-info}/WHEEL +0 -0
- {openinference_instrumentation_google_adk-0.1.7.dist-info → openinference_instrumentation_google_adk-0.1.9.dist-info}/entry_points.txt +0 -0
- {openinference_instrumentation_google_adk-0.1.7.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,
|
|
@@ -159,6 +161,7 @@ class _BaseAgentRunAsync(_WithTracer):
|
|
|
159
161
|
name = f"agent_run [{instance.name}]"
|
|
160
162
|
attributes = dict(get_attributes_from_context())
|
|
161
163
|
attributes[SpanAttributes.OPENINFERENCE_SPAN_KIND] = OpenInferenceSpanKindValues.AGENT.value
|
|
164
|
+
attributes[SpanAttributes.AGENT_NAME] = instance.name
|
|
162
165
|
|
|
163
166
|
class _AsyncGenerator(wrapt.ObjectProxy): # type: ignore[misc]
|
|
164
167
|
__wrapped__: AsyncGenerator[Event, None]
|
|
@@ -439,6 +442,27 @@ def _get_attributes_from_content(
|
|
|
439
442
|
)
|
|
440
443
|
|
|
441
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
|
+
|
|
442
466
|
@stop_on_exception
|
|
443
467
|
def _get_attributes_from_parts(
|
|
444
468
|
obj: Iterable[types.Part],
|
|
@@ -474,6 +498,9 @@ def _get_attributes_from_parts(
|
|
|
474
498
|
safe_json_dumps(function_response.response),
|
|
475
499
|
)
|
|
476
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)
|
|
477
504
|
|
|
478
505
|
|
|
479
506
|
@stop_on_exception
|
|
@@ -554,3 +581,6 @@ def _default(obj: Any) -> Any:
|
|
|
554
581
|
if isinstance(obj, bytes):
|
|
555
582
|
return base64.b64encode(obj).decode()
|
|
556
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=-HOKXlJJZ_xeIloaH22bVeuKd0OQBp51SWJ2glmlV80,20799
|
|
3
|
-
openinference/instrumentation/google_adk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
openinference/instrumentation/google_adk/version.py,sha256=YpKDcdV7CqL8n45u267wKtyloM13FSVbOdrqgNZnSLM,22
|
|
5
|
-
openinference_instrumentation_google_adk-0.1.7.dist-info/METADATA,sha256=Uz6lLP874V1VtNsYa-om4ezi5Jtpf6-jh5DdRc8B8Bc,5245
|
|
6
|
-
openinference_instrumentation_google_adk-0.1.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
7
|
-
openinference_instrumentation_google_adk-0.1.7.dist-info/entry_points.txt,sha256=SW0GBmqra9efyXhsKjeP6OX4vS7BFpzGeHZgrg_LUzw,211
|
|
8
|
-
openinference_instrumentation_google_adk-0.1.7.dist-info/licenses/LICENSE,sha256=x_Y7OX-lWxSUhmKoivlrD6WN3jWlIHxdug8BJv2SI34,10870
|
|
9
|
-
openinference_instrumentation_google_adk-0.1.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|