Skip to content

Python: Exclude certain fields from KernelFunction model dump #11081

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 1 commit into from
Mar 20, 2025

Conversation

moonbox3
Copy link
Contributor

Motivation and Context

When trying to do a model dump for KernelFunction models, they are failing with a message related to:

pydantic_core._pydantic_core.PydanticSerializationError: Unable to serialize unknown type: <class 'type'>

There are some class-level attributes that cannot be properly serialized.

Description

Exclude dumping certain model attributes from the model dump, which allows the main KernelFunction metadata and its underlying parameters to be serialized.

Contribution Checklist

@moonbox3 moonbox3 requested a review from a team as a code owner March 20, 2025 00:52
@markwallace-microsoft markwallace-microsoft added the python Pull requests for the Python Semantic Kernel label Mar 20, 2025
@moonbox3 moonbox3 self-assigned this Mar 20, 2025
@markwallace-microsoft
Copy link
Member

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
semantic_kernel/functions
   kernel_function_from_method.py96199%153
TOTAL20883233289% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3334 5 💤 0 ❌ 0 🔥 1m 40s ⏱️

@moonbox3 moonbox3 added this pull request to the merge queue Mar 20, 2025
Merged via the queue into microsoft:main with commit ec89fe4 Mar 20, 2025
30 checks passed
@moonbox3 moonbox3 deleted the kernel-func-model-dump branch March 20, 2025 02:22
@github-project-automation github-project-automation bot moved this to Sprint: Done in Semantic Kernel Mar 20, 2025
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
Archived in project
Development

Successfully merging this pull request may close these issues.

Python: Bug: KernelFunction model_dump(mode="json") fails
4 participants