Function: sanitizeOpenResponsesInput()
sanitizeOpenResponsesInput(
body):Record<string,unknown>
Rewrite Responses input so Open Responses will accept it.
Two OpenAI / Codex shapes that Databricks Open Responses (Claude, Gemini, …) reject:
- Prior assistant turns with
output_text/output_*content parts — Open Responses only allowsinput_text,input_image,input_file,input_audio. Map everyoutput_<kind>part toinput_<kind>. - Replayed extended-thinking blocks (
thinking,redacted_thinking,reasoningcontent parts, and top-levelreasoninginput items). Claude signs those; any client round-trip that mutates them (or a cross-provider replay) fails with e.g. “messages.N.content.M: Invaliddatainredacted_thinkingblock” Strip them — the UI/client already showed the thinking; replay does not need the signed blob. Same policy as appkit-mastra’s serving sanitize.
Returns a shallow copy when anything changes; otherwise the input body.
Parameters
Section titled “Parameters”Record<string, unknown>
Returns
Section titled “Returns”Record<string, unknown>