Full-stack app for RAG-based chatbot using Pinecone and Vercel AI SDK
Top 64.9% on sourcepulse
This repository provides a starter template for building a Retrieval Augmented Generation (RAG) chatbot using Pinecone and Vercel's AI SDK. It's designed for developers looking to create context-aware chatbots that can access and utilize domain-specific knowledge, reducing hallucinations and improving response accuracy.
How It Works
The application leverages a Next.js frontend with Vercel's AI SDK for efficient streaming. A backend API endpoint handles chat requests, integrating with OpenAI's API for generative responses. The core RAG functionality is implemented by a web crawler that scrapes provided URLs, chunks the content, generates embeddings, and stores them in a Pinecone index. When a user asks a question, the system retrieves relevant chunks from Pinecone based on the query's embedding, prepends this context to the prompt, and sends it to the LLM for a grounded response.
Quick Start & Requirements
npm install
npm run dev
OPENAI_API_KEY
environment variable), Pinecone API Key and Environment (set as PINECONE_API_KEY
and PINECONE_ENVIRONMENT
environment variables), Pinecone Index Name (set as PINECONE_INDEX
environment variable).Highlighted Details
RecursiveCharacterTextSplitter
and MarkdownTextSplitter
.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
7 months ago
1 day