manu commited on
Commit
45d4aa4
·
verified ·
1 Parent(s): 834e79b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -333,15 +333,18 @@ def stream_agent(question: str,
333
  yield round_state["final_text"] or " ", round_state["summary_text"] or " ", "\n".join(log_lines[-400:])
334
 
335
  # Log tool call argument deltas (optional)
336
- elif etype in ("response.function_call_arguments.delta", "response.tool_call_arguments.delta"):
337
  delta = getattr(event, "delta", None)
338
  if delta:
339
  log_lines.append(str(delta))
 
 
340
 
341
  # Capture tool RESULT text and try to parse indices
342
- elif etype.startswith("response.tool_result"):
343
  print("A tool output was detected")
344
- delta_text = getattr(event, "delta", "") or getattr(event, "output_text", "")
 
345
  if delta_text:
346
  tool_result_buffer += str(delta_text)
347
  parsed_now = _maybe_parse_indices(tool_result_buffer)
 
333
  yield round_state["final_text"] or " ", round_state["summary_text"] or " ", "\n".join(log_lines[-400:])
334
 
335
  # Log tool call argument deltas (optional)
336
+ elif etype in ("response.mcp_call_arguments.delta", "response.tool_call_arguments.delta"):
337
  delta = getattr(event, "delta", None)
338
  if delta:
339
  log_lines.append(str(delta))
340
+ round_state["summary_text"] += "\nQuery call: " + event.delta + "\n"
341
+ yield round_state["final_text"] or " ", round_state["summary_text"] or " ", "\n".join(log_lines[-400:])
342
 
343
  # Capture tool RESULT text and try to parse indices
344
+ elif etype.startswith("response.output_item.done"):
345
  print("A tool output was detected")
346
+ print(event)
347
+ delta_text = getattr(event.item, "output", "")
348
  if delta_text:
349
  tool_result_buffer += str(delta_text)
350
  parsed_now = _maybe_parse_indices(tool_result_buffer)