bstraehle commited on
Commit
51c03d5
1 Parent(s): e4cf670

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py CHANGED
@@ -49,6 +49,17 @@ def wait_on_run(client, thread, run):
49
  show_json("run", run)
50
  return run
51
 
 
 
 
 
 
 
 
 
 
 
 
52
  def list_messages(client, thread):
53
  messages = client.beta.threads.messages.list(
54
  thread_id=thread.id
@@ -81,6 +92,8 @@ def chat(message, history, openai_api_key):
81
  # async
82
  run = create_run(_client, _assistant, _thread)
83
  run = wait_on_run(_client, _thread, run)
 
 
84
 
85
  messages = list_messages(_client, _thread)
86
 
 
49
  show_json("run", run)
50
  return run
51
 
52
+ def list_run_steps(client, thread, run):
53
+ run_steps = client.beta.threads.runs.steps.list(
54
+ thread_id=thread.id,
55
+ run_id=run.id,
56
+ order="asc",
57
+ )
58
+ for step in run_steps.data:
59
+ step_details = step.step_details
60
+ print(json.dumps(show_json("step_details", step_details), indent=4))
61
+ return run_steps
62
+
63
  def list_messages(client, thread):
64
  messages = client.beta.threads.messages.list(
65
  thread_id=thread.id
 
92
  # async
93
  run = create_run(_client, _assistant, _thread)
94
  run = wait_on_run(_client, _thread, run)
95
+
96
+ list_run_steps(_client, _thread, run)
97
 
98
  messages = list_messages(_client, _thread)
99