OpenAI GPT-3.5 (ChatGPT API) Chat App with Streaming Responses
This is a simple chat application built using the ChatGPT API, GPT-3.5. It uses Next.js, and builds off of the OpenAI API quickstart tutorial. Edit the prompt in the generate.ts file to describe the kind of chat character you'd like.
For more on streaming with GPT-3, check out the vercel edge function tutorial. This has updated the code from the tutorial with the gpt-3.5-turbo model.
You can test out the promps in ChatGPT and also in the Playground Chat example.
Setup
Install
$ npm install
Make a copy of the example environment variables file
$ cp .env.example .env
Add your API key to the newly created .env
file, and add your prompt as well.
Run the app
$ npm run dev