A Structured Output is a way of interacting with a large language model while ensuring that its output conforms to a specific format that you can then use in your applications.
This is achieved by creating a JSON file which contains the information about the properties you require the LLM to output.
To make this process more flexible, I’ve created a Java implementation of the most useful commands, it’s available on Github, here.
To use it, simply create a Structure object and add in your required properties, you can then choose to restrict the response to conform exactly to your structure, or allow it to add its own properties.
For example, you can require that the LLM output a specific value, like the confidence level in its response. This can then be used to either disregard its response entirely, or use it for the originally intended purpose.
To learn more about the OpenAI implementation of Structured Outputs, click here.
Leave a Reply