Skip to content

Commit fb0a89f

Browse files
committed
Improve documentation
1 parent be70506 commit fb0a89f

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

docs/guides/ORCHESTRATION_CHAT_COMPLETION.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,29 +266,41 @@ It's possible to add images and multiple text inputs to a message.
266266

267267
### Add images to a message
268268

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.
269+
An image can be added to an existing message as follows.
270270

271271
```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"));
272+
message.addImage("https://url.to/image.jpg");
274273
```
274+
275+
You can also construct a message with an image directly, using the `MessageContent` class.
276+
277+
```java
278+
var message = Message.user(MessageContent.image("https://url.to/image.jpg"));
279+
```
280+
275281
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.
276282

277283
```java
278284
message.addImage("https://url.to/image.jpg", ImageItem.DetailLevel.low);
279285
```
286+
Note, that currently only user messages are supported for image attachments.
280287

281288
### Add multiple text inputs to a message
282289

283-
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.
290+
It's also possible to add multiple text inputs to a message. This can be useful for providing additional context to the AI model. You can construct a message with multiple text inputs as follows.
285291

286292
```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."));
293+
var message = Message.user("What is chess about?", "Answer in two sentences.");
290294
```
291295

296+
Or you can add additional text inputs to an existing message.
297+
298+
```java
299+
message.addText("Please use many emojis in your answer.");
300+
```
301+
302+
Note, that only user and system messages are supported for multiple text inputs.
303+
292304
Please find [an example in our Spring Boot application](../../sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java).
293305

294306

0 commit comments

Comments
 (0)