Repository navigation
Python: Report the injected Mistral SDK client's endpoint in service_url - #9968
Open
Mehedi Hasan (Mahdi-Hasan) wants to merge 2 commits into
Open
Mehedi Hasan (Mahdi-Hasan) wants to merge 2 commits into
Mehedi Hasan (Mahdi-Hasan) wants to merge 2 commits into
Conversation
Mistral chat and embedding clients kept MISTRAL_SERVER_URL (or an explicit server_url) in self.server_url when an SDK client was injected. Requests still went to the injected client's endpoint, so service_url() and the telemetry metadata reported the wrong server. An injected mistralai.client.Mistral now always defines server_url. Fixes microsoft#9965 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mehedi Hasan (Mahdi-Hasan)
temporarily deployed
to
github-app-auth
November 2, 2026 11:26 — with
GitHub Actions
Inactive
Mehedi Hasan (Mahdi-Hasan)
temporarily deployed
to
github-app-auth
November 2, 2026 11:26 — with
GitHub Actions
Inactive
Mehedi Hasan (Mahdi-Hasan)
marked this pull request as ready for review
November 2, 2026 11:43
Mehedi Hasan (Mahdi-Hasan)
temporarily deployed
to
github-app-auth
November 2, 2026 11:43 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Active moderate issues remain because injected SDK clients still load API key and server URL settings from ambient configuration, and the related documentation does not clearly distinguish SDK-client behavior from the deprecated HTTP-client path.
4 open issues
Review effort: Lite
Comment on lines
+408
to
+409
| # The injected SDK client sends the requests, so its endpoint wins over configured settings. | ||
| self.server_url = client.sdk_configuration.get_server_details()[0] |
Comment on lines
+160
to
+161
| # The injected SDK client sends the requests, so its endpoint wins over configured settings. | ||
| self.server_url = client.sdk_configuration.get_server_details()[0] |
| api_key: Mistral API key. Defaults to ``MISTRAL_API_KEY`` environment variable. | ||
| server_url: Optional server URL override. Defaults to ``MISTRAL_SERVER_URL`` | ||
| environment variable, or the Mistral default. | ||
| environment variable, or the Mistral default. Ignored when ``client`` is provided. |
| api_key: Mistral API key. Defaults to ``MISTRAL_API_KEY`` environment variable. | ||
| server_url: Optional server URL override. Defaults to ``MISTRAL_SERVER_URL`` | ||
| environment variable, or the Mistral default. | ||
| environment variable, or the Mistral default. Ignored when ``client`` is provided. |
server_url is only ignored when a Mistral SDK client is injected. The deprecated httpx.AsyncClient path via `client` still uses it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mehedi Hasan (Mahdi-Hasan)
temporarily deployed
to
github-app-auth
November 3, 2026 05:42 — with
GitHub Actions
Inactive
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Motivation & Context
When a
mistralai.client.Mistralis injected,RawMistralChatClient,MistralChatClientandMistralEmbeddingClientstill keepMISTRAL_SERVER_URL(or an explicitserver_url=) inself.server_url. Requests go to the injected client's endpoint, butservice_url()and telemetry report the other URL.Description & Review Guide
server_urlnow always comes fromclient.sdk_configuration.get_server_details()[0].server_urlis ignored whenclientis provided.http_clientpaths keep their existing precedence. Model resolution is unchanged.load_settingsreads every field of the TypedDict, and both fields are plain strings that can't fail parsing. So I kept oneload_settingscall and stopped using those values, rather than adding a second settings type.Related Issue
Fixes #9965
AI Assistance
AI assistance details: implementation, tests, and this description. The issue's repro was re-run against a real
MistralSDK client before and after the change.Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.🤖 Generated with Claude Code