How can I define Structured Outputs in LLMSynthesize?

Is there any way to work with structured outputs in LLMSynthesize? I couldn’t find it in the documentation. I would like to specify the JSON format of the result, for example, to ensure the output follows a structure like:

[{"name": ..., "role": ..., "company": ...}, ...]

Any tips?

Below is the OpenAI documentation on the topic: https://platform.openai.com/docs/guides/structured-outputs

You’ll have to use the API directly to get structured outputs.
Here’s the chain of thought example from Structured model outputs | OpenAI API converted to a ServiceExecute call
https://www.wolframcloud.com/obj/e36bc8e4-ac00-4872-84df-43714b38e29e

One way is to use the prompt “NothingElse”. You might also consider using ImportString for the obtained JSON text. See the attached notebook.


LLMSynthesize-for-structural-output.nb (154 KB)

Also, shameless plug, more workflows like the ones above are discussed here:


Robust-LLM-pipelines-thumbnail-small.png