Python: #6499 Mistral AI Chat Completion
Motivation and Context
- Why is this changed required ? To enable Mistral Models with Semantic Kernel, there was the issue #6499 in the Backlog to add a MistralAI Connector
- What problem does it solve ? It solves the problem, that semantic kernel is not yet integrated with MistralAI
- What scenario does it contribute to? The scenario is to use different connector than HF,OpenAI or AzureOpenAI. When User's want to use Mistral they can easliy integrate it now
- If it fixes an open issue, please link to the issue here. #6499
Description
The changes made are designed by the open_ai connector, i tried to stay as close as possible to the structure. For the integration i installed the mistral python package in the repository.
I added the following Classes :
- MistrealAIChatPromptExcecutionSettings --> Responsible to administrate the Prompt Execution against MistralAI
- MistralAIChatCompletion --> Responsible to coordinate the Classes and for Content parsing
- MistralAISettings --> Basic Settings to work with the MistralAIClient
To test the changes with the tests please add MISTRALAI_API_KEY and MISTRALAI_CHAT_MODEL_ID as Enviorment Variable
From a design decision i moved the processing of Functions from Connectors to the ChatCompletionClientBaseClass
What is integrated yet :
- [X] Integrate Mistral AI ChatCompletion Models without Streaming
- [X] Integrate Mistral AI Chat Completion Models with Streaming
- [X] Simple Integration Test to test Streaming and non Streaming
- [x] Extended Testing including Unit Testing & More Integration Tests
Contribution Checklist
- [X] The code builds clean without any errors or warnings
- [X] The PR follows the SK Contribution Guidelines and the pre-submission formatting script raises no violations
- [X] All unit tests pass, and I have added new tests where possible
- [X] I didn't break anyone :smile:
Python 3.10 Test Coverage Report •
report-only-changed-files is enabled. No files were changed during this commit :)File Stmts Miss Cover Missing TOTAL 6519 763 88%
Python 3.10 Unit Test Overview
| Tests | Skipped | Failures | Errors | Time |
|---|---|---|---|---|
| 1558 | 1 :zzz: | 0 :x: | 0 :fire: | 27.281s :stopwatch: |
As commented on #6921, i decided to split the PR's into a more Lightweight PR and then increase the connector.
Hi @nmoeller, we just merged a PR that messed with the python/tests/conftest.py, so please have a look to resolve conflicts. Thanks.
Hi @nmoeller, we just merged a PR that messed with the
python/tests/conftest.py, so please have a look to resolve conflicts. Thanks.
@moonbox3 I merged with the latest changes of the main Branch