Optionaloptions: { parser?: MessageParser<O>; request?: GenerateRequest<z.ZodTypeAny> }Provider-specific response data.
OptionalfinishAdditional information about why the model stopped generating, if any.
The reason generation stopped for this request.
OptionalmessageThe generated message.
OptionalparserThe parser for output parsing of this response.
OptionalrequestThe request that generated this response.
Usage information.
Returns all tool requests annotated as interrupts found in the generated message.
A list of ToolRequestParts.
Returns the first detected media part in the generated message. Useful for extracting (for example) an image from a generation expected to create one.
The first detected media part in the candidate.
Returns the message history for the request by concatenating the model response to the list of messages from the request. The result of this method can be safely serialized to JSON for persistence in a database.
A serializable list of messages compatible with generate({history}).
If the generated message contains a data part, it is returned. Otherwise,
the output() method extracts the first valid JSON object or array from the text
contained in the selected candidate's message and returns it.
The structured output contained in the selected candidate.
Concatenates all text parts present in the generated message with no delimiter.
A string of all concatenated text parts.
Returns all tool request found in the generated message.
Array of all tool request found in the candidate.
Throws an error if the response does not conform to expected schema.
Optionalrequest: GenerateRequest<z.ZodTypeAny>Optionalrequest: GenerateRequest<z.ZodTypeAny>
GenerateResponse is the result from a
generate()call and contains one or more generated candidate messages.