openinference-instrumentation-google-adk 0.1.5__tar.gz → 0.1.7__tar.gz
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-0.1.5 → openinference_instrumentation_google_adk-0.1.7}/PKG-INFO +3 -2
- {openinference_instrumentation_google_adk-0.1.5 → openinference_instrumentation_google_adk-0.1.7}/pyproject.toml +2 -1
- {openinference_instrumentation_google_adk-0.1.5 → openinference_instrumentation_google_adk-0.1.7}/src/openinference/instrumentation/google_adk/__init__.py +2 -2
- {openinference_instrumentation_google_adk-0.1.5 → openinference_instrumentation_google_adk-0.1.7}/src/openinference/instrumentation/google_adk/_wrappers.py +20 -9
- openinference_instrumentation_google_adk-0.1.7/src/openinference/instrumentation/google_adk/version.py +1 -0
- openinference_instrumentation_google_adk-0.1.5/src/openinference/instrumentation/google_adk/version.py +0 -1
- {openinference_instrumentation_google_adk-0.1.5 → openinference_instrumentation_google_adk-0.1.7}/.gitignore +0 -0
- {openinference_instrumentation_google_adk-0.1.5 → openinference_instrumentation_google_adk-0.1.7}/LICENSE +0 -0
- {openinference_instrumentation_google_adk-0.1.5 → openinference_instrumentation_google_adk-0.1.7}/README.md +0 -0
- {openinference_instrumentation_google_adk-0.1.5 → openinference_instrumentation_google_adk-0.1.7}/src/openinference/instrumentation/google_adk/py.typed +0 -0
|
@@ -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.7
|
|
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>
|
|
@@ -16,7 +16,8 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
-
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Requires-Python: <3.15,>=3.9
|
|
20
21
|
Requires-Dist: openinference-instrumentation>=0.1.32
|
|
21
22
|
Requires-Dist: openinference-semantic-conventions>=0.1.17
|
|
22
23
|
Requires-Dist: opentelemetry-api
|
|
@@ -8,7 +8,7 @@ dynamic = ["version"]
|
|
|
8
8
|
description = "OpenInference Google ADK Instrumentation"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|
|
11
|
-
requires-python = ">=3.9, <3.
|
|
11
|
+
requires-python = ">=3.9, <3.15"
|
|
12
12
|
authors = [
|
|
13
13
|
{ name = "OpenInference Authors", email = "oss@arize.com" },
|
|
14
14
|
]
|
|
@@ -23,6 +23,7 @@ classifiers = [
|
|
|
23
23
|
"Programming Language :: Python :: 3.11",
|
|
24
24
|
"Programming Language :: Python :: 3.12",
|
|
25
25
|
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Programming Language :: Python :: 3.14",
|
|
26
27
|
]
|
|
27
28
|
dependencies = [
|
|
28
29
|
"opentelemetry-api",
|
|
@@ -144,7 +144,7 @@ class GoogleADKInstrumentor(BaseInstrumentor): # type: ignore
|
|
|
144
144
|
|
|
145
145
|
setattr(runners, "tracer", _PassthroughTracer(tracer))
|
|
146
146
|
|
|
147
|
-
from google.adk.agents.base_agent import (
|
|
147
|
+
from google.adk.agents.base_agent import ( # type: ignore[attr-defined, unused-ignore]
|
|
148
148
|
tracer, # pyright: ignore[reportPrivateImportUsage]
|
|
149
149
|
)
|
|
150
150
|
|
|
@@ -164,7 +164,7 @@ class GoogleADKInstrumentor(BaseInstrumentor): # type: ignore
|
|
|
164
164
|
|
|
165
165
|
setattr(runners, "tracer", original)
|
|
166
166
|
|
|
167
|
-
from google.adk.agents.base_agent import (
|
|
167
|
+
from google.adk.agents.base_agent import ( # type: ignore[attr-defined, unused-ignore]
|
|
168
168
|
tracer, # pyright: ignore[reportPrivateImportUsage]
|
|
169
169
|
)
|
|
170
170
|
|
|
@@ -23,7 +23,7 @@ from google.adk.agents.run_config import RunConfig
|
|
|
23
23
|
from google.adk.events import Event
|
|
24
24
|
from google.adk.models.llm_request import LlmRequest
|
|
25
25
|
from google.adk.models.llm_response import LlmResponse
|
|
26
|
-
from google.adk.tools import BaseTool
|
|
26
|
+
from google.adk.tools.base_tool import BaseTool
|
|
27
27
|
from google.genai import types
|
|
28
28
|
from opentelemetry import context as context_api
|
|
29
29
|
from opentelemetry import trace as trace_api
|
|
@@ -260,7 +260,8 @@ class _TraceCallLlm(_WithTracer):
|
|
|
260
260
|
if system_instruction.parts:
|
|
261
261
|
for k, v in _get_attributes_from_parts(
|
|
262
262
|
system_instruction.parts,
|
|
263
|
-
|
|
263
|
+
span_attribute=SpanAttributes.LLM_INPUT_MESSAGES,
|
|
264
|
+
message_index=input_messages_index,
|
|
264
265
|
text_only=True,
|
|
265
266
|
):
|
|
266
267
|
span.set_attribute(k, v)
|
|
@@ -273,7 +274,8 @@ class _TraceCallLlm(_WithTracer):
|
|
|
273
274
|
for i, content in enumerate(contents, input_messages_index):
|
|
274
275
|
for k, v in _get_attributes_from_content(
|
|
275
276
|
content,
|
|
276
|
-
|
|
277
|
+
span_attribute=SpanAttributes.LLM_INPUT_MESSAGES,
|
|
278
|
+
message_index=i,
|
|
277
279
|
):
|
|
278
280
|
span.set_attribute(k, v)
|
|
279
281
|
if llm_response:
|
|
@@ -372,7 +374,7 @@ def _get_attributes_from_llm_response(
|
|
|
372
374
|
yield from _get_attributes_from_usage_metadata(obj.usage_metadata)
|
|
373
375
|
if obj.content:
|
|
374
376
|
yield from _get_attributes_from_content(
|
|
375
|
-
obj.content,
|
|
377
|
+
obj.content, span_attribute=SpanAttributes.LLM_OUTPUT_MESSAGES, message_index=0
|
|
376
378
|
)
|
|
377
379
|
|
|
378
380
|
|
|
@@ -425,12 +427,16 @@ def _get_attributes_from_content(
|
|
|
425
427
|
obj: types.Content,
|
|
426
428
|
/,
|
|
427
429
|
*,
|
|
428
|
-
|
|
430
|
+
span_attribute: str = SpanAttributes.LLM_INPUT_MESSAGES,
|
|
431
|
+
message_index: int = 0,
|
|
429
432
|
) -> Iterator[tuple[str, AttributeValue]]:
|
|
430
433
|
role = obj.role or "user"
|
|
434
|
+
prefix = f"{span_attribute}.{message_index}."
|
|
431
435
|
yield f"{prefix}{MessageAttributes.MESSAGE_ROLE}", role
|
|
432
436
|
if parts := obj.parts:
|
|
433
|
-
yield from _get_attributes_from_parts(
|
|
437
|
+
yield from _get_attributes_from_parts(
|
|
438
|
+
parts, span_attribute=span_attribute, message_index=message_index
|
|
439
|
+
)
|
|
434
440
|
|
|
435
441
|
|
|
436
442
|
@stop_on_exception
|
|
@@ -438,23 +444,27 @@ def _get_attributes_from_parts(
|
|
|
438
444
|
obj: Iterable[types.Part],
|
|
439
445
|
/,
|
|
440
446
|
*,
|
|
441
|
-
|
|
447
|
+
span_attribute: str = SpanAttributes.LLM_INPUT_MESSAGES,
|
|
448
|
+
message_index: int = 0,
|
|
442
449
|
text_only: bool = False,
|
|
443
450
|
) -> Iterator[tuple[str, AttributeValue]]:
|
|
444
451
|
for i, part in enumerate(obj):
|
|
445
452
|
if (text := part.text) is not None:
|
|
453
|
+
prefix = f"{span_attribute}.{message_index}.{MessageAttributes.MESSAGE_CONTENTS}.{i}."
|
|
446
454
|
yield from _get_attributes_from_text_part(
|
|
447
455
|
text,
|
|
448
|
-
prefix=
|
|
456
|
+
prefix=prefix,
|
|
449
457
|
)
|
|
450
458
|
elif text_only:
|
|
451
459
|
continue
|
|
452
460
|
elif (function_call := part.function_call) is not None:
|
|
461
|
+
prefix = f"{span_attribute}.{message_index}.{MessageAttributes.MESSAGE_TOOL_CALLS}.{i}."
|
|
453
462
|
yield from _get_attributes_from_function_call(
|
|
454
463
|
function_call,
|
|
455
|
-
prefix=
|
|
464
|
+
prefix=prefix,
|
|
456
465
|
)
|
|
457
466
|
elif (function_response := part.function_response) is not None:
|
|
467
|
+
prefix = f"{span_attribute}.{message_index}."
|
|
458
468
|
yield f"{prefix}{MessageAttributes.MESSAGE_ROLE}", "tool"
|
|
459
469
|
if function_response.name:
|
|
460
470
|
yield f"{prefix}{MessageAttributes.MESSAGE_NAME}", function_response.name
|
|
@@ -463,6 +473,7 @@ def _get_attributes_from_parts(
|
|
|
463
473
|
f"{prefix}{MessageAttributes.MESSAGE_CONTENT}",
|
|
464
474
|
safe_json_dumps(function_response.response),
|
|
465
475
|
)
|
|
476
|
+
message_index += 1
|
|
466
477
|
|
|
467
478
|
|
|
468
479
|
@stop_on_exception
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.7"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.5"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|