LlmResponse
LLM response class that provides the first candidate response from the model if available. Otherwise, contains the error code and message.
Constructors
Types
Fluent builder for LlmResponse, provided primarily for Java callers. Any property left unset falls back to the same default as the constructor.
Properties
Context cache metadata for this response, populated when context caching is enabled. null when caching is disabled or no cache information is available.
The citation metadata of the response.
Optional key-value pairs labeling the response. The entire map must be JSON serializable.
Error message if the response is an error.
The finish reason of the response.
Warning that the server will stop serving this connection shortly. Live only.
The grounding metadata of the response.
Transcription of the audio the user sent. Live only.
Whether the model is still working on the prompt, reported only with turnComplete; see InteractionStatus. On a completed turn, null means the model does not report it and is done. Live only.
Flag indicating that LLM was interrupted when generating the content. Usually it's due to user interruption during a bidi streaming.
Identifier of the live session this response came from. Live only.
A handle for resuming this session on a later connection. Live only.
The model version used to generate the response.
Transcription of the audio the model returned. Live only.
Whether the model has finished its turn. Live only.
Why the turn ended, when it ended for a reason other than ordinary completion. Live only.
The usage metadata of the LlmResponse.
A server-detected change in whether the user is speaking. Live only.
Functions
Returns a Builder initialized with this instance's properties, primarily for Java callers. Prefer it over copy from Java: copy takes every property positionally, so its signature changes whenever a property is added.