Package com.tnsai.rag

Interface ChunkContextGenerator


public interface ChunkContextGenerator
SPI for LLM-written chunk context used by ChunkContext.LLM.

TnsAI does not bundle a generator. Provider modules own inference, credentials, and lifecycle. supports(String) must be answerable without a network call.

Since:
0.15.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Stable identity of the bundled situate-the-chunk prompt.
  • Method Summary

    Modifier and Type
    Method
    Description
    Writes a short (about 50–100 tokens) description of the chunk's place in its parent document.
    boolean
    Returns whether this provider can serve model without calling out.
    default String
    Stable identity of this provider's situate prompt.
    default String
    Provider-owned prompt revision.
  • Field Details

    • LLM_TEMPLATE_ID

      static final String LLM_TEMPLATE_ID
      Stable identity of the bundled situate-the-chunk prompt.
      See Also:
  • Method Details

    • supports

      boolean supports(String model)
      Returns whether this provider can serve model without calling out.
      Parameters:
      model - exact, case-sensitive model identifier
      Returns:
      true when this provider can generate context
    • generate

      Writes a short (about 50–100 tokens) description of the chunk's place in its parent document.
      Parameters:
      request - immutable generation request
      Returns:
      non-blank context string, without the chunk body
    • templateId

      default String templateId()
      Stable identity of this provider's situate prompt. Changing the prompt requires a new id so fingerprints and the generation cache invalidate.
      Returns:
      non-blank template identity
      Since:
      0.15.0
    • templateVersion

      default String templateVersion()
      Provider-owned prompt revision. A bump invalidates cached context and the ingest fingerprint for ChunkContext.LLM sources.
      Returns:
      non-blank version token
      Since:
      0.15.0