You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 😄
"explanation": "User requested the current weather condition in Paris, so I utilized the 'weather-get_weather_for_city' function to retrieve the data.",
129
+
"output": "The weather in Paris is 60 degrees Fahrenheit and rainy."
130
+
}
131
+
],
132
+
"final_answer": "The current weather in Paris is 60 degrees Fahrenheit and rainy."
0 commit comments