Update mapper for open ai#236
Merged
nikhilNava merged 2 commits intomainfrom Apr 24, 2026
Merged
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds OpenAI-specific message mapping so gen_ai.input.messages / gen_ai.output.messages span attributes are converted into the Agent365 (A365) versioned message schema (v0.1.0) before spans are ended/exported, with unit + integration coverage.
Changes:
- Introduce
message_mapper.pyto normalize multiple OpenAI message shapes (chat completions, Response API, plain strings) into A365 typed-parts format. - Apply the mapper in the OpenAI trace processor on span end for
invoke_agentandchatoperations. - Add unit tests for the mapper and integration tests validating exported spans contain versioned message payloads.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
libraries/.../openai/message_mapper.py |
New mapping layer converting OpenAI message payloads into A365 v0.1.0 wrapper format. |
libraries/.../openai/trace_processor.py |
Invokes the new mapper during on_span_end to rewrite message attributes before span end. |
libraries/.../openai/trace_instrumentor.py |
Clears OpenAI Agents SDK trace processors on uninstrument. |
tests/observability/extensions/openai/test_message_mapper.py |
Unit tests covering supported input/output JSON shapes and fallback behavior. |
tests/observability/extensions/openai/integration/test_message_format.py |
Integration tests that capture enriched spans from real Azure OpenAI calls and validate versioned messages. |
juliomenendez
approved these changes
Apr 23, 2026
fpfp100
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task
Support A365 message format for openAi and SK
Result
The latest version of SK no longer reports input and output messages on span attributes.
openAI
Invoke agent
inference span