Class LlmResponse
java.lang.Object
com.google.adk.JsonBaseModel
com.google.adk.models.LlmResponse
Represents a response received from the LLM.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionError code if the response is an error.static LlmResponse.Builderbuilder()abstract Optional<com.google.genai.types.Content> content()Returns the content of the first candidate in the response, if available.static LlmResponsecreate(com.google.genai.types.GenerateContentResponse response) static LlmResponseReturns the custom metadata of the response, if available.abstract Optional<com.google.genai.types.FinishReason> Error code if the response is an error.Error message if the response is an error.abstract Optional<com.google.genai.types.FinishReason> Error code if the response is an error.abstract Optional<com.google.genai.types.GroundingMetadata> Returns the grounding metadata of the first candidate in the response, if available.abstract Optional<com.google.genai.types.Transcription> Input transcription.Indicates that LLM was interrupted when generating the content.The model version used to generate the response.abstract Optional<com.google.genai.types.Transcription> Output transcription.partial()Indicates whether the text content is part of a unfinished text stream.abstract LlmResponse.BuilderIndicates whether the response from the model is complete.abstract Optional<com.google.genai.types.GenerateContentResponseUsageMetadata> Usage metadata about the response(s).Methods inherited from class JsonBaseModel
fromJsonNode, fromJsonString, getMapper, toJson, toJsonNode, toJsonStringModifier and TypeMethodDescriptionstatic <T extends JsonBaseModel>
TfromJsonNode(com.fasterxml.jackson.databind.JsonNode jsonNode, Class<T> clazz) Deserializes a JsonNode to an object of the given type.static <T extends JsonBaseModel>
TfromJsonString(String jsonString, Class<T> clazz) Deserializes a Json string to an object of the given type.static com.fasterxml.jackson.databind.ObjectMapperReturns the mutable ObjectMapper instance used by ADK.toJson()Serializes this object (i.e., the ObjectMappper instance used by ADK) to a Json string.protected static com.fasterxml.jackson.databind.JsonNodetoJsonNode(Object object) Serializes an object to a JsonNode.static StringtoJsonString(Object object) Serializes an object to a Json string.
-
Method Details
-
content
Returns the content of the first candidate in the response, if available.- Returns:
- An
Contentof the firstCandidatein theGenerateContentResponseif the response contains at least one candidate., or an empty optional if no candidates are present in the response.
-
groundingMetadata
-
customMetadata
-
partial
-
turnComplete
-
errorCode
Error code if the response is an error. Code varies by model. -
finishReason
Error code if the response is an error. Code varies by model. -
avgLogprobs
-
errorMessage
-
interrupted
-
usageMetadata
public abstract Optional<com.google.genai.types.GenerateContentResponseUsageMetadata> usageMetadata()Usage metadata about the response(s). -
modelVersion
-
inputTranscription
Input transcription. The transcription is independent to the model turn which means it doesn't imply any ordering between transcription and model turn. -
outputTranscription
Output transcription. The transcription is independent to the model turn which means it doesn't imply any ordering between transcription and model turn. -
toBuilder
-
builder
-
create
-
create
-