Package com.tnsai.rag

Record Class ExtractionContext

java.lang.Object
java.lang.Record
com.tnsai.rag.ExtractionContext
Record Components:
sourceName - knowledge-source declaration name
attributes - extractor-neutral invocation attributes
maxInputBytes - maximum admitted raw input bytes
maxContentChars - maximum normalized whole-document characters
maxBlocks - maximum structural blocks
maxBlockChars - maximum characters in one structural block
maxStructuralPathChars - maximum characters in one structural path
maxTotalBlockChars - maximum characters across all blocks
maxTotalStructuralPathChars - maximum structural-path characters across all blocks
maxTotalMetadataEntries - maximum metadata keys and values across the output
maxTotalMetadataChars - maximum scalar characters across output metadata

public record ExtractionContext(String sourceName, Map<String,Object> attributes, int maxInputBytes, int maxContentChars, int maxBlocks, int maxBlockChars, int maxStructuralPathChars, int maxTotalBlockChars, int maxTotalStructuralPathChars, int maxTotalMetadataEntries, int maxTotalMetadataChars) extends Record
Immutable declaration context supplied to document extractors. Attribute values follow the immutable metadata algebra and bounds documented by DocumentInput.
Since:
0.13.0
  • Field Details

    • DEFAULT_MAX_INPUT_BYTES

      public static final int DEFAULT_MAX_INPUT_BYTES
      Default maximum raw input size per extracted document.
      See Also:
    • DEFAULT_MAX_CONTENT_CHARS

      public static final int DEFAULT_MAX_CONTENT_CHARS
      Default maximum normalized document text size.
      See Also:
    • DEFAULT_MAX_BLOCKS

      public static final int DEFAULT_MAX_BLOCKS
      Default maximum number of structural blocks per document.
      See Also:
    • DEFAULT_MAX_BLOCK_CHARS

      public static final int DEFAULT_MAX_BLOCK_CHARS
      Default maximum normalized text size per structural block.
      See Also:
    • DEFAULT_MAX_STRUCTURAL_PATH_CHARS

      public static final int DEFAULT_MAX_STRUCTURAL_PATH_CHARS
      Default maximum structural path size per block.
      See Also:
    • DEFAULT_MAX_TOTAL_BLOCK_CHARS

      public static final int DEFAULT_MAX_TOTAL_BLOCK_CHARS
      Default maximum normalized text across all structural blocks.
      See Also:
    • DEFAULT_MAX_TOTAL_STRUCTURAL_PATH_CHARS

      public static final int DEFAULT_MAX_TOTAL_STRUCTURAL_PATH_CHARS
      Default maximum path characters across all structural blocks.
      See Also:
    • DEFAULT_MAX_TOTAL_METADATA_ENTRIES

      public static final int DEFAULT_MAX_TOTAL_METADATA_ENTRIES
      Default maximum metadata keys and values across one output.
      See Also:
    • DEFAULT_MAX_TOTAL_METADATA_CHARS

      public static final int DEFAULT_MAX_TOTAL_METADATA_CHARS
      Default maximum scalar characters across one output's metadata.
      See Also:
  • Constructor Details

    • ExtractionContext

      public ExtractionContext(String sourceName, Map<String,Object> attributes, int maxInputBytes, int maxContentChars, int maxBlocks, int maxBlockChars, int maxStructuralPathChars, int maxTotalBlockChars, int maxTotalStructuralPathChars, int maxTotalMetadataEntries, int maxTotalMetadataChars)
      Creates an instance of a ExtractionContext record class.
      Parameters:
      sourceName - the value for the sourceName record component
      attributes - the value for the attributes record component
      maxInputBytes - the value for the maxInputBytes record component
      maxContentChars - the value for the maxContentChars record component
      maxBlocks - the value for the maxBlocks record component
      maxBlockChars - the value for the maxBlockChars record component
      maxStructuralPathChars - the value for the maxStructuralPathChars record component
      maxTotalBlockChars - the value for the maxTotalBlockChars record component
      maxTotalStructuralPathChars - the value for the maxTotalStructuralPathChars record component
      maxTotalMetadataEntries - the value for the maxTotalMetadataEntries record component
      maxTotalMetadataChars - the value for the maxTotalMetadataChars record component
    • ExtractionContext

      public ExtractionContext(String sourceName, Map<String,Object> attributes)
      Creates a context with the framework's bounded extraction defaults.
      Parameters:
      sourceName - knowledge-source declaration name
      attributes - extractor-neutral invocation attributes
  • Method Details

    • forSource

      public static ExtractionContext forSource(String sourceName)
      Creates a context without optional attributes.
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • sourceName

      public String sourceName()
      Returns the value of the sourceName record component.
      Returns:
      the value of the sourceName record component
    • attributes

      public Map<String,Object> attributes()
      Returns the value of the attributes record component.
      Returns:
      the value of the attributes record component
    • maxInputBytes

      public int maxInputBytes()
      Returns the value of the maxInputBytes record component.
      Returns:
      the value of the maxInputBytes record component
    • maxContentChars

      public int maxContentChars()
      Returns the value of the maxContentChars record component.
      Returns:
      the value of the maxContentChars record component
    • maxBlocks

      public int maxBlocks()
      Returns the value of the maxBlocks record component.
      Returns:
      the value of the maxBlocks record component
    • maxBlockChars

      public int maxBlockChars()
      Returns the value of the maxBlockChars record component.
      Returns:
      the value of the maxBlockChars record component
    • maxStructuralPathChars

      public int maxStructuralPathChars()
      Returns the value of the maxStructuralPathChars record component.
      Returns:
      the value of the maxStructuralPathChars record component
    • maxTotalBlockChars

      public int maxTotalBlockChars()
      Returns the value of the maxTotalBlockChars record component.
      Returns:
      the value of the maxTotalBlockChars record component
    • maxTotalStructuralPathChars

      public int maxTotalStructuralPathChars()
      Returns the value of the maxTotalStructuralPathChars record component.
      Returns:
      the value of the maxTotalStructuralPathChars record component
    • maxTotalMetadataEntries

      public int maxTotalMetadataEntries()
      Returns the value of the maxTotalMetadataEntries record component.
      Returns:
      the value of the maxTotalMetadataEntries record component
    • maxTotalMetadataChars

      public int maxTotalMetadataChars()
      Returns the value of the maxTotalMetadataChars record component.
      Returns:
      the value of the maxTotalMetadataChars record component