Q&A RAG Chatbot with Cohere reranking

This agent is an Q&A chatbot (RAG) that leverages a search engine and a reranking model to provide accurate answers based on internal policy documents. It processes user queries and retrieves relevant policy excerpts, ensuring responses are well-cited and contextually grounded.
Vellum Team
Created By
Aaron Levin
Expand to interact
Created By
Aaron Levin
Last Updated
July 31, 2025
Categories
Document extraction
RAG

How it Works / How to Build It

  1. MostRecentMessage: This node captures the latest user message from the chat history.
  2. SearchNode: It performs a search query against a document index (specifically, "vellum-trust-center-policies-2") using the latest message as the query. It retrieves up to 8 relevant documents based on semantic similarity and keywords.
  3. CohereAPIRerankChunks: This node takes the search results and reranks them using the Cohere API, enhancing the relevance of the retrieved documents based on the user's query.
  4. FormattedSearchResults: It formats the reranked search results into a structured output, preparing them for the next step.
  5. PromptNode: This node generates a final answer by prompting a machine learning model with the question and the formatted policy quotes, ensuring the response includes citations.
  6. FinalOutput: It outputs the final answer generated by the PromptNode.

What You Can Use This For

  • Answering employee questions about company policies.
  • Providing quick access to compliance information for legal teams.
  • Assisting HR with policy-related inquiries from staff.
  • Supporting customer service representatives with policy clarifications.

Prerequisites

  • Vellum account.
  • Document index created in Vellum
  • Cohere API key for reranking functionality.

How to Set It Up

  1. Create a new workflow in your Vellum account.
  2. Add the MostRecentMessage node to capture the latest user input.
  3. Connect the MostRecentMessage node to the SearchNode to perform a search based on the captured message.
  4. Link the SearchNode to the CohereAPIRerankChunks node to rerank the search results.
  5. Connect the CohereAPIRerankChunks to the FormattedSearchResults node to format the output.
  6. Link the FormattedSearchResults to the PromptNode to generate a final answer.
  7. Finally, connect the PromptNode to the FinalOutput node to display the answer to the user.
Related Templates

Discover more AI agent templates to automate different aspects of your business

Medical
Document extraction
SOAP Note Generation Agent
Created By
Anita Kirkovska
Document extraction
Content generation
Agent that summarizes lengthy reports (PDF -> Summary)
Created By
Anita Kirkovska
Document extraction
PDF Data Extraction to CSV
Created By
Anita Kirkovska
AI Agents
Web Search
Page scraping
React Agent for Web Search and Page Scraping
Created By
Aaron Levin
Coding
Automated Code Review Comment Generator for GitHub PRs
Created By
David Vargas
Evaluation
Synthetic Dataset Generator
Created By
Nico Finelli
Finance
Document extraction
Financial Statement Review Workflow
Created By
Anita Kirkovska
Content generation
Turn LinkedIn Posts into Articles and Push to Notion
Created By
Anita Kirkovska
Customer Service
Enhancing Customer
Trust Center RAG Chatbot
Created By
Akash Sharma
CUSTOMERS

We have changed the game of AI development — hear it from the enterprise leaders

Vellum helped us quickly evaluate prompt designs and workflows, saving us hours of development. This gave us the confidence to launch our virtual assistant in 14 U.S. markets.
Pratik Bhat
ai Product manager
We sped up AI development by 50 percent and decoupled updates from releases with Vellum. This allowed us to fix errors instantly without worrying about infrastructure uptime or costs.
Jordan Nemrow
Co-Founder & CTO @ Woflow
Vellum helped us quickly evaluate prompt designs and workflows, saving us hours of development. This gave us the confidence to launch our virtual assistant in 14 U.S. markets.
Sebi Lozano
Sr. Product Manager @ Redfin
GET STARTED

Build any AI agent with Vellum

Get started today and transform your business with intelligent automation
👋 Your partners in AI Excellence