Package com.tnsai.agents.async
Interface ChatEvent
- All Known Implementing Classes:
ChatEvent.Completed,ChatEvent.Error,ChatEvent.Started,ChatEvent.Token,ChatEvent.ToolCall,ChatEvent.ToolResult
public sealed interface ChatEvent
permits ChatEvent.Started, ChatEvent.Token, ChatEvent.ToolCall, ChatEvent.ToolResult, ChatEvent.Error, ChatEvent.Completed
Typed events for async chat streaming.
Provides a structured way to handle different types of events during asynchronous chat processing.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordChat completed event.static final recordError event.static final recordChat started event.static final recordToken streamed event.static final recordTool call initiated event.static final recordTool execution result event. -
Method Summary
Modifier and TypeMethodDescriptionstatic ChatEvent.Completedstatic ChatEvent.ErrorbooleanReturns true if this is a terminal event.static ChatEvent.StartedGets the timestamp of this event.static ChatEvent.Tokenstatic ChatEvent.ToolCallstatic ChatEvent.ToolResulttoolResult(String callId, Object result, boolean success)
-
Method Details
-
timestamp
Instant timestamp()Gets the timestamp of this event. -
isTerminal
boolean isTerminal()Returns true if this is a terminal event. -
started
-
token
-
toolCall
-
toolResult
-
error
-
completed
-