Python: removed additional properties from messages sent to OAI responses and chat completions#2344
Merged
eavanvalkenburg merged 1 commit intomicrosoft:mainfrom Nov 21, 2025
Conversation
Member
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR removes the mapping of ChatMessage.additional_properties to a "metadata" field when sending messages to OpenAI's Responses API and Chat Completions API. The Responses API rejects requests with additional properties on messages, causing errors. The PR also adds documentation clarifying that additional_properties are for internal Agent Framework use only and are not sent to external services.
- Removed code that was sending
message.additional_propertiesas "metadata" to OpenAI services - Added inline documentation to
ChatMessage.__init__()overloads and class docstring - Fixes API errors with the OpenAI Responses API
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
python/packages/core/agent_framework/openai/_responses_client.py |
Removed lines that mapped message.additional_properties to args["metadata"] in the message parser |
python/packages/core/agent_framework/openai/_chat_client.py |
Removed lines that mapped message.additional_properties to args["metadata"] in the message parser |
python/packages/core/agent_framework/_types.py |
Added documentation to clarify that additional_properties are used within Agent Framework and are not sent to services |
moonbox3
approved these changes
Nov 20, 2025
larohra
reviewed
Nov 20, 2025
larohra
approved these changes
Nov 20, 2025
arisng
pushed a commit
to arisng/agent-framework
that referenced
this pull request
Feb 2, 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.
Motivation and Context
The Responses API gives an error when additional properties are set on a chat message and some services did not send additional properties while Responses and OpenAI chat did, this removes that. The API docs for both also do not mention any other fields, but apparantely the Chat Completion API did not complain while Responses did.
Also adds a note on this to the docstring of ChatMessage.
Description
Contribution Checklist