Simple Enums missing from structured outputs
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.5k
- Forks
- 1.2k
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Description
Structured outputs currently only support Pydantic models (which are very useful), but is presently missing support for simple Enums, and requires redundant wrapping into a Pydantic model.
I want to be able to perform queries such as:
class SomeEnum(Enum):
SomeType: 'SomeType',
AnotherType: 'AnotherType'
response = ollama.chat(
model=...,
messages=...,
format=SomeEnum)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how ollama.chat handles the format argument and how the existing Pydantic structured-output path is implemented. Add support for passing a simple Python Enum directly, then verify that structured responses are constrained to the Enum values and that the existing Pydantic behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100