You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please find [an example in our Spring Boot application](../../sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java).
260
260
It shows the usage of Spring Boot's `ResponseBodyEmitter` to stream the chat completion delta messages to the frontend in real-time.
261
261
262
+
263
+
## Add images and multiple text inputs to a message
264
+
265
+
It's possible to add images and multiple text inputs to a message.
266
+
267
+
### Add images to a message
268
+
269
+
There are multiple ways to add an image to a user message as detailed below. Note, that currently only user messages are supported for image attachments.
270
+
271
+
```java
272
+
var message1 =Message.user("What is in this image?").addImage("https://url.to/image.jpg");
273
+
var message2 =Message.user("And what is in this image?").add(MessageContent.image("https://url.to/image.jpg"));
274
+
```
275
+
Some AI models, like GPT 4o, support additionally setting the detail level with which the image is read. This can be set via the `DetailLevel` parameter.
It's also possible to add multiple text inputs to a message. This can be useful for providing additional context to the AI model.
284
+
There are multiple ways to do this as detailed below. Note, that only user and system messages are supported for multiple text inputs.
285
+
286
+
```java
287
+
var message1 =Message.user("What is chess about?", "Answer in two sentences.");
288
+
var message2 =Message.user("What is chess about?").addText("Answer in two sentences.");
289
+
var message3 =Message.user("What is chess about?").add(MessageContent.text("Answer in two sentences."));
290
+
```
291
+
292
+
Please find [an example in our Spring Boot application](../../sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java).
293
+
294
+
262
295
## Set model parameters
263
296
264
297
Change your LLM configuration to add model parameters:
Copy file name to clipboardExpand all lines: docs/release-notes/release_notes.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,12 @@
8
8
9
9
### 🔧 Compatibility Notes
10
10
11
-
-
11
+
-`Message.content()` returns a `ContentItem` now instead of a `String`. Use `((TextItem) Message.content().contentItemList().get(0)).text()` if the corresponding `ContentItem` is a `TextItem` and the string representation is needed.
-[Convenient methods to create messages containing images and multiple text inputs](../guides/ORCHESTRATION_CHAT_COMPLETION.md#add-images-and-multiple-text-inputs-to-a-message)
0 commit comments