TechnologyNovember 16, 2023

Turn Product Docs into a RAG-Powered App with Vercel and Astra DB

Alex Leventer
Alex LeventerEcosystem
Turn Product Docs into a RAG-Powered App with Vercel and Astra DB

TLDR:  Try the RAGBot template created with Next.js and hosted on Vercel! In just a few clicks, deploy a customizable chat app that implements retrieval augmented generation (RAG) using the Vercel AI SDK and new Open AI Assistant API along with DataStax Astra DB vector search. You can also switch large language models (LLMs) and toggle RAG on and off to test your model and augmented-context performance. 

Vercel is the developer's platform of choice for building and running powerful web applications. Vercel’s Frontend Cloud provides the developer experience and infrastructure to build, scale, and secure a faster, more personalized web.  

Vercel’s Template Marketplace is a big part of the Vercel developer and ecosystem experience. Templates are pre-built, customizable project starters that can be directly deployed on Vercel's platform with a click of a button. Templates are the fastest way for developers to prototype and deploy Next.js web applications with all the best practices, performance, and scalability baked in.

So today we're excited to announce that our RAGBot chatbot starter, a generative AI chat application, has been added as a template!

About RAGBot

RAGBot is a Next.js chatbot template that implements the RAG pattern using Vercel's AI SDK and Astra DB vector search along with OpenAI’s embedding APIs and GPT.    

The frontend is built using React and Next.js. The backend is built in TypeScript using the Vercel AI SDK, which wraps the OpenAI APIs. The Vercel AI SDK uses the Astra DB TypeScript client, which connects to the vector database through the Astra DB schemaless document API.

Deploying RAGBot on Vercel 

To try the template for yourself:

  1. Goto the RAGBot template page
  2. Follow the directions on the page for creating the required accounts and databases (be sure to wait for database creation to complete)
  3. Click the "deploy" button
  4. Enter the required environment variables 

Minutes later, your RAGBot will be deployed to your custom Vercel subdomain and seeded with sample data.

Once deployed, you can ask RAGBot questions related to the sample dataset. In this case, it’s a set of Astra DB documentation, but you can also use your own sample data.

RAGBot also provides switches for you to experiment with different LLM models and toggle RAG on and off in order to test the effectiveness of the augmented context and performance of different LLMs. You can try these different settings by clicking the gear icon on the top right of the chatbot.

The code will show you how to use the Vercel AI SDK to pre-process and vectorize the sample dataset, use the OpenAI embeddings API to vectorize the documentation data, and insert it into your Astra DB vector database

Once you deploy RAGBot, you can experiment by asking questions related to Astra DB to see how the LLM writes answers based on the augmented context in the sample dataset.

Get started with RAGBot now on the Vercel Template Marketplace  and jumpstart your road to production GenAI on Vercel and Astra DB!  



Discover more
Retrieval-augmented generation

One-stop Data API for Production GenAI

Astra DB gives JavaScript developers a complete data API and out-of-the-box integrations that make it easier to build production RAG apps with high relevancy and low latency.