# 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

LlmResponse
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

Companion
Link copied to clipboard
object Companion

## Properties

citationMetadata
Link copied to clipboard
val citationMetadata: CitationMetadata? = null

The citation metadata of the response.

content
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.

errorMessage
Link copied to clipboard
val errorMessage: String? = null

Error message if the response is an error.

finishReason
Link copied to clipboard
val finishReason: FinishReason? = null

The finish reason of the response.

groundingMetadata
Link copied to clipboard
val groundingMetadata: GroundingMetadata? = null

The grounding metadata of the response.

interrupted
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.

modelVersion
Link copied to clipboard
val modelVersion: String? = null

The model version used to generate the response.

partial
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.

usageMetadata
Link copied to clipboard
val usageMetadata: UsageMetadata? = null

The usage metadata of the LlmResponse.