Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,7 @@ import zipfile
|
|
19 |
import random
|
20 |
|
21 |
from datetime import datetime
|
22 |
-
from openai import
|
23 |
from xml.etree import ElementTree as ET
|
24 |
from bs4 import BeautifulSoup
|
25 |
from collections import deque
|
@@ -158,7 +158,7 @@ def chat_with_model(prompt, document_section, model_choice='gpt-3.5-turbo'):
|
|
158 |
key = os.getenv('OPENAI_API_KEY')
|
159 |
openai.api_key = key
|
160 |
|
161 |
-
for chunk in openai.
|
162 |
model='gpt-3.5-turbo',
|
163 |
messages=conversation,
|
164 |
temperature=0.5,
|
@@ -189,7 +189,7 @@ def chat_with_file_contents(prompt, file_content, model_choice='gpt-3.5-turbo'):
|
|
189 |
conversation.append({'role': 'user', 'content': prompt})
|
190 |
if len(file_content)>0:
|
191 |
conversation.append({'role': 'assistant', 'content': file_content})
|
192 |
-
response = openai.
|
193 |
return response['choices'][0]['message']['content']
|
194 |
|
195 |
|
|
|
19 |
import random
|
20 |
|
21 |
from datetime import datetime
|
22 |
+
from openai import Completion
|
23 |
from xml.etree import ElementTree as ET
|
24 |
from bs4 import BeautifulSoup
|
25 |
from collections import deque
|
|
|
158 |
key = os.getenv('OPENAI_API_KEY')
|
159 |
openai.api_key = key
|
160 |
|
161 |
+
for chunk in openai.Completion.create(
|
162 |
model='gpt-3.5-turbo',
|
163 |
messages=conversation,
|
164 |
temperature=0.5,
|
|
|
189 |
conversation.append({'role': 'user', 'content': prompt})
|
190 |
if len(file_content)>0:
|
191 |
conversation.append({'role': 'assistant', 'content': file_content})
|
192 |
+
response = openai.Completion.create(model=model_choice, messages=conversation)
|
193 |
return response['choices'][0]['message']['content']
|
194 |
|
195 |
|