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.
The full canvas, before you import it
Click any node to see its config.
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
- Question receives a question about your documents.
- RetrieveCandidates searches your vector store for up to eight chunks. Built-in Cohere reranking is disabled because the Decision node performs this step.
- CandidateLoop sends each chunk, together with the original question, to RelevanceJudge.
- The Decision Model returns a Score from 0 to 3: unrelated, tangential, useful partial evidence, or a direct answer.
- CollectEvidence preserves each chunk's text, ID, metadata, vector similarity, and new relevance score.
- SelectEvidence drops scores below 2, sorts the rest by decision relevance, and keeps the top three.
- 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
- 1Click Import → Copy JSON on this page.
- 2Open your Heym and navigate to a workflow canvas.
- 3PressCmd+V/Ctrl+V— nodes appear instantly.
- 4Add your API keys in the node config panels and click Run.
Discover more automations
- Document OpsFile Upload Intake MetadataMint a single-use upload link, receive a multipart file, and return clean metadata plus the Drive download URL.
- Document OpsTesseract OCR PDF to TextUpload a scanned PDF, extract searchable text with Tesseract OCR, and return page-level results.
- Document OpsWebsite LoaderFetch clean, LLM-ready website text from any URL using the Jina Reader API.
- Document OpsPDF / DOCX Translation AgentTranslate the full text of any uploaded document using an AI agent.
- Document OpsBatch URL FetcherIterate over a JSON array of URLs with the Loop node, fetch each via HTTP, and merge all responses into one payload.
- Document OpsRAG Document IngestChunk and embed a document into a Qdrant vector store so it can be retrieved later by the RAG Search node.
- Document OpsRAG Q&A AgentSearch your Qdrant vector store for relevant context, then answer with an LLM — grounded in your own documents.
- Document OpsDrive Share Link MailerFetch a remote file into Drive, return the download link immediately, and email the same link asynchronously.
- Document OpsChat with Drive DocsAsk questions about your Google Drive PDF files. An agent lists your Drive, reads the file you need, extracts its text, and answers in plain language.
- Document OpsHTML Table to Markdown (Agent Skill)An agent runs a bundled Python skill that converts HTML tables into clean Markdown tables using only the standard library.
- Document OpsGoogle Drive to Heym Drive BackupMirror a Google Drive folder into Heym Drive on a schedule, exporting Google Docs automatically and posting a summary to Slack.
- Document OpsC2PA Content Credentials Validation RouterClassify C2PA validator results, escalate broken provenance, and archive a clear Content Credentials verification receipt.