Skip to content

Allow case-insensitive agents and clients resolution - #129

Merged
kzu merged 1 commit into
mainfrom
dev/caseinsensitive
Oct 20, 2025
Merged

Allow case-insensitive agents and clients resolution#129
kzu merged 1 commit into
mainfrom
dev/caseinsensitive

Conversation

@kzu

@kzukzu commented Oct 20, 2025

Copy link
Copy Markdown
Member

Configuration-driven sections can change case when a subsequent provider overrides a section value but uses a different casing (since config is inherently case-insensitive). This means we may end up with a client ID with an unexpected casing at run-time.

In order to solve this, we register both clients and agents using an alternative ServiceKey object which performs a comparer-aware comparison (defaults to ordinal ignore case).

Users would need to look for this alternative key explicitly, since we don't want to pollute the container with additional string-only registrations. But to improve discoverability of this case-insensitive lookup, we provide GetChatClient and GetAIAgent extension methods for IServiceProvider.

@kzukzu added the enhancement New feature or request label Oct 20, 2025
@kzu
kzuforce-pushed the dev/caseinsensitive branch from 3b93ae5 to 695e473CompareOctober 20, 2025 20:06
@kzu

kzu commented Oct 20, 2025

Copy link
Copy Markdown
MemberAuthor

21 passed21 passed18 skipped

🧪 Details on Ubuntu 24.04.3 LTS

from dotnet-retest v1.0.0 on .NET 9.0.10 with 💜 by @devlooped

@kzu
kzuforce-pushed the dev/caseinsensitive branch 2 times, most recently from 1de9934 to 63d7d52CompareOctober 20, 2025 20:12
Configuration-driven sections can change case when a subsequent provider overrides a section value but uses a different casing (since config is inherently case-insensitive). This means we may end up with a client ID with an unexpected casing at run-time.
In order to solve this, we register both clients and agents using an alternative ServiceKey object which performs a comparer-aware comparison (defaults to ordinal ignore case).
Users would need to look for this alternative key explicitly, since we don't want to pollute the container with additional string-only registrations. But to improve discoverability of this case-insensitive lookup, we provide GetChatClient and GetAIAgent extension methods for IServiceProvider.
@kzu
kzuforce-pushed the dev/caseinsensitive branch from 63d7d52 to d01ac12CompareOctober 20, 2025 20:13
@kzu
kzu enabled auto-merge (rebase) October 20, 2025 20:14
@kzu
kzu merged commit b2ff66d into mainOct 20, 2025
7 checks passed
@kzu
kzu deleted the dev/caseinsensitive branch October 20, 2025 20:15
@devloopeddevlooped locked and limited conversation to collaborators Nov 20, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@kzu