Skip to content
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 Function Calling #8016

Merged

Conversation

nmoeller
Copy link
Contributor

@nmoeller nmoeller commented Aug 9, 2024

Motivation and Context

  1. Why is this changed required ?
    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
  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.
    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.

After Integrating ChatCompletion and Embeddings now i would like to bring in FunctionCalling

What is integrated yet :

  • MistralAI FunctionCalling
  • MistralAI FunctionCalling Streaming
  • Extended Testing including Unit Testing
  • Integration Tests with FunctionCalling

Some Notes

  • Integration Tests are skipped when the environment variables are not to not break the current Integration Tests

Contribution Checklist

@markwallace-microsoft markwallace-microsoft added the python Pull requests for the Python Semantic Kernel label Aug 9, 2024
@github-actions github-actions bot changed the title #6499 Mistral AI Function Calling Python: #6499 Mistral AI Function Calling Aug 9, 2024
@nmoeller nmoeller marked this pull request as ready for review August 12, 2024 07:00
@nmoeller nmoeller requested a review from a team as a code owner August 12, 2024 07:00
@nmoeller
Copy link
Contributor Author

Should we already try to get the feature in the main branch or does it make sense to wait till #8020 is finished ? Since i was staying close to the OpenAi connector i will have the same behavior.

@moonbox3
Copy link
Contributor

Should we already try to get the feature in the main branch or does it make sense to wait till #8020 is finished ? Since i was staying close to the OpenAi connector i will have the same behavior.

I will get #8020 handled today.

@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Aug 14, 2024

Python Test Coverage

Python Test Coverage Report
FileStmtsMissCoverMissing
semantic_kernel
   kernel.py1994776%148, 159, 163, 313–316, 423, 437–480
semantic_kernel/agents/channels
   open_ai_assistant_channel.py49198%42
semantic_kernel/agents/group_chat
   agent_chat.py116199%91
   agent_group_chat.py67297%113, 135
   broadcast_queue.py72199%35
semantic_kernel/agents/open_ai
   assistant_content_generation.py68297%81–82
   open_ai_assistant_base.py361399%243, 321–322
semantic_kernel/connectors/ai
   chat_completion_client_base.py104298%374, 384
semantic_kernel/connectors/ai/azure_ai_inference/services
   azure_ai_inference_chat_completion.py107397%133, 153, 175
semantic_kernel/connectors/ai/embeddings
   embedding_generator_base.py8188%50
semantic_kernel/connectors/ai/google
   shared_utils.py39685%57–59, 97, 118–121
semantic_kernel/connectors/ai/google/google_ai/services
   google_ai_chat_completion.py117497%124, 149, 172, 174
   google_ai_text_completion.py61297%95, 117
   utils.py65395%140, 160–165
semantic_kernel/connectors/ai/google/vertex_ai/services
   utils.py67396%142, 162–167
   vertex_ai_chat_completion.py117497%117, 142, 165, 167
   vertex_ai_text_completion.py60297%91, 111
semantic_kernel/connectors/ai/hugging_face/services
   hf_text_completion.py59395%100, 109, 123
   hf_text_embedding.py32584%79–83
semantic_kernel/connectors/ai/mistral_ai/services
   mistral_ai_chat_completion.py111496%294–297
semantic_kernel/connectors/ai/ollama/services
   ollama_chat_completion.py51296%93, 127
   ollama_text_completion.py48296%88, 115
semantic_kernel/connectors/ai/open_ai/services
   open_ai_chat_completion_base.py117298%114, 257
semantic_kernel/connectors/memory/azure_ai_search
   azure_ai_search_collection.py87298%150, 152
semantic_kernel/connectors/memory/redis
   redis_collection.py160299%146, 316
   utils.py451176%145–146, 164, 166, 173–188
semantic_kernel/connectors/openapi_plugin
   openapi_manager.py58297%110–111
   openapi_parser.py88199%127
   openapi_runner.py105298%181–182
semantic_kernel/connectors/openapi_plugin/models
   rest_api_operation.py129199%242
semantic_kernel/contents
   function_call_content.py97199%201
semantic_kernel/data
   vector_store_record_collection.py2491992%410, 470–474, 482–486, 526–529, 536–539
   vector_store_record_utils.py26292%50, 52
semantic_kernel/functions
   kernel_function_decorator.py98199%102
   kernel_function_from_method.py96199%153
   kernel_function_from_prompt.py154795%165–166, 180, 201, 219, 239, 322
   kernel_function_log_messages.py36683%37–43
   kernel_plugin.py187299%472, 475
semantic_kernel/planners
   plan.py2344581%54, 163–165, 197, 214–227, 264, 269, 277–278, 288–291, 308, 313, 329, 332–337, 355, 360, 363, 365, 372, 386–388, 393–397
semantic_kernel/planners/function_calling_stepwise_planner
   function_calling_stepwise_planner.py116497%145, 189–190, 198
semantic_kernel/planners/sequential_planner
   sequential_planner.py64691%71, 75, 109, 125, 134–135
   sequential_planner_extensions.py50982%31–32, 56, 110–124
   sequential_planner_parser.py771284%66–74, 93, 117–120
semantic_kernel/schema
   kernel_json_schema_builder.py119596%50, 84, 206, 210–211
semantic_kernel/template_engine/blocks
   code_block.py77199%119
   named_arg_block.py43198%98
semantic_kernel/utils/telemetry
   user_agent.py16288%18–19
semantic_kernel/utils/telemetry/model_diagnostics
   decorators.py105298%210, 214
TOTAL1075725298% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
2392 1 💤 0 ❌ 0 🔥 53.532s ⏱️

@nmoeller nmoeller requested a review from moonbox3 August 22, 2024 07:15
@moonbox3 moonbox3 added this pull request to the merge queue Sep 10, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 10, 2024
@moonbox3 moonbox3 added this pull request to the merge queue Sep 11, 2024
github-merge-queue bot pushed a commit that referenced this pull request Sep 11, 2024
### 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 #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.

After Integrating ChatCompletion and Embeddings now i would like to
bring in FunctionCalling

What is integrated yet :

- [X] MistralAI FunctionCalling
- [X] MistralAI FunctionCalling Streaming
- [x] Extended Testing including Unit Testing
- [x] Integration Tests with FunctionCalling 


### Some Notes

- Integration Tests are skipped when the environment variables are not
to not break the current 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: Eduard van Valkenburg <eavanvalkenburg@users.noreply.github.com>
Co-authored-by: Tao Chen <taochen@microsoft.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 11, 2024
@moonbox3 moonbox3 added this pull request to the merge queue Sep 11, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 11, 2024
auto-merge was automatically disabled September 11, 2024 17:29

Head branch was pushed to by a user without write access

@moonbox3 moonbox3 added this pull request to the merge queue Sep 11, 2024
Merged via the queue into microsoft:main with commit 771ae44 Sep 11, 2024
24 of 25 checks passed
@nmoeller nmoeller deleted the issue-6499-Mistral-Ai-Function-Calling branch September 12, 2024 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests for the Python Semantic Kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants