Skip to content

My image list is not sent in the request #4480

@DavidTheExplorer

Description

@DavidTheExplorer

Bug description
I'm trying to send a list of images to ChatGPT to analyze, but it's insisting that no images are sent.
I enabled request logging and found that the image list is ignored.

Environment
Spring AI 1.0.2
Java 17

Minimal Complete Reproducible example

try(InputStream inputStream = Files.newInputStream(Path.of("1.jpg"));
    InputStream inputStream2 = Files.newInputStream(Path.of("2.jpg"));
    InputStream inputStream3 = Files.newInputStream(Path.of("3.jpg")))
{
    System.out.println(this.chatClient.prompt()
            .system("Check <something relevant to all the images>")
            .user(userSpec -> userSpec
                    .media(MimeTypeUtils.IMAGE_JPEG, new InputStreamResource(inputStream))
                    .media(MimeTypeUtils.IMAGE_JPEG, new InputStreamResource(inputStream2))
                    .media(MimeTypeUtils.IMAGE_JPEG, new InputStreamResource(inputStream3)))
            .call()
            .content());
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions