LlmResponse

data class LlmResponse(val content: Content? = null, val usageMetadata: UsageMetadata? = null, val finishReason: FinishReason? = null, val errorMessage: String? = null, val partial: Boolean = false, val interrupted: Boolean = false, val modelVersion: String? = null, val citationMetadata: CitationMetadata? = null, val groundingMetadata: GroundingMetadata? = null)

LLM response class that provides the first candidate response from the model if available. Otherwise, contains the error code and message.

Constructors

Link copied to clipboard
constructor(content: Content? = null, usageMetadata: UsageMetadata? = null, finishReason: FinishReason? = null, errorMessage: String? = null, partial: Boolean = false, interrupted: Boolean = false, modelVersion: String? = null, citationMetadata: CitationMetadata? = null, groundingMetadata: GroundingMetadata? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The citation metadata of the response.

Link copied to clipboard
val content: Content? = null

The generative content of the response. This should only contain content from the user or the model, and not any framework or system-generated data.

Link copied to clipboard
val errorMessage: String? = null

Error message if the response is an error.

Link copied to clipboard

The finish reason of the response.

Link copied to clipboard

The grounding metadata of the response.

Link copied to clipboard
val interrupted: Boolean = false

Flag indicating that LLM was interrupted when generating the content. Usually it's due to user interruption during a bidi streaming.

Link copied to clipboard
val modelVersion: String? = null

The model version used to generate the response.

Link copied to clipboard
val partial: Boolean = false

Indicates whether the text content is part of an unfinished text stream. Only used for streaming mode and when the content is plain text.

Link copied to clipboard

The usage metadata of the LlmResponse.