Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,12 +16,12 @@ def init_assistant(client):
|
|
16 |
instructions="You are a personal math tutor. Answer questions briefly, in a sentence or less.",
|
17 |
model="gpt-4-1106-preview",
|
18 |
)
|
19 |
-
|
20 |
return assistant
|
21 |
|
22 |
def init_thread(client):
|
23 |
thread = client.beta.threads.create()
|
24 |
-
|
25 |
return thread
|
26 |
|
27 |
def wait_on_run(client, thread, run):
|
@@ -58,13 +58,13 @@ def chat(message, history, openai_api_key):
|
|
58 |
thread_id=_thread.id,
|
59 |
content=message,
|
60 |
)
|
61 |
-
|
62 |
|
63 |
run = _client.beta.threads.runs.create(
|
64 |
assistant_id=_assistant.id,
|
65 |
thread_id=_thread.id,
|
66 |
)
|
67 |
-
|
68 |
|
69 |
run = wait_on_run(_client, _thread, run)
|
70 |
show_json("run", run)
|
|
|
16 |
instructions="You are a personal math tutor. Answer questions briefly, in a sentence or less.",
|
17 |
model="gpt-4-1106-preview",
|
18 |
)
|
19 |
+
show_json("assistant", assistant)
|
20 |
return assistant
|
21 |
|
22 |
def init_thread(client):
|
23 |
thread = client.beta.threads.create()
|
24 |
+
show_json("thread", thread)
|
25 |
return thread
|
26 |
|
27 |
def wait_on_run(client, thread, run):
|
|
|
58 |
thread_id=_thread.id,
|
59 |
content=message,
|
60 |
)
|
61 |
+
show_json("message", message)
|
62 |
|
63 |
run = _client.beta.threads.runs.create(
|
64 |
assistant_id=_assistant.id,
|
65 |
thread_id=_thread.id,
|
66 |
)
|
67 |
+
show_json("run", run)
|
68 |
|
69 |
run = wait_on_run(_client, _thread, run)
|
70 |
show_json("run", run)
|