Python: fix Google AI/Vertex AI crash on anyOf schema (#12442) by weiguangli-io · Pull Request #13624 · microsoft/semantic-kernel
…t#12442) The Google AI protobuf Schema does not support anyOf/oneOf fields or type-as-array. When ChatCompletionAgent instances are used as plugins, their parameter schemas (e.g. str | list[str]) include anyOf which causes ValueError during protobuf conversion. Add sanitize_schema_for_google_ai() to shared_utils that recursively rewrites anyOf/oneOf/type-array into nullable + single-type format. Apply it in both Google AI and Vertex AI function call format converters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rams, add integration tests - Add "allOf" to the sanitizer loop alongside anyOf/oneOf so allOf schemas are handled instead of passing through unsanitized - Guard Vertex AI parameters construction when metadata.parameters is empty, aligning behavior with the Google AI version - Add allOf unit tests (with and without null variants) - Add edge-case tests: all-null type list, all-null anyOf, variant with its own description - Add integration tests for both Google AI and Vertex AI format functions to prove end-to-end sanitization
- Capitalize first word of docstrings (D403): anyOf->AnyOf, oneOf->OneOf, allOf->AllOf - Add missing docstrings to test_sanitize_schema_none and test_sanitize_schema_simple_passthrough (D103) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters