Repository navigation
Description
Observed Behavior
Mistral chat and embedding constructors load MISTRAL_SERVER_URL before inspecting an injected mistralai.client.Mistral. When the environment contains a different URL, the wrapper keeps that environment value in self.server_url and service_url(), while requests still use the endpoint configured on the injected SDK client.
This produces inconsistent configuration and incorrect telemetry metadata.
Affected files:
python/packages/mistral/agent_framework_mistral/_chat_client.pypython/packages/mistral/agent_framework_mistral/_embedding_client.py
Expected Behavior
For an injected Mistral SDK client, the actual client endpoint should take precedence over explicit or environment client-construction settings. API key and server URL settings should only be resolved when Agent Framework constructs the SDK client. Wrapper-level model resolution can remain independent.
Steps to Reproduce
- Set
MISTRAL_SERVER_URL=https://env.example. - Create a Mistral SDK client for
https://client.example. - Inject it into a Mistral chat or embedding client.
- Observe that
service_url()reports the environment endpoint instead of the client's endpoint.
Minimal Reproduction
import os
from mistralai.client import Mistral
from agent_framework_mistral import RawMistralChatClient
os.environ["MISTRAL_SERVER_URL"] = "https://env.example"
sdk = Mistral(api_key="dummy", server_url="https://client.example")
client = RawMistralChatClient(client=sdk, model="mistral-test")
print(client.service_url())
print(sdk.sdk_configuration.get_server_details()[0])Error Messages and Stack Traces
service_url(): https://env.example
SDK endpoint: https://client.example
Package Versions
agent-framework-mistral: 1.0.0b261030; main at 93c346f
Python Version
Python 3.13.1
Operating System
macOS
Regression
Unknown
Additional Context
Compatibility impact: beta wrappers would report the injected client's endpoint instead of ambient configuration. Requests already use the injected client, so this aligns metadata with actual behavior.
Focused acceptance tests:
- Chat and embedding
service_url()use the injected SDK endpoint despiteMISTRAL_SERVER_URL. - API key/server URL settings are not loaded for an injected SDK client.
- Explicit model and model environment fallback remain unchanged.
- Injected SDK and HTTP clients remain open after wrapper close.
- Owned-client initialization keeps existing precedence.
AI assistance: I used an AI coding assistant to audit and reproduce the behavior.
Acknowledgements
- I searched existing issues and did not find a duplicate.
- I personally verified this behavior and the reproduction details are authentic.
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity