Class MergedContextBlock

java.lang.Object
sk.iway.iwcm.rag.search.MergedContextBlock

public class MergedContextBlock extends Object
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 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 entity
      startChunkIndex - first chunk index included in the block
      endChunkIndex - last chunk index included in the block
      text - merged chunk text
      maxSimilarity - highest similarity among merged chunks
      averageSimilarity - average similarity across merged chunks
      sourceChunkCount - 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 entity
      entityId - ID of the source entity
      startChunkIndex - first chunk index included in the block
      endChunkIndex - last chunk index included in the block
      text - merged chunk text
      maxSimilarity - highest similarity among merged chunks
      averageSimilarity - average similarity across merged chunks
      sourceChunkCount - number of chunks merged into this block
      sourceTitle - optional source title for future citations
      sourceUrl - optional source URL for future citations
  • Method Details

    • getEntityId

      public Long getEntityId()
    • getEntityType

      public String getEntityType()
    • getStartChunkIndex

      public int getStartChunkIndex()
    • getEndChunkIndex

      public int getEndChunkIndex()
    • getText

      public String getText()
    • getMaxSimilarity

      public double getMaxSimilarity()
    • getAverageSimilarity

      public double getAverageSimilarity()
    • getSourceChunkCount

      public int getSourceChunkCount()
    • getSourceTitle

      public String getSourceTitle()
    • getSourceUrl

      public String getSourceUrl()
    • setEntityId

      public void setEntityId(Long entityId)
    • setEntityType

      public void setEntityType(String entityType)
    • setStartChunkIndex

      public void setStartChunkIndex(int startChunkIndex)
    • setEndChunkIndex

      public void setEndChunkIndex(int endChunkIndex)
    • setText

      public void setText(String text)
    • setMaxSimilarity

      public void setMaxSimilarity(double maxSimilarity)
    • setAverageSimilarity

      public void setAverageSimilarity(double averageSimilarity)
    • setSourceChunkCount

      public void setSourceChunkCount(int sourceChunkCount)
    • setSourceTitle

      public void setSourceTitle(String sourceTitle)
    • setSourceUrl

      public void setSourceUrl(String sourceUrl)