I am trying to do a structured output task with o3 mini. I have defined some enums for one of the fields. For my task, I’m working with 10-15 enums, and depending on some rules, certain enums should be used and not others. I could write these rules into the description field in the schema. But I wonder if there are any approaches I can use?
enumerations are what you make them - what you are asking for is a type of governance, usually the enumerations are attatched to a schema and controlling factor, i use ai, some use other means.
you are also touching base on meta programming - also something i do “alot” just create a ruleset
ruleset in a yaml. thats easy. - that ruleset you send to the llm as a json object - in my experience, you can send a cool 50k instructions before it gets weird. those instructions are also how you get better structured output.
you also mentioned nuances - those are also controlled in the same way
if you need a comprehensive list of about 10 million enumerations categoriezed like this - lmk
This is interesting. When you mentioned sending the ruleset to the LLM as a JSON object, do you mean sending it as part of the system prompt? For example:
system_prompt = f"""
Consider the following ruleset when extracting values: {ruleset}
"""
The keyword array that directly parallels the enum itself will be passed to the AI and is understood in close proximity.
“enum” is the assertion signal being captured for building a context-free output enforcement grammar. The parallel parameter for a description is an annotation, in this case, communicating with the AI for better understanding.
If you like more bloated JSON schema that only demonstrates token consumption by self-imposed strict draft keywords, and also might have a different quality of AI understanding, sure, enjoy “permitted” keyword accompanied by “non-permitted by API” draft spec keyword that only works in conjunction, with more chance of being bounced on you later by some OpenAI-specific validator:
the better data in, the better data out. better if u have local framework make it into a packet and then make the instructions into a packet and then lauch that mfker into the api call. with more instructions.