Extracts the output text of a chat completion as a JSON payload.
The payload is parsed from the output text produced under the requested response format, and typed as T without
further validation: callers needing guarantees on its shape must validate it themselves.
A strict response format states an absent member as null instead of leaving it out. Object members stated as
null are therefore dropped, so that a payload generated under a strict schema conforms to the shape the schema was
converted from. null array items are kept.
Type Parameters
TextendsValue = Value
The expected shape of the JSON payload
Parameters
completion: ChatCompletion
The completion of a chat.completions.create request carrying a JSON response format
Extracts the output text of a chat completion as a JSON payload.
The payload is parsed from the output text produced under the requested response format, and typed as
Twithout further validation: callers needing guarantees on its shape must validate it themselves.A strict response format states an absent member as
nullinstead of leaving it out. Object members stated asnullare therefore dropped, so that a payload generated under a strict schema conforms to the shape the schema was converted from.nullarray items are kept.