Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A simple Next.js chatbot app to demonstrate the use of embedding models for RAG through the Vercel AI Gateway.
The Vercel AI Gateway Embeddings Demo is a Next.js boilerplate chatbot that demonstrates retrieval-augmented generation (RAG) using embedding models routed through the Vercel AI Gateway, with vectors stored in Neon.
This is a simple Next.js app that lets you paste facts or documents into a chat interface and receive answers grounded on that content. It takes pasted text as input, chunks it, generates embeddings through the Vercel AI Gateway, and stores those vectors in Neon PostgreSQL. When you ask a question, the app embeds your query, performs a cosine-similarity search over the stored chunks, and sends the retrieved snippets to a model to compose an answer. It is maintained by the Vercel team and community contributors.
vc dev plus vc env pull to manage environment variables and OIDC authentication tokens.The app follows a five-step process. First, pasted text is split into chunks. Second, each chunk is embedded by a model called through the Vercel AI Gateway. Third, the resulting vectors are stored in Neon. Fourth, when you ask a question, your query is embedded and a cosine-similarity search retrieves the most relevant chunks. Finally, a language model generates an answer from only those retrieved snippets.
The README links to the Vercel AI Gateway pricing page for details on how usage is billed. AI Gateway charges per token or per request depending on the provider used, but this template does not include its own pricing tier.
vc dev instead of running the Next.js dev server directly?Using vc dev automatically manages the OIDC authentication token for local development. The token expires every 12 hours, so pulling environment variables with vc env pull is needed periodically when running without vc dev.
Yes, the app stores embeddings in Neon. The one-click deploy option provisions a Neon storage integration for you, while local setup requires you to link a Neon database and pull its credentials via vc env pull.
Yes, the repository accepts contributions. The README states that issues and pull requests are welcome from the community to enhance functionality or fix bugs.
