Skip to content

Python: Support OpenAI message "name" field #2951

Closed

Description

@gdhuang

Background
The Python SDK does not currently map the ChatMessage.author_name field to OpenAI's optional "name" field when sending messages to the OpenAI completion API.
This field is useful for identifying different participants in conversations.

Current Behavior
In the Python implementation, the ChatMessage class has an author_name attribute.
However, when converting messages to OpenAI format in _openai_chat_message_parser(), the author_name is not included:
File: python/packages/core/agent_framework/openai/_chat_client.py:364-393

Expected Behavior

The author_name should be mapped to OpenAI's "name" field when present, similar to how the .NET implementation handles it.

string? name = SanitizeAuthorName(input.AuthorName);

File: https://github.com/dotnet/extensions/blob/main/src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIChatClient.cs:158

Activity

  1. added
    .NETUsage: [Issues, PRs], Target: .Net
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Dec 18, 2025
  2. changed the title [-]Python: Support OpenAI message "name" field[/-] [+].NET: Python: Support OpenAI message "name" field[/+] on Dec 18, 2025
  3. changed the title [-].NET: Python: Support OpenAI message "name" field[/-] [+]Python: Support OpenAI message "name" field[/+] on Dec 18, 2025
  4. removed
    .NETUsage: [Issues, PRs], Target: .Net
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Dec 18, 2025
  5. added a commit that references this issue on Dec 18, 2025
    487f293
  6. added 2 commits that reference this issue on Dec 18, 2025
    766c9c2
    6d14c13
  7. added a commit that references this issue on Dec 18, 2025
    e5c11d3
  8. added a commit that references this issue on Jan 2, 2026
    a5b36dc
  9. added a commit that references this issue on Jan 9, 2026
    1e36ba3
  10. added 2 commits that reference this issue on Jan 17, 2026
    cd77193
    172423a
  11. added a commit that references this issue on Jan 27, 2026
    787becf
  12. added a commit that references this issue on Feb 2, 2026
    a0ae383
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

pythonUsage: [Issues, PRs], Target: Python

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions