bstraehle commited on
Commit
9ea93d2
1 Parent(s): df144ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -17,7 +17,7 @@ def init_assistant():
17
  _assistant = _client.beta.assistants.create(
18
  name="Math Tutor",
19
  instructions="You are a personal math tutor. Answer questions briefly, in a sentence or less.",
20
- model="gpt-4-1106-preview",
21
  )
22
 
23
  _thread = _client.beta.threads.create()
@@ -27,8 +27,8 @@ def wait_on_run(run):
27
 
28
  while run.status == "queued" or run.status == "in_progress":
29
  run = _client.beta.threads.runs.retrieve(
30
- run_id=run.id,
31
  thread_id=_thread.id,
 
32
  )
33
  time.sleep(0.25)
34
 
@@ -58,8 +58,8 @@ def chat(message, history):
58
  if len(history_openai_format) == 1:
59
  init_assistant()
60
 
61
- show_json("assistant", _assistant)
62
- show_json("thread", _thread)
63
 
64
  #print("### history")
65
  #print(len(history_openai_format))
@@ -68,7 +68,7 @@ def chat(message, history):
68
  message = _client.beta.threads.messages.create(
69
  role="user",
70
  thread_id=_thread.id,
71
- content=message,
72
  )
73
 
74
  #show_json("message", message)
@@ -95,7 +95,7 @@ gr.ChatInterface(
95
  title="Math Tutor",
96
  description="Question",
97
  theme="soft",
98
- examples=["I need to solve the equation `3x + 13 = 11`. Can you help me?"],
99
  cache_examples=False,
100
  retry_btn=None,
101
  undo_btn=None,
 
17
  _assistant = _client.beta.assistants.create(
18
  name="Math Tutor",
19
  instructions="You are a personal math tutor. Answer questions briefly, in a sentence or less.",
20
+ model="gpt-4o",
21
  )
22
 
23
  _thread = _client.beta.threads.create()
 
27
 
28
  while run.status == "queued" or run.status == "in_progress":
29
  run = _client.beta.threads.runs.retrieve(
 
30
  thread_id=_thread.id,
31
+ run_id=run.id,
32
  )
33
  time.sleep(0.25)
34
 
 
58
  if len(history_openai_format) == 1:
59
  init_assistant()
60
 
61
+ #show_json("assistant", _assistant)
62
+ #show_json("thread", _thread)
63
 
64
  #print("### history")
65
  #print(len(history_openai_format))
 
68
  message = _client.beta.threads.messages.create(
69
  role="user",
70
  thread_id=_thread.id,
71
+ content=history_openai_format,
72
  )
73
 
74
  #show_json("message", message)
 
95
  title="Math Tutor",
96
  description="Question",
97
  theme="soft",
98
+ examples=["I need to solve the equation '3x + 13 = 11'. Can you help me?"],
99
  cache_examples=False,
100
  retry_btn=None,
101
  undo_btn=None,