Skip to content

Simplify and improve AI clients registration and configuration#277

Merged
kzu merged 4 commits into
mainfrom
dev/simpleconfig
May 13, 2026
Merged

Simplify and improve AI clients registration and configuration#277
kzu merged 4 commits into
mainfrom
dev/simpleconfig

Conversation

@kzu
Copy link
Copy Markdown
Member

@kzu kzu commented May 13, 2026

No description provided.

kzu added 4 commits May 10, 2026 14:59
Configuration in behavior pipelines is done by adding decorators in the chain. There's no need to down-cast a particular IChatClient implementation to further configure via an Action (if it were a Func returning a new IChatClient, perhaps?).

So we just switch to having the original mechanism which is simpler and avoids overload pollution
Introduces Configure*ClientDefaults extension methods for chat, text-to-speech, and speech-to-text clients, supporting both global and section-specific configuration. Adds new files for defaults registration and validation. Refactors AddClients/AddChatClients to apply defaults and deprecates old configure overloads. Updates tests and documentation to cover new defaults behavior. Includes minor code cleanup and improved argument validation.
Remove obsolete AddChatClients API and consolidate all client registration through AddClients, which now registers both IClientFactory and IChatClient keyed services from configuration. Refactor ConfigurableChatClient to use IClientFactory and introduce ConfigurableClientFactory for dynamic provider resolution and API key inheritance. Move DefaultsApplyingClientFactory to its own file and ensure defaults are applied on every client creation. Update all usages, tests, and documentation to reflect AddClients as the canonical entry point for all client types. Add extension methods for resolving clients by id.
- All client registration is now unified under AddAIClients, which handles both
  IClientFactory (sections with apikey) and IChatClient (sections with modelid)
- AddChatClients is replaced with an error-level [Obsolete] stub (DEAI001) that
  guides callers to migrate to AddAIClients and ConfigureChatClientDefaults
- IClientFactoryResolver and ClientFactoryResolver are made internal — they are
  implementation details not intended for direct consumption
- DefaultsEntry record types move into AIClientDefaultsExtensions, consolidating
  the defaults model with the methods that register them
- SKILL.md provides a Copilot skill with migration guide and usage examples;
  Devlooped.Extensions.AI.targets copies it to consuming repos on build
@kzu kzu added the enhancement New feature or request label May 13, 2026
@kzu
Copy link
Copy Markdown
Member Author

kzu commented May 13, 2026

41 passed 41 passed 10 skipped

🧪 Details on Ubuntu 24.04.4 LTS

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

@kzu kzu merged commit cc974fd into main May 13, 2026
3 checks passed
@kzu kzu deleted the dev/simpleconfig branch May 13, 2026 18:20
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.

1 participant