This is taken from this example which shows how to use the Vercel AI SDK with Next.js and OpenAI to create a ChatGPT-like AI-powered streaming chat bot.
This has been adapted to use Convex to power the chat bot.
To run the example locally you need to:
npm installto install the required dependenciesnpx convex dev --onceto set up a Convex project- Sign up at OpenAI's Developer Platform.
- Go to OpenAI's dashboard and create an API KEY.
- Set the required OpenAI environment variable as
OPENAI_API_KEYin the Convex dashboard npm devto launch the app.
There is also an example of this same chat bot using Hono with Convex HTTP actions on the hono-convex branch.