feat: Add Mistral AI model support through OpenAIChatCompletionClient#7569
Open
Ricardo-M-L wants to merge 3 commits intomicrosoft:mainfrom
Open
feat: Add Mistral AI model support through OpenAIChatCompletionClient#7569Ricardo-M-L wants to merge 3 commits intomicrosoft:mainfrom
Ricardo-M-L wants to merge 3 commits intomicrosoft:mainfrom
Conversation
Contributor
|
@Ricardo-M-L please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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.
Summary
Adds native Mistral AI model support to
OpenAIChatCompletionClient, enabling seamless integration with Mistral's OpenAI-compatible API.Changes:
_model_info.py: Add model entries for all Mistral AI model families (mistral-large, mistral-medium, mistral-small, codestral, open-codestral-mamba, pixtral, ministral, open-mistral-nemo) including model pointers (-latestaliases), model capabilities, and token limits_openai_client.py: Auto-detect Mistral models and configurebase_url(https://api.mistral.ai/v1/),MISTRAL_API_KEYenv var, and defaultinclude_name_in_message=Falseto prevent HTTP 422 errors from extranamefield in messagesinclude_name_in_messagebehaviorUsage:
Fixes #6151
Closes #6147
Test plan
test_openai_chat_completion_client_with_mistral_model- basic instantiationtest_openai_chat_completion_client_with_mistral_model_variants- all model variantstest_is_mistral_model- prefix detection (positive & negative cases)test_mistral_model_info- capability flags per model familytest_mistral_model_token_limits- token limits for all modelstest_mistral_resolve_model- pointer resolution (latest -> versioned)test_mistral_auto_base_url- automatic base URL configurationtest_mistral_auto_api_key- MISTRAL_API_KEY env var detectiontest_mistral_include_name_disabled_by_default- fixes Update of @langchain/mistralai necessary for using Mistral API in Autogen Studio #6147 HTTP 422test_mistral_include_name_can_be_overridden- explicit override works