bstraehle commited on
Commit
29c09e1
1 Parent(s): 0dd355b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -13
app.py CHANGED
@@ -119,21 +119,19 @@ def get_messages(client, thread):
119
  def extract_file_ids(step_details):
120
  file_ids = []
121
 
122
- for step in step_details:
123
- step_details = step.get('step_details', {})
124
- tool_calls = step_details.get('tool_calls', [])
125
 
126
- for tool_call in tool_calls:
127
- code_interpreter = tool_call.get('code_interpreter', {})
128
- outputs = code_interpreter.get('outputs', [])
 
 
 
 
 
 
 
129
 
130
- for output in outputs:
131
- if 'image' in output:
132
- file_id = output['image'].get('file_id')
133
- if file_id:
134
- file_ids.append(file_id)
135
- print(f"\n\n\n\n\n{file_id}")
136
-
137
  return file_ids
138
 
139
  def extract_content_values(data):
 
119
  def extract_file_ids(step_details):
120
  file_ids = []
121
 
122
+ tool_calls = step_details.get('tool_calls', [])
 
 
123
 
124
+ for tool_call in tool_calls:
125
+ code_interpreter = tool_call.get('code_interpreter', {})
126
+ outputs = code_interpreter.get('outputs', [])
127
+
128
+ for output in outputs:
129
+ if 'image' in output:
130
+ file_id = output['image'].get('file_id')
131
+ if file_id:
132
+ file_ids.append(file_id)
133
+ print(f"\n\n\n\n\n{file_id}")
134
 
 
 
 
 
 
 
 
135
  return file_ids
136
 
137
  def extract_content_values(data):