Zihao Wang
commited on
Commit
·
1097625
1
Parent(s):
ba10510
add api_key
Browse files
app.py
CHANGED
@@ -99,6 +99,7 @@ def chunk_texts(text, chunk_size = 2048):
|
|
99 |
from datetime import datetime
|
100 |
|
101 |
from openai import OpenAI
|
|
|
102 |
import os
|
103 |
|
104 |
chatgpt_system_prompt = f'''
|
@@ -115,7 +116,7 @@ Try to answer this question/instruction with step-by-step thoughts and make the
|
|
115 |
Use `\n\n` to split the answer into several paragraphs.
|
116 |
Just respond to the instruction directly. DO NOT add additional explanations or introducement in the answer unless you are asked to.
|
117 |
'''
|
118 |
-
openai_client = OpenAI()
|
119 |
draft = openai_client.chat.completions.create(
|
120 |
model="gpt-3.5-turbo",
|
121 |
messages=[
|
@@ -151,7 +152,7 @@ Try to make the query as relevant as possible to the last few sentences in the c
|
|
151 |
**IMPORTANT**
|
152 |
Just output the query directly. DO NOT add additional explanations or introducement in the answer unless you are asked to.
|
153 |
'''
|
154 |
-
openai_client = OpenAI()
|
155 |
query = openai_client.chat.completions.create(
|
156 |
model="gpt-3.5-turbo",
|
157 |
messages=[
|
@@ -197,7 +198,7 @@ Add more details from retrieved text to the answer.
|
|
197 |
Split the paragraphs with `\n\n` characters.
|
198 |
Just output the revised answer directly. DO NOT add additional explanations or annoucement in the revised answer unless you are asked to.
|
199 |
'''
|
200 |
-
openai_client = OpenAI()
|
201 |
revised_answer = openai_client.chat.completions.create(
|
202 |
model="gpt-3.5-turbo",
|
203 |
messages=[
|
|
|
99 |
from datetime import datetime
|
100 |
|
101 |
from openai import OpenAI
|
102 |
+
import openai
|
103 |
import os
|
104 |
|
105 |
chatgpt_system_prompt = f'''
|
|
|
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(openai.api_key)
|
120 |
draft = openai_client.chat.completions.create(
|
121 |
model="gpt-3.5-turbo",
|
122 |
messages=[
|
|
|
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 |
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=[
|