This example shows how to use the Vercel AI SDK with Next.js, LangChain, and Ollama to create a ChatGPT-like AI-powered streaming chat bot.
NOTE: Ollama needs to be deployed separately.
Deploy the example using Vercel:
Execute create-next-app
with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example https://github.com/brunnolou/next-ollama-app
yarn create next-app --example https://github.com/brunnolou/next-ollama-app
pnpm create next-app --example https://github.com/brunnolou/next-ollama-app
To run the example locally you need to:
- Download Ollama and install it locally.
- run
ollama run mistral
to download and install the model locally (Requires 4.1GB and 8GB of RAM) - Open http://localhost:11434 to check if Ollama is running.
yarn install
to install the required dependencies.yarn dev
to launch the development server.
To learn more about LangChain, OpenAI, Next.js, and the Vercel AI SDK take a look at the following resources:
- Vercel AI SDK docs - learn mode about the Vercel AI SDK
- Vercel AI Playground - compare and tune 20+ AI models side-by-side
- LangChain Documentation - learn about LangChain
- Ollama - learn about Ollama features, models, and API.
- Next.js Documentation - learn about Next.js features and API.