Back to Templates

AI SDK RAG Template
A Next.js application, powered by the Vercel AI SDK, that uses retrieval-augmented generation (RAG) to reason and respond with information outside of the model's training data.
Features
- Information retrieval and addition through tool calls using the streamTextfunction
- Real-time streaming of model responses to the frontend using the useChathook
- Vector embedding storage with DrizzleORM and PostgreSQL
- Animated UI with Framer Motion
Getting Started
To get the project up and running, follow these steps:
- 
Install dependencies: npm install
- 
Copy the example environment file: cp .env.example .env
- 
Add your Vercel AI Gateway API key and PostgreSQL connection string to the .envfile:AI_GATEWAY_API_KEY=your_api_key_hereDATABASE_URL=your_postgres_connection_string_here
- 
Migrate the database schema: npm run db:migrate
- 
Start the development server: npm run dev
Your project should now be running on http://localhost:3000.

