Skip to content

Conversation

@MD-V
Copy link

@MD-V MD-V commented Nov 21, 2025

Modified the OpenAI clients in AgentChatWebExample to send the needed metadata.

Motivation and Context

Fixes #2376

Description

I've added RawRepresentationFactory as suggested with now supplies the correct metadata for HostedAgentResponseExecutor.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings November 21, 2025 14:55
@MD-V
Copy link
Author

MD-V commented Nov 21, 2025

@microsoft-github-policy-service agree

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an issue where OpenAI ChatClients were not sending the required entity_id metadata in the AgentChatWebExample. The fix adds RawRepresentationFactory to the ChatOptions to supply the correct metadata for HostedAgentResponseExecutor.

Key Changes

  • Added RawRepresentationFactory to ChatOptions in both OpenAI client implementations to include entity_id metadata
  • Added using OpenAI.Responses; namespace in OpenAIChatCompletionsAgentClient.cs

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
dotnet/samples/AgentWebChat/AgentWebChat.Web/OpenAIResponsesAgentClient.cs Added RawRepresentationFactory to create ResponseCreationOptions with entity_id metadata
dotnet/samples/AgentWebChat/AgentWebChat.Web/OpenAIChatCompletionsAgentClient.cs Added using statement for OpenAI.Responses, introduced chatOptions variable with RawRepresentationFactory to create ChatCompletionOptions with entity_id metadata

@MD-V MD-V requested a review from arjendeblok December 3, 2025 10:20
Copy link

@arjendeblok arjendeblok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this example it works but for other LLM providers it may fail on the name of the model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET : Unable to supply metadata to OpenAI ChatClients

3 participants