This article was originally published on My Tech Blog.
AI Builder has added a feature similar to structured outputs, so I decided to try it out.
What is JSON Output?
Broadly speaking, JSON output (structured output) means "specifying the LLM's response into a designated JSON format data."
Until now, we used prompts like the following to specify the output, but the stability of the output wasn't quite there.
Generate the output in the following JSON format.
# output json schema
{
"type" : "object",
"properties" :
(omitted below)
}
Original OpenAI models and Azure OpenAI GPT models added "Structured Outputs" (formerly JSON mode), and now a corresponding feature has been equipped in AI Builder as well.
So, I decided to play around with it immediately.
*Official documentation is here:
[https://learn.microsoft.com/en-us/ai-builder/change-prompt-output]
Building JSON Output
For example, let's say we receive an email like this and want to use AI to extract "candidate dates and times."

First, select the "Create text with GPT using a prompt" action and choose [New custom prompt].

Then, select the "Output" icon, click [JSON] -> [Edit].

Enter an example of the JSON you want to output, click [Apply], and then [Save custom prompt].
*You can also specify the output JSON using a schema.

Finally, go back to Power Automate and input the string from earlier into the Input field to complete it.

When you run the flow, it returns the response in the "specified JSON" like this.

The Benefits of JSON Output
The advantage of outputting in JSON is that "it is easy to handle the results generated by GPT as data."
For example, in this case, by combining the generation results from GPT with Outlook's "Create event" action,

you can easily set the generated values to "Start time" and "End time,"

and easily add a schedule using a flow combined with GPT.

So, that was the extremely convenient JSON output.

Top comments (0)