Skip to content
VercelLogotypeVercelLogotype
LoginSign Up

Vercel AI Gateway Embeddings Demo

A simple Next.js chatbot app to demonstrate the use of embedding models for RAG through the Vercel AI Gateway.

DeployView Demo

A simple Next.js chatbot app to demonstrate the use of embedding models for RAG through the Vercel AI Gateway.

Paste any facts or docs into the chat and this app will chunk them, generate embeddings via the Vercel AI Gateway, and store them as vectors in Neon. When you ask a question, your query is embedded and the app performs a cosine-similarity search to pull the most relevant chunks. The model then answers using only the retrieved snippets, demonstrating semantic retrieval (RAG).

Getting Started

Setup

  1. Clone this repository with the Deploy button above
  2. Install the Vercel CLI if you don't already have it (pnpm i -g vercel)
  3. Clone the repository you created above: git clone <repo-url>
  4. Link it to a Vercel project: vc link or vc deploy
  5. Pull environment variables with vc env pull
  6. Install packages with pnpm i (or npm i or yarn i)
  7. Run a database migration with pnpm db:migrate && pnpm db:push
  8. Run the development server with vc dev and open http://localhost:3000 to try the chatbot

FAQ

  1. If you prefer running your local development server directly rather than using vc dev, you'll need to run vc env pull to fetch the project's OIDC authentication token locally
    1. the token expires every 12h, so you'll need to re-run this command periodically.
    2. if you use vc dev it will auto-refresh the token for you, so you don't need to fetch it manually
  2. If you're linking to an existing, older project, you may need to enable the OIDC token feature in your project settings.
    1. visit the project settings page (rightmost tab in your project's dashboard)
    2. search for 'OIDC' in settings
    3. toggle the button under "Secure Backend Access with OIDC Federation" to Enabled and click the "Save" button
  3. See this page to learn how AI Gateway billing works

Authors

This repository is maintained by the Vercel team and community contributors.

Contributions are welcome! Feel free to open issues or submit pull requests to enhance functionality or fix bugs.

GitHub
Ownervercel-labs
Repositoryai-gateway-embeddings-demo
Use Cases
AI
Stack
Next.js
Tailwind
Database
Neon

Related Templates

Vercel AI Gateway Demo

An open-source AI chatbot built with Next.js, the AI SDK, and the AI Gateway.
Vercel AI Gateway Demo thumbnail

Fal Image Generator

An open-source AI image generator built with Next.js, the AI SDK, and Fal.
Fal Image Generator thumbnail

Vercel x Groq Chatbot

An open-source AI chatbot built with Next.js, the AI SDK, and Groq.
Vercel x Groq Chatbot thumbnail

Agent Stack

  • AI SDK
  • AI Gateway
  • Sandbox
  • Workflows
  • EveNew
  • ConnectNew

Core Platform

  • CI/CD
  • Content Delivery
  • Fluid Compute
  • Observability

Security

  • Platform Security
  • WAF
  • Bot Management
  • Bot ID

Tools

  • Vercel DropNew
  • Vercel Agent
  • Vercel PluginNew
  • Next.js
  • Domains
  • v0

Frameworks

  • Nuxt
  • SvelteKit
  • Nitro
  • Turborepo
  • Tanstack Start
  • FastAPI
  • xmcp
  • All frameworks

SDKs

  • Vercel SDK
  • Workflow SDKNew
  • Flags SDK
  • Chat SDKNew
  • Queues SDKNew
  • Streamdown

Build

  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce
  • Platform Engineers
  • Design Engineers

Learn

  • Docs
  • Blog
  • Changelog
  • Knowledge Base
  • Academy
  • Articles
  • Community

Explore

  • Customers
  • Marketplace
  • Templates
  • Partner Finder
  • Vercel + AWS

Company

  • About
  • Careers
  • Press
  • Events
  • Startups
  • Shipped on Vercel
  • Open Source Program
  • Enterprise
  • Pricing
  • Help

Legal & Trust

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • DPA
  • Acceptable Use Policy
  • Legal (all documents)
  • Trust Center
  • Status

Social

  • GitHub
  • X
  • LinkedIn
  • YouTube
  • Instagram
  • VercelVercel
Agent Stack
  • AI SDK
  • AI Gateway
  • Sandbox
  • Workflows
  • Eve
Core Platform
  • Security
  • Content Delivery
  • Fluid Compute
  • Observability
  • CI/CD
Tools
  • Next.js
  • Vercel Agent
  • Vercel Plugin
  • Domains
  • v0
Learn
  • Docs
  • About
  • Blog
  • Changelog
  • Knowledge Base
Build
  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce
Explore
  • Customers
  • Marketplace
  • Partner Finder
  • AWS
  • Community
EnterprisePricing
Contact
Log InSign Up
Dashboard

Products

Agent Stack

  • AI SDK
  • AI Gateway
  • Sandbox
  • Workflows
  • Eve

Core Platform

  • Security
  • Content Delivery
  • Fluid Compute
  • Observability
  • CI/CD

Tools

  • Next.js
  • Vercel Agent
  • Vercel Plugin
  • Domains
  • v0
Resources

Learn

  • Docs
  • About
  • Blog
  • Changelog
  • Knowledge Base

Build

  • AI Apps
  • Web Apps
  • Marketing Sites
  • Platforms
  • Commerce

Explore

  • Customers
  • Marketplace
  • Partner Finder
  • AWS
  • Community
Enterprise
Pricing
Sign UpLog In
Contact
DeployView Demo

Loading status…

Select a display theme: