diff --git a/.pipeline/checkstyle.xml b/.pipeline/checkstyle.xml index c32d131d..c1841cb5 100644 --- a/.pipeline/checkstyle.xml +++ b/.pipeline/checkstyle.xml @@ -47,7 +47,7 @@ - + diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiChatMessage.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiChatMessage.java index 2bea24d0..181938c5 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiChatMessage.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiChatMessage.java @@ -84,17 +84,36 @@ class OpenAiChatUserMessage implements OpenAiChatMessage { @Getter(onMethod_ = @Nullable) private final List content = new ArrayList<>(); + /** + * Add text to the user message. + * + * @param content The text content. + * @return The user message. + */ @Nonnull public OpenAiChatUserMessage addText(@Nonnull final String content) { this.content.add(new ContentPartText().setText(content)); return this; } + /** + * Add an image to the user message. + * + * @param content The image URL. + * @return The user message. + */ @Nonnull public OpenAiChatUserMessage addImage(@Nonnull final String content) { return addImage(content, null); } + /** + * Add an image to the user message. + * + * @param content The image URL. + * @param detail The detail level of the image. + * @return The user message. + */ @Nonnull public OpenAiChatUserMessage addImage( @Nonnull final String content, @Nullable final ImageDetailLevel detail) { @@ -102,6 +121,12 @@ public OpenAiChatUserMessage addImage( return this; } + /** + * Add images or text to the user message. + * + * @param content The content(s) to add. + * @return The user message. + */ @Nonnull public OpenAiChatUserMessage addContent(@Nonnull final ContentPart... content) { this.content.addAll(List.of(content)); @@ -147,11 +172,24 @@ public static class ContentPartImage implements ContentPart { @Nonnull private ImageUrl url; + /** + * Set the URL of the image. + * + * @param url The URL of the image. + * @return The image URL. + */ @Nonnull public ContentPartImage setUrl(@Nonnull final String url) { return setUrl(url, null); } + /** + * Set the URL of the image. + * + * @param url The URL of the image. + * @param detailLevel The detail level of the image. + * @return The image URL. + */ @Nonnull public ContentPartImage setUrl( @Nonnull final String url, @Nullable final ImageDetailLevel detailLevel) { @@ -159,6 +197,7 @@ public ContentPartImage setUrl( return this; } + /** Image URL. */ // { "url": "website.com/picture.jpg" } @JsonFormat(shape = Shape.OBJECT) @NoArgsConstructor diff --git a/pom.xml b/pom.xml index 84f607d8..aab51c71 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ 3.25.3 2.0.16 2.43.0 - 8.41 + 10.17.0 2.1.3 3.2.2