Skip to content

Commit 7f67717

Browse files
committed
Add changelog
1 parent e43c9f2 commit 7f67717

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

instrumentation-genai/opentelemetry-instrumentation-vertexai/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## Unreleased
99

10+
- Start making changes to implement the big semantic convention changes made in https://github.com/open-telemetry/semantic-conventions/pull/2179.
11+
Now only a single event (`gen_ai.client.inference.operation.details`) is used to capture Chat History. These changes will be opt-in,
12+
users will need to set the environment variable OTEL_SEMCONV_STABILITY_OPT_IN to `gen_ai_latest_experimental` to see them ([#3386](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3386)).
1013
- Implement uninstrument for `opentelemetry-instrumentation-vertexai`
1114
([#3328](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/3328))
1215
- VertexAI support for async calling

instrumentation-genai/opentelemetry-instrumentation-vertexai/src/opentelemetry/instrumentation/vertexai/utils.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,7 @@ def _convert_response_to_output_messages(
323323

324324

325325
def _convert_content_to_message(content: content.Content) -> dict:
326-
message = {}
327-
message["role"] = content.role
328-
message["parts"] = []
326+
message = {"role": content.role, "parts": []}
329327
for idx, part in enumerate(content.parts):
330328
if "function_response" in part:
331329
part = part.function_response
@@ -353,7 +351,7 @@ def _convert_content_to_message(content: content.Content) -> dict:
353351
part = part.text
354352
else:
355353
message["parts"].append(
356-
type(part).to_dict(part, including_default_value_fields=False)
354+
type(part).to_dict(part, always_print_fields_with_no_presence=False)
357355
)
358356
message["parts"][-1]["type"] = type(part)
359357
return message
@@ -422,7 +420,7 @@ def _parts_to_any_value(
422420
return [
423421
cast(
424422
"dict[str, AnyValue]",
425-
type(part).to_dict(part, including_default_value_fields=False), # type: ignore[reportUnknownMemberType]
423+
type(part).to_dict(part, always_print_fields_with_no_presence=False), # type: ignore[reportUnknownMemberType]
426424
)
427425
for part in parts
428426
]

instrumentation-genai/opentelemetry-instrumentation-vertexai/tests/test_chat_completions.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from vertexai.preview.generative_models import (
1212
GenerativeModel as PreviewGenerativeModel,
1313
)
14-
1514
from opentelemetry.instrumentation.vertexai import VertexAIInstrumentor
1615
from opentelemetry.sdk._logs._internal.export.in_memory_log_exporter import (
1716
InMemoryLogExporter,
@@ -35,7 +34,12 @@ def test_generate_content(
3534
generate_content(
3635
model,
3736
[
38-
Content(role="user", parts=[Part.from_text("Say this is a test")]),
37+
Content(
38+
role="user",
39+
parts=[
40+
Part.from_text("Say this is a test"),
41+
],
42+
),
3943
],
4044
)
4145

0 commit comments

Comments
 (0)