opentelemetry-instrumentation-vertexai 0.24.0__tar.gz → 0.25.1__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.
Potentially problematic release.
This version of opentelemetry-instrumentation-vertexai might be problematic. Click here for more details.
- {opentelemetry_instrumentation_vertexai-0.24.0 → opentelemetry_instrumentation_vertexai-0.25.1}/PKG-INFO +2 -2
- {opentelemetry_instrumentation_vertexai-0.24.0 → opentelemetry_instrumentation_vertexai-0.25.1}/opentelemetry/instrumentation/vertexai/__init__.py +34 -12
- opentelemetry_instrumentation_vertexai-0.25.1/opentelemetry/instrumentation/vertexai/version.py +1 -0
- {opentelemetry_instrumentation_vertexai-0.24.0 → opentelemetry_instrumentation_vertexai-0.25.1}/pyproject.toml +2 -2
- opentelemetry_instrumentation_vertexai-0.24.0/opentelemetry/instrumentation/vertexai/version.py +0 -1
- {opentelemetry_instrumentation_vertexai-0.24.0 → opentelemetry_instrumentation_vertexai-0.25.1}/README.md +0 -0
- {opentelemetry_instrumentation_vertexai-0.24.0 → opentelemetry_instrumentation_vertexai-0.25.1}/opentelemetry/instrumentation/vertexai/config.py +0 -0
- {opentelemetry_instrumentation_vertexai-0.24.0 → opentelemetry_instrumentation_vertexai-0.25.1}/opentelemetry/instrumentation/vertexai/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: opentelemetry-instrumentation-vertexai
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.25.1
|
|
4
4
|
Summary: OpenTelemetry Vertex AI instrumentation
|
|
5
5
|
Home-page: https://github.com/traceloop/openllmetry/tree/main/packages/opentelemetry-instrumentation-vertexai
|
|
6
6
|
License: Apache-2.0
|
|
@@ -17,7 +17,7 @@ Provides-Extra: instruments
|
|
|
17
17
|
Requires-Dist: opentelemetry-api (>=1.25.0,<2.0.0)
|
|
18
18
|
Requires-Dist: opentelemetry-instrumentation (>=0.46b0,<0.47)
|
|
19
19
|
Requires-Dist: opentelemetry-semantic-conventions (>=0.46b0,<0.47)
|
|
20
|
-
Requires-Dist: opentelemetry-semantic-conventions-ai (==0.3.
|
|
20
|
+
Requires-Dist: opentelemetry-semantic-conventions-ai (==0.3.4)
|
|
21
21
|
Project-URL: Repository, https://github.com/traceloop/openllmetry/tree/main/packages/opentelemetry-instrumentation-vertexai
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
|
|
@@ -15,7 +15,11 @@ from opentelemetry.trace.status import Status, StatusCode
|
|
|
15
15
|
from opentelemetry.instrumentation.instrumentor import BaseInstrumentor
|
|
16
16
|
from opentelemetry.instrumentation.utils import _SUPPRESS_INSTRUMENTATION_KEY, unwrap
|
|
17
17
|
|
|
18
|
-
from opentelemetry.semconv.ai import
|
|
18
|
+
from opentelemetry.semconv.ai import (
|
|
19
|
+
SUPPRESS_LANGUAGE_MODEL_INSTRUMENTATION_KEY,
|
|
20
|
+
SpanAttributes,
|
|
21
|
+
LLMRequestTypeValues,
|
|
22
|
+
)
|
|
19
23
|
from opentelemetry.instrumentation.vertexai.version import __version__
|
|
20
24
|
|
|
21
25
|
logger = logging.getLogger(__name__)
|
|
@@ -88,7 +92,7 @@ WRAPPED_METHODS = [
|
|
|
88
92
|
|
|
89
93
|
def should_send_prompts():
|
|
90
94
|
return (
|
|
91
|
-
|
|
95
|
+
os.getenv("TRACELOOP_TRACE_CONTENT") or "true"
|
|
92
96
|
).lower() == "true" or context_api.get_value("override_enable_content_tracing")
|
|
93
97
|
|
|
94
98
|
|
|
@@ -124,15 +128,23 @@ def _set_input_attributes(span, args, kwargs, llm_model):
|
|
|
124
128
|
)
|
|
125
129
|
|
|
126
130
|
_set_span_attribute(span, SpanAttributes.LLM_REQUEST_MODEL, llm_model)
|
|
127
|
-
_set_span_attribute(
|
|
128
|
-
|
|
131
|
+
_set_span_attribute(
|
|
132
|
+
span, f"{SpanAttributes.LLM_PROMPTS}.0.user", kwargs.get("prompt")
|
|
133
|
+
)
|
|
134
|
+
_set_span_attribute(
|
|
135
|
+
span, SpanAttributes.LLM_REQUEST_TEMPERATURE, kwargs.get("temperature")
|
|
136
|
+
)
|
|
129
137
|
_set_span_attribute(
|
|
130
138
|
span, SpanAttributes.LLM_REQUEST_MAX_TOKENS, kwargs.get("max_output_tokens")
|
|
131
139
|
)
|
|
132
140
|
_set_span_attribute(span, SpanAttributes.LLM_REQUEST_TOP_P, kwargs.get("top_p"))
|
|
133
141
|
_set_span_attribute(span, SpanAttributes.LLM_TOP_K, kwargs.get("top_k"))
|
|
134
|
-
_set_span_attribute(
|
|
135
|
-
|
|
142
|
+
_set_span_attribute(
|
|
143
|
+
span, SpanAttributes.LLM_PRESENCE_PENALTY, kwargs.get("presence_penalty")
|
|
144
|
+
)
|
|
145
|
+
_set_span_attribute(
|
|
146
|
+
span, SpanAttributes.LLM_FREQUENCY_PENALTY, kwargs.get("frequency_penalty")
|
|
147
|
+
)
|
|
136
148
|
|
|
137
149
|
return
|
|
138
150
|
|
|
@@ -142,7 +154,9 @@ def _set_response_attributes(span, response, llm_model):
|
|
|
142
154
|
_set_span_attribute(span, SpanAttributes.LLM_RESPONSE_MODEL, llm_model)
|
|
143
155
|
|
|
144
156
|
if hasattr(response, "text"):
|
|
145
|
-
if hasattr(response, "_raw_response") and hasattr(
|
|
157
|
+
if hasattr(response, "_raw_response") and hasattr(
|
|
158
|
+
response._raw_response, "usage_metadata"
|
|
159
|
+
):
|
|
146
160
|
_set_span_attribute(
|
|
147
161
|
span,
|
|
148
162
|
SpanAttributes.LLM_USAGE_TOTAL_TOKENS,
|
|
@@ -164,14 +178,18 @@ def _set_response_attributes(span, response, llm_model):
|
|
|
164
178
|
prefix = f"{SpanAttributes.LLM_COMPLETIONS}.{index}"
|
|
165
179
|
_set_span_attribute(span, f"{prefix}.content", item.text)
|
|
166
180
|
elif isinstance(response.text, str):
|
|
167
|
-
_set_span_attribute(
|
|
181
|
+
_set_span_attribute(
|
|
182
|
+
span, f"{SpanAttributes.LLM_COMPLETIONS}.0.content", response.text
|
|
183
|
+
)
|
|
168
184
|
else:
|
|
169
185
|
if isinstance(response, list):
|
|
170
186
|
for index, item in enumerate(response):
|
|
171
187
|
prefix = f"{SpanAttributes.LLM_COMPLETIONS}.{index}"
|
|
172
188
|
_set_span_attribute(span, f"{prefix}.content", item)
|
|
173
189
|
elif isinstance(response, str):
|
|
174
|
-
_set_span_attribute(
|
|
190
|
+
_set_span_attribute(
|
|
191
|
+
span, f"{SpanAttributes.LLM_COMPLETIONS}.0.content", response
|
|
192
|
+
)
|
|
175
193
|
|
|
176
194
|
return
|
|
177
195
|
|
|
@@ -233,8 +251,10 @@ def _with_tracer_wrapper(func):
|
|
|
233
251
|
@_with_tracer_wrapper
|
|
234
252
|
async def _awrap(tracer, to_wrap, wrapped, instance, args, kwargs):
|
|
235
253
|
"""Instruments and calls every function defined in TO_WRAP."""
|
|
236
|
-
if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY)
|
|
237
|
-
|
|
254
|
+
if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY) or context_api.get_value(
|
|
255
|
+
SUPPRESS_LANGUAGE_MODEL_INSTRUMENTATION_KEY
|
|
256
|
+
):
|
|
257
|
+
return wrapped(*args, **kwargs)
|
|
238
258
|
|
|
239
259
|
llm_model = "unknown"
|
|
240
260
|
if hasattr(instance, "_model_id"):
|
|
@@ -271,7 +291,9 @@ async def _awrap(tracer, to_wrap, wrapped, instance, args, kwargs):
|
|
|
271
291
|
@_with_tracer_wrapper
|
|
272
292
|
def _wrap(tracer, to_wrap, wrapped, instance, args, kwargs):
|
|
273
293
|
"""Instruments and calls every function defined in TO_WRAP."""
|
|
274
|
-
if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY)
|
|
294
|
+
if context_api.get_value(_SUPPRESS_INSTRUMENTATION_KEY) or context_api.get_value(
|
|
295
|
+
SUPPRESS_LANGUAGE_MODEL_INSTRUMENTATION_KEY
|
|
296
|
+
):
|
|
275
297
|
return wrapped(*args, **kwargs)
|
|
276
298
|
|
|
277
299
|
llm_model = "unknown"
|
opentelemetry_instrumentation_vertexai-0.25.1/opentelemetry/instrumentation/vertexai/version.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.25.1"
|
|
@@ -8,7 +8,7 @@ show_missing = true
|
|
|
8
8
|
|
|
9
9
|
[tool.poetry]
|
|
10
10
|
name = "opentelemetry-instrumentation-vertexai"
|
|
11
|
-
version = "0.
|
|
11
|
+
version = "0.25.1"
|
|
12
12
|
description = "OpenTelemetry Vertex AI instrumentation"
|
|
13
13
|
authors = [
|
|
14
14
|
"Gal Kleinman <gal@traceloop.com>",
|
|
@@ -28,7 +28,7 @@ python = ">=3.9,<4"
|
|
|
28
28
|
opentelemetry-api = "^1.25.0"
|
|
29
29
|
opentelemetry-instrumentation = "^0.46b0"
|
|
30
30
|
opentelemetry-semantic-conventions = "^0.46b0"
|
|
31
|
-
opentelemetry-semantic-conventions-ai = "0.3.
|
|
31
|
+
opentelemetry-semantic-conventions-ai = "0.3.4"
|
|
32
32
|
|
|
33
33
|
[tool.poetry.group.dev.dependencies]
|
|
34
34
|
autopep8 = "^2.2.0"
|
opentelemetry_instrumentation_vertexai-0.24.0/opentelemetry/instrumentation/vertexai/version.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.24.0"
|
|
File without changes
|
|
File without changes
|