MCPcopy
hub / github.com/openai/openai-agents-python / extract_output_text

Function extract_output_text

tests/test_hitl_session_scenario.py:462–477  ·  view source on GitHub ↗
(item: dict[str, Any] | None)

Source from the content-addressed store, hash-verified

460
461
462def extract_output_text(item: dict[str, Any] | None) -> str:
463 if not item:
464 return ""
465
466 output = item.get("output")
467 if isinstance(output, str):
468 return output
469 if isinstance(output, list):
470 for entry in output:
471 if isinstance(entry, dict) and entry.get("type") == "input_text":
472 text = entry.get("text")
473 return text if isinstance(text, str) else ""
474 if isinstance(output, dict) and output.get("type") == "input_text":
475 text = output.get("text")
476 return text if isinstance(text, str) else ""
477 return ""

Callers 2

assert_step_outputFunction · 0.85
assert_step_itemsFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected