Package com.tnsai.session.replay
Record Class ReplayStep
java.lang.Object
java.lang.Record
com.tnsai.session.replay.ReplayStep
public record ReplayStep(int index, ConversationTurn turn, String description, Duration elapsedTime, boolean isFirst, boolean isLast)
extends Record
Represents a single step in a session replay.
Each step contains the original conversation turn along with metadata useful for replay and analysis.
- Author:
- TnsAI Team
-
Constructor Summary
ConstructorsConstructorDescriptionReplayStep(int index, ConversationTurn turn, String description, Duration elapsedTime, boolean isFirst, boolean isLast) Creates an instance of aReplaySteprecord class. -
Method Summary
Modifier and TypeMethodDescriptioncontent()Gets the turn content.contentPreview(int maxLength) Gets a truncated version of the content.Returns the value of thedescriptionrecord component.Returns the value of theelapsedTimerecord component.final booleanIndicates whether some other object is "equal to" this one.Gets the tool name if this is a tool-related step.final inthashCode()Returns a hash code value for this object.intindex()Returns the value of theindexrecord component.booleanChecks if this is an assistant message.booleanisFirst()Returns the value of theisFirstrecord component.booleanisLast()Returns the value of theisLastrecord component.booleanChecks if this is a tool call.booleanChecks if this is a tool result.booleanChecks if this is a user message.static ReplayStepof(int index, ConversationTurn turn, Duration elapsedTime, int totalSteps) Creates a replay step.final StringtoString()Returns a string representation of this record class.turn()Returns the value of theturnrecord component.type()Gets the turn type.
-
Constructor Details
-
ReplayStep
public ReplayStep(int index, ConversationTurn turn, String description, Duration elapsedTime, boolean isFirst, boolean isLast) Creates an instance of aReplaySteprecord class.- Parameters:
index- the value for theindexrecord componentturn- the value for theturnrecord componentdescription- the value for thedescriptionrecord componentelapsedTime- the value for theelapsedTimerecord componentisFirst- the value for theisFirstrecord componentisLast- the value for theisLastrecord component
-
-
Method Details
-
of
Creates a replay step.- Parameters:
index- the step indexturn- the conversation turnelapsedTime- time since session starttotalSteps- total number of steps- Returns:
- the replay step
-
type
Gets the turn type. -
content
Gets the turn content. -
contentPreview
Gets a truncated version of the content.- Parameters:
maxLength- maximum length- Returns:
- truncated content
-
isUserMessage
public boolean isUserMessage()Checks if this is a user message. -
isAssistantMessage
public boolean isAssistantMessage()Checks if this is an assistant message. -
isToolCall
public boolean isToolCall()Checks if this is a tool call. -
isToolResult
public boolean isToolResult()Checks if this is a tool result. -
getToolName
Gets the tool name if this is a tool-related step. -
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 '=='. -
index
public int index()Returns the value of theindexrecord component.- Returns:
- the value of the
indexrecord component
-
turn
Returns the value of theturnrecord component.- Returns:
- the value of the
turnrecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
elapsedTime
Returns the value of theelapsedTimerecord component.- Returns:
- the value of the
elapsedTimerecord component
-
isFirst
public boolean isFirst()Returns the value of theisFirstrecord component.- Returns:
- the value of the
isFirstrecord component
-
isLast
public boolean isLast()Returns the value of theisLastrecord component.- Returns:
- the value of the
isLastrecord component
-