#!/usr/bin/env bash # apply_patch: prints the structured create_file operation (nothing is applied). STATUS: LIVE_VERIFIED 2026-09-18 (gpt-5.4-nano). # Run: bash examples/openai/tools/apply-patch/apply_patch.sh set -eo pipefail # no -u: oai() runs in $(...) subshells, so OAI_STATUS may be unset in the parent source "$(dirname "$0")/../../../../scripts/lib.sh" R=$(oai POST /v1/responses -d '{"model":"gpt-5.4-nano","input":"Create a new file hello.txt containing the single line OK using apply_patch.", "tools":[{"type":"apply_patch"}],"tool_choice":{"type":"apply_patch"},"max_output_tokens":128,"reasoning":{"effort":"low"}}') log_request openai POST /v1/responses "${OAI_STATUS:-200}" 0.0002 "apply_patch.sh" echo "$R" | jq -c '.output[] | select(.type=="apply_patch_call") | {call_id, status, operation}'