https://github.com/pinecone-io/vercel-chatbot-template
https://github.com/pinecone-io/vercel-chatbot-template
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/pinecone-io/vercel-chatbot-template
- Owner: pinecone-io
- Created: 2023-05-24T22:41:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-06T20:25:04.000Z (over 2 years ago)
- Last Synced: 2025-04-06T08:27:09.296Z (8 months ago)
- Language: TypeScript
- Size: 299 KB
- Stars: 15
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AI Chat GPT-3 example
This example shows how to implement a chat bot backed by Pinecone using Next.js, API Routes, and [OpenAI ChatGPT API](https://beta.openai.com/docs/api-reference/completions/create).
### Components
- Next.js
- OpenAI API (ChatGPT) - streaming
- API Routes (Edge runtime) - streaming
- Pinecone store
## How to Use
You can choose from one of the following two methods to use this repository:
### One-Click Deploy
Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=vercel-examples):
[](https://vercel.com/new/clone?repository-url=https://github.com/vercel/examples/tree/main/solutions/ai-chatgpt&project-name=ai-chatgpt&repository-name=ai-chatgpt&env=OPENAI_API_KEY)
### Clone and Deploy
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [pnpm](https://pnpm.io/installation) to bootstrap the example:
```bash
pnpm create next-app --example https://github.com/vercel/examples/tree/main/solutions/ai-chatgpt
```
#### Set up environment variables
Rename [`.env.example`](.env.example) to `.env.local`:
```bash
cp .env.example .env.local
```
Update `OPENAI_API_KEY` with your [OpenAI](https://beta.openai.com/account/api-keys) secret key.
Update `PINECONE_API_KEY` with your [Pinecone](https://www.pinecone.io/start/) secret key, and `PINECONE_ENVIRONMENT` with your Pinecone environment name.
Choose a `PINECONE_INDEX` name for your index. If the index does not exist, it will be created automatically.
Next, run Next.js in development mode:
```bash
pnpm dev
```
The app should be up and running at http://localhost:3000.
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=edge-middleware-eap) ([Documentation](https://nextjs.org/docs/deployment)).