This is a Next.js project bootstrapped with create-next-app with RAGChat.
This project is a Retrieval-Augmented Generation (RAG) Chat application built using Upstash and LlamaIndex. It combines a powerful language model with real-time retrieval of external data to generate accurate, context-aware responses.
- Real-time Retrieval: Retrieve relevant documents from external sources (databases, APIs) using Upstash.
- Enhanced Response Generation: The application uses LlamaIndex to augment the base language model’s capabilities, improving the quality of responses.
- WebAssembly Support: Supports WebAssembly modules (like
tiktoken_bg.wasm) for faster tokenization and response times. - Deployed on Vercel: Easily deployed to serverless environments like Vercel, enabling seamless scaling.
- Frontend: Next.js,, Tailwind CSS
- Backend: Node.js, Upstash Redis, LlamaIndex
- Database: Upstash Redis, Upstash Vector
- Language Model Integration: LlamaIndex └─┬ @upstash/rag-chat@1.6.4 └── llamaindex@0.5.24
- Deployment: Vercel
Rag-Chat @upstash/rag-chat repo
-
Clone the repository:
git clone https://github.com/mrsamirr/ask-this-website -
Navigate to the project directory:
cd ask-this-website -
Install the dependencies:
npm installorbun install -
Set up environment variables:
-
Create a
.env.localfile in the root directory. -
Add your Upstash Redis URL and token:
UPSTASH_REDIS_REST_URL=your-upstash-urlUPSTASH_REDIS_REST_TOKEN=your-upstash-token
-
-
Build the project:
npm run build -
Start the development server:
npm run devorbun run dev
Open http://localhost:3125 with your browser to see the result.
Once the application is running, users can input their queries, and the system will retrieve relevant information from the Upstash Redis database to augment the language model’s responses. The response is a blend of generated text and retrieved facts, ensuring more accurate and relevant answers.
-
Deploy the application on Vercel using the Vercel CLI or the Vercel dashboard.
-
Ensure the environment variables are properly set in Vercel’s dashboard:
UPSTASH_REDIS_REST_URLUPSTASH_REDIS_REST_TOKEN
-
The application will automatically handle WebAssembly (
.wasm) files, liketiktoken_bg.wasm, for improved performance.
- Missing WebAssembly Files: Ensure that
.wasmfiles are properly included in the build. If you encounter issues withtiktoken_bg.wasm, check yournext.config.jsfile and ensure it includes the correct paths. - Upstash Connection Errors: Verify that your Upstash Redis URL and token are correct and have the necessary permissions.