From 75db423f3fc15dd8720ca523a097e381f555bbc9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Aug 2024 19:16:28 +0200 Subject: [PATCH] chore: [DevOps] bump com.puppycrawl.tools:checkstyle from 8.41 to 10.17.0 in the production-major group (#11) * 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] * Updated checkstyle * Fix checkstyle findings * Fix checkstyle findings again --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: I538344 Co-authored-by: Charles Dubois <103174266+CharlesDuboisSAP@users.noreply.github.com> --- .pipeline/checkstyle.xml | 2 +- .../openai/model/OpenAiChatMessage.java | 39 +++++++++++++++++++ pom.xml | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) 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