Skip to content

Python: Add Mistral AI embedding client package#5480

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

Python: Add Mistral AI embedding client package#5480
daric93 wants to merge 13 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

@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.

Copilot AI review requested due to automatic review settings April 29, 2026 19:24
@daric93 daric93 force-pushed the feature/mistral-embedding-client branch from fc9c4de to 39b15eb Compare April 29, 2026 19:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a new Python package to integrate Mistral AI embeddings into the agent framework, including unit/integration tests and CI wiring.

Changes:

  • Introduces agent-framework-mistral package with raw + telemetry-wrapped embedding clients
  • Adds tests (unit + optional integration) and registers them in integration workflows
  • Updates workspace config for dependency overrides and package/test discovery

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
python/pyproject.toml Adds workspace package registration, pyright test roots, and an OpenTelemetry dependency override
python/packages/mistral/agent_framework_mistral/_embedding_client.py Implements raw + telemetry embedding clients and Mistral-specific option/settings types
python/packages/mistral/tests/mistral/test_mistral_embedding_client.py Adds unit tests and a skipped-by-default integration test for embeddings
python/packages/mistral/pyproject.toml Defines the new package metadata, dependencies, and tooling config
python/packages/mistral/README.md Documents installation and basic embedding usage
python/packages/mistral/AGENTS.md Adds package-oriented usage notes/examples
python/.env.example Adds Mistral env var placeholders
python/PACKAGE_STATUS.md Registers the new package and its maturity status
.github/workflows/python-merge-tests.yml Runs Mistral integration tests in merge workflow
.github/workflows/python-integration-tests.yml Runs Mistral integration tests in scheduled/manual integration workflow

Comment thread python/packages/mistral/agent_framework_mistral/_embedding_client.py Outdated
Comment thread python/packages/mistral/README.md Outdated
Comment thread python/packages/mistral/AGENTS.md
Comment thread python/PACKAGE_STATUS.md
Comment thread python/pyproject.toml
daric93 added 2 commits April 30, 2026 11:54
Signed-off-by: Daria Korenieva <daric2612@gmail.com>
…ex, align docs

Signed-off-by: Daria Korenieva <daric2612@gmail.com>
@daric93 daric93 force-pushed the feature/mistral-embedding-client branch from 35e44c6 to daf562e Compare April 30, 2026 18:54
Copy link
Copy Markdown
Member

@eavanvalkenburg eavanvalkenburg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good, thanks for the work, just update to alpha status and remove the changes to integration tests, I will see if we can get mistral keys, so that we can enable that, but that will be a followup.

Comment thread .github/workflows/python-integration-tests.yml Outdated
Comment thread python/packages/mistral/pyproject.toml Outdated
@moonbox3
Copy link
Copy Markdown
Contributor

moonbox3 commented May 5, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/mistral/agent_framework_mistral
   _embedding_client.py590100% 
TOTAL31899369688% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
6277 30 💤 0 ❌ 0 🔥 1m 41s ⏱️

daric93 added 10 commits May 5, 2026 11:03
… - Change version to 1.0.0a260505 (alpha) - Update classifier to Development Status :: 3 - Alpha - Update PACKAGE_STATUS.md to alpha - Remove Mistral from integration test workflows (no API keys yet)

Signed-off-by: Daria Korenieva <daric2612@gmail.com>
…/microsoft-agent-framework into feature/mistral-embedding-client
…-management skill: alpha packages must include samples inside the package directory.

Signed-off-by: Daria Korenieva <daric2612@gmail.com>
…/microsoft-agent-framework into feature/mistral-embedding-client
Signed-off-by: Daria Korenieva <daric2612@gmail.com>
@daric93 daric93 requested a review from eavanvalkenburg May 8, 2026 17:14
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.

4 participants