This is the starter project for the Vercel AI SDK Retrieval-Augmented Generation (RAG) guide.
This project is a vercel ai sdk chatbot that will only respond with information that it has within its knowledge base. This is done by using tools. Tools also allow you to also stream UI from the backend (not in the scope of this example, but is a todo). The chatbot will be able to both store and retrieve information. This project is a foundation for an AI version of myself or a customer service rep for a business!
This project will use the following stack:
- Next.js 14 (App Router)
- Vercel AI SDK
- OpenAI
- Drizzle ORM
- Postgres with pgvector
- shadcn-ui and TailwindCSS for styling
This project requires an openapi key.
This project is set up to run postgresql locally. but you can change that to use vercel or another postgresql service.
brew services start postgresql
ps aux | grep postgres
psql -d postgres -U home
once you have set up postgresql locally and run pnpm install (all required libs) you can migrate the db. this will set up the schema and tables
pnpm db:migrate
after you have the hook to search query embeddings
pnpm db:push