Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review all IChatClient implementations for thread-safety and suitability as singleton #5499

Closed
SteveSandersonMS opened this issue Oct 10, 2024 · 0 comments · Fixed by #5515
Closed
Assignees
Labels
bug This issue describes a behavior which is not expected - a bug. work in progress 🚧

Comments

@SteveSandersonMS
Copy link
Member

SteveSandersonMS commented Oct 10, 2024

As per dotnet/aspire#6225, there's an argument that the ecosystem will be more understandable if IChatClient implementations are expected to be singleton and thread-safe.

We need to check whether that's already the case for all the leaf clients and middleware in this repo, and whether it will cause any issues with SK integration etc.

I know this creates a limitation that none of them could depend on scoped services. If that turns out to be a blocker we may be forced to reconsider. But right now I don't have a concrete scenario in mind where a scoped service would be strictly needed. The closest I can think of is if you want to depend on an HttpClient that is preconfigured with a delegating handler with auth tokens from your current DI scope. While that does seem like it would be a problem, presumably it would already be a problem when using Aspire's OpenAI integration regardless of this, so maybe people don't need to do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a behavior which is not expected - a bug. work in progress 🚧
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants