Nodes/ComfyUI Griptape Nodes/Griptape Rerank Driver: Cohere
ComfyUI Node

Griptape Rerank Driver: Cohere

A better ranking pass for your RAG results, at a price

By griptape-ai·Created 2 years ago·Updated about a year ago· 238
Griptape Rerank Driver: Cohere
    • DRIVER
    modelsrerank-english-v3.0
    top_n5
    cohere_api_key_env_varCOHERE_API_KEY

    Retrieval gives you the candidates; reranking decides which ones actually win. This node is a Cohere Rerank driver, the hosted option in the pack's rerank family, and it's what you add when your RAG agent keeps grabbing the wrong chunks.

    Here's the thing about vector search: it's good at finding related stuff, not always the right stuff. A reranker runs a second, more careful pass over the retrieved chunks and reorders them against your actual question. Cohere's rerank models are genuinely good at this - it's arguably their best product, and it's the model people reach for when a RAG pipeline "almost works" but keeps answering from the wrong paragraph.

    The catch is the usual one: it costs money per query, and it needs an API key. If you'd rather not, the pack's Griptape Rerank Driver: Local does the same job on your own hardware for free.

    How it works

    The node builds a CohereRerankDriver and hands it back as a DRIVER of type RERANK_DRIVER. That driver slots into the rerank input of a Griptape Rag Engine node (or a RAG tool), where it re-scores the retrieval stage's results before they reach the response stage. Nothing runs until the engine actually executes - this node just configures the reranker.

    The inputs that matter

    • models - rerank-english-v3.0 or rerank-multilingual-v3.0. English-only is cheaper and faster; grab multilingual if your docs aren't English.
    • top_n - how many re-ranked results to keep. Default 5.
    • cohere_api_key_env_var - this is the name of the env var holding your key, default COHERE_API_KEY. The tooltip says it plainly: do not paste your actual key here. It's a pointer, not a keyhole.

    Output: one DRIVER (RERANK_DRIVER).

    Installing

    Part of the ComfyUI-Griptape pack - ComfyUI Manager → search "Griptape" → Install, or:

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

    Restart ComfyUI. The pack installs griptape[all] plus python-dotenv; that's a heavy first install.

    You'll need a Cohere API key from https://dashboard.cohere.com/api-keys. Set it in ComfyUI's sidebar Settings → Griptape (it'll offer COHERE_API_KEY), or export it in your shell / .env - the pack reads .env via python-dotenv.

    Common gotchas

    The key-related one is the biggest: if you set the cohere_api_key_env_var field to anything other than the variable name you actually configured, you'll get an auth error and blame Cohere for it. Keep the default unless you know what you're doing.

    And don't wire this driver into a workflow where you haven't connected a rerank module on the engine side - the node happily configures, and only at runtime will you find out nothing is using it. Plus the pack-wide usuals: torch version conflicts on Nvidia (reinstall with the cu121 index) and stale-griptape ImportErrors fixed with python -m pip install griptape -U.

    CategoryGriptape/Agent Drivers/Rerank

    Inputs (3)

    NameTypeDefaultDescription
    modelsoptCOMBOrerank-english-v3.0Select the model to use for reranking.
    top_noptINT5Specify the number of top results to return.
    cohere_api_key_env_varoptSTRINGCOHERE_API_KEYEnvironment variable name for the Cohere API key. Do not use your actual API key here.

    Outputs (1)

    NameTypeDescription
    DRIVERRERANK_DRIVER