From b22c182406c757601654d63d0d001ff5c6cdbc81 Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" <219766164+opencode-agent[bot]@users.noreply.github.com> Date: Sun, 23 Aug 2026 13:39:38 -0500 Subject: [PATCH] fix(ai): preserve inline file data URLs (#44499) Co-authored-by: rekram1-node <63023139+rekram1-node@users.noreply.github.com> --- packages/ai/src/protocols/open-responses.ts | 8 ++-- .../recordings/pdf/openai-tool-result.json | 6 +-- .../recordings/pdf/openai-user-input.json | 6 +-- .../recordings/pdf/xai-tool-result.json | 7 ++- .../recordings/pdf/xai-user-input.json | 7 ++- .../openai-compatible-responses.test.ts | 46 ++++++++++++++++++- .../ai/test/provider/openai-responses.test.ts | 18 ++++---- 7 files changed, 69 insertions(+), 29 deletions(-) diff --git a/packages/ai/src/protocols/open-responses.ts b/packages/ai/src/protocols/open-responses.ts index ad4f3f217ea..25218be9c2f 100644 --- a/packages/ai/src/protocols/open-responses.ts +++ b/packages/ai/src/protocols/open-responses.ts @@ -428,7 +428,7 @@ const lowerMedia = Effect.fn("OpenResponses.lowerMedia")(function* ( return { type: "input_file" as const, filename: part.filename ?? (media.mime === "application/pdf" ? "document.pdf" : "file"), - ...(url ? { file_url: url } : { file_data: media.base64 }), + ...(url ? { file_url: url } : { file_data: media.dataUrl }), } } return { type: "input_image" as const, image_url: url ?? media.dataUrl } @@ -580,8 +580,7 @@ const lowerMessages = Effect.fn("OpenResponses.lowerMessages")(function* (reques if (part.type === "tool-result" && part.providerExecuted === true) { flushText() const id = itemID(part.providerMetadata, providerMetadataKey) - if (store !== false && id && !hostedToolReferences.has(id)) - input.push({ type: "item_reference", id }) + if (store !== false && id && !hostedToolReferences.has(id)) input.push({ type: "item_reference", id }) if (store === false && part.result.type === "content") { const content: ReadonlyArray = part.result.value input.push({ @@ -1126,7 +1125,8 @@ export const step = (state: ParserState, event: Event) => { } if (event.type === "response.refusal.delta" || event.type === "response.refusal.done") { const value = event.type === "response.refusal.delta" ? event.delta : event.refusal - if (!event.item_id || typeof value !== "string") return ProviderShared.eventError(state.id, `${event.type} is malformed`) + if (!event.item_id || typeof value !== "string") + return ProviderShared.eventError(state.id, `${event.type} is malformed`) return Effect.succeed( event.type === "response.refusal.delta" ? onOutputTextDelta(state, event, event.item_id) diff --git a/packages/ai/test/fixtures/recordings/pdf/openai-tool-result.json b/packages/ai/test/fixtures/recordings/pdf/openai-tool-result.json index 0c51f521a76..7bed1ee9a3e 100644 --- a/packages/ai/test/fixtures/recordings/pdf/openai-tool-result.json +++ b/packages/ai/test/fixtures/recordings/pdf/openai-tool-result.json @@ -10,7 +10,7 @@ "tool-result" ], "name": "pdf/openai-tool-result", - "recordedAt": "2026-07-22T18:15:36.438Z" + "recordedAt": "2026-08-23T18:32:19.300Z" }, "interactions": [ { @@ -21,14 +21,14 @@ "headers": { "content-type": "application/json" }, - "body": "{\"model\":\"gpt-4o-mini\",\"input\":[{\"role\":\"system\",\"content\":\"Read the PDF returned by the tool and follow the user's response format exactly.\"},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"Return only the verification code from the PDF.\"}]},{\"type\":\"function_call\",\"call_id\":\"call_pdf_1\",\"name\":\"read_pdf\",\"arguments\":\"{}\"},{\"type\":\"function_call_output\",\"call_id\":\"call_pdf_1\",\"output\":[{\"type\":\"input_text\",\"text\":\"PDF read successfully\"},{\"type\":\"input_file\",\"filename\":\"verification.pdf\",\"file_data\":\"JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA1IDAgUiA+PiA+PiAvQ29udGVudHMgNCAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL0xlbmd0aCA3NSA+PgpzdHJlYW0KQlQKL0YxIDE4IFRmCjcyIDcyMCBUZAooUERGIGNhc3NldHRlIHZlcmlmaWNhdGlvbiBjb2RlOiBPUkNISUQtNzM5MSkgVGoKRVQKZW5kc3RyZWFtCmVuZG9iago1IDAgb2JqCjw8IC9UeXBlIC9Gb250IC9TdWJ0eXBlIC9UeXBlMSAvQmFzZUZvbnQgL0hlbHZldGljYSA+PgplbmRvYmoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwNTggMDAwMDAgbiAKMDAwMDAwMDExNSAwMDAwMCBuIAowMDAwMDAwMjQxIDAwMDAwIG4gCjAwMDAwMDAzNjUgMDAwMDAgbiAKdHJhaWxlcgo8PCAvU2l6ZSA2IC9Sb290IDEgMCBSID4+CnN0YXJ0eHJlZgo0MzUKJSVFT0YK\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"read_pdf\",\"description\":\"Read the attached PDF.\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"store\":false,\"max_output_tokens\":40,\"temperature\":0,\"stream\":true}" + "body": "{\"model\":\"gpt-4o-mini\",\"input\":[{\"role\":\"system\",\"content\":\"Read the PDF returned by the tool and follow the user's response format exactly.\"},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"Return only the verification code from the PDF.\"}]},{\"type\":\"function_call\",\"call_id\":\"call_pdf_1\",\"name\":\"read_pdf\",\"arguments\":\"{}\"},{\"type\":\"function_call_output\",\"call_id\":\"call_pdf_1\",\"output\":[{\"type\":\"input_text\",\"text\":\"PDF read successfully\"},{\"type\":\"input_file\",\"filename\":\"verification.pdf\",\"file_data\":\"data:application/pdf;base64,JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA1IDAgUiA+PiA+PiAvQ29udGVudHMgNCAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL0xlbmd0aCA3NSA+PgpzdHJlYW0KQlQKL0YxIDE4IFRmCjcyIDcyMCBUZAooUERGIGNhc3NldHRlIHZlcmlmaWNhdGlvbiBjb2RlOiBPUkNISUQtNzM5MSkgVGoKRVQKZW5kc3RyZWFtCmVuZG9iago1IDAgb2JqCjw8IC9UeXBlIC9Gb250IC9TdWJ0eXBlIC9UeXBlMSAvQmFzZUZvbnQgL0hlbHZldGljYSA+PgplbmRvYmoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwNTggMDAwMDAgbiAKMDAwMDAwMDExNSAwMDAwMCBuIAowMDAwMDAwMjQxIDAwMDAwIG4gCjAwMDAwMDAzNjUgMDAwMDAgbiAKdHJhaWxlcgo8PCAvU2l6ZSA2IC9Sb290IDEgMCBSID4+CnN0YXJ0eHJlZgo0MzUKJSVFT0YK\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"read_pdf\",\"description\":\"Read the attached PDF.\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"store\":false,\"max_output_tokens\":40,\"temperature\":0,\"stream\":true}" }, "response": { "status": 200, "headers": { "content-type": "text/event-stream; charset=utf-8" }, - "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_0cd823aeeb11ef0e016a6108c703b88193872d736c48d60e2c\",\"object\":\"response\",\"created_at\":1784744135,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":40,\"max_tool_calls\":null,\"model\":\"gpt-4o-mini-2024-07-18\",\"moderation\":null,\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":false,\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[{\"type\":\"function\",\"description\":\"Read the attached PDF.\",\"name\":\"read_pdf\",\"output_schema\":null,\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_0cd823aeeb11ef0e016a6108c703b88193872d736c48d60e2c\",\"object\":\"response\",\"created_at\":1784744135,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":40,\"max_tool_calls\":null,\"model\":\"gpt-4o-mini-2024-07-18\",\"moderation\":null,\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":false,\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[{\"type\":\"function\",\"description\":\"Read the attached PDF.\",\"name\":\"read_pdf\",\"output_schema\":null,\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"type\":\"message\",\"status\":\"in_progress\",\"content\":[],\"role\":\"assistant\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.content_part.added\ndata: {\"type\":\"response.content_part.added\",\"content_index\":0,\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"output_index\":0,\"part\":{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"\"},\"sequence_number\":3}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"The\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"ztkMbqje3EBwS\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" verification\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"mEL\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" code\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"l7H1kZM2CjW\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" from\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"zoQfdh40bG4\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" the\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"5fXB3VBJUbAr\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" PDF\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"BpJQrXS6gY3c\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" is\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"xmGyHaXtMBy6i\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\":\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"oJeWezxDkzq3MRx\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" OR\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"LpS12bymKrO3H\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"CH\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"EvCpePUNmEXVil\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"ID\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"IS5u0zHGO1f3DZ\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"-\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"sQxTFLJOfQQxxil\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"739\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"iIJRJFEo0kyEU\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"1\",\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"obfuscation\":\"lwMVw41zdSRsVxm\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.output_text.done\ndata: {\"type\":\"response.output_text.done\",\"content_index\":0,\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"logprobs\":[],\"output_index\":0,\"sequence_number\":18,\"text\":\"The verification code from the PDF is: ORCHID-7391\"}\n\nevent: response.content_part.done\ndata: {\"type\":\"response.content_part.done\",\"content_index\":0,\"item_id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"output_index\":0,\"part\":{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"The verification code from the PDF is: ORCHID-7391\"},\"sequence_number\":19}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"type\":\"message\",\"status\":\"completed\",\"content\":[{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"The verification code from the PDF is: ORCHID-7391\"}],\"role\":\"assistant\"},\"output_index\":0,\"sequence_number\":20}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_0cd823aeeb11ef0e016a6108c703b88193872d736c48d60e2c\",\"object\":\"response\",\"created_at\":1784744135,\"status\":\"completed\",\"background\":false,\"completed_at\":1784744136,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":40,\"max_tool_calls\":null,\"model\":\"gpt-4o-mini-2024-07-18\",\"moderation\":null,\"output\":[{\"id\":\"msg_0cd823aeeb11ef0e016a6108c83f8081938114e89ac5d99c7e\",\"type\":\"message\",\"status\":\"completed\",\"content\":[{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"The verification code from the PDF is: ORCHID-7391\"}],\"role\":\"assistant\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":false,\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[{\"type\":\"function\",\"description\":\"Read the attached PDF.\",\"name\":\"read_pdf\",\"output_schema\":null,\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":107,\"input_tokens_details\":{\"cache_write_tokens\":0,\"cached_tokens\":0},\"output_tokens\":16,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":123},\"user\":null,\"metadata\":{}},\"sequence_number\":21}\n\n" + "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_0b591494b7edb09b016a8b3cb2837887d295d458c80a691078\",\"object\":\"response\",\"created_at\":1787509938,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":40,\"max_tool_calls\":null,\"model\":\"gpt-4o-mini-2024-07-18\",\"moderation\":null,\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":false,\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[{\"type\":\"function\",\"description\":\"Read the attached PDF.\",\"name\":\"read_pdf\",\"output_schema\":null,\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_0b591494b7edb09b016a8b3cb2837887d295d458c80a691078\",\"object\":\"response\",\"created_at\":1787509938,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":40,\"max_tool_calls\":null,\"model\":\"gpt-4o-mini-2024-07-18\",\"moderation\":null,\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":false,\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[{\"type\":\"function\",\"description\":\"Read the attached PDF.\",\"name\":\"read_pdf\",\"output_schema\":null,\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"type\":\"message\",\"status\":\"in_progress\",\"content\":[],\"role\":\"assistant\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.content_part.added\ndata: {\"type\":\"response.content_part.added\",\"content_index\":0,\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"output_index\":0,\"part\":{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"\"},\"sequence_number\":3}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"The\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"dych9P0FLUWmL\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" verification\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"3n5\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" code\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"5QQRE0RqvNe\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" from\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"E7B9kNWEwTC\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" the\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"xde3M3Zzbym6\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" PDF\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"fi75lFMCJLtc\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" is\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"H5D86nuBifF1t\",\"output_index\":0,\"sequence_number\":10}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\":\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"KpXOZmBafKGYpHb\",\"output_index\":0,\"sequence_number\":11}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\" OR\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"EZP2L41krKVV0\",\"output_index\":0,\"sequence_number\":12}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"CH\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"NkXactWna6IrVR\",\"output_index\":0,\"sequence_number\":13}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"ID\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"w1fbFxqBweNBXc\",\"output_index\":0,\"sequence_number\":14}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"-\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"YLEepNuiLrVu0E7\",\"output_index\":0,\"sequence_number\":15}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"739\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"hNtW1tUUOgKWY\",\"output_index\":0,\"sequence_number\":16}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"1\",\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"obfuscation\":\"y1i2r1rMGFMG9KW\",\"output_index\":0,\"sequence_number\":17}\n\nevent: response.output_text.done\ndata: {\"type\":\"response.output_text.done\",\"content_index\":0,\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"logprobs\":[],\"output_index\":0,\"sequence_number\":18,\"text\":\"The verification code from the PDF is: ORCHID-7391\"}\n\nevent: response.content_part.done\ndata: {\"type\":\"response.content_part.done\",\"content_index\":0,\"item_id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"output_index\":0,\"part\":{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"The verification code from the PDF is: ORCHID-7391\"},\"sequence_number\":19}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"type\":\"message\",\"status\":\"completed\",\"content\":[{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"The verification code from the PDF is: ORCHID-7391\"}],\"role\":\"assistant\"},\"output_index\":0,\"sequence_number\":20}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_0b591494b7edb09b016a8b3cb2837887d295d458c80a691078\",\"object\":\"response\",\"created_at\":1787509938,\"status\":\"completed\",\"background\":false,\"completed_at\":1787509939,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":40,\"max_tool_calls\":null,\"model\":\"gpt-4o-mini-2024-07-18\",\"moderation\":null,\"output\":[{\"id\":\"msg_0b591494b7edb09b016a8b3cb31a3087d2b0df430d97474924\",\"type\":\"message\",\"status\":\"completed\",\"content\":[{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"The verification code from the PDF is: ORCHID-7391\"}],\"role\":\"assistant\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":false,\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[{\"type\":\"function\",\"description\":\"Read the attached PDF.\",\"name\":\"read_pdf\",\"output_schema\":null,\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":107,\"input_tokens_details\":{\"cache_write_tokens\":0,\"cached_tokens\":0},\"output_tokens\":16,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":123},\"user\":null,\"metadata\":{}},\"sequence_number\":21}\n\n" } } ] diff --git a/packages/ai/test/fixtures/recordings/pdf/openai-user-input.json b/packages/ai/test/fixtures/recordings/pdf/openai-user-input.json index 113120a09b0..290657a5564 100644 --- a/packages/ai/test/fixtures/recordings/pdf/openai-user-input.json +++ b/packages/ai/test/fixtures/recordings/pdf/openai-user-input.json @@ -9,7 +9,7 @@ "user-input" ], "name": "pdf/openai-user-input", - "recordedAt": "2026-07-22T18:15:34.867Z" + "recordedAt": "2026-08-23T18:32:29.909Z" }, "interactions": [ { @@ -20,14 +20,14 @@ "headers": { "content-type": "application/json" }, - "body": "{\"model\":\"gpt-4o-mini\",\"input\":[{\"role\":\"user\",\"content\":[{\"type\":\"input_file\",\"filename\":\"verification.pdf\",\"file_data\":\"JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA1IDAgUiA+PiA+PiAvQ29udGVudHMgNCAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL0xlbmd0aCA3NSA+PgpzdHJlYW0KQlQKL0YxIDE4IFRmCjcyIDcyMCBUZAooUERGIGNhc3NldHRlIHZlcmlmaWNhdGlvbiBjb2RlOiBPUkNISUQtNzM5MSkgVGoKRVQKZW5kc3RyZWFtCmVuZG9iago1IDAgb2JqCjw8IC9UeXBlIC9Gb250IC9TdWJ0eXBlIC9UeXBlMSAvQmFzZUZvbnQgL0hlbHZldGljYSA+PgplbmRvYmoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwNTggMDAwMDAgbiAKMDAwMDAwMDExNSAwMDAwMCBuIAowMDAwMDAwMjQxIDAwMDAwIG4gCjAwMDAwMDAzNjUgMDAwMDAgbiAKdHJhaWxlcgo8PCAvU2l6ZSA2IC9Sb290IDEgMCBSID4+CnN0YXJ0eHJlZgo0MzUKJSVFT0YK\"},{\"type\":\"input_text\",\"text\":\"Return only the verification code from the PDF.\"}]}],\"store\":false,\"max_output_tokens\":40,\"temperature\":0,\"stream\":true}" + "body": "{\"model\":\"gpt-4o-mini\",\"input\":[{\"role\":\"user\",\"content\":[{\"type\":\"input_file\",\"filename\":\"verification.pdf\",\"file_data\":\"data:application/pdf;base64,JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA1IDAgUiA+PiA+PiAvQ29udGVudHMgNCAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL0xlbmd0aCA3NSA+PgpzdHJlYW0KQlQKL0YxIDE4IFRmCjcyIDcyMCBUZAooUERGIGNhc3NldHRlIHZlcmlmaWNhdGlvbiBjb2RlOiBPUkNISUQtNzM5MSkgVGoKRVQKZW5kc3RyZWFtCmVuZG9iago1IDAgb2JqCjw8IC9UeXBlIC9Gb250IC9TdWJ0eXBlIC9UeXBlMSAvQmFzZUZvbnQgL0hlbHZldGljYSA+PgplbmRvYmoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwNTggMDAwMDAgbiAKMDAwMDAwMDExNSAwMDAwMCBuIAowMDAwMDAwMjQxIDAwMDAwIG4gCjAwMDAwMDAzNjUgMDAwMDAgbiAKdHJhaWxlcgo8PCAvU2l6ZSA2IC9Sb290IDEgMCBSID4+CnN0YXJ0eHJlZgo0MzUKJSVFT0YK\"},{\"type\":\"input_text\",\"text\":\"Return only the verification code from the PDF.\"}]}],\"store\":false,\"max_output_tokens\":40,\"temperature\":0,\"stream\":true}" }, "response": { "status": 200, "headers": { "content-type": "text/event-stream; charset=utf-8" }, - "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_098ccdfefefe7eee016a6108c55ad48194a250d21618f41130\",\"object\":\"response\",\"created_at\":1784744134,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":40,\"max_tool_calls\":null,\"model\":\"gpt-4o-mini-2024-07-18\",\"moderation\":null,\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":false,\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_098ccdfefefe7eee016a6108c55ad48194a250d21618f41130\",\"object\":\"response\",\"created_at\":1784744134,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":40,\"max_tool_calls\":null,\"model\":\"gpt-4o-mini-2024-07-18\",\"moderation\":null,\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":false,\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"msg_098ccdfefefe7eee016a6108c6b6e48194bdd91a4de2cb7bbe\",\"type\":\"message\",\"status\":\"in_progress\",\"content\":[],\"role\":\"assistant\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.content_part.added\ndata: {\"type\":\"response.content_part.added\",\"content_index\":0,\"item_id\":\"msg_098ccdfefefe7eee016a6108c6b6e48194bdd91a4de2cb7bbe\",\"output_index\":0,\"part\":{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"\"},\"sequence_number\":3}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"OR\",\"item_id\":\"msg_098ccdfefefe7eee016a6108c6b6e48194bdd91a4de2cb7bbe\",\"logprobs\":[],\"obfuscation\":\"OT7X1BjsfOw0Y7\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"CH\",\"item_id\":\"msg_098ccdfefefe7eee016a6108c6b6e48194bdd91a4de2cb7bbe\",\"logprobs\":[],\"obfuscation\":\"XpcQS0WDba72lQ\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"ID\",\"item_id\":\"msg_098ccdfefefe7eee016a6108c6b6e48194bdd91a4de2cb7bbe\",\"logprobs\":[],\"obfuscation\":\"IfrmlWWbGSpVPM\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"-\",\"item_id\":\"msg_098ccdfefefe7eee016a6108c6b6e48194bdd91a4de2cb7bbe\",\"logprobs\":[],\"obfuscation\":\"Jpf9w1TEeBMJR6X\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"739\",\"item_id\":\"msg_098ccdfefefe7eee016a6108c6b6e48194bdd91a4de2cb7bbe\",\"logprobs\":[],\"obfuscation\":\"J1beY5zFoug8n\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"1\",\"item_id\":\"msg_098ccdfefefe7eee016a6108c6b6e48194bdd91a4de2cb7bbe\",\"logprobs\":[],\"obfuscation\":\"kG1Isnrwy5QR4QB\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.output_text.done\ndata: {\"type\":\"response.output_text.done\",\"content_index\":0,\"item_id\":\"msg_098ccdfefefe7eee016a6108c6b6e48194bdd91a4de2cb7bbe\",\"logprobs\":[],\"output_index\":0,\"sequence_number\":10,\"text\":\"ORCHID-7391\"}\n\nevent: response.content_part.done\ndata: {\"type\":\"response.content_part.done\",\"content_index\":0,\"item_id\":\"msg_098ccdfefefe7eee016a6108c6b6e48194bdd91a4de2cb7bbe\",\"output_index\":0,\"part\":{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"ORCHID-7391\"},\"sequence_number\":11}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"msg_098ccdfefefe7eee016a6108c6b6e48194bdd91a4de2cb7bbe\",\"type\":\"message\",\"status\":\"completed\",\"content\":[{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"ORCHID-7391\"}],\"role\":\"assistant\"},\"output_index\":0,\"sequence_number\":12}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_098ccdfefefe7eee016a6108c55ad48194a250d21618f41130\",\"object\":\"response\",\"created_at\":1784744134,\"status\":\"completed\",\"background\":false,\"completed_at\":1784744134,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":40,\"max_tool_calls\":null,\"model\":\"gpt-4o-mini-2024-07-18\",\"moderation\":null,\"output\":[{\"id\":\"msg_098ccdfefefe7eee016a6108c6b6e48194bdd91a4de2cb7bbe\",\"type\":\"message\",\"status\":\"completed\",\"content\":[{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"ORCHID-7391\"}],\"role\":\"assistant\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":false,\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":44,\"input_tokens_details\":{\"cache_write_tokens\":0,\"cached_tokens\":0},\"output_tokens\":7,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":51},\"user\":null,\"metadata\":{}},\"sequence_number\":13}\n\n" + "body": "event: response.created\ndata: {\"type\":\"response.created\",\"response\":{\"id\":\"resp_03fe79eb21c3966c016a8b3cbc8dd087d2a1ace811c65df1b3\",\"object\":\"response\",\"created_at\":1787509948,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":40,\"max_tool_calls\":null,\"model\":\"gpt-4o-mini-2024-07-18\",\"moderation\":null,\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":false,\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":0}\n\nevent: response.in_progress\ndata: {\"type\":\"response.in_progress\",\"response\":{\"id\":\"resp_03fe79eb21c3966c016a8b3cbc8dd087d2a1ace811c65df1b3\",\"object\":\"response\",\"created_at\":1787509948,\"status\":\"in_progress\",\"background\":false,\"completed_at\":null,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":40,\"max_tool_calls\":null,\"model\":\"gpt-4o-mini-2024-07-18\",\"moderation\":null,\"output\":[],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"auto\",\"store\":false,\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":null,\"user\":null,\"metadata\":{}},\"sequence_number\":1}\n\nevent: response.output_item.added\ndata: {\"type\":\"response.output_item.added\",\"item\":{\"id\":\"msg_03fe79eb21c3966c016a8b3cbdc80487d2931dc4faae7d7917\",\"type\":\"message\",\"status\":\"in_progress\",\"content\":[],\"role\":\"assistant\"},\"output_index\":0,\"sequence_number\":2}\n\nevent: response.content_part.added\ndata: {\"type\":\"response.content_part.added\",\"content_index\":0,\"item_id\":\"msg_03fe79eb21c3966c016a8b3cbdc80487d2931dc4faae7d7917\",\"output_index\":0,\"part\":{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"\"},\"sequence_number\":3}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"OR\",\"item_id\":\"msg_03fe79eb21c3966c016a8b3cbdc80487d2931dc4faae7d7917\",\"logprobs\":[],\"obfuscation\":\"yWd69jgaISp72p\",\"output_index\":0,\"sequence_number\":4}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"CH\",\"item_id\":\"msg_03fe79eb21c3966c016a8b3cbdc80487d2931dc4faae7d7917\",\"logprobs\":[],\"obfuscation\":\"hej2idzQwCaPqW\",\"output_index\":0,\"sequence_number\":5}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"ID\",\"item_id\":\"msg_03fe79eb21c3966c016a8b3cbdc80487d2931dc4faae7d7917\",\"logprobs\":[],\"obfuscation\":\"sl8SeTfUXy9Ohx\",\"output_index\":0,\"sequence_number\":6}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"-\",\"item_id\":\"msg_03fe79eb21c3966c016a8b3cbdc80487d2931dc4faae7d7917\",\"logprobs\":[],\"obfuscation\":\"JZu9QRbobcx96zk\",\"output_index\":0,\"sequence_number\":7}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"739\",\"item_id\":\"msg_03fe79eb21c3966c016a8b3cbdc80487d2931dc4faae7d7917\",\"logprobs\":[],\"obfuscation\":\"Jfe5Qs5BbQHZY\",\"output_index\":0,\"sequence_number\":8}\n\nevent: response.output_text.delta\ndata: {\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"1\",\"item_id\":\"msg_03fe79eb21c3966c016a8b3cbdc80487d2931dc4faae7d7917\",\"logprobs\":[],\"obfuscation\":\"OGqjloQZUp4rdu3\",\"output_index\":0,\"sequence_number\":9}\n\nevent: response.output_text.done\ndata: {\"type\":\"response.output_text.done\",\"content_index\":0,\"item_id\":\"msg_03fe79eb21c3966c016a8b3cbdc80487d2931dc4faae7d7917\",\"logprobs\":[],\"output_index\":0,\"sequence_number\":10,\"text\":\"ORCHID-7391\"}\n\nevent: response.content_part.done\ndata: {\"type\":\"response.content_part.done\",\"content_index\":0,\"item_id\":\"msg_03fe79eb21c3966c016a8b3cbdc80487d2931dc4faae7d7917\",\"output_index\":0,\"part\":{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"ORCHID-7391\"},\"sequence_number\":11}\n\nevent: response.output_item.done\ndata: {\"type\":\"response.output_item.done\",\"item\":{\"id\":\"msg_03fe79eb21c3966c016a8b3cbdc80487d2931dc4faae7d7917\",\"type\":\"message\",\"status\":\"completed\",\"content\":[{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"ORCHID-7391\"}],\"role\":\"assistant\"},\"output_index\":0,\"sequence_number\":12}\n\nevent: response.completed\ndata: {\"type\":\"response.completed\",\"response\":{\"id\":\"resp_03fe79eb21c3966c016a8b3cbc8dd087d2a1ace811c65df1b3\",\"object\":\"response\",\"created_at\":1787509948,\"status\":\"completed\",\"background\":false,\"completed_at\":1787509949,\"error\":null,\"frequency_penalty\":0.0,\"incomplete_details\":null,\"instructions\":null,\"max_output_tokens\":40,\"max_tool_calls\":null,\"model\":\"gpt-4o-mini-2024-07-18\",\"moderation\":null,\"output\":[{\"id\":\"msg_03fe79eb21c3966c016a8b3cbdc80487d2931dc4faae7d7917\",\"type\":\"message\",\"status\":\"completed\",\"content\":[{\"type\":\"output_text\",\"annotations\":[],\"logprobs\":[],\"text\":\"ORCHID-7391\"}],\"role\":\"assistant\"}],\"parallel_tool_calls\":true,\"presence_penalty\":0.0,\"previous_response_id\":null,\"prompt_cache_key\":null,\"prompt_cache_retention\":\"in_memory\",\"reasoning\":{\"context\":null,\"effort\":null,\"summary\":null},\"safety_identifier\":null,\"service_tier\":\"default\",\"store\":false,\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"},\"verbosity\":\"medium\"},\"tool_choice\":\"auto\",\"tool_usage\":{\"image_gen\":{\"input_tokens\":0,\"input_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"output_tokens\":0,\"output_tokens_details\":{\"image_tokens\":0,\"text_tokens\":0},\"total_tokens\":0},\"web_search\":{\"num_requests\":0}},\"tools\":[],\"top_logprobs\":0,\"top_p\":1.0,\"truncation\":\"disabled\",\"usage\":{\"input_tokens\":44,\"input_tokens_details\":{\"cache_write_tokens\":0,\"cached_tokens\":0},\"output_tokens\":7,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":51},\"user\":null,\"metadata\":{}},\"sequence_number\":13}\n\n" } } ] diff --git a/packages/ai/test/fixtures/recordings/pdf/xai-tool-result.json b/packages/ai/test/fixtures/recordings/pdf/xai-tool-result.json index bd39c70cbd7..d5e506e9665 100644 --- a/packages/ai/test/fixtures/recordings/pdf/xai-tool-result.json +++ b/packages/ai/test/fixtures/recordings/pdf/xai-tool-result.json @@ -10,8 +10,7 @@ "tool-result" ], "name": "pdf/xai-tool-result", - "recordedAt": "2026-07-22T18:15:43.608Z", - "protocol": "xai-responses" + "recordedAt": "2026-08-23T18:32:22.691Z" }, "interactions": [ { @@ -22,14 +21,14 @@ "headers": { "content-type": "application/json" }, - "body": "{\"model\":\"grok-4.5\",\"input\":[{\"role\":\"system\",\"content\":\"Read the PDF returned by the tool and follow the user's response format exactly.\"},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"Return only the verification code from the PDF.\"}]},{\"type\":\"function_call\",\"call_id\":\"call_pdf_1\",\"name\":\"read_pdf\",\"arguments\":\"{}\"},{\"type\":\"function_call_output\",\"call_id\":\"call_pdf_1\",\"output\":[{\"type\":\"input_text\",\"text\":\"PDF read successfully\"},{\"type\":\"input_file\",\"filename\":\"verification.pdf\",\"file_data\":\"JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA1IDAgUiA+PiA+PiAvQ29udGVudHMgNCAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL0xlbmd0aCA3NSA+PgpzdHJlYW0KQlQKL0YxIDE4IFRmCjcyIDcyMCBUZAooUERGIGNhc3NldHRlIHZlcmlmaWNhdGlvbiBjb2RlOiBPUkNISUQtNzM5MSkgVGoKRVQKZW5kc3RyZWFtCmVuZG9iago1IDAgb2JqCjw8IC9UeXBlIC9Gb250IC9TdWJ0eXBlIC9UeXBlMSAvQmFzZUZvbnQgL0hlbHZldGljYSA+PgplbmRvYmoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwNTggMDAwMDAgbiAKMDAwMDAwMDExNSAwMDAwMCBuIAowMDAwMDAwMjQxIDAwMDAwIG4gCjAwMDAwMDAzNjUgMDAwMDAgbiAKdHJhaWxlcgo8PCAvU2l6ZSA2IC9Sb290IDEgMCBSID4+CnN0YXJ0eHJlZgo0MzUKJSVFT0YK\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"read_pdf\",\"description\":\"Read the attached PDF.\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"store\":false,\"max_output_tokens\":40,\"temperature\":0,\"stream\":true}" + "body": "{\"model\":\"grok-4.5\",\"input\":[{\"role\":\"system\",\"content\":\"Read the PDF returned by the tool and follow the user's response format exactly.\"},{\"role\":\"user\",\"content\":[{\"type\":\"input_text\",\"text\":\"Return only the verification code from the PDF.\"}]},{\"type\":\"function_call\",\"call_id\":\"call_pdf_1\",\"name\":\"read_pdf\",\"arguments\":\"{}\"},{\"type\":\"function_call_output\",\"call_id\":\"call_pdf_1\",\"output\":[{\"type\":\"input_text\",\"text\":\"PDF read successfully\"},{\"type\":\"input_file\",\"filename\":\"verification.pdf\",\"file_data\":\"data:application/pdf;base64,JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA1IDAgUiA+PiA+PiAvQ29udGVudHMgNCAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL0xlbmd0aCA3NSA+PgpzdHJlYW0KQlQKL0YxIDE4IFRmCjcyIDcyMCBUZAooUERGIGNhc3NldHRlIHZlcmlmaWNhdGlvbiBjb2RlOiBPUkNISUQtNzM5MSkgVGoKRVQKZW5kc3RyZWFtCmVuZG9iago1IDAgb2JqCjw8IC9UeXBlIC9Gb250IC9TdWJ0eXBlIC9UeXBlMSAvQmFzZUZvbnQgL0hlbHZldGljYSA+PgplbmRvYmoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwNTggMDAwMDAgbiAKMDAwMDAwMDExNSAwMDAwMCBuIAowMDAwMDAwMjQxIDAwMDAwIG4gCjAwMDAwMDAzNjUgMDAwMDAgbiAKdHJhaWxlcgo8PCAvU2l6ZSA2IC9Sb290IDEgMCBSID4+CnN0YXJ0eHJlZgo0MzUKJSVFT0YK\"}]}],\"tools\":[{\"type\":\"function\",\"name\":\"read_pdf\",\"description\":\"Read the attached PDF.\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"store\":false,\"max_output_tokens\":40,\"temperature\":0,\"stream\":true}" }, "response": { "status": 200, "headers": { "content-type": "text/event-stream" }, - "body": "event: response.created\ndata: {\"sequence_number\":0,\"type\":\"response.created\",\"response\":{\"created_at\":0,\"completed_at\":null,\"id\":\"dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"max_output_tokens\":40,\"model\":\"grok-4.5\",\"object\":\"response\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[{\"type\":\"function\",\"description\":\"Read the attached PDF.\",\"name\":\"read_pdf\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"top_p\":0.949999988079071,\"usage\":null,\"user\":null,\"incomplete_details\":null,\"status\":\"in_progress\",\"store\":false,\"metadata\":{\"system_fingerprint\":\"fp_a39489019fa99b6e\"},\"background\":false,\"service_tier\":\"default\",\"truncation\":\"disabled\",\"top_logprobs\":0,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"prompt_cache_key\":null,\"max_tool_calls\":null,\"safety_identifier\":null,\"error\":null,\"instructions\":null}}\n\nevent: response.in_progress\ndata: {\"sequence_number\":1,\"type\":\"response.in_progress\",\"response\":{\"created_at\":0,\"completed_at\":null,\"id\":\"dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"max_output_tokens\":40,\"model\":\"grok-4.5\",\"object\":\"response\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[{\"type\":\"function\",\"description\":\"Read the attached PDF.\",\"name\":\"read_pdf\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"top_p\":0.949999988079071,\"usage\":null,\"user\":null,\"incomplete_details\":null,\"status\":\"in_progress\",\"store\":false,\"metadata\":{\"system_fingerprint\":\"fp_a39489019fa99b6e\"},\"background\":false,\"service_tier\":\"default\",\"truncation\":\"disabled\",\"top_logprobs\":0,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"prompt_cache_key\":null,\"max_tool_calls\":null,\"safety_identifier\":null,\"error\":null,\"instructions\":null}}\n\nevent: response.output_item.added\ndata: {\"sequence_number\":2,\"type\":\"response.output_item.added\",\"item\":{\"content\":[],\"id\":\"msg_dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"role\":\"assistant\",\"type\":\"message\",\"status\":\"in_progress\"},\"output_index\":0}\n\nevent: response.content_part.added\ndata: {\"sequence_number\":3,\"type\":\"response.content_part.added\",\"content_index\":0,\"item_id\":\"msg_dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"output_index\":0,\"part\":{\"type\":\"output_text\",\"text\":\"\",\"logprobs\":[],\"annotations\":[]}}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":4,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"OR\",\"item_id\":\"msg_dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"output_index\":0,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":5,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"CH\",\"item_id\":\"msg_dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"output_index\":0,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":6,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"ID\",\"item_id\":\"msg_dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"output_index\":0,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":7,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"-\",\"item_id\":\"msg_dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"output_index\":0,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":8,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"739\",\"item_id\":\"msg_dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"output_index\":0,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":9,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"1\",\"item_id\":\"msg_dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"output_index\":0,\"logprobs\":[]}\n\nevent: response.output_text.done\ndata: {\"sequence_number\":10,\"type\":\"response.output_text.done\",\"content_index\":0,\"item_id\":\"msg_dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"output_index\":0,\"text\":\"ORCHID-7391\",\"logprobs\":[]}\n\nevent: response.content_part.done\ndata: {\"sequence_number\":11,\"type\":\"response.content_part.done\",\"content_index\":0,\"item_id\":\"msg_dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"output_index\":0,\"part\":{\"type\":\"output_text\",\"text\":\"ORCHID-7391\",\"logprobs\":[],\"annotations\":[]}}\n\nevent: response.output_item.done\ndata: {\"sequence_number\":12,\"type\":\"response.output_item.done\",\"item\":{\"content\":[{\"type\":\"output_text\",\"text\":\"ORCHID-7391\",\"logprobs\":[],\"annotations\":[]}],\"id\":\"msg_dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"role\":\"assistant\",\"type\":\"message\",\"status\":\"completed\"},\"output_index\":0}\n\nevent: response.completed\ndata: {\"sequence_number\":13,\"type\":\"response.completed\",\"response\":{\"created_at\":0,\"completed_at\":1784744143,\"id\":\"dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"max_output_tokens\":40,\"model\":\"grok-4.5\",\"object\":\"response\",\"output\":[{\"content\":[{\"type\":\"output_text\",\"text\":\"ORCHID-7391\",\"logprobs\":[],\"annotations\":[]}],\"id\":\"msg_dab13d84-6060-9eb7-b898-cbe7a3475ad7\",\"role\":\"assistant\",\"type\":\"message\",\"status\":\"completed\"}],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[{\"type\":\"function\",\"description\":\"Read the attached PDF.\",\"name\":\"read_pdf\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"top_p\":0.949999988079071,\"usage\":{\"input_tokens\":1592,\"input_tokens_details\":{\"cached_tokens\":128},\"output_tokens\":10,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":1602,\"num_sources_used\":0,\"num_server_side_tools_used\":0,\"cost_in_usd_ticks\":30264000,\"context_details\":{\"input_tokens\":1592,\"output_tokens\":11}},\"user\":null,\"incomplete_details\":null,\"status\":\"completed\",\"store\":false,\"metadata\":{\"system_fingerprint\":\"fp_a39489019fa99b6e\"},\"background\":false,\"service_tier\":\"default\",\"truncation\":\"disabled\",\"top_logprobs\":0,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"prompt_cache_key\":null,\"max_tool_calls\":null,\"safety_identifier\":null,\"error\":null,\"instructions\":null}}\n\n" + "body": "event: response.created\ndata: {\"sequence_number\":0,\"type\":\"response.created\",\"response\":{\"created_at\":0,\"completed_at\":null,\"id\":\"0759ba64-ac9b-99ec-a177-354062954b11\",\"max_output_tokens\":40,\"model\":\"grok-4.5\",\"object\":\"response\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[{\"type\":\"function\",\"description\":\"Read the attached PDF.\",\"name\":\"read_pdf\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"top_p\":0.949999988079071,\"usage\":null,\"user\":null,\"incomplete_details\":null,\"status\":\"in_progress\",\"store\":false,\"metadata\":{\"system_fingerprint\":\"fp_a39489019fa99b6e\"},\"background\":false,\"service_tier\":\"default\",\"truncation\":\"disabled\",\"top_logprobs\":0,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"prompt_cache_key\":null,\"max_tool_calls\":null,\"safety_identifier\":null,\"error\":null,\"instructions\":null}}\n\nevent: response.in_progress\ndata: {\"sequence_number\":1,\"type\":\"response.in_progress\",\"response\":{\"created_at\":0,\"completed_at\":null,\"id\":\"0759ba64-ac9b-99ec-a177-354062954b11\",\"max_output_tokens\":40,\"model\":\"grok-4.5\",\"object\":\"response\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[{\"type\":\"function\",\"description\":\"Read the attached PDF.\",\"name\":\"read_pdf\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"top_p\":0.949999988079071,\"usage\":null,\"user\":null,\"incomplete_details\":null,\"status\":\"in_progress\",\"store\":false,\"metadata\":{\"system_fingerprint\":\"fp_a39489019fa99b6e\"},\"background\":false,\"service_tier\":\"default\",\"truncation\":\"disabled\",\"top_logprobs\":0,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"prompt_cache_key\":null,\"max_tool_calls\":null,\"safety_identifier\":null,\"error\":null,\"instructions\":null}}\n\nevent: response.output_item.added\ndata: {\"sequence_number\":2,\"type\":\"response.output_item.added\",\"item\":{\"content\":[],\"id\":\"msg_0759ba64-ac9b-99ec-a177-354062954b11\",\"role\":\"assistant\",\"type\":\"message\",\"status\":\"in_progress\"},\"output_index\":0}\n\nevent: response.content_part.added\ndata: {\"sequence_number\":3,\"type\":\"response.content_part.added\",\"content_index\":0,\"item_id\":\"msg_0759ba64-ac9b-99ec-a177-354062954b11\",\"output_index\":0,\"part\":{\"type\":\"output_text\",\"text\":\"\",\"logprobs\":[],\"annotations\":[]}}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":4,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"OR\",\"item_id\":\"msg_0759ba64-ac9b-99ec-a177-354062954b11\",\"output_index\":0,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":5,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"CH\",\"item_id\":\"msg_0759ba64-ac9b-99ec-a177-354062954b11\",\"output_index\":0,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":6,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"ID\",\"item_id\":\"msg_0759ba64-ac9b-99ec-a177-354062954b11\",\"output_index\":0,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":7,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"-\",\"item_id\":\"msg_0759ba64-ac9b-99ec-a177-354062954b11\",\"output_index\":0,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":8,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"739\",\"item_id\":\"msg_0759ba64-ac9b-99ec-a177-354062954b11\",\"output_index\":0,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":9,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"1\",\"item_id\":\"msg_0759ba64-ac9b-99ec-a177-354062954b11\",\"output_index\":0,\"logprobs\":[]}\n\nevent: response.output_text.done\ndata: {\"sequence_number\":10,\"type\":\"response.output_text.done\",\"content_index\":0,\"item_id\":\"msg_0759ba64-ac9b-99ec-a177-354062954b11\",\"output_index\":0,\"text\":\"ORCHID-7391\",\"logprobs\":[]}\n\nevent: response.content_part.done\ndata: {\"sequence_number\":11,\"type\":\"response.content_part.done\",\"content_index\":0,\"item_id\":\"msg_0759ba64-ac9b-99ec-a177-354062954b11\",\"output_index\":0,\"part\":{\"type\":\"output_text\",\"text\":\"ORCHID-7391\",\"logprobs\":[],\"annotations\":[]}}\n\nevent: response.output_item.done\ndata: {\"sequence_number\":12,\"type\":\"response.output_item.done\",\"item\":{\"content\":[{\"type\":\"output_text\",\"text\":\"ORCHID-7391\",\"logprobs\":[],\"annotations\":[]}],\"id\":\"msg_0759ba64-ac9b-99ec-a177-354062954b11\",\"role\":\"assistant\",\"type\":\"message\",\"status\":\"completed\"},\"output_index\":0}\n\nevent: response.completed\ndata: {\"sequence_number\":13,\"type\":\"response.completed\",\"response\":{\"created_at\":0,\"completed_at\":1787509942,\"id\":\"0759ba64-ac9b-99ec-a177-354062954b11\",\"max_output_tokens\":40,\"model\":\"grok-4.5\",\"object\":\"response\",\"output\":[{\"content\":[{\"type\":\"output_text\",\"text\":\"ORCHID-7391\",\"logprobs\":[],\"annotations\":[]}],\"id\":\"msg_0759ba64-ac9b-99ec-a177-354062954b11\",\"role\":\"assistant\",\"type\":\"message\",\"status\":\"completed\"}],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[{\"type\":\"function\",\"description\":\"Read the attached PDF.\",\"name\":\"read_pdf\",\"parameters\":{\"type\":\"object\",\"properties\":{},\"additionalProperties\":false},\"strict\":false}],\"top_p\":0.949999988079071,\"usage\":{\"input_tokens\":1262,\"input_tokens_details\":{\"cached_tokens\":128},\"output_tokens\":10,\"output_tokens_details\":{\"reasoning_tokens\":0},\"total_tokens\":1272,\"num_sources_used\":0,\"num_server_side_tools_used\":0,\"cost_in_usd_ticks\":23664000,\"context_details\":{\"input_tokens\":1262,\"output_tokens\":11}},\"user\":null,\"incomplete_details\":null,\"status\":\"completed\",\"store\":false,\"metadata\":{\"system_fingerprint\":\"fp_a39489019fa99b6e\"},\"background\":false,\"service_tier\":\"default\",\"truncation\":\"disabled\",\"top_logprobs\":0,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"prompt_cache_key\":null,\"max_tool_calls\":null,\"safety_identifier\":null,\"error\":null,\"instructions\":null}}\n\n" } } ] diff --git a/packages/ai/test/fixtures/recordings/pdf/xai-user-input.json b/packages/ai/test/fixtures/recordings/pdf/xai-user-input.json index f5fa00a5d46..11343a6fe74 100644 --- a/packages/ai/test/fixtures/recordings/pdf/xai-user-input.json +++ b/packages/ai/test/fixtures/recordings/pdf/xai-user-input.json @@ -9,8 +9,7 @@ "user-input" ], "name": "pdf/xai-user-input", - "recordedAt": "2026-07-22T18:15:42.429Z", - "protocol": "xai-responses" + "recordedAt": "2026-08-23T18:32:21.346Z" }, "interactions": [ { @@ -21,14 +20,14 @@ "headers": { "content-type": "application/json" }, - "body": "{\"model\":\"grok-4.5\",\"input\":[{\"role\":\"user\",\"content\":[{\"type\":\"input_file\",\"filename\":\"verification.pdf\",\"file_data\":\"JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA1IDAgUiA+PiA+PiAvQ29udGVudHMgNCAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL0xlbmd0aCA3NSA+PgpzdHJlYW0KQlQKL0YxIDE4IFRmCjcyIDcyMCBUZAooUERGIGNhc3NldHRlIHZlcmlmaWNhdGlvbiBjb2RlOiBPUkNISUQtNzM5MSkgVGoKRVQKZW5kc3RyZWFtCmVuZG9iago1IDAgb2JqCjw8IC9UeXBlIC9Gb250IC9TdWJ0eXBlIC9UeXBlMSAvQmFzZUZvbnQgL0hlbHZldGljYSA+PgplbmRvYmoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwNTggMDAwMDAgbiAKMDAwMDAwMDExNSAwMDAwMCBuIAowMDAwMDAwMjQxIDAwMDAwIG4gCjAwMDAwMDAzNjUgMDAwMDAgbiAKdHJhaWxlcgo8PCAvU2l6ZSA2IC9Sb290IDEgMCBSID4+CnN0YXJ0eHJlZgo0MzUKJSVFT0YK\"},{\"type\":\"input_text\",\"text\":\"Return only the verification code from the PDF.\"}]}],\"store\":false,\"max_output_tokens\":40,\"temperature\":0,\"stream\":true}" + "body": "{\"model\":\"grok-4.5\",\"input\":[{\"role\":\"user\",\"content\":[{\"type\":\"input_file\",\"filename\":\"verification.pdf\",\"file_data\":\"data:application/pdf;base64,JVBERi0xLjQKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZyAvUGFnZXMgMiAwIFIgPj4KZW5kb2JqCjIgMCBvYmoKPDwgL1R5cGUgL1BhZ2VzIC9LaWRzIFszIDAgUl0gL0NvdW50IDEgPj4KZW5kb2JqCjMgMCBvYmoKPDwgL1R5cGUgL1BhZ2UgL1BhcmVudCAyIDAgUiAvTWVkaWFCb3ggWzAgMCA2MTIgNzkyXSAvUmVzb3VyY2VzIDw8IC9Gb250IDw8IC9GMSA1IDAgUiA+PiA+PiAvQ29udGVudHMgNCAwIFIgPj4KZW5kb2JqCjQgMCBvYmoKPDwgL0xlbmd0aCA3NSA+PgpzdHJlYW0KQlQKL0YxIDE4IFRmCjcyIDcyMCBUZAooUERGIGNhc3NldHRlIHZlcmlmaWNhdGlvbiBjb2RlOiBPUkNISUQtNzM5MSkgVGoKRVQKZW5kc3RyZWFtCmVuZG9iago1IDAgb2JqCjw8IC9UeXBlIC9Gb250IC9TdWJ0eXBlIC9UeXBlMSAvQmFzZUZvbnQgL0hlbHZldGljYSA+PgplbmRvYmoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwNTggMDAwMDAgbiAKMDAwMDAwMDExNSAwMDAwMCBuIAowMDAwMDAwMjQxIDAwMDAwIG4gCjAwMDAwMDAzNjUgMDAwMDAgbiAKdHJhaWxlcgo8PCAvU2l6ZSA2IC9Sb290IDEgMCBSID4+CnN0YXJ0eHJlZgo0MzUKJSVFT0YK\"},{\"type\":\"input_text\",\"text\":\"Return only the verification code from the PDF.\"}]}],\"store\":false,\"max_output_tokens\":40,\"temperature\":0,\"stream\":true}" }, "response": { "status": 200, "headers": { "content-type": "text/event-stream" }, - "body": "event: response.created\ndata: {\"sequence_number\":0,\"type\":\"response.created\",\"response\":{\"created_at\":0,\"completed_at\":null,\"id\":\"c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"max_output_tokens\":40,\"model\":\"grok-4.5\",\"object\":\"response\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":0.949999988079071,\"usage\":null,\"user\":null,\"incomplete_details\":null,\"status\":\"in_progress\",\"store\":false,\"metadata\":{\"system_fingerprint\":\"fp_a39489019fa99b6e\"},\"background\":false,\"service_tier\":\"default\",\"truncation\":\"disabled\",\"top_logprobs\":0,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"prompt_cache_key\":null,\"max_tool_calls\":null,\"safety_identifier\":null,\"error\":null,\"instructions\":null}}\n\nevent: response.in_progress\ndata: {\"sequence_number\":1,\"type\":\"response.in_progress\",\"response\":{\"created_at\":0,\"completed_at\":null,\"id\":\"c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"max_output_tokens\":40,\"model\":\"grok-4.5\",\"object\":\"response\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":0.949999988079071,\"usage\":null,\"user\":null,\"incomplete_details\":null,\"status\":\"in_progress\",\"store\":false,\"metadata\":{\"system_fingerprint\":\"fp_a39489019fa99b6e\"},\"background\":false,\"service_tier\":\"default\",\"truncation\":\"disabled\",\"top_logprobs\":0,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"prompt_cache_key\":null,\"max_tool_calls\":null,\"safety_identifier\":null,\"error\":null,\"instructions\":null}}\n\nevent: response.output_item.added\ndata: {\"sequence_number\":2,\"type\":\"response.output_item.added\",\"item\":{\"id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"summary\":[],\"type\":\"reasoning\",\"status\":\"in_progress\"},\"output_index\":0}\n\nevent: response.reasoning_summary_part.added\ndata: {\"sequence_number\":3,\"type\":\"response.reasoning_summary_part.added\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"part\":{\"text\":\"\",\"type\":\"summary_text\"},\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":4,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\"The\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":5,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" user\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":6,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" wants\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":7,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" me\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":8,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" to\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":9,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" return\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":10,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" only\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":11,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" the\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":12,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" verification\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":13,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" code\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":14,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" from\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":15,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" the\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":16,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" PDF\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":17,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\".\\n\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.done\ndata: {\"sequence_number\":18,\"type\":\"response.reasoning_summary_text.done\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"summary_index\":0,\"text\":\"The user wants me to return only the verification code from the PDF.\\n\"}\n\nevent: response.reasoning_summary_part.done\ndata: {\"sequence_number\":19,\"type\":\"response.reasoning_summary_part.done\",\"item_id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":0,\"part\":{\"text\":\"The user wants me to return only the verification code from the PDF.\\n\",\"type\":\"summary_text\"},\"summary_index\":0}\n\nevent: response.output_item.done\ndata: {\"sequence_number\":20,\"type\":\"response.output_item.done\",\"item\":{\"id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"summary\":[{\"text\":\"The user wants me to return only the verification code from the PDF.\\n\",\"type\":\"summary_text\"}],\"type\":\"reasoning\",\"status\":\"completed\"},\"output_index\":0}\n\nevent: response.output_item.added\ndata: {\"sequence_number\":21,\"type\":\"response.output_item.added\",\"item\":{\"content\":[],\"id\":\"msg_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"role\":\"assistant\",\"type\":\"message\",\"status\":\"in_progress\"},\"output_index\":1}\n\nevent: response.content_part.added\ndata: {\"sequence_number\":22,\"type\":\"response.content_part.added\",\"content_index\":0,\"item_id\":\"msg_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":1,\"part\":{\"type\":\"output_text\",\"text\":\"\",\"logprobs\":[],\"annotations\":[]}}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":23,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"OR\",\"item_id\":\"msg_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":1,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":24,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"CH\",\"item_id\":\"msg_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":1,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":25,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"ID\",\"item_id\":\"msg_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":1,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":26,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"-\",\"item_id\":\"msg_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":1,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":27,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"739\",\"item_id\":\"msg_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":1,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":28,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"1\",\"item_id\":\"msg_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":1,\"logprobs\":[]}\n\nevent: response.output_text.done\ndata: {\"sequence_number\":29,\"type\":\"response.output_text.done\",\"content_index\":0,\"item_id\":\"msg_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":1,\"text\":\"ORCHID-7391\",\"logprobs\":[]}\n\nevent: response.content_part.done\ndata: {\"sequence_number\":30,\"type\":\"response.content_part.done\",\"content_index\":0,\"item_id\":\"msg_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"output_index\":1,\"part\":{\"type\":\"output_text\",\"text\":\"ORCHID-7391\",\"logprobs\":[],\"annotations\":[]}}\n\nevent: response.output_item.done\ndata: {\"sequence_number\":31,\"type\":\"response.output_item.done\",\"item\":{\"content\":[{\"type\":\"output_text\",\"text\":\"ORCHID-7391\",\"logprobs\":[],\"annotations\":[]}],\"id\":\"msg_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"role\":\"assistant\",\"type\":\"message\",\"status\":\"completed\"},\"output_index\":1}\n\nevent: response.completed\ndata: {\"sequence_number\":32,\"type\":\"response.completed\",\"response\":{\"created_at\":0,\"completed_at\":1784744142,\"id\":\"c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"max_output_tokens\":40,\"model\":\"grok-4.5\",\"object\":\"response\",\"output\":[{\"id\":\"rs_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"summary\":[{\"text\":\"The user wants me to return only the verification code from the PDF.\\n\",\"type\":\"summary_text\"}],\"type\":\"reasoning\",\"status\":\"completed\"},{\"content\":[{\"type\":\"output_text\",\"text\":\"ORCHID-7391\",\"logprobs\":[],\"annotations\":[]}],\"id\":\"msg_c69d4e2b-243a-909a-84b6-ee953321ef6c\",\"role\":\"assistant\",\"type\":\"message\",\"status\":\"completed\"}],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":0.949999988079071,\"usage\":{\"input_tokens\":1522,\"input_tokens_details\":{\"cached_tokens\":128},\"output_tokens\":119,\"output_tokens_details\":{\"reasoning_tokens\":109},\"total_tokens\":1641,\"num_sources_used\":0,\"num_server_side_tools_used\":0,\"cost_in_usd_ticks\":35404000,\"context_details\":{\"input_tokens\":1522,\"output_tokens\":119}},\"user\":null,\"incomplete_details\":null,\"status\":\"completed\",\"store\":false,\"metadata\":{\"system_fingerprint\":\"fp_a39489019fa99b6e\"},\"background\":false,\"service_tier\":\"default\",\"truncation\":\"disabled\",\"top_logprobs\":0,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"prompt_cache_key\":null,\"max_tool_calls\":null,\"safety_identifier\":null,\"error\":null,\"instructions\":null}}\n\n" + "body": "event: response.created\ndata: {\"sequence_number\":0,\"type\":\"response.created\",\"response\":{\"created_at\":0,\"completed_at\":null,\"id\":\"0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"max_output_tokens\":40,\"model\":\"grok-4.5\",\"object\":\"response\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":0.949999988079071,\"usage\":null,\"user\":null,\"incomplete_details\":null,\"status\":\"in_progress\",\"store\":false,\"metadata\":{\"system_fingerprint\":\"fp_a39489019fa99b6e\"},\"background\":false,\"service_tier\":\"default\",\"truncation\":\"disabled\",\"top_logprobs\":0,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"prompt_cache_key\":null,\"max_tool_calls\":null,\"safety_identifier\":null,\"error\":null,\"instructions\":null}}\n\nevent: response.in_progress\ndata: {\"sequence_number\":1,\"type\":\"response.in_progress\",\"response\":{\"created_at\":0,\"completed_at\":null,\"id\":\"0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"max_output_tokens\":40,\"model\":\"grok-4.5\",\"object\":\"response\",\"output\":[],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":0.949999988079071,\"usage\":null,\"user\":null,\"incomplete_details\":null,\"status\":\"in_progress\",\"store\":false,\"metadata\":{\"system_fingerprint\":\"fp_a39489019fa99b6e\"},\"background\":false,\"service_tier\":\"default\",\"truncation\":\"disabled\",\"top_logprobs\":0,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"prompt_cache_key\":null,\"max_tool_calls\":null,\"safety_identifier\":null,\"error\":null,\"instructions\":null}}\n\nevent: response.output_item.added\ndata: {\"sequence_number\":2,\"type\":\"response.output_item.added\",\"item\":{\"id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"summary\":[],\"type\":\"reasoning\",\"status\":\"in_progress\"},\"output_index\":0}\n\nevent: response.reasoning_summary_part.added\ndata: {\"sequence_number\":3,\"type\":\"response.reasoning_summary_part.added\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"part\":{\"text\":\"\",\"type\":\"summary_text\"},\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":4,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\"The\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":5,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" user\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":6,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" wants\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":7,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" me\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":8,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" to\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":9,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" return\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":10,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" only\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":11,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" the\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":12,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" verification\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":13,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" code\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":14,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" from\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":15,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" the\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":16,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" PDF\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":17,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\".\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":18,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" The\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":19,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" document\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":20,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" shows\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":21,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\":\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":22,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" PDF\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":23,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" cassette\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":24,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" verification\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":25,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" code\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":26,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\":\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":27,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\" OR\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":28,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\"CH\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":29,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\"ID\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":30,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\"-\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":31,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\"739\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":32,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\"1\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.delta\ndata: {\"sequence_number\":33,\"type\":\"response.reasoning_summary_text.delta\",\"delta\":\"\\n\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0}\n\nevent: response.reasoning_summary_text.done\ndata: {\"sequence_number\":34,\"type\":\"response.reasoning_summary_text.done\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"summary_index\":0,\"text\":\"The user wants me to return only the verification code from the PDF. The document shows: PDF cassette verification code: ORCHID-7391\\n\"}\n\nevent: response.reasoning_summary_part.done\ndata: {\"sequence_number\":35,\"type\":\"response.reasoning_summary_part.done\",\"item_id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":0,\"part\":{\"text\":\"The user wants me to return only the verification code from the PDF. The document shows: PDF cassette verification code: ORCHID-7391\\n\",\"type\":\"summary_text\"},\"summary_index\":0}\n\nevent: response.output_item.done\ndata: {\"sequence_number\":36,\"type\":\"response.output_item.done\",\"item\":{\"id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"summary\":[{\"text\":\"The user wants me to return only the verification code from the PDF. The document shows: PDF cassette verification code: ORCHID-7391\\n\",\"type\":\"summary_text\"}],\"type\":\"reasoning\",\"status\":\"completed\"},\"output_index\":0}\n\nevent: response.output_item.added\ndata: {\"sequence_number\":37,\"type\":\"response.output_item.added\",\"item\":{\"content\":[],\"id\":\"msg_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"role\":\"assistant\",\"type\":\"message\",\"status\":\"in_progress\"},\"output_index\":1}\n\nevent: response.content_part.added\ndata: {\"sequence_number\":38,\"type\":\"response.content_part.added\",\"content_index\":0,\"item_id\":\"msg_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":1,\"part\":{\"type\":\"output_text\",\"text\":\"\",\"logprobs\":[],\"annotations\":[]}}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":39,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"OR\",\"item_id\":\"msg_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":1,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":40,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"CH\",\"item_id\":\"msg_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":1,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":41,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"ID\",\"item_id\":\"msg_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":1,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":42,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"-\",\"item_id\":\"msg_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":1,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":43,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"739\",\"item_id\":\"msg_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":1,\"logprobs\":[]}\n\nevent: response.output_text.delta\ndata: {\"sequence_number\":44,\"type\":\"response.output_text.delta\",\"content_index\":0,\"delta\":\"1\",\"item_id\":\"msg_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":1,\"logprobs\":[]}\n\nevent: response.output_text.done\ndata: {\"sequence_number\":45,\"type\":\"response.output_text.done\",\"content_index\":0,\"item_id\":\"msg_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":1,\"text\":\"ORCHID-7391\",\"logprobs\":[]}\n\nevent: response.content_part.done\ndata: {\"sequence_number\":46,\"type\":\"response.content_part.done\",\"content_index\":0,\"item_id\":\"msg_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"output_index\":1,\"part\":{\"type\":\"output_text\",\"text\":\"ORCHID-7391\",\"logprobs\":[],\"annotations\":[]}}\n\nevent: response.output_item.done\ndata: {\"sequence_number\":47,\"type\":\"response.output_item.done\",\"item\":{\"content\":[{\"type\":\"output_text\",\"text\":\"ORCHID-7391\",\"logprobs\":[],\"annotations\":[]}],\"id\":\"msg_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"role\":\"assistant\",\"type\":\"message\",\"status\":\"completed\"},\"output_index\":1}\n\nevent: response.completed\ndata: {\"sequence_number\":48,\"type\":\"response.completed\",\"response\":{\"created_at\":0,\"completed_at\":1787509941,\"id\":\"0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"max_output_tokens\":40,\"model\":\"grok-4.5\",\"object\":\"response\",\"output\":[{\"id\":\"rs_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"summary\":[{\"text\":\"The user wants me to return only the verification code from the PDF. The document shows: PDF cassette verification code: ORCHID-7391\\n\",\"type\":\"summary_text\"}],\"type\":\"reasoning\",\"status\":\"completed\"},{\"content\":[{\"type\":\"output_text\",\"text\":\"ORCHID-7391\",\"logprobs\":[],\"annotations\":[]}],\"id\":\"msg_0f4f5d2a-f334-9b4f-8e0e-219549e755d5\",\"role\":\"assistant\",\"type\":\"message\",\"status\":\"completed\"}],\"parallel_tool_calls\":true,\"previous_response_id\":null,\"reasoning\":{\"effort\":null,\"summary\":null},\"temperature\":0.0,\"text\":{\"format\":{\"type\":\"text\"}},\"tool_choice\":\"auto\",\"tools\":[],\"top_p\":0.949999988079071,\"usage\":{\"input_tokens\":1192,\"input_tokens_details\":{\"cached_tokens\":128},\"output_tokens\":55,\"output_tokens_details\":{\"reasoning_tokens\":45},\"total_tokens\":1247,\"num_sources_used\":0,\"num_server_side_tools_used\":0,\"cost_in_usd_ticks\":24964000,\"context_details\":{\"input_tokens\":1192,\"output_tokens\":56}},\"user\":null,\"incomplete_details\":null,\"status\":\"completed\",\"store\":false,\"metadata\":{\"system_fingerprint\":\"fp_a39489019fa99b6e\"},\"background\":false,\"service_tier\":\"default\",\"truncation\":\"disabled\",\"top_logprobs\":0,\"presence_penalty\":0.0,\"frequency_penalty\":0.0,\"prompt_cache_key\":null,\"max_tool_calls\":null,\"safety_identifier\":null,\"error\":null,\"instructions\":null}}\n\n" } } ] diff --git a/packages/ai/test/provider/openai-compatible-responses.test.ts b/packages/ai/test/provider/openai-compatible-responses.test.ts index ad46fbc516d..f2fe17d7306 100644 --- a/packages/ai/test/provider/openai-compatible-responses.test.ts +++ b/packages/ai/test/provider/openai-compatible-responses.test.ts @@ -78,6 +78,45 @@ describe("Open Responses-compatible route", () => { }), ) + it.effect("uses data URLs for embedded PDF messages and tool results", () => + Effect.gen(function* () { + const model = configure({ + apiKey: "test-key", + baseURL: "https://responses.example.test/v1", + provider: "example", + }).model("example-model") + const pdf = "data:application/pdf;base64,JVBERi0xLjQ=" + const prepared = yield* compileRequest( + LLM.request({ + model, + messages: [ + Message.user([{ type: "media", mediaType: "application/pdf", data: pdf, filename: "input.pdf" }]), + Message.assistant({ type: "tool-call", id: "call_1", name: "read", input: {} }), + Message.tool({ + id: "call_1", + name: "read", + resultType: "content", + result: [{ type: "file", uri: pdf, mime: "application/pdf", name: "result.pdf" }], + }), + ], + }), + ) + + expect(prepared.body.input).toEqual([ + { + role: "user", + content: [{ type: "input_file", filename: "input.pdf", file_data: pdf }], + }, + { type: "function_call", call_id: "call_1", name: "read", arguments: "{}" }, + { + type: "function_call_output", + call_id: "call_1", + output: [{ type: "input_file", filename: "result.pdf", file_data: pdf }], + }, + ]) + }), + ) + it.effect("rejects OpenAI-native tools", () => Effect.gen(function* () { const model = configure({ @@ -114,7 +153,12 @@ describe("Open Responses-compatible route", () => { expect(prepared.body).toMatchObject({ input: [ - { type: "message", role: "assistant", content: [{ type: "output_text", text: "Unclassified." }], phase: null }, + { + type: "message", + role: "assistant", + content: [{ type: "output_text", text: "Unclassified." }], + phase: null, + }, ], }) }), diff --git a/packages/ai/test/provider/openai-responses.test.ts b/packages/ai/test/provider/openai-responses.test.ts index 0a0f40af04d..e4f214d9cdb 100644 --- a/packages/ai/test/provider/openai-responses.test.ts +++ b/packages/ai/test/provider/openai-responses.test.ts @@ -190,9 +190,7 @@ describe("OpenAI Responses route", () => { it.effect("passes through provider-defined service tiers", () => Effect.gen(function* () { - const prepared = yield* compileRequest( - LLMRequest.update(request, { providerOptions: { serviceTier: "scale" } }), - ) + const prepared = yield* compileRequest(LLMRequest.update(request, { providerOptions: { serviceTier: "scale" } })) expect(prepared.body.service_tier).toBe("scale") }), @@ -1273,7 +1271,7 @@ describe("OpenAI Responses route", () => { { type: "input_file", filename: "report.pdf", - file_data: "JVBERi0xLjQ=", + file_data: "data:application/pdf;base64,JVBERi0xLjQ=", }, ]) }), @@ -1300,7 +1298,7 @@ describe("OpenAI Responses route", () => { ) expect(expectToolOutput(prepared.body).output).toEqual([ - { type: "input_file", filename: "report.pdf", file_data: base64 }, + { type: "input_file", filename: "report.pdf", file_data: dataUrl }, ]) }), ) @@ -1333,7 +1331,7 @@ describe("OpenAI Responses route", () => { { type: "input_file", filename: "report.pdf", - file_data: "JVBERi0xLjQ=", + file_data: "data:application/pdf;base64,JVBERi0xLjQ=", }, ]) }), @@ -1358,7 +1356,7 @@ describe("OpenAI Responses route", () => { ) expect(expectToolOutput(prepared.body).output).toEqual([ - { type: "input_file", filename: "file", file_data: "AAECAw==" }, + { type: "input_file", filename: "file", file_data: "data:audio/mpeg;base64,AAECAw==" }, ]) }), ) @@ -2806,7 +2804,7 @@ describe("OpenAI Responses route", () => { { type: "input_file", filename: "report.pdf", - file_data: "JVBERi0xLjQ=", + file_data: "data:application/pdf;base64,JVBERi0xLjQ=", }, ], }, @@ -2837,7 +2835,7 @@ describe("OpenAI Responses route", () => { { type: "input_file", filename: "report.pdf", - file_data: "JVBERi0xLjQ=", + file_data: "data:application/pdf;base64,JVBERi0xLjQ=", }, ], }, @@ -2862,7 +2860,7 @@ describe("OpenAI Responses route", () => { { type: "input_file", filename: "file", - file_data: "AAECAw==", + file_data: "data:application/x-tar;base64,AAECAw==", }, ], },