Nodes/ComfyUI Griptape Nodes/Griptape RAG Rerank: Text Chunks Module
ComfyUI Node

Griptape RAG Rerank: Text Chunks Module

Fix the #1 RAG failure — bad chunk ordering — with a rerank pass

By griptape-ai·Created 2 years ago·Updated about a year ago· 238
Griptape RAG Rerank: Text Chunks Module
  • rerank_driver
  • MODULE

The classic RAG failure mode: retrieval returns the right chunks in the wrong order, and the LLM, which reads top-to-bottom, answers from the wrong paragraph. Reranking exists to fix that - a second pass that scores the retrieved chunks against the query and re-sorts them so the most relevant material is on top. This node is Griptape's rerank stage, and it's the highest-leverage upgrade you can make to a RAG pipeline once it mostly works.

It's a rerank-stage module, which means it plugs into the rerank_module input on the Griptape RAG Engine - not into the module lists. It's the odd one out on purpose: the engine attaches a single rerank module to its retrieval stage.

The inputs that matter

One input, and it's optional:

  • rerank_driver - the model that does the scoring. Type RERANK_DRIVER, produced by the pack's rerank driver nodes (a Cohere rerank driver and a local one exist in the pack's driver menu, though they're separate nodes from this one). If you leave it empty, the module runs without reranking - you get a rerank stage that does nothing but pass chunks through. So the "improvement" only materializes if you actually wire a driver in.

How it works

Under the hood it builds a Griptape TextChunksRerankRagModule. When the retrieval stage returns its candidate chunks, this module re-scores them against the query and returns a reordered list. A good reranker - like Cohere's - understands meaning, so it catches relevance that a pure keyword/embedding retrieval pass missed, and it shrinks the context window your LLM needs to read. That means better answers and lower token spend.

What it outputs

A MODULE output (singular type, unlike the MODULE_LIST most RAG modules emit). It's meant for exactly one socket: rerank_module on the RAG Engine.

Installing it

Ships in the pack - ComfyUI Manager → GriptapeComfyUI-Griptape, restart, or

cd ComfyUI/custom_nodes
git clone https://github.com/griptape-ai/ComfyUI-Griptape

Common issues

The trap is wiring it without a rerank_driver and expecting magic - no driver, no rerank, by design. And since the driver nodes live elsewhere in the pack, beginners often can't find how to produce a RERANK_DRIVER; look in the pack's drivers menu (Cohere rerank or local rerank) rather than hunting inside this node. If reranked answers still miss, the problem is usually upstream retrieval quality, not the ordering - a reranker can't promote a chunk retrieval never found. Pack-wide torch/version issues apply as usual.

CategoryGriptape/RAG

Inputs (1)

NameTypeDefaultDescription
rerank_driveroptRERANK_DRIVER

Outputs (1)

NameTypeDescription
MODULEMODULE