Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 17, 2026

Makes all IChatClient implementations internal (providers are the public API now) and eliminates the need for explicit ApplyExtensions() calls by auto-configuring RawRepresentationFactory when OpenAI-specific extension properties are set.

Changes

  • Internal chat clients: OpenAIChatClient, AzureOpenAIChatClient, AzureInferenceChatClient are now internal
  • Auto-configured factory: Setting ReasoningEffort or Verbosity automatically installs the RawRepresentationFactory
  • Moved extension properties: ReasoningEffort and Verbosity moved from ChatExtensions to OpenAIExtensions namespace with documentation clarifying OpenAI Responses API specificity
  • Validation: Throws InvalidOperationException if RawRepresentationFactory is already set to a custom factory
  • Removed ExtendedChatOptions: Replaced with OpenAIChatOptions in the OpenAI namespace for config binding
  • Removed ApplyExtensions(): No longer needed

Before

var options = new ChatOptions { ReasoningEffort = ReasoningEffort.High };
await chat.GetResponseAsync(messages, options.ApplyExtensions());

After

var options = new ChatOptions { ReasoningEffort = ReasoningEffort.High };
await chat.GetResponseAsync(messages, options); // Factory auto-configured on property set

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • kzu.blob.core.windows.net
    • Triggering command: /usr/bin/dotnet dotnet restore (dns block)
    • Triggering command: /usr/bin/dotnet dotnet restore --no-dependencies /home/REDACTED/work/Extensions.AI/Extensions.AI/src/Extensions.CodeAnalysis/Extensions.CodeAnalysis.csproj --packages /home/REDACTED/work/Extensions.AI/.codeql-scratch/dbs/csharp/working/packages /p:DisableImplicitNuGetFallbackFolder=true --verbosity normal /p:TargetFrameworkRootPath=/home/REDACTED/work/Extensions.AI/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot /p:NetCoreTargetingPackRoot=/home/REDACTED/work/Extensions.AI/.codeql-scratch/dbs/csharp/working/emptyFakeDotnetRoot (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

I'd like all IChatClient implementations to be purely internal (since we have the providers now).
As part of this change, I'd like the ApplyExtensions for OpenAI-extended properties via ChatOptions to be unnecessary in the following way:

  • on set of any of the extension properties, we'd set the RawRepresentationFactory to point to a method on a singleton factory static factory/method to apply the properties as needed.
  • The extension properties would be OpenAI-specific rather than generic. They would contain documentation highlighting that they are to be used only with the Responses API.
  • If the representation factory is set to some other factory, we'll throw.
  • ExtendedChatOptions should be gone since it's not used at all

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…e RawRepresentationFactory

Co-authored-by: kzu <169707+kzu@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor IChatClient implementations for internal use only Internalize IChatClient implementations and auto-configure RawRepresentationFactory Jan 17, 2026
Copilot AI requested a review from kzu January 17, 2026 20:00
@kzu kzu marked this pull request as ready for review January 17, 2026 20:35
@kzu kzu added the enhancement New feature or request label Jan 17, 2026
@kzu kzu enabled auto-merge (rebase) January 17, 2026 20:36
@kzu
Copy link
Member

kzu commented Jan 17, 2026

18 passed 18 passed 13 skipped

🧪 Details on Ubuntu 24.04.3 LTS

from retest v1.1.0 on .NET 10.0.2 with 💜 by @devlooped

Rather than opaque key in the additional properties, use a more determininstic approach by checking the factory target instance being our own implementation of the factory.
@kzu kzu force-pushed the copilot/refactor-ichatclient-implementations branch from 20a41b5 to d789e9c Compare January 17, 2026 20:36
@kzu kzu merged commit b996b3e into main Jan 17, 2026
4 checks passed
@kzu kzu deleted the copilot/refactor-ichatclient-implementations branch January 17, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants