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
Copy file name to clipboardExpand all lines: docs/guides/ORCHESTRATION_CHAT_COMPLETION.md
+9-13Lines changed: 9 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -266,37 +266,33 @@ It's possible to add images and multiple text inputs to a message.
266
266
267
267
### Add images to a message
268
268
269
-
An image can be added to an existing message as follows.
269
+
An image can be added to a message as follows.
270
270
271
271
```java
272
-
var newMessage = message.andImage("https://url.to/image.jpg");
272
+
var message =Message.user("Describe the following image");
273
+
var newMessage = message.withImage("https://url.to/image.jpg");
273
274
```
274
275
275
-
You can also construct a message with an image directly, using the `MessageContent` class.
276
+
You can also construct a message with an image directly, using the `ImageItem` class.
276
277
277
278
```java
278
-
var message =Message.user(MessageContent.image("https://url.to/image.jpg"));
279
+
var message =Message.user(newImageItem("https://url.to/image.jpg"));
279
280
```
280
281
281
282
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.
282
283
283
284
```java
284
-
var newMessage = message.andImage("https://url.to/image.jpg", ImageItem.DetailLevel.low);
285
+
var newMessage = message.withImage("https://url.to/image.jpg", ImageItem.DetailLevel.LOW);
285
286
```
286
287
Note, that currently only user messages are supported for image attachments.
287
288
288
289
### Add multiple text inputs to a message
289
290
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.
291
+
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 add additional text inputs as follows.
291
292
292
293
```java
293
-
var message =Message.user("What is chess about?", "Answer in two sentences.");
294
-
```
295
-
296
-
Or you can add additional text inputs to an existing message.
297
-
298
-
```java
299
-
var newMessage = message.andText("Please use many emojis in your answer.");
294
+
var message =Message.user("What is chess about?");
295
+
var newMessage = message.withText("Answer in two sentences.");
300
296
```
301
297
302
298
Note, that only user and system messages are supported for multiple text inputs.
Copy file name to clipboardExpand all lines: docs/release-notes/release_notes.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@
8
8
9
9
### 🔧 Compatibility Notes
10
10
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.
11
+
-`Message.content()` returns a `ContentItem` now instead of a `String`. Use `((TextItem) Message.content().items().get(0)).text()` if the corresponding `ContentItem` is a `TextItem` and the string representation is needed.
0 commit comments