alexkueck commited on
Commit
0179ea7
1 Parent(s): 8814607

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +12 -3
utils.py CHANGED
@@ -475,12 +475,21 @@ def cancel_outputing():
475
  ########################################
476
  #Open Assistant Funktionen für File upload
477
  ########################################
478
- def get_response(thread, client):
 
 
 
 
 
 
 
 
 
479
  return client.beta.threads.messages.list(thread_id=thread.id, order="asc")
480
 
481
- def create_thread_and_run(user_input, client):
482
  thread = client.beta.threads.create()
483
- run = submit_message(MATH_ASSISTANT_ID, thread, user_input)
484
  return thread, run
485
 
486
  def pretty_print(messages):
 
475
  ########################################
476
  #Open Assistant Funktionen für File upload
477
  ########################################
478
+ def submit_message(assistant_id, thread, user_message):
479
+ client.beta.threads.messages.create(
480
+ thread_id=thread.id, role="user", content=user_message
481
+ )
482
+ return client.beta.threads.runs.create(
483
+ thread_id=thread.id,
484
+ assistant_id=assistant_id,
485
+ )
486
+
487
+ def get_response(thread, client, assi_id):
488
  return client.beta.threads.messages.list(thread_id=thread.id, order="asc")
489
 
490
+ def create_thread_and_run(user_input, client, assi_id):
491
  thread = client.beta.threads.create()
492
+ run = submit_message(assi_id, thread, user_input)
493
  return thread, run
494
 
495
  def pretty_print(messages):