Package com.tnsai.session.extraction
Record Class ExtractedKnowledge
java.lang.Object
java.lang.Record
com.tnsai.session.extraction.ExtractedKnowledge
public record ExtractedKnowledge(String id, ExtractionType type, String sessionId, String problem, String content, String summary, List<String> codeSnippets, List<String> relatedFiles, List<String> tags, double confidence, Instant extractedAt, Map<String,Object> metadata)
extends Record
Represents knowledge extracted from a session.
Extracted knowledge can be of various types (solution, pattern, decision, etc.) and includes context about where and how it was learned.
Usage
ExtractedKnowledge knowledge = ExtractedKnowledge.solution()
.sessionId("session-123")
.problem("JWT token expiration not handled")
.content("Add refresh token mechanism with 401 interceptor")
.codeSnippets(List.of("public class TokenRefreshInterceptor {...}"))
.relatedFiles(List.of("AuthService.java", "TokenInterceptor.java"))
.confidence(0.92)
.build();
- Author:
- TnsAI Team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for ExtractedKnowledge. -
Constructor Summary
ConstructorsConstructorDescriptionExtractedKnowledge(String id, ExtractionType type, String sessionId, String problem, String content, String summary, List<String> codeSnippets, List<String> relatedFiles, List<String> tags, double confidence, Instant extractedAt, Map<String, Object> metadata) Creates an instance of aExtractedKnowledgerecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ExtractedKnowledge.BuilderCreates a builder for ANTIPATTERN type knowledge.static ExtractedKnowledge.Builderbuilder()Creates a general builder.Returns the value of thecodeSnippetsrecord component.doubleReturns the value of theconfidencerecord component.content()Returns the value of thecontentrecord component.static ExtractedKnowledge.Builderdecision()Creates a builder for DECISION type knowledge.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theextractedAtrecord component.booleanChecks if this knowledge has code snippets.final inthashCode()Returns a hash code value for this object.booleanChecks if this knowledge has related files.id()Returns the value of theidrecord component.booleanChecks if this knowledge has high confidence (threshold 0.8).booleanisHighConfidence(double threshold) Checks if this knowledge has high confidence.static ExtractedKnowledge.Builderlearning()Creates a builder for LEARNING type knowledge.metadata()Returns the value of themetadatarecord component.static ExtractedKnowledge.Builderpattern()Creates a builder for PATTERN type knowledge.problem()Returns the value of theproblemrecord component.Returns the value of therelatedFilesrecord component.Returns the value of thesessionIdrecord component.static ExtractedKnowledge.Buildersolution()Creates a builder for SOLUTION type knowledge.summary()Returns the value of thesummaryrecord component.tags()Returns the value of thetagsrecord component.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.
-
Constructor Details
-
ExtractedKnowledge
public ExtractedKnowledge(String id, ExtractionType type, String sessionId, String problem, String content, String summary, List<String> codeSnippets, List<String> relatedFiles, List<String> tags, double confidence, Instant extractedAt, Map<String, Object> metadata) Creates an instance of aExtractedKnowledgerecord class.- Parameters:
id- the value for theidrecord componenttype- the value for thetyperecord componentsessionId- the value for thesessionIdrecord componentproblem- the value for theproblemrecord componentcontent- the value for thecontentrecord componentsummary- the value for thesummaryrecord componentcodeSnippets- the value for thecodeSnippetsrecord componentrelatedFiles- the value for therelatedFilesrecord componenttags- the value for thetagsrecord componentconfidence- the value for theconfidencerecord componentextractedAt- the value for theextractedAtrecord componentmetadata- the value for themetadatarecord component
-
-
Method Details
-
solution
Creates a builder for SOLUTION type knowledge. -
pattern
Creates a builder for PATTERN type knowledge. -
decision
Creates a builder for DECISION type knowledge. -
learning
Creates a builder for LEARNING type knowledge. -
antipattern
Creates a builder for ANTIPATTERN type knowledge. -
builder
Creates a general builder. -
isHighConfidence
public boolean isHighConfidence(double threshold) Checks if this knowledge has high confidence.- Parameters:
threshold- the confidence threshold (default 0.8)- Returns:
- true if confidence is at or above threshold
-
isHighConfidence
public boolean isHighConfidence()Checks if this knowledge has high confidence (threshold 0.8). -
hasCodeSnippets
public boolean hasCodeSnippets()Checks if this knowledge has code snippets. -
hasRelatedFiles
public boolean hasRelatedFiles()Checks if this knowledge has related files. -
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 '=='. -
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
sessionId
Returns the value of thesessionIdrecord component.- Returns:
- the value of the
sessionIdrecord component
-
problem
Returns the value of theproblemrecord component.- Returns:
- the value of the
problemrecord component
-
content
Returns the value of thecontentrecord component.- Returns:
- the value of the
contentrecord component
-
summary
Returns the value of thesummaryrecord component.- Returns:
- the value of the
summaryrecord component
-
codeSnippets
Returns the value of thecodeSnippetsrecord component.- Returns:
- the value of the
codeSnippetsrecord component
-
tags
Returns the value of thetagsrecord component.- Returns:
- the value of the
tagsrecord component
-
confidence
public double confidence()Returns the value of theconfidencerecord component.- Returns:
- the value of the
confidencerecord component
-
extractedAt
Returns the value of theextractedAtrecord component.- Returns:
- the value of the
extractedAtrecord component
-
metadata
Returns the value of themetadatarecord component.- Returns:
- the value of the
metadatarecord component
-