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 LlmResponseabstract 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.Indicates that LLM was interrupted when generating the content.The model version used to generate the response.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, toJsonString
-
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
-
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
-
toBuilder
-
builder
-
create
-
create
-