The following key steps need to be followed to install and configure the Upstash RAG Chat Component:
Installation process
You can choose to install using any of the package management tools npm, pnpm or yarn:
- npm install:
npm install @upstash/rag-chat-component - pnpm installation:
pnpm add @upstash/rag-chat-component - yarn installation:
yarn add @upstash/rag-chat-component
Environment variable configuration
Create or modify the .env file in the project root directory after installation, the following variables must be configured:
- UPSTASH_VECTOR_REST_URL
- UPSTASH_VECTOR_REST_TOKEN
- OPENAI_API_KEY
- TOGETHER_API_KEY
For persistent chat logs, additional configuration is required:
- UPSTASH_REDIS_REST_URL
- UPSTASH_REDIS_REST_TOKEN
Style Configuration
Add the following to the tailwind.config.ts file to ensure that the component styles are loaded correctly:
import type { Config } from "tailwindcss";
export default {
content: ["./node_modules/@upstash/rag-chat-component/**/*.{js,mjs}"],
} satisfies Config;
Once you have completed these basic configurations, you are ready to start integrating the chat feature in your application.
This answer comes from the articleAdding a RAG-driven online chat tool to Next.js applicationsThe































