semantic-kernel icon indicating copy to clipboard operation
semantic-kernel copied to clipboard

Python: #6499 Mistral AI Chat Completion

Open nmoeller opened this issue 1 year ago • 4 comments

Motivation and Context

  1. 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
  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. #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

nmoeller avatar Jul 02 '24 12:07 nmoeller

Py3.10 Test Coverage

Python 3.10 Test Coverage Report •
FileStmtsMissCoverMissing
TOTAL651976388% 
report-only-changed-files is enabled. No files were changed during this commit :)

Python 3.10 Unit Test Overview

Tests Skipped Failures Errors Time
1558 1 :zzz: 0 :x: 0 :fire: 27.281s :stopwatch:

markwallace-microsoft avatar Jul 02 '24 12:07 markwallace-microsoft

As commented on #6921, i decided to split the PR's into a more Lightweight PR and then increase the connector.

nmoeller avatar Jul 02 '24 12:07 nmoeller

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 avatar Jul 02 '24 14:07 moonbox3

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

nmoeller avatar Jul 02 '24 14:07 nmoeller