@@ -242,6 +242,11 @@ describe("chatCompletionsToResponsesBody image parts", () => {
242242 { part : { type : "image_url" , image_url : "https://example.com/image.png" } , expected : { type : "input_image" , image_url : "https://example.com/image.png" } } ,
243243 { part : { type : "image_url" , image_url : "https://example.com/image.png" , detail : "low" } , expected : { type : "input_image" , image_url : "https://example.com/image.png" , detail : "low" } } ,
244244 { part : { type : "image_url" , image_url : { url : "https://example.com/image.png" } } , expected : { type : "input_image" , image_url : "https://example.com/image.png" } } ,
245+ { part : { type : "image" , data : "aGVsbG8=" , mimeType : "image/png" } , expected : { type : "input_image" , image_url : "data:image/png;base64,aGVsbG8=" } } ,
246+ { part : { type : "image" , data : "aGVsbG8=" , mediaType : "image/jpeg" } , expected : { type : "input_image" , image_url : "data:image/jpeg;base64,aGVsbG8=" } } ,
247+ { part : { type : "image" , data : "data:image/webp;base64,aGVsbG8=" , mimeType : "image/png" } , expected : { type : "input_image" , image_url : "data:image/webp;base64,aGVsbG8=" } } ,
248+ { part : { type : "image" , source : { type : "base64" , media_type : "image/jpeg" , data : "aGVsbG8=" } } , expected : { type : "input_image" , image_url : "data:image/jpeg;base64,aGVsbG8=" } } ,
249+ { part : { type : "image" , source : { type : "url" , url : "https://example.com/claude.png" } } , expected : { type : "input_image" , image_url : "https://example.com/claude.png" } } ,
245250 ] ) ( "preserves user image shorthand and omitted detail: %j" , ( { part, expected } ) => {
246251 const body = chatCompletionsToResponsesBody ( { model : "mock/test-model" , messages : [ { role : "user" , content : [ part ] } ] } ) ;
247252 expect ( body . input ) . toEqual ( [ { type : "message" , role : "user" , content : [ expected ] } ] ) ;
0 commit comments