Skip to content

Python: Support structured outputs with Azure AI inference chat completion.#12183

Merged
moonbox3 merged 6 commits intomicrosoft:mainfrom
moonbox3:az-ai-inf-stuctured-outputs
May 21, 2025
Merged

Python: Support structured outputs with Azure AI inference chat completion.#12183
moonbox3 merged 6 commits intomicrosoft:mainfrom
moonbox3:az-ai-inf-stuctured-outputs

Conversation

@moonbox3
Copy link
Collaborator

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.

Description

Adds functionality to handle structured outputs for the Azure AI Inference Chat Completion calls.

Contribution Checklist

@moonbox3 moonbox3 self-assigned this May 20, 2025
@moonbox3 moonbox3 requested a review from a team as a code owner May 20, 2025 09:55
@moonbox3 moonbox3 added the python Pull requests for the Python Semantic Kernel label May 20, 2025
@moonbox3 moonbox3 added the ai connector Anything related to AI connectors label May 20, 2025
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented May 20, 2025

Python Unit Test Overview

Tests Skipped Failures Errors Time
3595 18 💤 0 ❌ 0 🔥 1m 48s ⏱️

@moonbox3 moonbox3 enabled auto-merge May 20, 2025 23:24
@moonbox3 moonbox3 added this pull request to the merge queue May 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 21, 2025
@moonbox3 moonbox3 enabled auto-merge May 21, 2025 09:24
@moonbox3 moonbox3 added this pull request to the merge queue May 21, 2025
Merged via the queue into microsoft:main with commit c084b06 May 21, 2025
28 checks passed
@moonbox3 moonbox3 deleted the az-ai-inf-stuctured-outputs branch May 21, 2025 09:36
@github-project-automation github-project-automation bot moved this to Sprint: Done in Semantic Kernel May 21, 2025
jcruzmot-te pushed a commit to thousandeyes/aia-semantic-kernel that referenced this pull request Sep 15, 2025
…etion. (microsoft#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 microsoft#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 😄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai connector Anything related to AI connectors python Pull requests for the Python Semantic Kernel

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Python: Bug: response_format not supported with AzureAIInferenceChatPromptExecutionSettings

4 participants