Files
semantic-kernel/python/samples
Evan Mattson c084b067de Python: Support structured outputs with Azure AI inference chat completion. (#12183)
### Motivation and Context

The Azure AI inference SDK released support for structured outputs for
chat completions (for models that support it). We had not brought this
into SK. This PR adds functionality and the ability to run the
structured output samples that exist today.

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

Adds functionality to handle structured outputs for the Azure AI
Inference Chat Completion calls.
- Fixes a bug within AzureAIInferenceChatCompletion where the wrong
isinstance check type is used. This prevented adding tool calls during
streaming invocation. Also properly add the `ai_model_id` from the
connector during message construction during streaming invocation,
- Adds unit tests for AzureAIInferenceChatCompletion structured outputs
- Closes #11952

<!-- 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 😄
2025-05-21 09:29:03 +00:00
..
2025-05-06 18:02:41 +00:00

Semantic Kernel Samples

Type Description
getting_started Take this step by step tutorial to get started with Semantic Kernel and get introduced to the key concepts.
getting_started_with_agents Take this step by step tutorial to get started with Semantic Kernel Agents and get introduced to the key concepts.
getting_started_with_processes Take this step by step tutorial to get started with Semantic Kernel Processes and get introduced to the key concepts.
concepts This section contains focused samples which illustrate all of the concepts included in Semantic Kernel.
demos Look here to find a sample which demonstrate how to use many of Semantic Kernel features.
learn_resources Code snippets that are related to online documentation sources like Microsoft Learn, DevBlogs and others