From c66532d2c7ed5f7a247cdbf32ad17effbe71e8cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Aug 2024 08:18:23 +0000 Subject: [PATCH 1/4] chore: [DevOps] bump com.puppycrawl.tools:checkstyle Bumps the production-major group with 1 update: [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle). Updates `com.puppycrawl.tools:checkstyle` from 8.41 to 10.17.0 - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-8.41...checkstyle-10.17.0) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-type: direct:production update-type: version-update:semver-major dependency-group: production-major ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2e6d4887..2f79861d 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ 3.25.3 2.0.13 2.43.0 - 8.41 + 10.17.0 2.1.3 3.2.2 From 32a604dad3f8ad8b66ff2575ea4a824218e821cc Mon Sep 17 00:00:00 2001 From: I538344 Date: Tue, 13 Aug 2024 15:51:28 +0200 Subject: [PATCH 2/4] Updated checkstyle --- .pipeline/checkstyle.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ - + From 587df2b434d7ef296bcdfcd0da85151191a97c92 Mon Sep 17 00:00:00 2001 From: I538344 Date: Tue, 13 Aug 2024 15:57:44 +0200 Subject: [PATCH 3/4] Fix checkstyle findings --- .../openai/model/OpenAiChatMessage.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) 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..75508612 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) { From daacceacfaff303f5ba79d5222c0402792ecd41b Mon Sep 17 00:00:00 2001 From: I538344 Date: Tue, 13 Aug 2024 16:01:34 +0200 Subject: [PATCH 4/4] Fix checkstyle findings again --- .../ai/sdk/foundationmodels/openai/model/OpenAiChatMessage.java | 1 + 1 file changed, 1 insertion(+) 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 75508612..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 @@ -197,6 +197,7 @@ public ContentPartImage setUrl( return this; } + /** Image URL. */ // { "url": "website.com/picture.jpg" } @JsonFormat(shape = Shape.OBJECT) @NoArgsConstructor