Extracts the output text of a Gemini API response as a JSON payload.
The payload is parsed from the output text produced under the requested response schema, and typed as T without
further validation: callers needing guarantees on its shape must validate it themselves.
Type Parameters
TextendsValue = Value
The expected shape of the JSON payload
Parameters
response: GenerateContentResponse
The response of a generateContent request carrying a response schema
The JSON payload parsed from the output text of response
Throws
Error If response carries no output text (see text), or if its text is not
well-formed JSON, for instance because the reply was cut short by an exhausted output budget
Extracts the output text of a Gemini API response as a JSON payload.
The payload is parsed from the output text produced under the requested response schema, and typed as
Twithout further validation: callers needing guarantees on its shape must validate it themselves.