-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Python: #6499 Mistral AI Chat Completion #7049
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python: #6499 Mistral AI Chat Completion #7049
Conversation
|
As commented on #6921, i decided to split the PR's into a more Lightweight PR and then increase the connector. |
python/semantic_kernel/connectors/ai/mistral_ai/services/mistral_ai_chat_completion.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/mistral_ai/services/mistral_ai_chat_completion.py
Outdated
Show resolved
Hide resolved
|
Hi @nmoeller, we just merged a PR that messed with the |
…-Connector-chat-completion
...l/connectors/ai/mistral_ai/prompt_execution_settings/mistral_ai_prompt_execution_settings.py
Outdated
Show resolved
Hide resolved
moonbox3
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for working on this!
…ps://github.com/nmoeller/semantic-kernel into issue-6499-Mistral-Ai-Connector-chat-completion
juliomenendez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a few minor comments.
python/semantic_kernel/connectors/ai/mistral_ai/services/mistral_ai_chat_completion.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/mistral_ai/services/mistral_ai_chat_completion.py
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/mistral_ai/services/mistral_ai_chat_completion.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/mistral_ai/services/mistral_ai_chat_completion.py
Outdated
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/mistral_ai/services/mistral_ai_chat_completion.py
Show resolved
Hide resolved
python/semantic_kernel/connectors/ai/mistral_ai/services/mistral_ai_chat_completion.py
Show resolved
Hide resolved
eavanvalkenburg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm!
…ps://github.com/nmoeller/semantic-kernel into issue-6499-Mistral-Ai-Connector-chat-completion
…ps://github.com/nmoeller/semantic-kernel into issue-6499-Mistral-Ai-Connector-chat-completion
### Motivation and Context 1. I saw that you are having spikes regarding enabling MyPy 2. On ##7049 i had the Liskov Principle commented 3. In #7144 is saw how you plan to solve this so i decided to adjust the mistral connector to this ### Description The PR contains changes to be compliant to MyPy in Mistral AI Connector. Changes input Parameter for MistralAIChatCompletion from MistralAIPromptExecutionSettings to PromptExecutionSettings. Adding Test Cases for MistralAIPromptExecutionSettings and PromptExecutionSettings.  ### Tasks - [x] Changes input Parameter for Liskov - [x] Settings conversion - [x] Adjust TestCases to 100% ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone 😄 --------- Co-authored-by: Nico Möller <nicomoller@microsoft.com> Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
### Motivation and Context <!-- Thank you for your contribution to the semantic-kernel repo! Please help reviewers and future users, providing the following information: 1. Why is this change required? 2. What problem does it solve? 3. What scenario does it contribute to? 4. If it fixes an open issue, please link to the issue here. --> 1. Why is this changed required ? To enable Mistral Models with Semantic Kernel, there was the issue microsoft#6499 in the Backlog to add a MistralAI Connector 2. What problem does it solve ? It solves the problem, that semantic kernel is not yet integrated with MistralAI 3. 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 4. If it fixes an open issue, please link to the issue here. microsoft#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 <!-- Before submitting this PR, please make sure: --> - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone 😄 --------- Co-authored-by: Nico Möller <nicomoller@microsoft.com>
### Motivation and Context 1. I saw that you are having spikes regarding enabling MyPy 2. On #microsoft#7049 i had the Liskov Principle commented 3. In microsoft#7144 is saw how you plan to solve this so i decided to adjust the mistral connector to this ### Description The PR contains changes to be compliant to MyPy in Mistral AI Connector. Changes input Parameter for MistralAIChatCompletion from MistralAIPromptExecutionSettings to PromptExecutionSettings. Adding Test Cases for MistralAIPromptExecutionSettings and PromptExecutionSettings.  ### Tasks - [x] Changes input Parameter for Liskov - [x] Settings conversion - [x] Adjust TestCases to 100% ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone 😄 --------- Co-authored-by: Nico Möller <nicomoller@microsoft.com> Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
Motivation and Context
To enable Mistral Models with Semantic Kernel, there was the issue Python: Add Mistral AI Connector #6499 in the Backlog to add a MistralAI Connector
It solves the problem, that semantic kernel is not yet integrated with MistralAI
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
Python: Add Mistral AI Connector #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 :
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 :
Contribution Checklist