Skip to content

Python: Add Mistral AI embedding client package#5480

Open
daric93 wants to merge 3 commits intomicrosoft:mainfrom
daric93:feature/mistral-embedding-client
Open

Python: Add Mistral AI embedding client package#5480
daric93 wants to merge 3 commits intomicrosoft:mainfrom
daric93:feature/mistral-embedding-client

Conversation

@daric93
Copy link
Copy Markdown

@daric93 daric93 commented Apr 24, 2026

Motivation and Context

Adds Mistral AI embedding support to the Python agent framework, as part of the Phase 9 additional embedding implementations tracked in #4171.

Mistral AI provides embedding models via their Python SDK. This PR adds a new agent-framework-mistral package with an embedding client that follows the same patterns established by the Ollama and OpenAI embedding clients.

Description

New package: python/packages/mistral/

  • MistralEmbeddingClient — embedding client with OpenTelemetry telemetry support
  • RawMistralEmbeddingClient — raw client without telemetry layer
  • MistralEmbeddingOptionsTypedDict extending EmbeddingGenerationOptions for Mistral-specific options
  • MistralEmbeddingSettingsTypedDict for env var resolution (MISTRAL_API_KEY, MISTRAL_EMBEDDING_MODEL, MISTRAL_SERVER_URL)

Uses the mistralai SDK v2 (>=2.0.0,<3) with create_async() for async embedding generation. Maps Mistral's output_dimension parameter to the framework's dimensions option, and normalizes usage fields to input_token_count / total_token_count.

Tests: 14 unit tests (100% coverage) + 1 integration test (skipped without API key).

CI: Added Mistral to the python-tests-misc-integration job in both python-integration-tests.yml and python-merge-tests.yml. Integration tests will skip until MISTRAL_API_KEY (secret) and MISTRAL_EMBEDDING_MODEL_ID (var) are provisioned in the GitHub integration environment.

Dependency note: mistralai pins opentelemetry-semantic-conventions<0.61, but the workspace dev dependency opentelemetry-sdk==1.40.0 requires 0.61b0. Resolved via override-dependencies in
pyproject.toml. Safe at runtime; removable once mistralai relaxes the bound.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? No

Signed-off-by: Daria Korenieva <daric2612@gmail.com>
@moonbox3 moonbox3 added documentation Improvements or additions to documentation python labels Apr 24, 2026
@daric93
Copy link
Copy Markdown
Author

daric93 commented Apr 27, 2026

@eavanvalkenburg please review when you have time — this implements the Mistral AI embedding client from #4171.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants