Skip to content

Conversation

@eavanvalkenburg
Copy link
Member

@eavanvalkenburg eavanvalkenburg commented Jul 8, 2024

Motivation and Context

Up until this point, we had not had full test coverage for all openai classes, and mypy type checking was disabled.
These have now both been solved, lots of small fixes for the typing and a set of new tests for the different parts of the openai suite of classes have been added.

fixes #7131
fixes #6930

Description

The unit tests for OpenAI all now have multiple ways of creating checked and tested.
Also actual responses from the openai package are created and used to test the parsing of those into our classes.

Contribution Checklist

@eavanvalkenburg eavanvalkenburg requested a review from a team as a code owner July 8, 2024 15:15
@eavanvalkenburg eavanvalkenburg marked this pull request as draft July 8, 2024 15:16
@markwallace-microsoft markwallace-microsoft added the python Pull requests for the Python Semantic Kernel label Jul 8, 2024
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Jul 8, 2024

Py3.10 Test Coverage

Python 3.10 Test Coverage Report •
FileStmtsMissCoverMissing
semantic_kernel/connectors/ai
   chat_completion_client_base.py14564%51, 90–96
   text_completion_client_base.py12558%43, 74–78
semantic_kernel/connectors/ai/azure_ai_inference/services
   azure_ai_inference_chat_completion.py1417646%133–159, 187–206, 233–244, 253–289, 295–306, 326–348, 370–373, 402–411, 419, 434–436, 454
semantic_kernel/connectors/ai/embeddings
   embedding_generator_base.py8188%48
semantic_kernel/connectors/ai/open_ai/services
   azure_chat_completion.py853262%141, 147–148, 157–158, 163–180, 184–188, 200–211
   azure_config_base.py35489%76–78, 93
   open_ai_chat_completion.py26388%58–59, 65
   open_ai_chat_completion_base.py1687058%93, 97, 117, 142–146, 171, 179, 181, 185, 203–208, 226–254, 257–268, 283–290, 301–309, 325–332, 353, 361, 367–370, 382–385, 416
   open_ai_handler.py46491%67–68, 80–81
   open_ai_text_completion.py25484%58–59, 61, 80
   open_ai_text_completion_base.py602657%66–69, 92–109, 115–118, 137, 145
   open_ai_text_embedding.py24483%59–60, 62, 80
   open_ai_text_embedding_base.py36489%56–57, 60, 74
semantic_kernel/contents
   streaming_text_content.py14471%32, 40, 42, 44
   text_content.py28293%49, 56
TOTAL684761991% 

Python 3.10 Unit Test Overview

Tests Skipped Failures Errors Time
1695 1 💤 0 ❌ 0 🔥 22.499s ⏱️

@moonbox3
Copy link
Collaborator

moonbox3 commented Jul 8, 2024

By the time we create a PR from this draft, I really hope the motivation & context section can be more than two words. :)

@eavanvalkenburg eavanvalkenburg marked this pull request as ready for review July 9, 2024 14:48
@eavanvalkenburg eavanvalkenburg enabled auto-merge July 9, 2024 14:52
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Jul 10, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 10, 2024
@moonbox3 moonbox3 added this pull request to the merge queue Jul 10, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jul 10, 2024
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Jul 11, 2024
Merged via the queue into microsoft:main with commit ea92767 Jul 11, 2024
@eavanvalkenburg eavanvalkenburg deleted the cqs_openai branch July 11, 2024 12:09
github-merge-queue bot pushed a commit that referenced this pull request Jul 11, 2024
### 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.


![image](https://github.com/microsoft/semantic-kernel/assets/23048106/5822896e-17d1-4d68-9348-da6765ac3527)


### 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>
LudoCorporateShark pushed a commit to LudoCorporateShark/semantic-kernel that referenced this pull request Aug 25, 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.
-->
Up until this point, we had not had full test coverage for all openai
classes, and mypy type checking was disabled.
These have now both been solved, lots of small fixes for the typing and
a set of new tests for the different parts of the openai suite of
classes have been added.

fixes microsoft#7131
fixes microsoft#6930

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
The unit tests for OpenAI all now have multiple ways of creating checked
and tested.
Also actual responses from the openai package are created and used to
test the parsing of those into our classes.

### 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 😄
LudoCorporateShark pushed a commit to LudoCorporateShark/semantic-kernel that referenced this pull request Aug 25, 2024
### 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.


![image](https://github.com/microsoft/semantic-kernel/assets/23048106/5822896e-17d1-4d68-9348-da6765ac3527)


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

Python: CQ Spike: OpenAI Python: KernelArguments should be optional if there are no arguments

4 participants