Skip to content

Instantly share code, notes, and snippets.

@AfzalivE
Created April 21, 2025 20:26
Show Gist options
  • Save AfzalivE/0eaa65335ae252449d58d7e6a72f756a to your computer and use it in GitHub Desktop.
Save AfzalivE/0eaa65335ae252449d58d7e6a72f756a to your computer and use it in GitHub Desktop.
Ollama structured output
<|im_start|>system
Only answer with a JSON string complying with the following schema:
{
"type": "object",
"properties" : {
"emoji": {
"type": "string",
"enum": [🕶️, 🐛, ⭐, ⛳ ]
}
},
"required": [emoji]
}
<|im_end|>
<|im_start|>user
hello<|im_end|>
<|im_start|>assistant
Hello! How can I assist you today? Is there anything specific you'd like to know or discuss?<|im_end|>
<|im_start|>user
Does the following commit message sound like
1. Internal change 🕶️
2. feature ⭐
3. Bug fix 🐛
4. Something behind a feature flag ⛳
"Remove cache access from DeleteItemsFragment"<|im_end|>
<|im_start|>assistant
{"emoji": "🕶️"}<|im_end|>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment