Spaces:
Runtime error
Runtime error
Jin Ziqi
commited on
Commit
·
d42b071
1
Parent(s):
0303c30
update the interface
Browse files
app.py
CHANGED
|
@@ -22,21 +22,15 @@ openai.api_key = os.getenv("api_key")
|
|
| 22 |
|
| 23 |
def greet(question):
|
| 24 |
input = question + '\n\n' + "|step|subquestion|process|result|"
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
{"role": "system", "content": "You are a helpful assistant that generate table to solve reasoning problem."},
|
| 31 |
-
{"role": "user", "content": input},
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
except:
|
| 37 |
-
print("Unexpected error:", sys.exc_info()[0])
|
| 38 |
-
time.sleep(5)
|
| 39 |
-
continue
|
| 40 |
return "|step|subquestion|process|result|\n" + response
|
| 41 |
|
| 42 |
|
|
|
|
| 22 |
|
| 23 |
def greet(question):
|
| 24 |
input = question + '\n\n' + "|step|subquestion|process|result|"
|
| 25 |
+
response = openai.ChatCompletion.create(
|
| 26 |
+
model="gpt-3.5-turbo",
|
| 27 |
+
messages=[
|
| 28 |
+
{"role": "system", "content": "You are a helpful assistant that generate table to solve reasoning problem."},
|
| 29 |
+
{"role": "user", "content": input},
|
|
|
|
|
|
|
| 30 |
|
| 31 |
+
]
|
| 32 |
+
)
|
| 33 |
+
response = response["choices"][0]["message"]["content"]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
return "|step|subquestion|process|result|\n" + response
|
| 35 |
|
| 36 |
|