Skip to content

Conversation

sunyuhan1998
Copy link
Contributor

In the following section of the Multimodality API documentation, the constructor method for UserMessage used in the example code no longer exists:

For most of the multimodal LLMs, the Spring AI code would look something like this:
[source,java]
----
var imageResource = new ClassPathResource("/multimodal.test.png");
var userMessage = new UserMessage(
"Explain what do you see in this picture?", // content
new Media(MimeTypeUtils.IMAGE_PNG, this.imageResource)); // media
ChatResponse response = chatModel.call(new Prompt(this.userMessage));
----

The current PR modifies it to use the Builder pattern for construction.

Signed-off-by: Sun Yuhan <sunyuhan1998@users.noreply.github.com>
@ilayaperumalg ilayaperumalg self-assigned this Sep 26, 2025
@ilayaperumalg ilayaperumalg added multimodality documentation Improvements or additions to documentation labels Sep 26, 2025
@ilayaperumalg ilayaperumalg added this to the 1.1.0.M3 milestone Sep 26, 2025
@ilayaperumalg
Copy link
Member

@sunyuhan1998 Thanks for the PR fixing the doc.

@ilayaperumalg ilayaperumalg merged commit 1b923c2 into spring-projects:main Sep 26, 2025
2 checks passed
spring-builds pushed a commit that referenced this pull request Sep 26, 2025
Fixes #4475 Signed-off-by: Sun Yuhan <sunyuhan1998@users.noreply.github.com> Co-authored-by: Sun Yuhan <sunyuhan1998@users.noreply.github.com> (cherry picked from commit 1b923c2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants