Skip to content

Conversation

@kzu
Copy link
Member

@kzu kzu commented Jul 2, 2025

In MEAI, the expectation is that you get chat clients for specific models from the same OpenAI client. There's no concept of a default model at that level.

This aligns the implementation with that approach.

In addition, we add an analyzer that ensures the user can still invoke GetChatClient(model).AsIChatClient() while getting the proper behavior which in our GrokClient case is that you should use the returned client from GetChatClient(model) directly without an additional wrapping done by the MEAI AsIChatClient, since we implement the IChatClient in the returned client directly.

This allows us to cache and use multiple chat clients dynamically matching the model in each request's ChatOptions.

This also fixes a bug where we were not properly setting the search mode to On instead of Auto when using Tools.

@kzu kzu added the enhancement New feature or request label Jul 2, 2025
@kzu kzu force-pushed the dev/chatclient branch from 25be8a6 to 1b2bcd0 Compare July 2, 2025 03:20
@kzu kzu enabled auto-merge (rebase) July 2, 2025 03:21
@kzu
Copy link
Member Author

kzu commented Jul 2, 2025

5 skipped 5 skipped

🧪 Details on Ubuntu 24.04.2 LTS

from dotnet-retest v0.7.1 on .NET 8.0.17 with 💜 by @devlooped

@kzu kzu force-pushed the dev/chatclient branch from 1b2bcd0 to a027cf2 Compare July 2, 2025 03:27
In MEAI, the expectation is that you get chat clients for specific models from the same OpenAI client. There's no concept of a default model at that level.

This aligns the implementation with that approach.

In addition, we add an analyzer that ensures the user can still invoke `GetChatClient(model).AsIChatClient()` while getting the proper behavior which in our `GrokClient` case is that you should use the returned client from `GetChatClient(model)` directly without an additional wrapping done by the MEAI `AsIChatClient`, since we implement the `IChatClient` in the returned client directly.

This allows us to cache and use multiple chat clients dynamically matching the model in each request's ChatOptions.

This also fixes a bug where we were not properly setting the search mode to On instead of Auto when using Tools.
@kzu kzu force-pushed the dev/chatclient branch from a027cf2 to 55bab9c Compare July 2, 2025 03:30
@kzu kzu merged commit cb9c443 into main Jul 2, 2025
9 of 10 checks passed
@kzu kzu deleted the dev/chatclient branch July 2, 2025 03:38
@devlooped devlooped locked and limited conversation to collaborators Aug 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants