bstraehle commited on
Commit
8153096
1 Parent(s): e26d276

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -60,23 +60,23 @@ def create_assistant(client):
60
  ],
61
  )
62
 
63
- #show_json("assistant", assistant)
64
 
65
  return assistant
66
 
67
  def load_assistant(client):
68
- ASSISTANT_ID = "asst_TpZgBd2QYaxUxCwUy8J9m3Bq"
69
 
70
  assistant = client.beta.assistants.retrieve(ASSISTANT_ID)
71
 
72
- #show_json("assistant", assistant)
73
 
74
  return assistant
75
 
76
  def create_thread(client):
77
  thread = client.beta.threads.create()
78
 
79
- #show_json("thread", thread)
80
 
81
  return thread
82
 
@@ -87,7 +87,7 @@ def create_message(client, thread, msg):
87
  content=msg,
88
  )
89
 
90
- #show_json("message", message)
91
 
92
  return message
93
 
@@ -97,7 +97,7 @@ def create_run(client, assistant, thread):
97
  thread_id=thread.id,
98
  )
99
 
100
- #show_json("run", run)
101
 
102
  return run
103
 
@@ -111,7 +111,7 @@ def wait_on_run(client, thread, run):
111
 
112
  time.sleep(0.5)
113
 
114
- #show_json("run", run)
115
 
116
  return run
117
 
@@ -122,7 +122,7 @@ def get_run_steps(client, thread, run):
122
  order="asc",
123
  )
124
 
125
- #show_json("run_steps", run_steps)
126
 
127
  return run_steps
128
 
@@ -159,7 +159,7 @@ def get_messages(client, thread):
159
  thread_id=thread.id
160
  )
161
 
162
- #show_json("messages", messages)
163
 
164
  return messages
165
 
@@ -217,7 +217,7 @@ def chat(message, history):
217
  global client, assistant, thread
218
 
219
  if assistant == None:
220
- assistant = create_assistant(client)
221
 
222
  if thread == None or len(history) == 0:
223
  thread = create_thread(client)
 
60
  ],
61
  )
62
 
63
+ show_json("assistant", assistant)
64
 
65
  return assistant
66
 
67
  def load_assistant(client):
68
+ ASSISTANT_ID = "asst_z9aCDk3Sp7yvWKRyLykbFIds"
69
 
70
  assistant = client.beta.assistants.retrieve(ASSISTANT_ID)
71
 
72
+ show_json("assistant", assistant)
73
 
74
  return assistant
75
 
76
  def create_thread(client):
77
  thread = client.beta.threads.create()
78
 
79
+ show_json("thread", thread)
80
 
81
  return thread
82
 
 
87
  content=msg,
88
  )
89
 
90
+ show_json("message", message)
91
 
92
  return message
93
 
 
97
  thread_id=thread.id,
98
  )
99
 
100
+ show_json("run", run)
101
 
102
  return run
103
 
 
111
 
112
  time.sleep(0.5)
113
 
114
+ show_json("run", run)
115
 
116
  return run
117
 
 
122
  order="asc",
123
  )
124
 
125
+ show_json("run_steps", run_steps)
126
 
127
  return run_steps
128
 
 
159
  thread_id=thread.id
160
  )
161
 
162
+ show_json("messages", messages)
163
 
164
  return messages
165
 
 
217
  global client, assistant, thread
218
 
219
  if assistant == None:
220
+ assistant = load_assistant(client)
221
 
222
  if thread == None or len(history) == 0:
223
  thread = create_thread(client)