Package com.tnsai.session
Record Class SessionSearchResult
java.lang.Object
java.lang.Record
com.tnsai.session.SessionSearchResult
public record SessionSearchResult(AgentSession session, double score, List<SessionSearchResult.MatchedTurn> matchedTurns, List<String> highlights)
extends Record
Result of a session search operation.
- Author:
- TnsAI Team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA matched turn within a session.static final recordPosition of a match within content. -
Constructor Summary
ConstructorsConstructorDescriptionSessionSearchResult(AgentSession session, double score, List<SessionSearchResult.MatchedTurn> matchedTurns, List<String> highlights) Creates an instance of aSessionSearchResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.Gets the first user message from the session.Gets the session ID.final inthashCode()Returns a hash code value for this object.booleanChecks if this result has matched turns.Returns the value of thehighlightsrecord component.Returns the value of thematchedTurnsrecord component.static SessionSearchResultof(AgentSession session) Creates a result with just the session.static SessionSearchResultof(AgentSession session, double score) Creates a result with score.doublescore()Returns the value of thescorerecord component.session()Returns the value of thesessionrecord component.final StringtoString()Returns a string representation of this record class.static SessionSearchResultwithMatches(AgentSession session, double score, List<SessionSearchResult.MatchedTurn> matchedTurns) Creates a result with matched turns.
-
Constructor Details
-
SessionSearchResult
public SessionSearchResult(AgentSession session, double score, List<SessionSearchResult.MatchedTurn> matchedTurns, List<String> highlights) Creates an instance of aSessionSearchResultrecord class.- Parameters:
session- the value for thesessionrecord componentscore- the value for thescorerecord componentmatchedTurns- the value for thematchedTurnsrecord componenthighlights- the value for thehighlightsrecord component
-
-
Method Details
-
of
Creates a result with just the session. -
of
Creates a result with score. -
withMatches
public static SessionSearchResult withMatches(AgentSession session, double score, List<SessionSearchResult.MatchedTurn> matchedTurns) Creates a result with matched turns. -
hasMatches
public boolean hasMatches()Checks if this result has matched turns. -
getSessionId
Gets the session ID. -
getFirstUserMessage
Gets the first user message from the session. -
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 '=='. -
session
Returns the value of thesessionrecord component.- Returns:
- the value of the
sessionrecord component
-
score
public double score()Returns the value of thescorerecord component.- Returns:
- the value of the
scorerecord component
-
matchedTurns
Returns the value of thematchedTurnsrecord component.- Returns:
- the value of the
matchedTurnsrecord component
-
highlights
Returns the value of thehighlightsrecord component.- Returns:
- the value of the
highlightsrecord component
-