By providing a Pydantic model as an additional argument to an OpenAI ChatCompletion call, this package allows developers to easily obtain structured data that conforms to their Pydantic model definition.
It works by inserting a tuned prompt that includes the Pydantic model’s json_schema.
Post-completion it further validates the language model output and remediates errors by providing feedback to the model if errors are encountered during json parsing or during Pydantic model validation.
Six examples are provided for different types of unstructured data, including nested data.