Update openai_requests.py
Browse files- openai_requests.py +6 -2
openai_requests.py
CHANGED
@@ -24,5 +24,9 @@ def get_completion_from_openai(prompt, max_tokens = None):
|
|
24 |
headers=headers,
|
25 |
stream=False,
|
26 |
)
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
24 |
headers=headers,
|
25 |
stream=False,
|
26 |
)
|
27 |
+
try {
|
28 |
+
return response.json()['choices'][0]['message']['content']
|
29 |
+
} except {
|
30 |
+
print(response.json())
|
31 |
+
}
|
32 |
+
|