Package sk.iway.iwcm.rag.search
Class MergedContextBlock
java.lang.Object
sk.iway.iwcm.rag.search.MergedContextBlock
A merged context block produced by the RAG post-processing pipeline.
Represents one or more adjacent chunks from the same entity, merged into a single text block.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty merged context block for frameworks and manual population.MergedContextBlock(Long entityId, int startChunkIndex, int endChunkIndex, String text, double maxSimilarity, double averageSimilarity, int sourceChunkCount) Creates a merged context block without optional source metadata.MergedContextBlock(String entityType, Long entityId, int startChunkIndex, int endChunkIndex, String text, double maxSimilarity, double averageSimilarity, int sourceChunkCount, String sourceTitle, String sourceUrl) Creates a merged context block with structured retrieval and optional source metadata for the RAG answer prompt. -
Method Summary
Modifier and TypeMethodDescriptiondoubleintdoubleintintgetText()voidsetAverageSimilarity(double averageSimilarity) voidsetEndChunkIndex(int endChunkIndex) voidsetEntityId(Long entityId) voidsetEntityType(String entityType) voidsetMaxSimilarity(double maxSimilarity) voidsetSourceChunkCount(int sourceChunkCount) voidsetSourceTitle(String sourceTitle) voidsetSourceUrl(String sourceUrl) voidsetStartChunkIndex(int startChunkIndex) void
-
Constructor Details
-
MergedContextBlock
public MergedContextBlock()Creates an empty merged context block for frameworks and manual population. -
MergedContextBlock
public MergedContextBlock(Long entityId, int startChunkIndex, int endChunkIndex, String text, double maxSimilarity, double averageSimilarity, int sourceChunkCount) Creates a merged context block without optional source metadata.- Parameters:
entityId- ID of the source entitystartChunkIndex- first chunk index included in the blockendChunkIndex- last chunk index included in the blocktext- merged chunk textmaxSimilarity- highest similarity among merged chunksaverageSimilarity- average similarity across merged chunkssourceChunkCount- number of chunks merged into this block
-
MergedContextBlock
public MergedContextBlock(String entityType, Long entityId, int startChunkIndex, int endChunkIndex, String text, double maxSimilarity, double averageSimilarity, int sourceChunkCount, String sourceTitle, String sourceUrl) Creates a merged context block with structured retrieval and optional source metadata for the RAG answer prompt.- Parameters:
entityType- type of the source entityentityId- ID of the source entitystartChunkIndex- first chunk index included in the blockendChunkIndex- last chunk index included in the blocktext- merged chunk textmaxSimilarity- highest similarity among merged chunksaverageSimilarity- average similarity across merged chunkssourceChunkCount- number of chunks merged into this blocksourceTitle- optional source title for future citationssourceUrl- optional source URL for future citations
-
-
Method Details
-
getEntityId
-
getEntityType
-
getStartChunkIndex
public int getStartChunkIndex() -
getEndChunkIndex
public int getEndChunkIndex() -
getText
-
getMaxSimilarity
public double getMaxSimilarity() -
getAverageSimilarity
public double getAverageSimilarity() -
getSourceChunkCount
public int getSourceChunkCount() -
getSourceTitle
-
getSourceUrl
-
setEntityId
-
setEntityType
-
setStartChunkIndex
public void setStartChunkIndex(int startChunkIndex) -
setEndChunkIndex
public void setEndChunkIndex(int endChunkIndex) -
setText
-
setMaxSimilarity
public void setMaxSimilarity(double maxSimilarity) -
setAverageSimilarity
public void setAverageSimilarity(double averageSimilarity) -
setSourceChunkCount
public void setSourceChunkCount(int sourceChunkCount) -
setSourceTitle
-
setSourceUrl
-