Skip to content

Add Builder argument to IAIClientFactory methods - #103

Merged
MikeAlhayek merged 2 commits into
mainfrom
ma/improve-factory
Jul 9, 2026
Merged

Add Builder argument to IAIClientFactory methods#103
MikeAlhayek merged 2 commits into
mainfrom
ma/improve-factory

Conversation

@MikeAlhayek

Copy link
Copy Markdown
Member

This pull request introduces new overloads to the IAIClientFactory interface that allow callers to configure the builder pipeline for AI clients (chat, embeddings, image generation, speech-to-text, and text-to-speech) before the factory builds the final client. This enables middleware such as UseDefaultResilience() to be applied during client creation, making it easier to add resilience and other behaviors. The documentation and changelogs have been updated to reflect these new patterns, providing clear examples for both the new and existing approaches.

API Enhancements:

  • Added overloads to IAIClientFactory for all major AI client types (IChatClient, IEmbeddingGenerator, IImageGenerator, ISpeechToTextClient, ITextToSpeechClient) that accept a builder-configuration delegate, allowing middleware (like resilience policies) to be applied before building the client. [1] [2] [3] [4] [5]

Documentation Updates:

  • Updated documentation in ai-core.md, ai-resilience.md, and getting-started-aspnet.md to show how to use the new IAIClientFactory overloads for configuring resilience and other middleware, including code examples and guidance on when to use each approach. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Changelog and Package References:

  • Added a changelog entry describing the new overloads and their use cases.
  • Added a package reference to Microsoft.Extensions.AI in the project file to support the new builder extensions.

These changes make it easier and more consistent to apply cross-cutting concerns like resilience to AI clients, whether you are using the factory or building clients manually.

@MikeAlhayek
MikeAlhayek merged commit 83617ff into main Jul 9, 2026
10 checks passed
@MikeAlhayek
MikeAlhayek deleted the ma/improve-factory branch July 9, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant