Zihao Wang
commited on
Commit
•
a57c21c
1
Parent(s):
15f2583
update key
Browse files
app.py
CHANGED
@@ -116,7 +116,8 @@ Try to answer this question/instruction with step-by-step thoughts and make the
|
|
116 |
Use `\n\n` to split the answer into several paragraphs.
|
117 |
Just respond to the instruction directly. DO NOT add additional explanations or introducement in the answer unless you are asked to.
|
118 |
'''
|
119 |
-
openai_client = OpenAI(api_key=openai.api_key)
|
|
|
120 |
draft = openai_client.chat.completions.create(
|
121 |
model="gpt-3.5-turbo",
|
122 |
messages=[
|
@@ -152,7 +153,8 @@ Try to make the query as relevant as possible to the last few sentences in the c
|
|
152 |
**IMPORTANT**
|
153 |
Just output the query directly. DO NOT add additional explanations or introducement in the answer unless you are asked to.
|
154 |
'''
|
155 |
-
openai_client = OpenAI(api_key = openai.api_key)
|
|
|
156 |
query = openai_client.chat.completions.create(
|
157 |
model="gpt-3.5-turbo",
|
158 |
messages=[
|
@@ -198,7 +200,8 @@ Add more details from retrieved text to the answer.
|
|
198 |
Split the paragraphs with `\n\n` characters.
|
199 |
Just output the revised answer directly. DO NOT add additional explanations or annoucement in the revised answer unless you are asked to.
|
200 |
'''
|
201 |
-
openai_client = OpenAI(api_key = openai.api_key)
|
|
|
202 |
revised_answer = openai_client.chat.completions.create(
|
203 |
model="gpt-3.5-turbo",
|
204 |
messages=[
|
@@ -340,8 +343,7 @@ def clear_func():
|
|
340 |
|
341 |
def set_openai_api_key(api_key):
|
342 |
if api_key and api_key.startswith("sk-") and len(api_key) > 50:
|
343 |
-
|
344 |
-
openai.api_key = api_key
|
345 |
|
346 |
with gr.Blocks(title = page_title) as demo:
|
347 |
|
|
|
116 |
Use `\n\n` to split the answer into several paragraphs.
|
117 |
Just respond to the instruction directly. DO NOT add additional explanations or introducement in the answer unless you are asked to.
|
118 |
'''
|
119 |
+
# openai_client = OpenAI(api_key=openai.api_key)
|
120 |
+
openai_client = OpenAI(api_key = os.environ.get("OPENAI_API_KEY"))
|
121 |
draft = openai_client.chat.completions.create(
|
122 |
model="gpt-3.5-turbo",
|
123 |
messages=[
|
|
|
153 |
**IMPORTANT**
|
154 |
Just output the query directly. DO NOT add additional explanations or introducement in the answer unless you are asked to.
|
155 |
'''
|
156 |
+
# openai_client = OpenAI(api_key = openai.api_key)
|
157 |
+
openai_client = OpenAI(api_key = os.environ.get("OPENAI_API_KEY"))
|
158 |
query = openai_client.chat.completions.create(
|
159 |
model="gpt-3.5-turbo",
|
160 |
messages=[
|
|
|
200 |
Split the paragraphs with `\n\n` characters.
|
201 |
Just output the revised answer directly. DO NOT add additional explanations or annoucement in the revised answer unless you are asked to.
|
202 |
'''
|
203 |
+
# openai_client = OpenAI(api_key = openai.api_key)
|
204 |
+
openai_client = OpenAI(api_key = os.environ.get("OPENAI_API_KEY"))
|
205 |
revised_answer = openai_client.chat.completions.create(
|
206 |
model="gpt-3.5-turbo",
|
207 |
messages=[
|
|
|
343 |
|
344 |
def set_openai_api_key(api_key):
|
345 |
if api_key and api_key.startswith("sk-") and len(api_key) > 50:
|
346 |
+
os.environ["OPENAI_API_KEY"] = api_key
|
|
|
347 |
|
348 |
with gr.Blocks(title = page_title) as demo:
|
349 |
|