Class Event
java.lang.Object
com.google.adk.JsonBaseModel
com.google.adk.events.Event
Represents an event in a session.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionactions()author()The author of the event, it could be the name of the agent or "user" literal.branch()The branch of the event.voidSets the branch for this event.static Event.Builderbuilder()Optional<com.google.genai.types.Content> content()The custom metadata of the event.booleanOptional<com.google.genai.types.FinishReason> final booleanReturns true if this is a final response.Optional<com.google.genai.types.FinishReason> static EventParses an event from a JSON string.final com.google.common.collect.ImmutableList<com.google.genai.types.FunctionCall> Returns all function calls from this event.final com.google.common.collect.ImmutableList<com.google.genai.types.FunctionResponse> Returns all function responses from this event.static StringOptional<com.google.genai.types.GroundingMetadata> The grounding metadata of the event.inthashCode()final booleanReturns whether the event has a trailing code execution result.id()The event id.Optional<com.google.genai.types.Transcription> Input transcription.Id of the invocation that this event belongs to.Set of ids of the long running function calls.The model version used to generate the response.Optional<com.google.genai.types.Transcription> Output transcription.partial()partial is true for incomplete chunks from the LLM streaming response.voidsetActions(EventActions actions) voidvoidsetAvgLogprobs(@Nullable Double avgLogprobs) voidsetContent(@Nullable com.google.genai.types.Content content) voidsetCustomMetadata(@Nullable List<com.google.genai.types.CustomMetadata> customMetadata) voidsetErrorCode(@Nullable com.google.genai.types.FinishReason errorCode) voidsetErrorMessage(@Nullable String errorMessage) voidsetFinishReason(@Nullable com.google.genai.types.FinishReason finishReason) voidsetFinishReason(Optional<com.google.genai.types.FinishReason> finishReason) Deprecated.voidsetGroundingMetadata(@Nullable com.google.genai.types.GroundingMetadata groundingMetadata) voidvoidsetInputTranscription(@Nullable com.google.genai.types.Transcription inputTranscription) voidsetInterrupted(@Nullable Boolean interrupted) voidsetInvocationId(String invocationId) voidsetLongRunningToolIds(@Nullable Set<String> longRunningToolIds) voidsetModelVersion(@Nullable String modelVersion) voidsetOutputTranscription(@Nullable com.google.genai.types.Transcription outputTranscription) voidsetPartial(@Nullable Boolean partial) voidsetTimestamp(long timestamp) voidsetTurnComplete(@Nullable Boolean turnComplete) voidsetUsageMetadata(@Nullable com.google.genai.types.GenerateContentResponseUsageMetadata usageMetadata) final StringConverts the event content into a readable string.longThe timestamp of the event.Creates a builder pre-filled with this event's values.toString()Optional<com.google.genai.types.GenerateContentResponseUsageMetadata> 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
-
generateEventId
-
id
The event id. -
setId
-
invocationId
Id of the invocation that this event belongs to. -
setInvocationId
-
author
The author of the event, it could be the name of the agent or "user" literal. -
setAuthor
-
content
-
setContent
public void setContent(@Nullable com.google.genai.types.Content content) -
actions
-
setActions
-
longRunningToolIds
-
setLongRunningToolIds
-
partial
-
setPartial
-
turnComplete
-
setTurnComplete
-
errorCode
-
finishReason
-
setErrorCode
public void setErrorCode(@Nullable com.google.genai.types.FinishReason errorCode) -
setFinishReason
Deprecated. -
setFinishReason
public void setFinishReason(@Nullable com.google.genai.types.FinishReason finishReason) -
errorMessage
-
setErrorMessage
-
usageMetadata
-
setUsageMetadata
public void setUsageMetadata(@Nullable com.google.genai.types.GenerateContentResponseUsageMetadata usageMetadata) -
avgLogprobs
-
setAvgLogprobs
-
interrupted
-
setInterrupted
-
branch
-
branch
Sets the branch for this event.Format: agentA.agentB.agentC — shows hierarchy of nested agents.
- Parameters:
branch- Branch identifier.
-
groundingMetadata
The grounding metadata of the event. -
setGroundingMetadata
public void setGroundingMetadata(@Nullable com.google.genai.types.GroundingMetadata groundingMetadata) -
customMetadata
-
setCustomMetadata
-
modelVersion
-
setModelVersion
-
inputTranscription
Input transcription. The transcription is independent to the model turn which means it doesn't imply any ordering between transcription and model turn. -
setInputTranscription
public void setInputTranscription(@Nullable com.google.genai.types.Transcription inputTranscription) -
outputTranscription
Output transcription. The transcription is independent to the model turn which means it doesn't imply any ordering between transcription and model turn. -
setOutputTranscription
public void setOutputTranscription(@Nullable com.google.genai.types.Transcription outputTranscription) -
timestamp
public long timestamp()The timestamp of the event. -
setTimestamp
public void setTimestamp(long timestamp) -
functionCalls
public final com.google.common.collect.ImmutableList<com.google.genai.types.FunctionCall> functionCalls()Returns all function calls from this event. -
functionResponses
public final com.google.common.collect.ImmutableList<com.google.genai.types.FunctionResponse> functionResponses()Returns all function responses from this event. -
hasTrailingCodeExecutionResult
public final boolean hasTrailingCodeExecutionResult()Returns whether the event has a trailing code execution result. -
finalResponse
public final boolean finalResponse()Returns true if this is a final response. -
stringifyContent
Converts the event content into a readable string.Includes text, function calls, and responses.
- Returns:
- Stringified content.
-
builder
-
fromJson
-
toBuilder
Creates a builder pre-filled with this event's values. -
equals
-
toString
-
hashCode
-