You've been doing this for a while now:
response = client.chat.completions.create(
model="gemini-2.0-flash",
messages=[{"role": "user", "content": f"Extract the following fields from this text: {fields}. Text: {text}"}]
)
data = json.loads(response.choices[0].message.content)
proposal = Proposal(**data)
Parse the response. Hope the JSON is valid. Add a retry. Add a fallback. Add validation. Repeat for every model in your app.
There's a better way.
Meet exomodel
exomodel is an open-source Python framework that turns your Pydantic models into autonomous agents. Instead of writing prompts that produce objects, you define the object — and it fills itself.
The paradigm shift:
Old way
exomodel way
Write prompt → parse response → validate
Define schema → call .create()
Manual JSON extraction
Native Pydantic validation
One prompt per model
Provider-agnostic, reusable
Fragile string parsing
Structured output, always
Let's build someth
Discussion
Say something first
It all starts with you—share your thoughts now.