Spaces:
Sleeping
Sleeping
Update app.py
Browse filesReasoning output working
app.py
CHANGED
|
@@ -256,7 +256,7 @@ async def chat(prompt_window, user_window, password, history, output_window,
|
|
| 256 |
|
| 257 |
if not credentials_ok(user_window, password):
|
| 258 |
return ['Invalid Credentials', prompt_window, uploaded_image_files,
|
| 259 |
-
image_window, file_download, history,
|
| 260 |
instructions = '''
|
| 261 |
You are a helpful assistant.
|
| 262 |
You can call tools to compute straight-line distances and to search the web for
|
|
@@ -358,14 +358,21 @@ async def chat(prompt_window, user_window, password, history, output_window,
|
|
| 358 |
fp.write(base64.b64decode(img_result))
|
| 359 |
image_window = gr.Image(visible=True, value=image_out_path)
|
| 360 |
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 364 |
|
| 365 |
reply = md(result.final_output)
|
| 366 |
response += "\n\n***YOU***: " + prompt + "\n\n***GPT***: " + reply.replace('```','\n\n```\n\n')
|
| 367 |
if reasoning != '':
|
| 368 |
-
response += '\n\n**Reasoning:**\n' + reasoning + '\n'
|
| 369 |
history.append({"role":"assistant", "content":result.final_output})
|
| 370 |
except Exception as e:
|
| 371 |
exception_msg = f'Error: {e.message}'
|
|
|
|
| 256 |
|
| 257 |
if not credentials_ok(user_window, password):
|
| 258 |
return ['Invalid Credentials', prompt_window, uploaded_image_files,
|
| 259 |
+
image_window, file_download, history, uploaded_file_paths, prior_inputs]
|
| 260 |
instructions = '''
|
| 261 |
You are a helpful assistant.
|
| 262 |
You can call tools to compute straight-line distances and to search the web for
|
|
|
|
| 358 |
fp.write(base64.b64decode(img_result))
|
| 359 |
image_window = gr.Image(visible=True, value=image_out_path)
|
| 360 |
|
| 361 |
+
if item.type == "reasoning_item":
|
| 362 |
+
for o in item.raw_item.summary:
|
| 363 |
+
if o.type == "summary_text":
|
| 364 |
+
reasoning += ('\n' + o.text + '\n')
|
| 365 |
+
|
| 366 |
+
# for raw in result.raw_responses:
|
| 367 |
+
# for item in raw.output:
|
| 368 |
+
# if item.type == 'reasoning' and item.summary:
|
| 369 |
+
# for o in item.summary:
|
| 370 |
+
# reasoning += ('\nm1: ' + o.text + '\n')
|
| 371 |
|
| 372 |
reply = md(result.final_output)
|
| 373 |
response += "\n\n***YOU***: " + prompt + "\n\n***GPT***: " + reply.replace('```','\n\n```\n\n')
|
| 374 |
if reasoning != '':
|
| 375 |
+
response += '\n\n**Reasoning:**\n\n' + reasoning + '\n'
|
| 376 |
history.append({"role":"assistant", "content":result.final_output})
|
| 377 |
except Exception as e:
|
| 378 |
exception_msg = f'Error: {e.message}'
|