Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .pipeline/checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
<suppress files="[/\\]core[/\\]model[/\\]" checks=".*"/>
<suppress files="[/\\]openai[/\\]generated[/\\]model[/\\]" checks=".*"/>
<suppress files="[/\\]orchestration[/\\]model[/\\]" checks=".*"/>
<suppress files="[/\\]grounding[/\\]api[/\\]" checks=".*"/>
<suppress files="[/\\]grounding[/\\]client[/\\]" checks=".*"/>
<suppress files="[/\\]grounding[/\\]model[/\\]" checks=".*"/>
<suppress files="[/\\]registry[/\\]client[/\\]" checks=".*"/>
<suppress files="[/\\]registry[/\\]model[/\\]" checks=".*"/>
<!-- Suppress TODOs -->
<suppress files="OpenAiChatMessage.java" checks="TodoComment" lines="257,7" />
<suppress files="OpenAiChatMessage.java" checks="TodoComment" lines="261,7" />
<suppress files="ChatCompletionResponseMessage.java" checks="TodoComment" lines="53,34" />
<suppress files="CreateChatCompletionRequest.java" checks="TodoComment" lines="73,47" />
</suppressions>
6 changes: 3 additions & 3 deletions .pipeline/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<property name="severity" value="info"/>
</module>
<module name="JavadocVariable">
<property name="accessModifiers" value="protected"/>
<property name="accessModifiers" value="protected, public"/>
<property name="severity" value="info"/>
</module>
<module name="MissingJavadocMethod">
Expand All @@ -47,7 +47,7 @@
<property name="severity" value="info"/>
</module>
<module name="JavadocMethod">
<property name="accessModifiers" value="protected"/>
<property name="accessModifiers" value="protected, public"/>
<property name="allowedAnnotations" value="Override"/>
<property name="severity" value="info"/>
</module>
Expand All @@ -56,7 +56,7 @@
<property name="severity" value="info"/>
</module>
<module name="JavadocVariable">
<property name="accessModifiers" value="protected"/>
<property name="accessModifiers" value="protected, public"/>
<property name="severity" value="info"/>
</module>
Comment on lines 54 to 57
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a duplicate <module> right? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Is updated. Thanks :)

<module name="IllegalCatch">
Expand Down
2 changes: 2 additions & 0 deletions .pipeline/spotbugs-exclusions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<Package name="com.sap.ai.sdk.orchestration.model"/>
<Package name="com.sap.ai.sdk.grounding.client"/>
<Package name="com.sap.ai.sdk.grounding.model"/>
<Package name="com.sap.ai.sdk.prompt.registry.model"/>
<Package name="com.sap.ai.sdk.prompt.registry.client"/>
Comment on lines +10 to +11
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive-by fix: the generated code for prompt registry was not excluded from spotbugs.

</Or>
</Match>
<Match>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class ClientResponseHandler<T, E extends ClientException>
* Set the {@link ObjectMapper} to use for parsing JSON responses.
*
* @param jackson The {@link ObjectMapper} to use
* @return the current instance of {@link ClientResponseHandler} with the changed object mapper
*/
@Beta
@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class ClientStreamingHandler<D extends StreamedDelta, E extends ClientExc
* Set the {@link ObjectMapper} to use for parsing JSON responses.
*
* @param jackson The {@link ObjectMapper} to use
* @return the current instance of {@link ClientStreamingHandler} with the changed object mapper
*/
@Nonnull
public ClientStreamingHandler<D, E> objectMapper(@Nonnull final ObjectMapper jackson) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public interface StreamedDelta {
* <p>{@code content_filter}: Omitted content due to a flag from our content filters
*
* <p>{@code null}: API response still in progress or incomplete
*
* @return the finish reason or null.
*/
@Nullable
String getFinishReason();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public OpenAiClient withApiVersion(@Nonnull final String apiVersion) {
*
* @param destination The specific {@link HttpDestination} to use.
* @see AiCoreService#getInferenceDestination(String)
* @return a new OpenAI client.
*/
@Beta
@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ public OpenAiChatUserMessage addContent(@Nonnull final ContentPart... content) {
@Type(value = ContentPartImage.class, name = "image_url")
})
public interface ContentPart {
/** Get the type of the content part. */
/**
* Get the type of the content part.
*
* @return The type of the content part as string.
*/
@Nonnull
String getType();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ public OrchestrationChatResponse chatCompletion(
* Generate a completion for the given prompt.
*
* @param prompt a text message.
* @return A stream of message deltas
* @param config the configuration to use
* @return a stream of message deltas
* @throws OrchestrationClientException if the request fails or if the finish reason is
* content_filter
* @since 1.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ public OrchestrationModuleConfig withMaskingConfig(
* @link <a
* href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/input-filtering">SAP
* AI Core: Orchestration - Input Filtering</a>
* @param contentFilters one or more content filters to apply to the input.
* @param contentFilter a filter to apply to the input.
* @param contentFilters zero or more additional content filters to apply to the input.
* @return a new {@code OrchestrationModuleConfig} instance with the specified input filters
* added.
*/
Expand Down Expand Up @@ -174,7 +175,8 @@ public OrchestrationModuleConfig withInputFiltering(
* @link <a
* href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/output-filtering">SAP
* AI Core: Orchestration - Output Filtering</a>
* @param contentFilters one or more content filters to apply to the output.
* @param contentFilter a filter to apply to the input.
* @param contentFilters zero or more additional content filters to apply to the input.
* @return a new {@code OrchestrationModuleConfig} instance with the specified output filters
* added.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public OrchestrationPrompt(@Nonnull final Message message, @Nonnull final Messag
* Initialize a prompt based on template variables.
*
* @param inputParams The input parameters as entries of template variables and their contents.
* @param messages The messages to be sent to the orchestration service.
*/
public OrchestrationPrompt(
@Nonnull final Map<String, String> inputParams, @Nonnull final Message... messages) {
Expand All @@ -60,6 +61,7 @@ public OrchestrationPrompt(
* Set the chat history of this prompt.
*
* @param messagesHistory The chat history to add.
* @return The current instance of {@link OrchestrationPrompt} with the changed chat history.
*/
@Nonnull
public OrchestrationPrompt messageHistory(@Nonnull final List<Message> messagesHistory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public OrchestrationChatModel() {
/**
* Constructor with a custom client.
*
* @param client The custom client to use.
* @since 1.2.0
*/
public OrchestrationChatModel(@Nonnull final OrchestrationClient client) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public OpenAiChatCompletionOutput chatCompletion(@Nonnull final String prompt) {
/**
* Asynchronous stream of an OpenAI chat request
*
* @param message The message to send to the assistant
* @return the emitter that streams the assistant message response
*/
@Nonnull
Expand All @@ -64,6 +65,7 @@ public Stream<OpenAiChatCompletionDelta> streamChatCompletionDeltas(
/**
* Asynchronous stream of an OpenAI chat request
*
* @param message The message to send to the assistant
* @return the emitter that streams the assistant message response
*/
@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public OpenAiChatCompletionResponse chatCompletion(@Nonnull final String prompt)
/**
* Asynchronous stream of an OpenAI chat request
*
* @param message The message to send to the assistant
* @return the emitter that streams the assistant message response
*/
@Nonnull
Expand All @@ -66,6 +67,7 @@ public Stream<OpenAiChatCompletionDelta> streamChatCompletionDeltas(
/**
* Asynchronous stream of an OpenAI chat request
*
* @param message The message to send to the assistant
* @return the emitter that streams the assistant message response
*/
@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class OrchestrationService {
/**
* Chat request to OpenAI through the Orchestration service with a simple prompt.
*
* @param famousPhrase the phrase to send to the assistant
* @return the assistant response object
*/
@Nonnull
Expand All @@ -62,6 +63,7 @@ public OrchestrationChatResponse completion(@Nonnull final String famousPhrase)
/**
* Chat request to OpenAI through the Orchestration service with an image.
*
* @param pathToImage the path to the image
* @return the assistant response object
*/
@Nonnull
Expand All @@ -78,6 +80,7 @@ public OrchestrationChatResponse imageInput(@Nonnull final String pathToImage) {
/**
* Chat request to OpenAI through the Orchestration service with multiple strings.
*
* @param questions the list of questions to send to the assistant
* @return the assistant response object
*/
@Nonnull
Expand All @@ -91,6 +94,7 @@ public OrchestrationChatResponse multiStringInput(@Nonnull final List<String> qu
/**
* Asynchronous stream of an OpenAI chat request
*
* @param topic the topic to send to the assistant
* @return a stream of assistant message responses
*/
@Nonnull
Expand All @@ -106,6 +110,7 @@ public Stream<String> streamChatCompletion(@Nonnull final String topic) {
*
* @link <a href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/templating">SAP
* AI Core: Orchestration - Templating</a>
* @param language the language to use in the template
* @return the assistant response object
*/
@Nonnull
Expand All @@ -124,6 +129,7 @@ public OrchestrationChatResponse template(@Nonnull final String language) {
/**
* Chat request to OpenAI through the Orchestration service using message history.
*
* @param prevMessage the previous message to send to the assistant
* @return the assistant response object
*/
@Nonnull
Expand Down Expand Up @@ -237,6 +243,7 @@ public OrchestrationChatResponse llamaGuardInputFilter(final boolean filter)
* @link <a
* href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/data-masking">SAP AI
* Core: Orchestration - Data Masking</a>
* @param entity the entity to be masked
* @return the assistant response object
*/
@Nonnull
Expand All @@ -261,6 +268,8 @@ public OrchestrationChatResponse maskingAnonymization(@Nonnull final DPIEntities
/**
* Chat request to OpenAI through the Orchestration deployment under a specific resource group.
*
* @param resourceGroup the resource group to use
* @param famousPhrase the phrase to send to the assistant
* @return the assistant response object
*/
@Nonnull
Expand All @@ -282,6 +291,7 @@ public OrchestrationChatResponse completionWithResourceGroup(
* @link <a
* href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/data-masking">SAP AI
* Core: Orchestration - Data Masking</a>
* @param entity the entity to be pseudonymized
* @return the assistant response object
*/
@Nonnull
Expand Down Expand Up @@ -375,6 +385,7 @@ public OrchestrationChatResponse groundingHelpSapCom(@Nonnull final String userM
* @link <a
* href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/structured-output">SAP
* AI Core: Orchestration - Structured Output</a>
* @param word the word to translate
* @return the assistant response object
*/
@Nonnull
Expand Down Expand Up @@ -410,6 +421,7 @@ class Translation {
* @link <a
* href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/structured-output">SAP
* AI Core: Orchestration - Structured Output</a>
* @param word the word to translate
* @return the assistant response object
*/
@Nonnull
Expand All @@ -436,6 +448,7 @@ public OrchestrationChatResponse responseFormatJsonObject(@Nonnull final String
* @link <a
* href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/structured-output">SAP
* AI Core: Orchestration - Structured Output</a>
* @param word the word to translate
* @return the assistant response object
*/
@Nonnull
Expand All @@ -460,6 +473,7 @@ public OrchestrationChatResponse responseFormatText(@Nonnull final String word)
*
* @link <a href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/templating">SAP
* AI Core: Orchestration - Templating</a>
* @param topic the topic to send to the assistant
* @return the assistant response object
*/
@Nonnull
Expand All @@ -482,6 +496,7 @@ public OrchestrationChatResponse templateFromPromptRegistryById(@Nonnull final S
*
* @link <a href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/templating">SAP
* AI Core: Orchestration - Templating</a>
* @param topic the topic to send to the assistant
* @return the assistant response object
*/
@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public ChatResponse masking() {
* href="https://docs.spring.io/spring-ai/reference/api/tools.html#_methods_as_tools">Spring AI
* Tool Method Declarative Specification</a>
*
* @param internalToolExecutionEnabled whether the internal tool execution is enabled
* @return the assistant response object
*/
@Nonnull
Expand Down