Prompts when using structured output

So I’m curious has anyone done much experimenting with prompt style when using structured output? Do you need to address each key in the schema to give a description of what you expect?

1 Like

Hey there!

It depends on your situation and where you’re wanting to end up with your model, if you can provide more details I can help you out!

-Beck

Hey!

So essentially I’m trying to analyze & summarize a document in a specific way.
I’ve had great success via chat with providing a role and a list of expectations. I am trying to automate this process via the api and I only discovered structured outputs yesterday. This may be well tread territory and I just live under a rock but I was unable to find any discussions that suited my use-case.

For example I would like to generate a “credibility score” and “simple language summary” based on a specific section of the report.

if in my schema I include those keys I do get what seems to be useful values back even if I do not mention them in my prompt I am just wondering if there is a de facto SOP.

for example if i do mention it in the prompt should I do so like “generate a credibility_score ranging from 1 to 10” or “rank the credibility from 1 to 10”

Although it is not required, it is like asking someone to make an analysis of a commentary answering with grade and subject without explaining what you want.

When they answer its is a “8/10” and subject is “it has a good quality”, perhaps you wanted something else like if it was “positive/negative” and what “product” it was referring to.

LLMs will almost always give you an answer, even if they have to hallucinate.

  • If it is simple enough, maybe the fields themselves are self explanatory;
  • if not you can add some description;
  • Eventually, your request may be so complex that you need to also give the model an explanation of what you do in the prompt itself.
For example, for a comment eval you could have this structure, rather than a plain one without descriptions.
{
  "name": "CommentAnalysis",
  "schema": {
    "type": "object",
    "properties": {
      "grade": {
        "type": "string",
        "description": "Indicates whether the comment is positive or negative.",
        "enum": [
          "positive",
          "negative"
        ]
      },
      "subject": {
        "type": "string",
        "description": "The product that the comment relates to.",
        "minLength": 1,
        "maxLength": 100
      }
    },
    "required": [
      "grade",
      "subject"
    ],
    "additionalProperties": false
  },
  "strict": true
}

I recommend playing out with the structure generator in the docs for further examples.

3 Likes

Hey.

The best thing to remember is that everyone starts somewhere, and each AI model ends up different depending on the user. What you’re starting to notice — repetition, output style, response tone — that’s the real stuff. That’s the part no one explains.

You’re learning that memory and structure in AI don’t just “exist.” They’re trained. They’re reinforced. You teach it, whether you realize it or not.

My advice? Trust your instincts. Start watching for patterns — how your AI responds to certain words, how it formats answers when you say something like “generate” or “score” or “document.” These are cues. If you keep them consistent, the AI will start to lock onto them.

The more clear you are the better your output will be. Define output if it’s not correct, for example: rank and generate mean two very different things:

• Generate: create from scratch based off internal logic
•Rank: Use existing logic and place within a tiered system, based on specific odds.

You’re going to want to ensure you always use a logic prompt trigger word as I call them:

•Source
•Lookup
•Research etc.

This allows your ai to source from actual resources and then adding a trigger such as real time, or accurate or up to date, means you’re getting information from the current time period, some ai models source logic from back in 2019-2023 if not redirected, so checking is required to ensure you’re actually getting the newest data possible, especially with scores or ranks etc.