Structured output allows you to always format responses according to a specific input JSON schema. As of now, the following models support structured output under PremSDK:

  1. gpt-4o
  2. gpt-4o-mini

To invoke function calling, you need to define a JSON schema and pass that schema inside the response_format argument. Here is an example to get started with structured output using PremAI SDK.

To understand structured output, you should have an understanding of the Prem SDK. If not, please check that out first.


Structured Output is still on early phases. We are going to bring more improvements in near future starting from supporting structured outputs on other LLMs and support for pydantic and Zod in our SDK.