Package com.google.genkit.ai.agent
Class AgentStreamChunk
java.lang.Object
com.google.genkit.ai.agent.AgentStreamChunk
AgentStreamChunk represents a streaming chunk from an agent execution.
The customPatch field is a JSON array of JSON-patch operations (RFC 6902).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for AgentStreamChunk. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AgentStreamChunk.Builderbuilder()Creates a builder for AgentStreamChunk.Returns the artifact in this chunk.com.fasterxml.jackson.databind.JsonNodeReturns the custom-state patch as a JSON array of patch operations.Returns the model response chunk.Returns the turn-end signal.voidsetArtifact(Artifact artifact) Sets the artifact.voidsetCustomPatch(com.fasterxml.jackson.databind.JsonNode customPatch) Sets the custom-state patch.voidsetModelChunk(ModelResponseChunk modelChunk) Sets the model response chunk.voidsetTurnEnd(TurnEnd turnEnd) Sets the turn-end signal.
-
Constructor Details
-
AgentStreamChunk
public AgentStreamChunk()Default constructor.
-
-
Method Details
-
builder
Creates a builder for AgentStreamChunk.- Returns:
- a new builder
-
getModelChunk
Returns the model response chunk.- Returns:
- the model chunk
-
setModelChunk
Sets the model response chunk.- Parameters:
modelChunk- the model chunk
-
getCustomPatch
public com.fasterxml.jackson.databind.JsonNode getCustomPatch()Returns the custom-state patch as a JSON array of patch operations.- Returns:
- the custom patch node (array)
-
setCustomPatch
public void setCustomPatch(com.fasterxml.jackson.databind.JsonNode customPatch) Sets the custom-state patch.- Parameters:
customPatch- a JSON array of patch operations
-
getArtifact
Returns the artifact in this chunk.- Returns:
- the artifact, or null if not present
-
setArtifact
Sets the artifact.- Parameters:
artifact- the artifact
-
getTurnEnd
Returns the turn-end signal.- Returns:
- the turn end, or null if the turn has not ended
-
setTurnEnd
Sets the turn-end signal.- Parameters:
turnEnd- the turn end
-