-
Notifications
You must be signed in to change notification settings - Fork 4k
Python: Fix Ollama settings issue with structured outputs - #12355 #12386
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
Python: Fix Ollama settings issue with structured outputs - #12355 #12386
Conversation
Hi @xyang2013, thanks for creating a PR for this. You'll want to make sure you properly set up your dev env so that you can install the pre-commit hooks. This will ensure that all checks have passed locally - like ruff and others. You can follow our setup guide here: https://github.com/microsoft/semantic-kernel/blob/main/python/DEV_SETUP.md#using-uv. There are also some unit tests failing: https://github.com/microsoft/semantic-kernel/actions/runs/15460655067/job/43533345701?pr=12386#step:5:604. Please have a look, thank you. |
Thanks, @moonbox3. I’ll take a look at the documentation later. Does that mean I need to update not only the Ollama settings file but also the associated unit tests? |
If unit tests are not passing because of this change, then yes, they will need an update. |
Thanks @moonbox3. I spent some time setting up the environment and ran the following command:
It showed up many unrelated errors (not related to Ollama). Should I just focus on the ones related to the change? |
Please run the unit tests, not the integration tests. |
Hi @xyang2013, haven't seen a response from you in a bit. I've got a PR open that fixes this - we should still allow for format: Literal["json"] | dict[str, Any] | None = None No tests are breaking. |
### Motivation and Context Ollama's execution settings currently only allow for `json` literal. We also want to support structured outputs for models that support it. <!-- 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 - Closes #12355 - Supersedes #12386 <!-- 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 😄
Issue heading:
Python: New Feature: OllamaChatPromptExecutionSettings does not support structured outputs #12355
Link:
#12355