Generate JSON that matches your exact schema — every time. 100% guaranteed schema compliance with automatic validation.
Outputs always match your schema — no more parsing errors
Eliminate regex, retry logic, and validation code
Generate data that integrates directly with your code
Hope the model returns valid JSON:
Guaranteed valid JSON every time:
Define your schema using JSON Schema and pass it to the API:
from mythicdot import MythicDot
client = MythicDot()
response = client.chat.completions.create(
model="mythic-4",
messages=[
{"role": "user", "content": "Extract info: John is 30, works at Acme Inc as an engineer"}
],
response_format={
"type": "json_schema",
"json_schema": {
"name": "person",
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"},
"company": {"type": "string"},
"role": {"type": "string"}
},
"required": ["name", "age", "company", "role"]
}
}
}
)
# Output is guaranteed to match schema
person = response.choices[0].message.parsed
print(person.name) # "John"
print(person.age) # 30
Extract structured information from documents, emails, or any text into a consistent format.
Generate records that match your database schema exactly, ready for insertion.
Build APIs that return consistent, typed responses from AI-generated content.
Create form data, configuration files, or any structured content automatically.
| Type | Description | Example |
|---|---|---|
string |
Text values | "Hello" |
integer |
Whole numbers | 42 |
number |
Floating-point | 3.14 |
boolean |
True/false | true |
array |
Ordered lists | ["a", "b"] |
object |
Nested structures | {"key": "value"} |
enum |
Fixed set of values | "draft" | "published" |
When you need the model to output only specific values (like status codes, categories, or ratings), use the enum type to guarantee valid outputs.
Try structured outputs with your first API call.
Get Started →