Skip to content

Python: Add json schema handling. Add experimental tag to OpenAPI and Memory Connectors. #6335

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

Merged
merged 9 commits into from
May 20, 2024

Conversation

moonbox3
Copy link
Contributor

Motivation and Context

The Python code base could handle some primitive types for the schema for tool call objects and kernel parameter metadata. However, it couldn't properly handle the more complex JSON schemas for tool call objects.

Description

This PR introduces:

Contribution Checklist

@moonbox3 moonbox3 requested a review from a team as a code owner May 19, 2024 23:43
@markwallace-microsoft markwallace-microsoft added python Pull requests for the Python Semantic Kernel memory labels May 19, 2024
Copy link
Member

@eavanvalkenburg eavanvalkenburg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! Some minor notes!

@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented May 20, 2024

Py3.10 Test Coverage

Python 3.10 Test Coverage Report •
FileStmtsMissCoverMissing
semantic_kernel
   kernel.py2625081%122, 124, 190, 197–206, 236, 246–254, 326–362, 432–433, 660, 681–683, 719, 721, 731
   kernel_pydantic.py9189%6
semantic_kernel/connectors/ai/google_palm/services
   gp_text_embedding.py32681%34–35, 61–62, 71–72
semantic_kernel/connectors/ai/hugging_face/services
   hf_text_embedding.py21210%3–60
semantic_kernel/connectors/ai/open_ai/services
   open_ai_text_embedding.py22386%55–56, 85
   open_ai_text_embedding_base.py19195%45
   utils.py201430%20–30, 38–53
semantic_kernel/connectors/openapi_plugin
   openapi_function_execution_parameters.py26196%36
   openapi_manager.py34514059%105–111, 114–131, 134–136, 139–152, 155–166, 169–181, 208, 224, 237, 271, 276, 280, 356, 379, 382, 411, 479, 482–483, 491–492, 518–520, 526–527, 533–547, 551–567, 570–572, 575–577, 585–628, 691–724
semantic_kernel/functions
   kernel_function_from_method.py85693%128, 147–148, 154, 157–158
semantic_kernel/memory
   memory_query_result.py24962%45–52, 68
   memory_record.py471764%46–54, 76, 108, 121, 125, 129, 133, 137, 141
   memory_store_base.py11373%13, 16, 20
   null_memory.py15567%19, 31, 35, 45, 49
   semantic_text_memory.py351946%30–32, 55–67, 92–104, 120–121, 144–153, 161
   volatile_memory_store.py986336%32–35, 45, 56–57, 68, 80–85, 97–103, 116–128, 143–153, 165–171, 183–188, 208, 236–279
semantic_kernel/schema
   kernel_json_schema_builder.py45296%32, 57
TOTAL6260103983% 

Python 3.10 Unit Test Overview

Tests Skipped Failures Errors Time
1341 1 💤 0 ❌ 0 🔥 12.712s ⏱️

Copy link
Member

@eavanvalkenburg eavanvalkenburg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nits, nothing major

@moonbox3 moonbox3 enabled auto-merge May 20, 2024 21:03
@moonbox3 moonbox3 added this pull request to the merge queue May 20, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 20, 2024
@moonbox3 moonbox3 enabled auto-merge May 20, 2024 21:54
@moonbox3 moonbox3 added this pull request to the merge queue May 20, 2024
Merged via the queue into microsoft:main with commit 517a0f8 May 20, 2024
25 checks passed
@moonbox3 moonbox3 deleted the json_schema branch May 20, 2024 22:02
LudoCorporateShark pushed a commit to LudoCorporateShark/semantic-kernel that referenced this pull request Aug 25, 2024
… Memory Connectors. (microsoft#6335)

### Motivation and Context

The Python code base could handle some primitive types for the schema
for tool call objects and kernel parameter metadata. However, it
couldn't properly handle the more complex JSON schemas for tool call
objects.

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

### Description

This PR introduces:
- JSON schema handling for KernelParameterMetadata and tool call
objects.
- Updates to the tool call utils method to properly recurse on the
KernelParameterMetadata's stucture.
- Adds unit tests for this code.
- Add experimental_class/experimental_functions to various parts of the
code base like Memory Connectors and OpenAPI plugin.
- Fixes microsoft#6310 
- Fixes microsoft#6280

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### 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 😄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
memory python Pull requests for the Python Semantic Kernel
Projects
None yet
4 participants