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-appyarn create next-app --example https://github.com/brunnolou/next-ollama-apppnpm create next-app --example https://github.com/brunnolou/next-ollama-appTo run the example locally you need to:
- Download Ollama and install it locally.
- run
ollama run mistralto download and install the model locally (Requires 4.1GB and 8GB of RAM) - Open http://localhost:11434 to check if Ollama is running.
yarn installto install the required dependencies.yarn devto 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.