Package com.axelor.ai.chat.stream
Class Turn
java.lang.Object
com.axelor.ai.chat.stream.Turn
Accumulator for one assistant turn. The streamer emits ASSISTANT + TOOL
UIMessages across
multiple agentic steps; this class folds them into a single parts list with UIPart.StepStart delimiters between steps.
One instance per top-level stream. Sub-agent frames share the same Turn with the
parent — their parts are appended (and stamped with axelor.agentCode by the persistence
service) into the same row.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendAssistantStep(List<UIPart> stepParts) Appends a new agentic step's parts, prefixing withUIPart.StepStartif the turn already has prior content.voidappendParts(List<UIPart> stepParts) Appends parts within the current step, with no step boundary before them.booleanvoidstatic voidmergeTool(List<UIPart> parts, UIPart.Tool incoming) Mergesincominginto the tool with the sametoolCallId, or appends if none found.voidmergeToolParts(List<UIPart> toolParts) Merges tool parts into the turn bytoolCallId, or appends when no match exists.parts()voidsetAgentCode(String agentCode) voidsetAssistantUuid(UUID assistantUuid) voidsetFinishReason(FinishReason finishReason)
-
Constructor Details
-
Turn
public Turn()
-
-
Method Details
-
assistantUuid
-
setAssistantUuid
-
parts
-
agentCode
-
setAgentCode
-
hasContent
public boolean hasContent() -
markContent
public void markContent() -
finishReason
-
setFinishReason
-
appendAssistantStep
Appends a new agentic step's parts, prefixing withUIPart.StepStartif the turn already has prior content. -
appendParts
Appends parts within the current step, with no step boundary before them. -
mergeToolParts
Merges tool parts into the turn bytoolCallId, or appends when no match exists. -
mergeTool
Mergesincominginto the tool with the sametoolCallId, or appends if none found.inputandcallProviderMetadataare identity/ownership anchors set at first emission — both are kept fromexisting, so a synthetic update auto-stamped with a sub-agent'sagentCodecannot reassign a parent-owned tool or wipe its input.
-