Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -190,13 +190,23 @@ def function(Textbox, Textbox2, Textbox3, Dropdown):
|
|
190 |
try:
|
191 |
sleep(0.8)
|
192 |
def chat_with_assistant(messages, functions=None):
|
193 |
-
chat = openai.ChatCompletion.create(
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
)
|
199 |
-
reply = chat.choices[0].message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
return reply
|
201 |
|
202 |
functions = [
|
|
|
190 |
try:
|
191 |
sleep(0.8)
|
192 |
def chat_with_assistant(messages, functions=None):
|
193 |
+
# chat = openai.ChatCompletion.create(
|
194 |
+
# model=model,
|
195 |
+
# messages=data["messages"],
|
196 |
+
# functions=functions,
|
197 |
+
# function_call="auto"
|
198 |
+
# )
|
199 |
+
# reply = chat.choices[0].message
|
200 |
+
# return reply
|
201 |
+
response = requests.post(base, json={
|
202 |
+
"model":model,
|
203 |
+
"messages":data["messages"],
|
204 |
+
"functions":functions,
|
205 |
+
"function_call":"auto"
|
206 |
+
})
|
207 |
+
|
208 |
+
reply = json.loads(response.content)
|
209 |
+
reply = reply["choices"][0]["message"]
|
210 |
return reply
|
211 |
|
212 |
functions = [
|