Skip to content

Commit 466a610

Browse files
authored
Python: Allow for structured outputs with Ollama (#12533)
### 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 😄
1 parent 2e8f17d commit 466a610

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python/semantic_kernel/connectors/ai/ollama/ollama_prompt_execution_settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
class OllamaPromptExecutionSettings(PromptExecutionSettings):
1111
"""Settings for Ollama prompt execution."""
1212

13-
format: Literal["json"] | None = None
13+
format: Literal["json"] | dict[str, Any] | None = None
1414
options: dict[str, Any] | None = None
1515

1616

0 commit comments

Comments
 (0)