Standard RAG Reference Formatter

Purpose: Filters retrieved chunks to only those explicitly referenced in the generated response

Pipeline Stage: Generation

When Called:

  • ✓ Retrieved chunks exist

  • ✓ Response exists and not empty

  • ✓ LLM-based reference filtering enabled (reference_formatter_type == "llm")

  • After response generation

  • Before formatting final references for display

Input/Output Example:

Input: "According to the documentation, GLChat uses various vector datastore."
Chunks: [
  Chunk(content="GLChat uses ES...", id="chunk-1"),
  Chunk(content="Data store including...", id="chunk-2"),
  Chunk(content="Elastic Search is...", id="chunk-3")
]

Output: {{"id": ["<chunk-1>", "<chunk-3>"]}}

Configuration:

{
  "model": "gpt-4.1-mini",
  "prompt_builder_type": "prompt_builder",
  "output_parser_type": "none",
  "model_kwargs": {
    "response_schema": {
      "type": "object",
      "properties": {
        "referenced_chunk_ids": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": ["referenced_chunk_ids"]
    },
    "default_hyperparameters": {
      "temperature": 1e-07
    },
    "retry_config": {
      "timeout": 300,
      "max_retries": 2
    }
  }
}

Last updated