Skip to content

Commit 18963d8

Browse files
committed
Make OPENAI_ASSISTANT_ID optional, and work with current setup flow.
1 parent c6d1318 commit 18963d8

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

.env.example

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
# Create an OpenAI API key at https://platform.openai.com/account/api-keys
55
OPENAI_API_KEY="sk-123..."
6-
# Create an OpenAI Assistant at https://platform.openai.com/account/assistants.
6+
7+
# (optional) Create an OpenAI Assistant at https://platform.openai.com/assistants.
78
# IMPORTANT! Be sure to enable file search and code interpreter tools.
89
OPENAI_ASSISTANT_ID="123..."

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
A quick-start template using the OpenAI [Assistants API](https://platform.openai.com/docs/assistants/overview) with [Next.js](https://nextjs.org/docs).
44
<br/>
55
<br/>
6-
![openai_assistants_quickstart](https://github.com/openai/openai-assistants-quickstart-internal/assets/25421602/3ea9c3d9-2bc6-410a-a7bf-dcae03cae899)
6+
![OpenAI Assistants API Quickstart](https://github.com/openai/openai-assistants-quickstart/assets/27232/755e85e9-3ea4-421f-b202-3b0c435ea270)
77

88
## Quickstart Setup
99

@@ -14,15 +14,14 @@ git clone https://github.com/openai/openai-assistants-quickstart.git
1414
cd openai-assistants-quickstart
1515
```
1616

17-
### 2. Set your [OpenAI API key](https://platform.openai.com/api-keys) and [OpenAI Assistant ID](https://platform.openai.com/account/assistants)
17+
### 2. Set your [OpenAI API key](https://platform.openai.com/api-keys)
1818

19-
Copy `.env.example` and rename it to `.env` and enter your API keys. When you create an OpenAI Assistant, **be sure to enable file search and code interpreter tools.**
20-
21-
```env
22-
OPENAI_API_KEY="sk-123..."
23-
OPENAI_ASSISTANT_ID="123..."
19+
```shell
20+
export OPENAI_API_KEY="sk_..."
2421
```
2522

23+
(or in `.env.example` and rename it to `.env`).
24+
2625
### 3. Install dependencies
2726

2827
```shell
@@ -40,6 +39,7 @@ npm run dev
4039
## Deployment
4140

4241
You can deploy this project to Vercel or any other platform that supports Next.js.
42+
4343
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fopenai%2Fopenai-assistants-quickstart&env=OPENAI_API_KEY,OPENAI_ASSISTANT_ID&envDescription=API%20Keys%20and%20Instructions&envLink=https%3A%2F%2Fgithub.com%2Fopenai%2Fopenai-assistants-quickstart%2Fblob%2Fmain%2F.env.example)
4444

4545
## Overview
@@ -57,7 +57,7 @@ The main logic for chat will be found in the `Chat` component in `app/components
5757

5858
### Main Components
5959

60-
- `app/components/chat.tsx` - handles chat chat rendering, [streaming](https://platform.openai.com/docs/assistants/overview?context=with-streaming), and [function call](https://platform.openai.com/docs/assistants/tools/function-calling/quickstart?context=streaming&lang=node.js) forwarding
60+
- `app/components/chat.tsx` - handles chat rendering, [streaming](https://platform.openai.com/docs/assistants/overview?context=with-streaming), and [function call](https://platform.openai.com/docs/assistants/tools/function-calling/quickstart?context=streaming&lang=node.js) forwarding
6161
- `app/components/file-viewer.tsx` - handles uploading, fetching, and deleting files for [file search](https://platform.openai.com/docs/assistants/tools/file-search)
6262

6363
### Endpoints

app/assistant-config.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
export const assistantId = process.env.OPENAI_ASSISTANT_ID; // set your assistant ID here
1+
export let assistantId = ""; // set your assistant ID here
2+
3+
if (assistantId === "") {
4+
assistantId = process.env.OPENAI_ASSISTANT_ID;
5+
}

0 commit comments

Comments
 (0)