Skip to content

Conversation

@Cirilla-zmh
Copy link
Member

@Cirilla-zmh Cirilla-zmh commented Dec 3, 2025

Description

  • Add support for emitting inference events.
  • Add gen_ai.system_instructions attributes for inference span or events.
  • Refactor span_utils.py for more brief implementation.
  • Add Reasoning, Blob, File, Uri message types.

Fixes #3065

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Add unit tests

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@Cirilla-zmh Cirilla-zmh requested a review from a team as a code owner December 3, 2025 09:21
@Cirilla-zmh
Copy link
Member Author

Cirilla-zmh commented Dec 3, 2025

Typecheck failure is not related to this PR, so it may be ignored. cc @aabmass

typecheck: commands[0]> pyright
/home/runner/work/opentelemetry-python-contrib/opentelemetry-python-contrib/util/opentelemetry-util-genai/src/opentelemetry/util/genai/_upload/completion_hook.py
  /home/runner/work/opentelemetry-python-contrib/opentelemetry-python-contrib/util/opentelemetry-util-genai/src/opentelemetry/util/genai/_upload/completion_hook.py:175:17 - error: No overloads for "join" match the provided arguments (reportCallIssue)
  /home/runner/work/opentelemetry-python-contrib/opentelemetry-python-contrib/util/opentelemetry-util-genai/src/opentelemetry/util/genai/_upload/completion_hook.py:175:27 - error: Argument of type "Generator[str | Unknown | bytes | Any, None, None]" cannot be assigned to parameter "iterable" of type "Iterable[str]" in function "join"
    "Generator[str | Unknown | bytes | Any, None, None]" is not assignable to "Iterable[str]"
      Type parameter "_T_co@Iterable" is covariant, but "str | Unknown | bytes | Any" is not a subtype of "str"
        Type "str | Unknown | bytes | Any" is not assignable to type "str"
          "bytes" is not assignable to "str" (reportArgumentType)

Change-Id: I8fd0b896fc103a986f78c7351ce627611e545a62
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I5c4c93613e3e1084245b7298955a08cbc7c9708d
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: If34cfce0e7eb130db6a1e8e30a5f4be7c215285f
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I847f75259e01729db88129a44b241afb0ea2aca4
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I818a042d275d3c8e3348647d73e34560e7d92f54
Co-developed-by: Cursor <noreply@cursor.com>
@Cirilla-zmh Cirilla-zmh force-pushed the minghui/log_chat_messages branch from fbce5a2 to 1d312c5 Compare December 4, 2025 05:37
Change-Id: I40b8e01bbe4fa9c182e99085a7c71d4536042247
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: Ie07c495002143fb2f0cf88033206290eb85386ad
Co-developed-by: Cursor <noreply@cursor.com>
@JWinermaSplunk
Copy link

I think changing some of the apply attributes methods to output a dictionary instead of attaching the attributes for events sake is ok, though making the methods llm specific will lead to a lot of overlapping code overtime if more genai types are implemented in the future. More so applies to methods like _apply_common_span_attributes, _apply_finish_attributes, etc, which could take different genai type invocations.

@Cirilla-zmh
Copy link
Member Author

Cirilla-zmh commented Dec 5, 2025

More so applies to methods like _apply_common_span_attributes, _apply_finish_attributes, etc, which could take different genai type invocations.

@JWinermaSplunk Thanks for your suggestions! We do need to classify the attributes for common, inference, agent and so on to reuse them as much as possible. However, I don't want to involve many features in this PR because that means we'd better refactor the design of LLMInovcation to a layered model with CommonInvocation, MessagesInocation and so on.

Could you please create another issue to mark this proposal? I believe @keith-decker and @aabmass would also be interested in this.

Change-Id: Ida0c2305d950d978c31eb04a80e21e947fabdfba
Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I1da48b52b76042a9efd124057681f579cc93fb6e
Co-developed-by: Cursor <noreply@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Library for uploading blobs as part of instrumentation #GenAI #MultiModal

3 participants