Replies: 2 comments
-
See OpenAI`s Structured Outputs vs JSON mode |
Beta Was this translation helpful? Give feedback.
0 replies
-
TODO: Update FormatDefinition section |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For each prompt template you can define the exact format you need.
It's similar concept as JSON mode from OpenAI (its kinda super-JSON mode) but with 3 advantages:
Simple syntax
- EXPECT JSON
- EXPECT XML
Format + count expectations
You can combine format and count - it will only take and count the data part, not the structure part:
This will NOT pass:
This will pass:
Format + schema
Partial check
If there are any tokens you have that cannot result in a valid format (even healed). The partial result is discarded and one token is returned.
See more in discussion about 🔙 Expectation-aware generation.
Healing
When there is obvious how to make format valid from invalid, it is done without rerunning LLM.
This invalid JSON:
Will be healed:
FormatDefinition
Each format is defined by a format definition.
For all code samples look here.
Beta Was this translation helpful? Give feedback.
All reactions