Package com.tnsai.agents.async
Record Class ChatEvent.Token
java.lang.Object
java.lang.Record
com.tnsai.agents.async.ChatEvent.Token
- All Implemented Interfaces:
ChatEvent
- Enclosing interface:
ChatEvent
public static record ChatEvent.Token(Instant timestamp, String content, int index)
extends Record
implements ChatEvent
Token streamed event.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tnsai.agents.async.ChatEvent
ChatEvent.Completed, ChatEvent.Error, ChatEvent.Started, ChatEvent.Token, ChatEvent.ToolCall, ChatEvent.ToolResult -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncontent()Returns the value of thecontentrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intindex()Returns the value of theindexrecord component.booleanReturns true if this is a terminal event.Returns the value of thetimestamprecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Token
-
Token
Creates an instance of aTokenrecord class.- Parameters:
timestamp- the value for thetimestamprecord componentcontent- the value for thecontentrecord componentindex- the value for theindexrecord component
-
-
Method Details
-
isTerminal
public boolean isTerminal()Description copied from interface:ChatEventReturns true if this is a terminal event.- Specified by:
isTerminalin interfaceChatEvent
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
timestamp
Returns the value of thetimestamprecord component. -
content
Returns the value of thecontentrecord component.- Returns:
- the value of the
contentrecord component
-
index
public int index()Returns the value of theindexrecord component.- Returns:
- the value of the
indexrecord component
-