bstraehle commited on
Commit
6e6e7d5
1 Parent(s): 39b970f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -102,6 +102,7 @@ def get_run_steps(client, thread, run):
102
  def get_run_step_details(run_steps):
103
  for step in run_steps.data:
104
  step_details = step.step_details
 
105
 
106
  show_json("step_details", step_details)
107
 
@@ -113,7 +114,18 @@ def get_messages(client, thread):
113
  show_json("messages", messages)
114
 
115
  return messages
116
-
 
 
 
 
 
 
 
 
 
 
 
117
  def extract_content_values(data):
118
  content_values = []
119
 
 
102
  def get_run_step_details(run_steps):
103
  for step in run_steps.data:
104
  step_details = step.step_details
105
+ extract_file_id(step_details) #XXXXX
106
 
107
  show_json("step_details", step_details)
108
 
 
114
  show_json("messages", messages)
115
 
116
  return messages
117
+
118
+ #XXXXX
119
+ def extract_file_id(data):
120
+ for step in data["data"]:
121
+ if "step_details" in step and "tool_calls" in step["step_details"]:
122
+ for tool_call in step["step_details"]["tool_calls"]:
123
+ if "code_interpreter" in tool_call and "outputs" in tool_call["code_interpreter"]:
124
+ for output in tool_call["code_interpreter"]["outputs"]:
125
+ if "image" in output and "file_id" in output["image"]:
126
+ file_id = output["image"]["file_id"]
127
+ print(f"#########################################Found file_id: {file_id}")
128
+
129
  def extract_content_values(data):
130
  content_values = []
131