FeaturedDocument Ops#Decision Model#RAG#Reranker#Score#Grounded Answers

Decision Model RAG Reranker

Retrieve document chunks, score their relevance with a Decision Model, and give an LLM only the best evidence for a grounded answer.

Workflow at a glance

The full canvas, before you import it

Click any node to see its config.

#Decision Model#RAG#Reranker#Score#Grounded Answers

Click a node to select it — same as the Heym editor; the panel shows its settings.

12 nodes · Free & source-available

Decision Model RAG Reranker

Semantic similarity finds related text, but related text does not always answer the question. This workflow adds a Decision Model after vector retrieval to judge each chunk against the actual question. It keeps the strongest evidence and asks an LLM to answer from that evidence alone.

What this workflow does

  1. Question receives a question about your documents.
  2. RetrieveCandidates searches your vector store for up to eight chunks. Built-in Cohere reranking is disabled because the Decision node performs this step.
  3. CandidateLoop sends each chunk, together with the original question, to RelevanceJudge.
  4. The Decision Model returns a Score from 0 to 3: unrelated, tangential, useful partial evidence, or a direct answer.
  5. CollectEvidence preserves each chunk's text, ID, metadata, vector similarity, and new relevance score.
  6. SelectEvidence drops scores below 2, sorts the rest by decision relevance, and keeps the top three.
  7. HasEvidence runs GroundedAnswer only when evidence survived. Otherwise NoEvidence asks the user to refine the question or add documents.

Setup

Select an existing vector store on RetrieveCandidates and set its database type to match. The default is Qdrant. Ingest your documents first; this template only searches them. Select a Decision Model credential on RelevanceJudge and an LLM credential on GroundedAnswer. Change the starter model if needed.

The default question is about a refund policy. For a useful first test, ingest a direct refund-policy passage, a tangential pricing passage, and an unrelated deployment note. Inspect how vector similarity and decision relevance differ.

Reading the reranked result

The selected chunks are available at $SelectEvidence.chunks. Each item has id, text, metadata, vector_score, and relevance. The answer includes chunk IDs as citations. The original vector score is retained for inspection but does not determine the final order.

Score is probability-weighted, so values can fall between the four rubric levels. The cutoff of 2 and the top-three limit are examples to tune against your own retrieval evaluation set.

Empty results and cost

An empty search or a set of irrelevant chunks reaches NoEvidence without generating an answer. A successful search makes one decision call per retrieved chunk and, when evidence passes the cutoff, one LLM call. The loop is sequential and collects results explicitly in a run variable. This is a transparent reranking example, not a claim that it outperforms a dedicated reranker on every dataset.

How to import this template

  1. 1Click Import → Copy JSON on this page.
  2. 2Open your Heym and navigate to a workflow canvas.
  3. 3PressCmd+V/Ctrl+V— nodes appear instantly.
  4. 4Add your API keys in the node config panels and click Run.
More workflow templates
View all templates
Heym
incident analysis · production AI
Observed across 100s of AI rollouts

AI workflows don't fail because of prompts.
They fail because of orchestration.

symptom · glue code01
5 tools
Scripts, vector DB, approval bot, tracing, browser runner — none of them talk.
symptom · visibility02
~0%
Observable behavior across the stack. Debugging is guesswork.
with heym · one runtime
1 canvas
Agents, RAG, HITL, MCP, traces & evals. Self-hosted. Observable.
AI-Native RuntimeProduction-Grade
github.com/heymrun/heym