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 TypeMethodDescriptionstatic LlmResponse.Builder
builder()
abstract Optional
<com.google.genai.types.Content> content()
Returns the content of the first candidate in the response, if available.static LlmResponse
create
(com.google.genai.types.GenerateContentResponse response) static LlmResponse
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.GroundingMetadata> Returns the grounding metadata of the first candidate in the response, if available.Indicates that LLM was interrupted when generating the content.partial()
Indicates whether the text content is part of a unfinished text stream.abstract LlmResponse.Builder
Indicates whether the response from the model is complete.Methods inherited from class com.google.adk.JsonBaseModel
fromJsonNode, fromJsonString, getMapper, toJson, toJsonNode, toJsonString
-
Method Details
-
content
Returns the content of the first candidate in the response, if available.- Returns:
- An
Content
of the firstCandidate
in theGenerateContentResponse
if 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. -
errorMessage
-
interrupted
-
toBuilder
-
builder
-
create
-
create
-