diff --git a/.pipeline/checkstyle.xml b/.pipeline/checkstyle.xml index ba470a5e4..da29aa120 100644 --- a/.pipeline/checkstyle.xml +++ b/.pipeline/checkstyle.xml @@ -29,7 +29,17 @@ - + + + + + + + + + + + diff --git a/.pipeline/dependency-check-suppression.xml b/.pipeline/dependency-check-suppression.xml index fa7f661dc..02296b7ac 100644 --- a/.pipeline/dependency-check-suppression.xml +++ b/.pipeline/dependency-check-suppression.xml @@ -1,13 +1,5 @@ - - - CVE-2026-47852 - - - - CVE-2026-47851 - CVE-2021-41251 diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/GroundingClient.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/GroundingClient.java index a366223ee..aa49a5e1f 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/GroundingClient.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/GroundingClient.java @@ -39,7 +39,7 @@ public GroundingClient() { /** * Constructor with custom AI Core service instance. * - * @param service The instance of AI Core service + * @param service the instance of AI Core service. */ public GroundingClient(final @Nonnull AiCoreService service) { this(service, DEFAULT_BASE_PATH); @@ -48,7 +48,7 @@ public GroundingClient(final @Nonnull AiCoreService service) { /** * Get the Pipelines API. * - * @return The Pipelines API. + * @return the Pipelines API. */ @Nonnull public PipelinesApi pipelines() { @@ -58,7 +58,7 @@ public PipelinesApi pipelines() { /** * Get the Vector API. * - * @return The Vector API. + * @return the Vector API. */ @Nonnull public VectorApi vector() { @@ -68,7 +68,7 @@ public VectorApi vector() { /** * Get the Retrieval API. * - * @return The Retrieval API. + * @return the Retrieval API. */ @Nonnull public RetrievalApi retrieval() { @@ -76,10 +76,10 @@ public RetrievalApi retrieval() { } /** - * Create a new OpenAI client with a custom header added to every call made with this client + * Create a new OpenAI client with a custom header added to every call made with this client. * - * @param key the key of the custom header to add - * @param value the value of the custom header to add + * @param key the key of the custom header to add. + * @param value the value of the custom header to add. * @return a new client. * @since 1.17.0 */ diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/PromptRegistryClient.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/PromptRegistryClient.java index bbf58d0fe..dca202481 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/PromptRegistryClient.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/PromptRegistryClient.java @@ -6,7 +6,7 @@ import javax.annotation.Nonnull; /** - * Unified client to use Prompt Registry API + * Unified client to use Prompt Registry API. * * @since 2.0 */ @@ -14,24 +14,24 @@ public class PromptRegistryClient { private final AiCoreService aiCoreService; - /** Constructs default PromptRegistryClient */ + /** Constructs default PromptRegistryClient. */ public PromptRegistryClient() { this(new AiCoreService()); } /** - * Constructs PromptRegistryClient with customized AiCoreService + * Constructs PromptRegistryClient with customized AiCoreService. * - * @param service customized AiCoreService + * @param service customized AiCoreService. */ public PromptRegistryClient(@Nonnull final AiCoreService service) { aiCoreService = service; } /** - * Get the prompt templates client + * Get the prompt templates' client. * - * @return the client + * @return the client. */ @Nonnull public PromptTemplatesApi prompt() { @@ -39,9 +39,9 @@ public PromptTemplatesApi prompt() { } /** - * Get the orchestration configs client + * Get the orchestration configs client. * - * @return the client + * @return the client. */ @Nonnull public OrchestrationConfigsApi orchestrationConfig() { diff --git a/core/src/main/java/com/sap/ai/sdk/core/AiCoreService.java b/core/src/main/java/com/sap/ai/sdk/core/AiCoreService.java index 471923a06..ddb1ec9f8 100644 --- a/core/src/main/java/com/sap/ai/sdk/core/AiCoreService.java +++ b/core/src/main/java/com/sap/ai/sdk/core/AiCoreService.java @@ -52,8 +52,8 @@ public AiCoreService() { * base path set. But for special cases a different base path may be required (e.g. when consuming * AI Core via some proxy that expects a different base path). * - * @param destination The base destination to be used for AI Core service calls. - * @return A new AI Core Service object using the provided destination as basis. + * @param destination the base destination to be used for AI Core service calls. + * @return a new AI Core Service object using the provided destination as basis. */ @Nonnull public AiCoreService withBaseDestination(@Nonnull final HttpDestination destination) { @@ -64,10 +64,10 @@ public AiCoreService withBaseDestination(@Nonnull final HttpDestination destinat * Get the base destination for AI Core service calls. This destination won't have any resource * group set. * - * @return The base destination. - * @throws DestinationAccessException If there was an issue creating the base destination, e.g. in + * @return the base destination. + * @throws DestinationAccessException if there was an issue creating the base destination, e.g. in * case of invalid credentials. - * @throws DestinationNotFoundException If there was an issue creating the base destination, e.g. + * @throws DestinationNotFoundException if there was an issue creating the base destination, e.g. * in case of missing credentials. * @see #withBaseDestination(HttpDestination) */ @@ -81,10 +81,10 @@ public HttpDestination getBaseDestination() * Get a destination to perform inference calls against a deployment under the default resource * group on AI Core. * - * @return The destination pointing to the specific deployment ID. - * @throws DestinationAccessException If there was an issue creating the base destination, e.g. in + * @return the destination pointing to the specific deployment ID. + * @throws DestinationAccessException if there was an issue creating the base destination, e.g. in * case of invalid credentials. - * @throws DestinationNotFoundException If there was an issue creating the base destination, e.g. + * @throws DestinationNotFoundException if there was an issue creating the base destination, e.g. * in case of missing credentials. * @see #getInferenceDestination(String) for specifying a custom resource group. */ @@ -98,8 +98,8 @@ public InferenceDestinationBuilder getInferenceDestination() * Get a destination to perform inference calls against a deployment for the given resource group * on AI Core. * - * @param resourceGroup The resource group to be used for the new endpoint. - * @return The destination pointing to the specific deployment ID. + * @param resourceGroup the resource group to be used for the new endpoint. + * @return the destination pointing to the specific deployment ID. * @see #getInferenceDestination() for using the default resource group. */ @Nonnull @@ -111,7 +111,7 @@ public InferenceDestinationBuilder getInferenceDestination(@Nonnull final String * Get an {@link ApiClient} to execute requests based on clients generated from OpenAPI * specifications. * - * @return A new client object based on {@link #getBaseDestination()}. + * @return a new client object based on {@link #getBaseDestination()}. */ @Nonnull public ApiClient getApiClient() { @@ -123,8 +123,8 @@ public ApiClient getApiClient() { * The result of this together with the base path defined on the destination will be used for * inference calls towards this deployment. * - * @param deploymentId The deployment ID to be used for the path. - * @return The path to the deployment. + * @param deploymentId the deployment ID to be used for the path. + * @return the path to the deployment. */ @Nonnull protected String buildDeploymentPath(@Nonnull final String deploymentId) { @@ -150,11 +150,11 @@ public class InferenceDestinationBuilder { /** * Use a fixed deployment ID to identify the deployment. * - * @param deploymentId The ID of the deployment to target. - * @return A new destination targeting the specified deployment. - * @throws DestinationAccessException If there was an issue creating the base destination, e.g. + * @param deploymentId the ID of the deployment to target. + * @return a new destination targeting the specified deployment. + * @throws DestinationAccessException if there was an issue creating the base destination, e.g. * in case of invalid credentials. - * @throws DestinationNotFoundException If there was an issue creating the base destination, + * @throws DestinationNotFoundException if there was an issue creating the base destination, * e.g. in case of missing credentials. * @see #forModel(AiModel) * @see #forScenario(String) @@ -169,9 +169,9 @@ public HttpDestination usingDeploymentId(@Nonnull final String deploymentId) * Lookup a deployment based on the given {@link AiModel}. If there are multiple deployments for * the given model, the first one is returned. * - * @param model The model to be used for inference calls. - * @return A new destination targeting a deployment for the given model. - * @throws DeploymentResolutionException If no running deployment is found for the model. + * @param model the model to be used for inference calls. + * @return a new destination targeting a deployment for the given model. + * @throws DeploymentResolutionException if no running deployment is found for the model. * @see #forScenario(String) * @see #usingDeploymentId(String) */ @@ -186,9 +186,9 @@ public HttpDestination forModel(@Nonnull final AiModel model) * Lookup a deployment based on the given scenario. If there are multiple deployments within the * same scenario, the first one is returned. * - * @param scenarioId The scenario to discover deployments for. - * @return A new destination targeting a deployment within the given scenario. - * @throws DeploymentResolutionException If no running deployment is found within the scenario. + * @param scenarioId the scenario to discover deployments for. + * @return a new destination targeting a deployment within the given scenario. + * @throws DeploymentResolutionException if no running deployment is found within the scenario. * @see #forModel(AiModel) * @see #usingDeploymentId(String) */ diff --git a/core/src/main/java/com/sap/ai/sdk/core/AiModel.java b/core/src/main/java/com/sap/ai/sdk/core/AiModel.java index f0d63a556..eaf29c3fc 100644 --- a/core/src/main/java/com/sap/ai/sdk/core/AiModel.java +++ b/core/src/main/java/com/sap/ai/sdk/core/AiModel.java @@ -9,7 +9,7 @@ public interface AiModel { /** * Get the model's name. * - * @return The name of the model. + * @return the name of the model. */ @Nonnull String name(); @@ -17,7 +17,7 @@ public interface AiModel { /** * Get the model's version. * - * @return The version of the model, or null if not specified. + * @return the version of the model, or null if not specified. */ @Nullable String version(); diff --git a/core/src/main/java/com/sap/ai/sdk/core/DeploymentResolver.java b/core/src/main/java/com/sap/ai/sdk/core/DeploymentResolver.java index 41c1c9640..ac2b292a0 100644 --- a/core/src/main/java/com/sap/ai/sdk/core/DeploymentResolver.java +++ b/core/src/main/java/com/sap/ai/sdk/core/DeploymentResolver.java @@ -133,10 +133,10 @@ private Optional getCachedDeployment( } /** - * This exists because getBackendDetails() is broken + * This exists because getBackendDetails() is broken. * - * @param targetModel The target model object. - * @param deployment The deployment. + * @param targetModel the target model object. + * @param deployment the deployment. * @return true if the deployment is of the model. */ protected static boolean isDeploymentOfModel( diff --git a/core/src/main/java/com/sap/ai/sdk/core/JacksonConfiguration.java b/core/src/main/java/com/sap/ai/sdk/core/JacksonConfiguration.java index c4af8e263..17da8ca3c 100644 --- a/core/src/main/java/com/sap/ai/sdk/core/JacksonConfiguration.java +++ b/core/src/main/java/com/sap/ai/sdk/core/JacksonConfiguration.java @@ -18,10 +18,12 @@ public final class JacksonConfiguration { /** - * Default object mapper used for JSON de-/serialization. Only intended for internal usage - * within this SDK. Largely follows the defaults set by Spring. + * Default object mapper used for JSON de-/serialization. Largely follows the defaults set by + * Spring. * - * @return A new object mapper with the default configuration. + *

For internal use only. + * + * @return a new object mapper with the default configuration. * @see Jackson2ObjectMapperBuilder */ diff --git a/core/src/main/java/com/sap/ai/sdk/core/common/ClientError.java b/core/src/main/java/com/sap/ai/sdk/core/common/ClientError.java index 17a495b4a..e1f3fbb05 100644 --- a/core/src/main/java/com/sap/ai/sdk/core/common/ClientError.java +++ b/core/src/main/java/com/sap/ai/sdk/core/common/ClientError.java @@ -12,7 +12,7 @@ public interface ClientError { /** * Get the error message. * - * @return The error message + * @return the error message. */ @Nullable String getMessage(); diff --git a/core/src/main/java/com/sap/ai/sdk/core/common/ClientException.java b/core/src/main/java/com/sap/ai/sdk/core/common/ClientException.java index facceba87..2545dfbcd 100644 --- a/core/src/main/java/com/sap/ai/sdk/core/common/ClientException.java +++ b/core/src/main/java/com/sap/ai/sdk/core/common/ClientException.java @@ -49,8 +49,8 @@ public class ClientException extends RuntimeException { * * @param clientError the original structured error payload received from the remote service, can * be null if not available. - * @return the current instance of {@link ClientException} with the changed ClientError data - * @param the type of the exception, typically a subclass of {@link ClientException} + * @param the type of the exception, typically a subclass of {@link ClientException}. + * @return the current instance of {@link ClientException} with the changed ClientError data. */ @SuppressWarnings("unchecked") @Nonnull @@ -62,10 +62,10 @@ public T setClientError(@Nullable final ClientError /** * Sets the original HTTP request that caused this exception. * - * @param httpResponse the original HTTP response that caused this exception, can be null if not - * available. - * @return the current instance of {@link ClientException} with the changed HTTP response - * @param the type of the exception, typically a subclass of {@link ClientException} + * @param httpResponse the original HTTP response that caused this exception. Can be {@code null} + * if not available. + * @param the type of the exception, typically a subclass of {@link ClientException}. + * @return the current instance of {@link ClientException} with the changed HTTP response. */ @SuppressWarnings("unchecked") @Nonnull @@ -78,10 +78,10 @@ public T setHttpResponse( /** * Sets the original HTTP request that caused this exception. * - * @param httpRequest the original HTTP request that caused this exception, can be null if not - * available. - * @return the current instance of {@link ClientException} with the changed HTTP request - * @param the type of the exception, typically a subclass of {@link ClientException} + * @param httpRequest the original HTTP request that caused this exception. Can be {@code null} if + * not available. + * @param the type of the exception, typically a subclass of {@link ClientException}. + * @return the current instance of {@link ClientException} with the changed HTTP request. */ @SuppressWarnings("unchecked") @Nonnull diff --git a/core/src/main/java/com/sap/ai/sdk/core/common/ClientExceptionFactory.java b/core/src/main/java/com/sap/ai/sdk/core/common/ClientExceptionFactory.java index 3ace4fb26..2b81941a8 100644 --- a/core/src/main/java/com/sap/ai/sdk/core/common/ClientExceptionFactory.java +++ b/core/src/main/java/com/sap/ai/sdk/core/common/ClientExceptionFactory.java @@ -7,8 +7,8 @@ * A factory whose implementations can provide customized exception types and error mapping logic * for different service clients or error scenarios. * - * @param The subtype of {@link ClientException} to be created by this factory. - * @param The subtype of {@link ClientError} payload that can be processed by this factory. + * @param the subtype of {@link ClientException} to be created by this factory. + * @param the subtype of {@link ClientError} payload that can be processed by this factory. */ @FunctionalInterface public interface ClientExceptionFactory { @@ -16,9 +16,9 @@ public interface ClientExceptionFactory The type of the successful response. - * @param The type of the exception to throw. - * @param The type of the error response. + *

For internal use only. + * + * @param the type of the successful response. + * @param the type of the exception to throw. + * @param the type of the error response. * @since 1.1.0 */ @Slf4j @RequiredArgsConstructor public class ClientResponseHandler implements HttpClientResponseHandler { - /** The HTTP success response type */ + /** The HTTP success response type. */ @Nonnull final Class successType; - /** The HTTP error response type */ + /** The HTTP error response type. */ @Nonnull final Class errorType; /** The factory to create exceptions for Http 4xx/5xx responses. */ @Nonnull final ClientExceptionFactory exceptionFactory; - /** The parses for JSON responses, will be private once we can remove mixins */ + /** The parses for JSON responses, will be private once we can remove mixins. */ @Nonnull ObjectMapper objectMapper = getDefaultObjectMapper(); /** * Internal SDK usage only. 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 + * @param jackson the {@link ObjectMapper} to use. + * @return the current instance of {@link ClientResponseHandler} with the changed object mapper. */ @Nonnull public ClientResponseHandler objectMapper(@Nonnull final ObjectMapper jackson) { @@ -58,9 +60,9 @@ public ClientResponseHandler objectMapper(@Nonnull final ObjectMapper j * Internal SDK usage only. Processes a {@link ClassicHttpResponse} and returns some value * corresponding to that response. * - * @param response The response to process - * @return A model class instantiated from the response - * @throws E in case of a problem or the connection was aborted + * @param response the response to process. + * @return a model class instantiated from the response. + * @throws E in case of a problem or the connection was aborted. */ @Nonnull @Override @@ -102,8 +104,8 @@ private Try tryGetContent(@Nonnull final HttpEntity entity) { /** * For internal SDK usage only. Process the error response and throw an exception. * - * @param httpResponse The response to process - * @throws ClientException if the response is an error (4xx/5xx) + * @param httpResponse the response to process. + * @throws ClientException if the response is an error (4xx/5xx). */ @SuppressWarnings("PMD.CloseResource") protected void buildAndThrowException(@Nonnull final ClassicHttpResponse httpResponse) throws E { @@ -144,9 +146,9 @@ protected void buildAndThrowException(@Nonnull final ClassicHttpResponse httpRes * For internal SDK usage only. Parses the JSON content of an error response and throws a module * specific exception. * - * @param content The JSON content of the error response. - * @param httpResponse The HTTP response that contains the error. - * @throws ClientException if the response is an error (4xx/5xx) + * @param content the JSON content of the error response. + * @param httpResponse the HTTP response that contains the error. + * @throws ClientException if the response is an error (4xx/5xx). */ protected void parseErrorResponseAndThrow( @Nonnull final String content, @Nonnull final ClassicHttpResponse httpResponse) throws E { diff --git a/core/src/main/java/com/sap/ai/sdk/core/common/ClientStreamingHandler.java b/core/src/main/java/com/sap/ai/sdk/core/common/ClientStreamingHandler.java index e7680d555..3025b2302 100644 --- a/core/src/main/java/com/sap/ai/sdk/core/common/ClientStreamingHandler.java +++ b/core/src/main/java/com/sap/ai/sdk/core/common/ClientStreamingHandler.java @@ -10,12 +10,13 @@ import org.apache.hc.core5.http.ClassicHttpResponse; /** - * For internal SDK usage only. Parse incoming JSON responses and handles any errors. For internal - * use only. + * Parses incoming JSON responses and handles any errors. * - * @param The type of the response. - * @param The type of the exception to throw. - * @param The type of the error. + *

For internal use only. + * + * @param the type of the response. + * @param the type of the exception to throw. + * @param the type of the error. * @since 1.2.0 */ @Slf4j @@ -26,8 +27,8 @@ public class ClientStreamingHandler< /** * For internal SDK usage only. 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 + * @param jackson the {@link ObjectMapper} to use. + * @return the current instance of {@link ClientStreamingHandler} with the changed object mapper. */ @Nonnull public ClientStreamingHandler objectMapper(@Nonnull final ObjectMapper jackson) { @@ -38,9 +39,9 @@ public ClientStreamingHandler objectMapper(@Nonnull final ObjectMapper /** * For internal SDK usage only. Creates a new instance of the {@link ClientStreamingHandler}. * - * @param deltaType The type of the response. - * @param errorType The type of the error. - * @param exceptionFactory The factory to create exceptions. + * @param deltaType the type of the response. + * @param errorType the type of the error. + * @param exceptionFactory the factory to create exceptions. */ public ClientStreamingHandler( @Nonnull final Class deltaType, @@ -53,9 +54,9 @@ public ClientStreamingHandler( * For internal SDK usage only. Processes a {@link ClassicHttpResponse} and returns a {@link * Stream} of deltas corresponding to that response. * - * @param response The response to process - * @return A {@link Stream} of a model class instantiated from the response - * @throws E in case of a problem or the connection was aborted + * @param response the response to process. + * @return a {@link Stream} of a model class instantiated from the response. + * @throws E in case of a problem or the connection was aborted. */ @SuppressWarnings("PMD.CloseResource") // Stream is closed automatically when consumed @Nonnull diff --git a/core/src/main/java/com/sap/ai/sdk/core/common/IterableStreamConverter.java b/core/src/main/java/com/sap/ai/sdk/core/common/IterableStreamConverter.java index 3a6515b90..67c43271b 100644 --- a/core/src/main/java/com/sap/ai/sdk/core/common/IterableStreamConverter.java +++ b/core/src/main/java/com/sap/ai/sdk/core/common/IterableStreamConverter.java @@ -23,15 +23,14 @@ /** * Internal utility class to convert from a reading handler to {@link Iterable} and {@link Stream}. * - *

Note: All operations are sequential in nature. Thread safety is not - * guaranteed. + *

Note: All operations are sequential in nature. Thread safety is not guaranteed. * - * @param Iterated item type. + * @param iterated item type. */ @Slf4j @RequiredArgsConstructor(access = AccessLevel.PRIVATE) class IterableStreamConverter implements Iterator { - /** see DEFAULT_CHAR_BUFFER_SIZE in {@link BufferedReader} * */ + /** See DEFAULT_CHAR_BUFFER_SIZE in {@link BufferedReader}. */ static final int BUFFER_SIZE = 8192; private static final String ERR_CONTENT = "Failed to read response content."; @@ -90,9 +89,9 @@ public T next() { * java.io.InputStream} is closed, when the resulting Stream is closed (e.g. via * try-with-resources) or when an exception occurred. * - * @param response The HTTP response object. - * @param exceptionFactory The exception factory to use for creating exceptions. - * @return A sequential Stream object. + * @param response the HTTP response object. + * @param exceptionFactory the exception factory to use for creating exceptions. + * @return a sequential Stream object. * @throws ClientException if the provided HTTP entity object is {@code null} or empty. */ @SuppressWarnings("PMD.CloseResource") // Stream is closed automatically when consumed diff --git a/core/src/main/java/com/sap/ai/sdk/core/common/RequestLogContext.java b/core/src/main/java/com/sap/ai/sdk/core/common/RequestLogContext.java index cd0a15914..3a6c44073 100644 --- a/core/src/main/java/com/sap/ai/sdk/core/common/RequestLogContext.java +++ b/core/src/main/java/com/sap/ai/sdk/core/common/RequestLogContext.java @@ -15,7 +15,7 @@ /** * Utility for managing MDC (Mapped Diagnostic Context) for logging of AI Core requests. * - *

This class is intended for internal use only. + *

For internal use only. */ @Slf4j @UtilityClass @@ -28,7 +28,7 @@ private static void setCallId(@Nonnull final String callId) { /** * Set the endpoint for the current request context. * - * @param endpoint the endpoint URL + * @param endpoint the endpoint URL. */ public static void setEndpoint(@Nonnull final String endpoint) { MDC.put(MdcKeys.ENDPOINT, endpoint); @@ -37,7 +37,7 @@ public static void setEndpoint(@Nonnull final String endpoint) { /** * Set the destination for the current request context. * - * @param destination the destination name + * @param destination the destination name. */ public static void setDestination(@Nonnull final String destination) { MDC.put(MdcKeys.DESTINATION, destination); @@ -46,7 +46,7 @@ public static void setDestination(@Nonnull final String destination) { /** * Set the mode for the current request context. * - * @param mode the request mode + * @param mode the request mode. */ public static void setMode(@Nonnull final Mode mode) { MDC.put(MdcKeys.MODE, mode.getValue()); @@ -55,7 +55,7 @@ public static void setMode(@Nonnull final Mode mode) { /** * Set the service for the current request context. * - * @param service the service type + * @param service the service type. */ public static void setService(@Nonnull final Service service) { MDC.put(MdcKeys.SERVICE, service.getValue()); @@ -88,7 +88,7 @@ public static void logRequestStart() { /** * Log successful response with duration and size information. * - * @param response the HTTP response + * @param response the HTTP response. */ public static void logResponseSuccess(@Nonnull final ClassicHttpResponse response) { if (!log.isDebugEnabled()) { @@ -119,9 +119,9 @@ private static class MdcKeys { /** Request execution modes. */ @RequiredArgsConstructor public enum Mode { - /** Synchronous request mode */ + /** Synchronous request mode. */ SYNCHRONOUS("synchronous"), - /** Streaming request mode */ + /** Streaming request mode. */ STREAMING("streaming"); @Getter private final String value; } @@ -129,9 +129,9 @@ public enum Mode { /** AI service types. */ @RequiredArgsConstructor public enum Service { - /** OpenAI service */ + /** OpenAI service. */ OPENAI("OpenAI"), - /** Orchestration service */ + /** Orchestration service. */ ORCHESTRATION("Orchestration"); @Getter private final String value; } diff --git a/core/src/main/java/com/sap/ai/sdk/core/common/StreamedDelta.java b/core/src/main/java/com/sap/ai/sdk/core/common/StreamedDelta.java index 8c77f5ef3..fe2766b96 100644 --- a/core/src/main/java/com/sap/ai/sdk/core/common/StreamedDelta.java +++ b/core/src/main/java/com/sap/ai/sdk/core/common/StreamedDelta.java @@ -15,9 +15,9 @@ public interface StreamedDelta { /** * Get the message content from the delta. * - *

Note: If there are multiple choices only the first one is returned + *

Note: If there are multiple choices only the first one is returned. * - *

Note: Some deltas do not contain any content + *

Note: Some deltas do not contain any content. * * @return the message content or empty string. */ diff --git a/docs/adrs/007-javadoc-style.md b/docs/adrs/007-javadoc-style.md new file mode 100644 index 000000000..b6b9ef006 --- /dev/null +++ b/docs/adrs/007-javadoc-style.md @@ -0,0 +1,280 @@ +# JavaDoc Style Guide + +## Status + +Accepted + +## Context + +The public API JavaDoc of the SAP AI SDK lacked a consistent style. +Phrases were worded differently across modules, punctuation was inconsistent, and block tags appeared in varying orders. +This inconsistency creates a fragmented impression for SDK users reading the generated API documentation. + +To enforce the style mechanically, the following Checkstyle rules are active in `.pipeline/checkstyle.xml`: + +- `SummaryJavadoc` — first sentence must end with a period +- `AtclauseOrder` — block tags must appear in the order: `@param`, `@return`, `@throws`, `@see`, `@since`, `@deprecated` +- `NonEmptyAtclauseDescription` — every block tag must have a description +- `JavadocParagraph` — `

` tags must be correctly placed + +## Decision + +All public and protected JavaDoc follows the rules below. + +--- + +### 1. General + +* Write in **English**. +* Every JavaDoc comment — whether on a class, method, or field — must end its first (summary) sentence with a **period (`.`)**. +* **Summary sentences** (the first sentence of a class, method, or field comment) are full sentences: capitalized first word, ending with a period. +* **Block-tag descriptions** (`@param`, `@return`, `@throws`) are sentence fragments continuing the tag: lowercase first word, ending with a period. +* Keep the summary sentence on its own conceptual line. + Further paragraphs are separated by a `

` tag placed at the **start** of the new paragraph. JavaDoc does not use a closing `

` — the tag acts as a paragraph separator, and the `JavadocParagraph` check enforces this. + +```java +/** + * Resolves a deployment ID for a given AI model. + * + *

If multiple deployments match, the first one is returned. + */ +``` + +--- + +### 2. Classes and interfaces + +* The summary sentence describes **what the class/interface is**, not what it does. +* Use noun phrases: `"A client for..."`, `"Utility for..."`, `"Configuration of..."`. + +```java +/** A client for sending requests to the Orchestration service. */ +public class OrchestrationClient { ... } + +/** Utility for managing MDC context for AI Core request logging. */ +@UtilityClass +public class RequestLogContext { ... } +``` + +--- + +### 3. Methods + +* The summary sentence describes **what the method does**, starting with a third-person singular verb. +* Use verb phrases: `"Resolves..."`, `"Sets..."`, `"Creates..."`, `"Builds..."`. + +```java +/** + * Resolves the deployment ID for the given model. + * + * @param resourceGroup the resource group, usually {@code "default"}. + * @param model the AI model to resolve. + * @return the deployment ID. + * @throws DeploymentResolutionException if no running deployment is found. + */ +String getDeploymentId(String resourceGroup, AiModel model); +``` + +--- + +### 4. Fields and constants + +* Use a short noun phrase ending with a period. + +```java +/** The default resource group. */ +public static final String DEFAULT_RESOURCE_GROUP = "default"; +``` + +--- + +### 5. Block tags + +Block tags must appear in this order: `@param`, `@return`, `@throws`, `@see`, `@since`, `@deprecated`. + +A block-tag description reads as a fragment continuing the tag (e.g. "`@return` the deployment ID."), so its first word is **lowercase** — unlike a summary sentence, which is a full, capitalized sentence (see section 1). Proper nouns, class names, and inline tags (`{@link ...}`, `{@code ...}`) keep their original casing. + +#### `@param` +* Lowercase first word, ending with a period. +* For generic type parameters, document them last among `@param` tags. + +```java +@param destination the destination used for AI Core service calls. +@param the type of the successful response. +``` + +#### `@return` +* Lowercase first word, ending with a period. +* Do not write `"Returns ..."` — the tag already implies it. + +```java +@return the deployment ID. +@return the current instance for chaining. +``` + +#### `@throws` +* Lowercase first word, ending with a period. +* Start with `"if ..."` to describe the condition. + +```java +@throws DeploymentResolutionException if no running deployment is found for the model. +``` + +#### `@deprecated` +* For API replacements: `"Use {@link X} instead."` +* For deprecated AI models on AI Core without a known retirement date: `"This model is deprecated on AI Core."` +* For deprecated AI models with a retirement date and replacement: `"This model is deprecated on AI Core with a planned retirement on YYYY-MM-DD. Use {@link X} instead."` + +```java +// API replacement +@deprecated Use {@link #chatCompletion(OpenAiChatCompletionRequest)} instead. + +// Model deprecation without retirement date +@deprecated This model is deprecated on AI Core. + +// Model deprecation with retirement date and replacement +@deprecated This model is deprecated on AI Core with a planned retirement on 2025-09-01. Use {@link OpenAiModel#GPT_4O} instead. +``` + +#### `@since` +* Provide the version in which the API was introduced, using the format `major.minor.patch`. + +```java +@since 1.4.0 +``` + +--- + +### 6. Inline tags + +* Use `{@link ClassName}` or `{@link ClassName#method()}` to reference navigable types and methods. +* Use `{@code value}` for literals, string values, primitive values, or code snippets that should not be a hyperlink. +* Do not use `{@linkplain}`. + +```java +// Correct +Use {@link AiCoreService} to obtain a destination. +The default value is {@code "default"}. + +// Incorrect +Use {@linkplain AiCoreService} to obtain a destination. +``` + +--- + +### 7. Notes and important remarks + +Use `

Note:` for supplementary remarks that do not belong in the summary sentence. + +```java +// Correct +/** + * Sets a custom base destination. + * + *

Note: The destination is expected to have the {@code /v2/} base path set. + * + * @param destination the base destination. + * @return a new instance using the provided destination. + */ +``` + +Do not use `NOTE:`, `Note:`, `NOTE:`, or plain `Note:` without HTML tags. + +```java +// Incorrect +/** + * Sets a custom base destination. + * + *

NOTE: The destination is expected to have the {@code /v2/} base path set. + */ +``` + +--- + +### 8. Code examples + +Use `

{@code ... }
` for multi-line code examples. + +```java +/** + * Creates a client with a custom destination. + * + *

Example: + * + *

{@code
+ * var client = new OrchestrationClient(
+ *     new AiCoreService().getInferenceDestination("my-rg").forScenario("orchestration"));
+ * }
+ * + * @param destination the specific destination to use. + */ +``` + +--- + +### 9. What not to document + +* Do not add JavaDoc to `@Override` methods — they inherit the parent's documentation. +* Do not add JavaDoc to generated code (OpenAPI-generated classes are excluded via `checkstyle-suppressions.xml`). +* Do not repeat the method or field name in the summary sentence. + +```java +// Correct +/** The name of the model as registered in AI Core. */ +String getModelName(); + +// Incorrect +/** Gets the model name. */ +String getModelName(); +``` + +--- + +### 10. Canonical phrases + +Use the exact wording below wherever these situations apply, to ensure consistent phrasing across all modules. + +#### Resource group parameter + +When the resource group has no context-specific meaning, use: + +```java +@param resourceGroup the resource group, usually {@code "default"}. +``` + +When the context is more specific, a tailored description is acceptable (e.g. `"the resource group of the deleted deployment"`). + +#### Nullable parameters + +Use `{@code null}` when referencing the null value inline. There is no JavaDoc-standard for nullability, so we follow the `{@code null}` convention for consistency with other inline code references. Write it as a second sentence within the `@param` description — no new line. + +```java +// Correct +@param cause an optional cause of the exception. Can be {@code null} if not applicable. + +// Incorrect +@param cause an optional cause of the exception, can be null if not applicable. +@param cause nullable cause. +``` + +#### Internal-use APIs + +APIs that are part of the public class structure but not intended for use by SDK consumers must carry the following sentence as a separate `

` paragraph. Use exactly `"For internal use only."` — no variations such as `"intended for internal use"` or `"only for internal usage"`. + +```java +// Correct +/** + * Parses incoming JSON responses and handles errors. + * + *

For internal use only. + */ +public class ClientResponseHandler { ... } + +// Incorrect +/** + * Parses incoming JSON responses and handles errors. + * + *

This class is intended for internal use only. + */ +public class ClientResponseHandler { ... } +``` diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/AiCoreOpenAiClient.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/AiCoreOpenAiClient.java index 39ddc0c96..f1620d538 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/AiCoreOpenAiClient.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/AiCoreOpenAiClient.java @@ -32,9 +32,9 @@ public class AiCoreOpenAiClient { * Create an OpenAI client for a deployment serving the specified model using the default resource * group. * - * @param model The AI model to target. - * @return A configured OpenAI client instance. - * @throws DeploymentResolutionException If no running deployment is found for the model. + * @param model the AI model to target. + * @return a configured OpenAI client instance. + * @throws DeploymentResolutionException if no running deployment is found for the model. */ @Nonnull public static AiCoreOpenAiClient forModel(@Nonnull final OpenAiModel model) { @@ -45,10 +45,10 @@ public static AiCoreOpenAiClient forModel(@Nonnull final OpenAiModel model) { * Create an OpenAI client for a deployment serving the specified model in the given resource * group. * - * @param model The AI model to target. - * @param resourceGroup The resource group containing the deployment. - * @return A configured OpenAI client instance. - * @throws DeploymentResolutionException If no running deployment is found for the model. + * @param model the AI model to target. + * @param resourceGroup the resource group containing the deployment. + * @return a configured OpenAI client instance. + * @throws DeploymentResolutionException if no running deployment is found for the model. */ @Nonnull public static AiCoreOpenAiClient forModel( @@ -75,7 +75,7 @@ private static ClientOptions buildClientOptions(@Nonnull final HttpDestination d /** * Get a synchronous ResponseService client for the configured model and resource group. * - * @return A configured synchronous OpenAI ResponseService client. + * @return a configured synchronous OpenAI ResponseService client. */ @Nonnull public ResponseService responses() { @@ -85,7 +85,7 @@ public ResponseService responses() { /** * Get an asynchronous client factory for the configured model and resource group. * - * @return An Async factory for creating asynchronous OpenAI clients. + * @return an Async factory for creating asynchronous OpenAI clients. */ @Nonnull public Async async() { @@ -103,7 +103,7 @@ public static class Async { /** * Get an asynchronous ResponseService client for the configured model and resource group. * - * @return A configured OpenAI ResponseServiceAsync client. + * @return a configured OpenAI ResponseServiceAsync client. */ @Nonnull public ResponseServiceAsync responses() { diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiBatchInput.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiBatchInput.java index 9bbc53909..dc7137b11 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiBatchInput.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiBatchInput.java @@ -28,13 +28,13 @@ public class OpenAiBatchInput { private static final ObjectMapper mapper = getDefaultObjectMapper(); - /** The list of individual batch requests */ + /** The list of individual batch requests. */ private final List requests = new ArrayList<>(); /** * Constructs an OpenAiBatchInput from a list of OpenAiChatCompletionRequest objects. * - * @param chatCompletionRequests the list of chat completion requests to include in the batch + * @param chatCompletionRequests the list of chat completion requests to include in the batch. */ public OpenAiBatchInput(@Nonnull final OpenAiChatCompletionRequest... chatCompletionRequests) { for (int i = 0; i < chatCompletionRequests.length; i++) { @@ -61,10 +61,10 @@ public String toString() { /** * Represents a single batch request in OpenAI batch format. * - * @param customId a custom identifier for the request, used for tracking in batch processing - * @param body the body of the request, which is a CreateChatCompletionRequest - * @param method the HTTP method for the request, e.g., "POST" - * @param url the endpoint URL for the request, e.g., "/v1/chat/completions" + * @param customId a custom identifier for the request, used for tracking in batch processing. + * @param body the body of the request, which is a CreateChatCompletionRequest. + * @param method the HTTP method for the request, e.g., "POST". + * @param url the endpoint URL for the request, e.g., "/v1/chat/completions". * @since 1.20.0 */ public record SingleRequest( diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionDelta.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionDelta.java index 6b73ca667..4b327a13d 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionDelta.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionDelta.java @@ -56,7 +56,7 @@ public String getFinishReason() { /** * Retrieves the completion usage from the response, or null if it is not available. * - * @return The completion usage or null. + * @return the completion usage or null. */ @Nullable public CompletionUsage getCompletionUsage() { diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionRequest.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionRequest.java index 8d04c990c..f2d9cf462 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionRequest.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionRequest.java @@ -150,7 +150,7 @@ public class OpenAiChatCompletionRequest { /** * Creates an OpenAiChatCompletionPrompt with string as user message. * - * @param message the message to be added to the prompt + * @param message the message to be added to the prompt. */ @Tolerate public OpenAiChatCompletionRequest(@Nonnull final String message) { @@ -160,8 +160,8 @@ public OpenAiChatCompletionRequest(@Nonnull final String message) { /** * Creates an OpenAiChatCompletionPrompt with a multiple unpacked messages. * - * @param message the primary message to be added to the prompt - * @param messages additional messages to be added to the prompt + * @param message the primary message to be added to the prompt. + * @param messages additional messages to be added to the prompt. */ @Tolerate public OpenAiChatCompletionRequest( @@ -172,7 +172,7 @@ public OpenAiChatCompletionRequest( /** * Creates an OpenAiChatCompletionPrompt with a list of messages. * - * @param messages the list of messages to be added to the prompt + * @param messages the list of messages to be added to the prompt. * @since 1.6.0 */ @Tolerate @@ -203,9 +203,9 @@ public OpenAiChatCompletionRequest(@Nonnull final List messages) /** * Adds stop sequences to the request. * - * @param sequence the primary stop sequence - * @param sequences additional stop sequences - * @return a new OpenAiChatCompletionRequest instance with the specified stop sequences + * @param sequence the primary stop sequence. + * @param sequences additional stop sequences. + * @return a new OpenAiChatCompletionRequest instance with the specified stop sequences. */ @Tolerate @Nonnull @@ -217,8 +217,8 @@ public OpenAiChatCompletionRequest withStop( /** * Sets the parallel tool calls option. * - * @param parallelToolCalls Whether to allow parallel tool calls. - * @return A new instance with the specified option. + * @param parallelToolCalls whether to allow parallel tool calls. + * @return a new instance with the specified option. */ @Nonnull public OpenAiChatCompletionRequest withParallelToolCalls( @@ -251,8 +251,8 @@ public OpenAiChatCompletionRequest withParallelToolCalls( /** * Sets the log probabilities option. * - * @param logprobs Whether to include log probabilities in the response. - * @return A new instance with the specified option. + * @param logprobs whether to include log probabilities in the response. + * @return a new instance with the specified option. */ @Nonnull public OpenAiChatCompletionRequest withLogprobs(@Nonnull final Boolean logprobs) { @@ -305,7 +305,7 @@ public OpenAiChatCompletionRequest withToolChoice(@Nonnull final OpenAiToolChoic /** * Converts the request to a generated model class CreateChatCompletionRequest. * - * @return the CreateChatCompletionRequest + * @return the CreateChatCompletionRequest. */ CreateChatCompletionRequest createCreateChatCompletionRequest() { final var request = new CreateChatCompletionRequest(); diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionResponse.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionResponse.java index 2eb9b4a97..d68398fc5 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionResponse.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiChatCompletionResponse.java @@ -40,7 +40,7 @@ public class OpenAiChatCompletionResponse { /** * Gets the token usage from the original response. * - * @return the token usage + * @return the token usage. */ @Nonnull public CompletionUsage getTokenUsage() { @@ -50,7 +50,7 @@ public CompletionUsage getTokenUsage() { /** * Gets the first choice from the original response. * - * @return the first choice + * @return the first choice. */ @Nonnull public CreateChatCompletionResponseChoicesInner getChoice() { @@ -63,8 +63,8 @@ public CreateChatCompletionResponseChoicesInner getChoice() { *

The content may be empty {@code ""} if the assistant did not return any content i.e. when * tool calls are present. * - * @return the content of the first choice - * @throws OpenAiClientException if the content is filtered by the content filter + * @return the content of the first choice. + * @throws OpenAiClientException if the content is filtered by the content filter. */ @Nonnull public String getContent() { @@ -78,8 +78,8 @@ public String getContent() { /** * Gets the {@code OpenAiAssistantMessage} for the first choice. * - * @return the assistant message - * @throws OpenAiClientException if the content is filtered by the content filter + * @return the assistant message. + * @throws OpenAiClientException if the content is filtered by the content filter. * @since 1.6.0 */ @Nonnull diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClient.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClient.java index 056c8f6ed..b37a67cf1 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClient.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClient.java @@ -77,9 +77,9 @@ public static OpenAiClient forModel(@Nonnull final OpenAiModel foundationModel) } /** - * Creates and configures OpenAI Realtime API client + * Creates and configures OpenAI Realtime API client. * - * @return created client + * @return created client. */ @Nonnull public static OpenAiRealtimeClient realtimeClient() { @@ -117,9 +117,9 @@ private OpenAiClient withApiVersion(@Nonnull final String apiVersion) { * OpenAiClient.withCustomDestination(destination); * } * - * @param destination The specific {@link HttpDestination} to use. - * @see AiCoreService#getInferenceDestination(String) + * @param destination the specific {@link HttpDestination} to use. * @return a new OpenAI client. + * @see AiCoreService#getInferenceDestination(String) */ @Nonnull public static OpenAiClient withCustomDestination(@Nonnull final Destination destination) { @@ -135,11 +135,11 @@ public static OpenAiClient withCustomDestination(@Nonnull final Destination dest /** * Add a system prompt before user prompts. * - *

Note: The system prompt is ignored on chat completions invoked with + *

Note: The system prompt is ignored on chat completions invoked with * OpenAiChatCompletionPrompt. * - * @param systemPrompt the system prompt - * @return the client + * @param systemPrompt the system prompt. + * @return the client. */ @Nonnull public OpenAiClient withSystemPrompt(@Nonnull final String systemPrompt) { @@ -148,10 +148,10 @@ public OpenAiClient withSystemPrompt(@Nonnull final String systemPrompt) { } /** - * Create a new OpenAI client with a custom header added to every call made with this client + * Create a new OpenAI client with a custom header added to every call made with this client. * - * @param key the key of the custom header to add - * @param value the value of the custom header to add + * @param key the key of the custom header to add. + * @param value the value of the custom header to add. * @return a new client. * @since 1.11.0 */ @@ -166,9 +166,9 @@ public OpenAiClient withHeader(@Nonnull final String key, @Nonnull final String /** * Create a new openAI client with multiple custom headers added to every call made with this - * client + * client. * - * @param headers a map of key value pairs for the custom headers to add + * @param headers a map of key value pairs for the custom headers to add. * @return a new client. * @since 1.22.0 */ @@ -187,8 +187,8 @@ public OpenAiClient withHeaders(@Nonnull final Map headers) { * Generate a completion for the given string prompt as user. * * @param prompt a text message. - * @return the completion output - * @throws OpenAiClientException if the request fails + * @return the completion output. + * @throws OpenAiClientException if the request fails. * @deprecated Use {@link #chatCompletion(OpenAiChatCompletionRequest)} instead. */ @Nonnull @@ -207,8 +207,8 @@ public OpenAiChatCompletionOutput chatCompletion(@Nonnull final String prompt) * Generate a completion for the given conversation and request parameters. * * @param request the completion request. - * @return the completion output - * @throws OpenAiClientException if the request fails + * @return the completion output. + * @throws OpenAiClientException if the request fails. * @since 1.4.0 */ @Nonnull @@ -223,8 +223,8 @@ public OpenAiChatCompletionResponse chatCompletion( * Generate a completion for the given low-level request object. * * @param request the completion request. - * @return the completion output - * @throws OpenAiClientException if the request fails + * @return the completion output. + * @throws OpenAiClientException if the request fails. * @since 1.4.0 */ @Nonnull @@ -238,8 +238,8 @@ public CreateChatCompletionResponse chatCompletion( * Generate a completion for the given conversation and request parameters. * * @param parameters the completion request. - * @return the completion output - * @throws OpenAiClientException if the request fails + * @return the completion output. + * @throws OpenAiClientException if the request fails. * @deprecated Use {@link #chatCompletion(OpenAiChatCompletionRequest)} instead. */ @Nonnull @@ -273,8 +273,8 @@ public OpenAiChatCompletionOutput chatCompletion( * Stream#parallel()} on this stream is not supported. * * @param prompt a text message. - * @return A stream of text chunks - * @throws OpenAiClientException if the request fails or if the finish reason is content_filter + * @return a stream of text chunks. + * @throws OpenAiClientException if the request fails or if the finish reason is content_filter. * @see #streamChatCompletionDeltas(OpenAiChatCompletionRequest) */ @Nonnull @@ -323,9 +323,9 @@ private static void throwOnContentFilter(@Nonnull final OpenAiChatCompletionDelt * block until all chunks are consumed. Also, for obvious reasons, invoking {@link * Stream#parallel()} on this stream is not supported. * - * @param request The prompt, including a list of messages. - * @return A stream of message deltas - * @throws OpenAiClientException if the request fails or if the finish reason is content_filter + * @param request the prompt, including a list of messages. + * @return a stream of message deltas. + * @throws OpenAiClientException if the request fails or if the finish reason is content_filter. * @see #streamChatCompletion(String) * @since 1.4.0 */ @@ -339,9 +339,9 @@ public Stream streamChatCompletionDeltas( * Stream a completion for the given low-level request object. Returns a lazily populated * stream of delta objects. * - * @param request The completion request. - * @return A stream of message deltas - * @throws OpenAiClientException if the request fails or if the finish reason is content_filter + * @param request the completion request. + * @return a stream of message deltas. + * @throws OpenAiClientException if the request fails or if the finish reason is content_filter. * @see #streamChatCompletionDeltas(OpenAiChatCompletionRequest) for a higher-level API * @since 1.4.0 */ @@ -377,9 +377,9 @@ public Stream streamChatCompletionDeltas( * block until all chunks are consumed. Also, for obvious reasons, invoking {@link * Stream#parallel()} on this stream is not supported. * - * @param parameters The prompt, including a list of messages. - * @return A stream of message deltas - * @throws OpenAiClientException if the request fails or if the finish reason is content_filter + * @param parameters the prompt, including a list of messages. + * @return a stream of message deltas. + * @throws OpenAiClientException if the request fails or if the finish reason is content_filter. * @deprecated Use {@link #streamChatCompletionDeltas(OpenAiChatCompletionRequest)} instead. */ @Nonnull @@ -408,8 +408,8 @@ private void warnIfUnsupportedUsage() { * models and algorithms using high-level request object. * * @param request the request with input text. - * @return the embedding response convenience object - * @throws OpenAiClientException if the request fails + * @return the embedding response convenience object. + * @throws OpenAiClientException if the request fails. * @see #embedding(EmbeddingsCreateRequest) for full confgurability. * @since 1.4.0 */ @@ -423,8 +423,8 @@ public OpenAiEmbeddingResponse embedding(@Nonnull final OpenAiEmbeddingRequest r * Get a vector representation of a given inputs using low-level request. * * @param request the request with input text. - * @return the embedding output - * @throws OpenAiClientException if the request fails + * @return the embedding output. + * @throws OpenAiClientException if the request fails. * @see #embedding(OpenAiEmbeddingRequest) for conveninece api * @since 1.4.0 */ @@ -440,8 +440,8 @@ public EmbeddingsCreate200Response embedding(@Nonnull final EmbeddingsCreateRequ * models and algorithms. * * @param parameters the input text. - * @return the embedding output - * @throws OpenAiClientException if the request fails + * @return the embedding output. + * @throws OpenAiClientException if the request fails. */ @Nonnull @Deprecated diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClientException.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClientException.java index d9fb196d1..d409e5d24 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClientException.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiClientException.java @@ -16,7 +16,7 @@ public class OpenAiClientException extends ClientException { /** * Retrieves the {@link ErrorResponse} from the OpenAI service, if available. * - * @return The {@link ErrorResponse} object, or {@code null} if not available. + * @return the {@link ErrorResponse} object, or {@code null} if not available. */ @Nullable public ErrorResponse getErrorResponse() { diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiEmbeddingRequest.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiEmbeddingRequest.java index a7ce92325..a8a8b03c2 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiEmbeddingRequest.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiEmbeddingRequest.java @@ -23,7 +23,7 @@ public class OpenAiEmbeddingRequest { /** * Constructs an OpenAiEmbeddingRequest from a list of strings. * - * @param tokens a list of tokens to be embedded + * @param tokens a list of tokens to be embedded. */ public OpenAiEmbeddingRequest(@Nonnull final List tokens) { this.tokens = Collections.unmodifiableList(tokens); @@ -32,7 +32,7 @@ public OpenAiEmbeddingRequest(@Nonnull final List tokens) { /** * Converts this request to an EmbeddingsCreateRequest. * - * @return an EmbeddingsCreateRequest with the tokens to be embedded + * @return an EmbeddingsCreateRequest with the tokens to be embedded. */ @Nonnull EmbeddingsCreateRequest createEmbeddingsCreateRequest() { diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiEmbeddingResponse.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiEmbeddingResponse.java index dc6f260f4..4d13afc1b 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiEmbeddingResponse.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiEmbeddingResponse.java @@ -32,7 +32,7 @@ public class OpenAiEmbeddingResponse { /** * Read the embeddings from the response as a list of float arrays. * - * @return a list of float arrays + * @return a list of float arrays. */ @Nonnull public List getEmbeddingVectors() { diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiError.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiError.java index 3e7ef1652..b3782a3db 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiError.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiError.java @@ -23,7 +23,7 @@ public class OpenAiError implements ClientError { /** * Gets the error message from the contained original response. * - * @return the error message + * @return the error message. */ @Nonnull public String getMessage() { diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiImageItem.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiImageItem.java index 787315b62..20849e2d0 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiImageItem.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiImageItem.java @@ -6,8 +6,8 @@ /** * Represents an image item in a {@link OpenAiMessageContent} object. * - * @param imageUrl the URL of the image - * @param detailLevel the detail level of the image (optional) + * @param imageUrl the URL of the image. + * @param detailLevel the detail level of the image (optional). * @since 1.4.0 */ public record OpenAiImageItem(@Nonnull String imageUrl, @Nonnull DetailLevel detailLevel) @@ -16,7 +16,7 @@ public record OpenAiImageItem(@Nonnull String imageUrl, @Nonnull DetailLevel det /** * Creates a new image item with the given image URL. * - * @param imageUrl the URL of the image + * @param imageUrl the URL of the image. */ public OpenAiImageItem(@Nonnull final String imageUrl) { this(imageUrl, DetailLevel.AUTO); @@ -36,8 +36,8 @@ public enum DetailLevel { /** * Converts a string to a detail level. * - * @param str the string to convert - * @return the detail level + * @param str the string to convert. + * @return the detail level. */ @Nonnull static DetailLevel fromString(@Nonnull final String str) { @@ -45,9 +45,9 @@ static DetailLevel fromString(@Nonnull final String str) { } /** - * Get the string representation of the DetailLevel + * Get the string representation of the DetailLevel. * - * @return the DetailLevel as string + * @return the DetailLevel as string. */ @Nonnull public String toString() { diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiMessageContent.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiMessageContent.java index f89a94c66..4d704c7e4 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiMessageContent.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiMessageContent.java @@ -6,7 +6,7 @@ /** * Represents the content of a chat message. * - * @param items a list of the content items + * @param items a list of the content items. * @since 1.4.0 */ public record OpenAiMessageContent(@Nonnull List items) {} diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiModel.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiModel.java index 48764a7bd..6a8a34fc2 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiModel.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiModel.java @@ -11,81 +11,81 @@ * latest availability of OpenAI models in AI Core, please refer to SAP Availability of Generative AI Models . * - * @param name The name of the model. - * @param version The version of the model (optional). + * @param name the name of the model. + * @param version the version of the model (optional). */ public record OpenAiModel(@Nonnull String name, @Nullable String version) implements AiModel { - /** Azure OpenAI GPT-4o model */ + /** Azure OpenAI GPT-4o model. */ public static final OpenAiModel GPT_4O = new OpenAiModel("gpt-4o", null); - /** Azure OpenAI Text Embedding 3 Large model */ + /** Azure OpenAI Text Embedding 3 Large model. */ public static final OpenAiModel TEXT_EMBEDDING_3_LARGE = new OpenAiModel("text-embedding-3-large", null); - /** Azure OpenAI Text Embedding 3 Small model */ + /** Azure OpenAI Text Embedding 3 Small model. */ public static final OpenAiModel TEXT_EMBEDDING_3_SMALL = new OpenAiModel("text-embedding-3-small", null); - /** Azure OpenAI GPT-o4 Mini model */ + /** Azure OpenAI GPT-o4 Mini model. */ public static final OpenAiModel O4_MINI = new OpenAiModel("o4-mini", null); - /** Azure OpenAI GPT-o3 model */ + /** Azure OpenAI GPT-o3 model. */ public static final OpenAiModel O3 = new OpenAiModel("o3", null); - /** Azure OpenAI GPT-4.1 model */ + /** Azure OpenAI GPT-4.1 model. */ public static final OpenAiModel GPT_41 = new OpenAiModel("gpt-4.1", null); - /** Azure OpenAI GPT-4.1-nano model */ + /** Azure OpenAI GPT-4.1-nano model. */ public static final OpenAiModel GPT_41_NANO = new OpenAiModel("gpt-4.1-nano", null); - /** Azure OpenAI GPT-4.1-mini model */ + /** Azure OpenAI GPT-4.1-mini model. */ public static final OpenAiModel GPT_41_MINI = new OpenAiModel("gpt-4.1-mini", null); - /** Azure OpenAI GPT-5 model */ + /** Azure OpenAI GPT-5 model. */ public static final OpenAiModel GPT_5 = new OpenAiModel("gpt-5", null); - /** Azure OpenAI GPT-5-mini model */ + /** Azure OpenAI GPT-5-mini model. */ public static final OpenAiModel GPT_5_MINI = new OpenAiModel("gpt-5-mini", null); - /** Azure OpenAI GPT-5-nano model */ + /** Azure OpenAI GPT-5-nano model. */ public static final OpenAiModel GPT_5_NANO = new OpenAiModel("gpt-5-nano", null); - /** Azure OpenAI GPT-5.1 model */ + /** Azure OpenAI GPT-5.1 model. */ public static final OpenAiModel GPT_51 = new OpenAiModel("gpt-5.1", null); - /** Azure OpenAI GPT-realtime model */ + /** Azure OpenAI GPT-realtime model. */ public static final OpenAiModel GPT_REALTIME = new OpenAiModel("gpt-realtime", null); - /** Azure OpenAI GPT-5.2 model */ + /** Azure OpenAI GPT-5.2 model. */ public static final OpenAiModel GPT_52 = new OpenAiModel("gpt-5.2", null); - /** Azure OpenAI GPT-5.3-codex model */ + /** Azure OpenAI GPT-5.3-codex model. */ public static final OpenAiModel GPT_53_CODEX = new OpenAiModel("gpt-5.3-codex", null); - /** Azure OpenAI GPT-5.4 model */ + /** Azure OpenAI GPT-5.4 model. */ public static final OpenAiModel GPT_54 = new OpenAiModel("gpt-5.4", null); - /** Azure OpenAI GPT-5.4-nano model */ + /** Azure OpenAI GPT-5.4-nano model. */ public static final OpenAiModel GPT_54_NANO = new OpenAiModel("gpt-5.4-nano", null); - /** Azure OpenAI GPT-5.5 model */ + /** Azure OpenAI GPT-5.5 model. */ public static final OpenAiModel GPT_55 = new OpenAiModel("gpt-5.5", null); - /** Azure OpenAI GPT-5.6-luna model */ + /** Azure OpenAI GPT-5.6-luna model. */ public static final OpenAiModel GPT_56_LUNA = new OpenAiModel("gpt-5.6-luna", null); - /** Azure OpenAI GPT-5.6-sol model */ + /** Azure OpenAI GPT-5.6-sol model. */ public static final OpenAiModel GPT_56_SOL = new OpenAiModel("gpt-5.6-sol", null); - /** Azure OpenAI GPT-5.6-terra model */ + /** Azure OpenAI GPT-5.6-terra model. */ public static final OpenAiModel GPT_56_TERRA = new OpenAiModel("gpt-5.6-terra", null); /** * Create a new instance of OpenAiModel with the provided version. * - * @param version The version of the model. - * @return The new instance of OpenAiModel. + * @param version the version of the model. + * @return the new instance of OpenAiModel. */ @Nonnull public OpenAiModel withVersion(@Nonnull final String version) { diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiTextItem.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiTextItem.java index 03413b3af..267f45d26 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiTextItem.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiTextItem.java @@ -5,7 +5,7 @@ /** * Represents a text item in a {@link OpenAiMessageContent} object. * - * @param text the text of the item + * @param text the text of the item. * @since 1.4.0 */ public record OpenAiTextItem(@Nonnull String text) implements OpenAiContentItem {} diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiTool.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiTool.java index ba2382d1c..eede28a0d 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiTool.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiTool.java @@ -77,8 +77,8 @@ public class OpenAiTool { * Instantiates a OpenAiTool builder instance on behalf of an executable function. * * @param function the function to be executed. - * @return an OpenAiTool builder instance. * @param the type of the function input-argument class. + * @return an OpenAiTool builder instance. */ @Nonnull public static Builder1 forFunction(@Nonnull final Function function) { @@ -118,8 +118,8 @@ public interface Builder2 { /** * Sets the name of the function. * - * @param name the name of the function - * @return a new OpenAiTool instance with the specified name + * @param name the name of the function. + * @return a new OpenAiTool instance with the specified name. */ @Nonnull OpenAiTool withName(@Nonnull final String name); @@ -165,9 +165,9 @@ private static SchemaGenerator createSchemaGenerator() { * Returns a list of {@link OpenAiToolMessage} objects, each containing the execution result * encoded as a JSON string. * - * @param tools the list of tools to execute - * @param msg the assistant message containing a list of tool calls with arguments - * @return The list of tool messages with the results. + * @param tools the list of tools to execute. + * @param msg the assistant message containing a list of tool calls with arguments. + * @return the list of tool messages with the results. */ @Nonnull static List execute( @@ -186,8 +186,8 @@ static List execute( * Executes each tool call found in the specified assistant message using the provided tools. * Returns a map that links each executed tool call to its corresponding result. * - * @param tools the list of tools to execute - * @param msg the assistant message containing a list of tool calls with arguments + * @param tools the list of tools to execute. + * @param msg the assistant message containing a list of tool calls with arguments. * @return a map that contains the function calls and their respective tool results. */ @Nonnull diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiToolCall.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiToolCall.java index 71fbf3c9f..98be765f5 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiToolCall.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiToolCall.java @@ -11,10 +11,10 @@ public sealed interface OpenAiToolCall permits OpenAiFunctionCall { /** * Creates a new instance of {@link OpenAiToolCall}. * - * @param id The unique identifier for the tool call. - * @param name The name of the tool to be called. - * @param arguments The arguments for the tool call, encoded as a JSON string. - * @return A new instance of {@link OpenAiToolCall}. + * @param id the unique identifier for the tool call. + * @param name the name of the tool to be called. + * @param arguments the arguments for the tool call, encoded as a JSON string. + * @return a new instance of {@link OpenAiToolCall}. * @since 1.10.0 */ @Nonnull diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiUtils.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiUtils.java index 18d9b6e06..fb4e26492 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiUtils.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/OpenAiUtils.java @@ -10,7 +10,7 @@ /** * Utility class for handling OpenAI module. * - *

Only intended for internal usage within this SDK. + *

For internal use only. * * @since 1.4.0 */ @@ -19,9 +19,9 @@ class OpenAiUtils { /** * Converts an OpenAiMessage to a ChatCompletionRequestMessage. * - * @param message the OpenAiMessage to convert - * @return the corresponding ChatCompletionRequestMessage - * @throws IllegalArgumentException if the message type is unknown + * @param message the OpenAiMessage to convert. + * @return the corresponding ChatCompletionRequestMessage. + * @throws IllegalArgumentException if the message type is unknown. */ @Nonnull static ChatCompletionRequestMessage createChatCompletionRequestMessage( @@ -42,7 +42,7 @@ static ChatCompletionRequestMessage createChatCompletionRequestMessage( /** * Default object mapper used for JSON de-/serialization. * - * @return A new object mapper with the default configuration. + * @return a new object mapper with the default configuration. */ @Nonnull static ObjectMapper getOpenAiObjectMapper() { diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/TextInputChannel.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/TextInputChannel.java index f1d2dadd2..beaa6da22 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/TextInputChannel.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/TextInputChannel.java @@ -4,14 +4,14 @@ /** * Allows to input (send) text to the open channel, must be closed when not needed anymore (e.g. - * try-with-resources) + * try-with-resources). */ public interface TextInputChannel extends AutoCloseable { /** - * Sends input text + * Sends input text. * - * @param text text to send + * @param text text to send. */ void sendText(@Nonnull final String text); } diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiChatCompletionParameters.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiChatCompletionParameters.java index 63c7bbf89..5935501a5 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiChatCompletionParameters.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiChatCompletionParameters.java @@ -85,7 +85,7 @@ public class OpenAiChatCompletionParameters extends OpenAiCompletionParameters { @Nullable private ToolChoice toolChoice; - /** "response_format": { "type": "json_object" } */ + /** "response_format": { "type": "json_object" }. */ @JsonFormat(shape = JsonFormat.Shape.OBJECT) @RequiredArgsConstructor public enum ResponseFormat { @@ -136,7 +136,7 @@ public OpenAiChatCompletionParameters setToolChoiceAuto() { * Controls which (if any) function is called by the model. Specifying a particular function * forces the model to call that function. * - * @param functionName The name of the function to call. + * @param functionName the name of the function to call. * @return ${code this} instance for chaining. */ @Nonnull @@ -190,7 +190,7 @@ public OpenAiChatCompletionParameters setStop(@Nullable final String... values) /** * Add messages to the conversation. * - * @param messages The messages to add. + * @param messages the messages to add. * @return this instance for chaining. */ @Nonnull 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 d7bd94123..f58b8b1e4 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 @@ -44,7 +44,7 @@ public interface OpenAiChatMessage { /** * The role of the messages author. * - * @return The role of the messages author. + * @return the role of the messages author. */ @Nonnull String getRole(); @@ -52,7 +52,7 @@ public interface OpenAiChatMessage { /** * The contents of the message. * - * @return The contents of the message. + * @return the contents of the message. */ @Nullable Object getContent(); @@ -91,8 +91,8 @@ class OpenAiChatUserMessage implements OpenAiChatMessage { /** * Add text to the user message. * - * @param content The text content. - * @return The user message. + * @param content the text content. + * @return the user message. */ @Nonnull public OpenAiChatUserMessage addText(@Nonnull final String content) { @@ -103,8 +103,8 @@ public OpenAiChatUserMessage addText(@Nonnull final String content) { /** * Add an image to the user message. * - * @param content The image URL. - * @return The user message. + * @param content the image URL. + * @return the user message. */ @Nonnull public OpenAiChatUserMessage addImage(@Nonnull final String content) { @@ -114,9 +114,9 @@ public OpenAiChatUserMessage addImage(@Nonnull final String content) { /** * Add an image to the user message. * - * @param content The image URL. - * @param detail The detail level of the image. - * @return The user message. + * @param content the image URL. + * @param detail the detail level of the image. + * @return the user message. */ @Nonnull public OpenAiChatUserMessage addImage( @@ -128,8 +128,8 @@ public OpenAiChatUserMessage addImage( /** * Add images or text to the user message. * - * @param content The content(s) to add. - * @return The user message. + * @param content the content(s) to add. + * @return the user message. */ @Nonnull public OpenAiChatUserMessage addContent(@Nonnull final ContentPart... content) { @@ -148,7 +148,7 @@ public interface ContentPart { /** * Get the type of the content part. * - * @return The type of the content part as string. + * @return the type of the content part as string. */ @Nonnull String getType(); @@ -183,8 +183,8 @@ public static class ContentPartImage implements ContentPart { /** * Set the URL of the image. * - * @param url The URL of the image. - * @return The image URL. + * @param url the URL of the image. + * @return the image URL. */ @Nonnull public ContentPartImage setUrl(@Nonnull final String url) { @@ -194,9 +194,9 @@ public ContentPartImage setUrl(@Nonnull final String url) { /** * 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. + * @param url the URL of the image. + * @param detailLevel the detail level of the image. + * @return the image URL. */ @Nonnull public ContentPartImage setUrl( diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiCompletionParameters.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiCompletionParameters.java index 46c30bbbd..32f1238fc 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiCompletionParameters.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiCompletionParameters.java @@ -120,7 +120,7 @@ public class OpenAiCompletionParameters { @JsonProperty("stream_options") private OpenAiStreamOptions streamOptions; - /** "stream_options": { "include_usage": "true" } */ + /** "stream_options": { "include_usage": "true" }. */ @RequiredArgsConstructor @Setter @JsonFormat(shape = JsonFormat.Shape.OBJECT) @@ -153,7 +153,7 @@ public void enableStreaming() { * Up to four sequences where the API will stop generating further tokens. The returned text won't * contain the stop sequence. * - * @param values The stop sequences. + * @param values the stop sequences. * @return ${code this} instance for chaining. */ @Nonnull diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiEmbeddingParameters.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiEmbeddingParameters.java index 8aefa6197..4f8cb6323 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiEmbeddingParameters.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/model/OpenAiEmbeddingParameters.java @@ -47,7 +47,7 @@ public class OpenAiEmbeddingParameters { * newlines (\n) in your input with a single space, as we have observed inferior results when * newlines are present. * - * @param input Input text to get embeddings for, encoded as a string. + * @param input input text to get embeddings for, encoded as a string. * @return ${code this} instance for chaining. */ @Nonnull diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/AudioInputChannel.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/AudioInputChannel.java index 2f017c041..0638a4203 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/AudioInputChannel.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/AudioInputChannel.java @@ -1,18 +1,18 @@ package com.sap.ai.sdk.foundationmodels.openai.realtime; /** - * Functional interface representing audio input channel (used by audio data producer) + * Functional interface representing audio input channel (used by audio data producer). * - *

Should be closed by application (try-with-resources) when not needed anymore + *

Should be closed by application (try-with-resources) when not needed anymore. */ public interface AudioInputChannel extends AutoCloseable { /** * This method is sequentially invoked by audio data provider to supply implementer (consumer) * with the audio data. Exact audio format (encoding, sampling rate, etc.) depends on the usage - * context + * context. * - * @param rawBytesChunk binary data in the depending on the use case format + * @param rawBytesChunk binary data in the depending on the use case format. */ void inputAudio(byte[] rawBytesChunk); } diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/AudioOutputChannel.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/AudioOutputChannel.java index 4271e3f1a..5893e817c 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/AudioOutputChannel.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/AudioOutputChannel.java @@ -1,17 +1,17 @@ package com.sap.ai.sdk.foundationmodels.openai.realtime; -/** Functional interface representing audio output channel (audio data consumer) */ +/** Functional interface representing audio output channel (audio data consumer). */ public interface AudioOutputChannel { /** * This method is sequentially invoked by audio data provider to supply implementer (consumer) * with the audio data. Exact audio format (encoding, sampling rate, etc.) depends on the usage - * context + * context. * - * @param rawBytesChunk binary data in the depending on the use case format + * @param rawBytesChunk binary data in the depending on the use case format. * @param isLast true if this call logically concludes previous and this passed bytes data into a * single logical entity (e.g. gets called at the end when all byte parts of a single message - * get passed) + * get passed). */ void outputAudio(byte[] rawBytesChunk, boolean isLast); } diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/OpenAiRealtimeClient.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/OpenAiRealtimeClient.java index 116a52827..e476f6ba8 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/OpenAiRealtimeClient.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/OpenAiRealtimeClient.java @@ -9,7 +9,7 @@ /** * OpenAI client implementation of Realtime API. Abstracts technical implementation, transport and - * threading and exposes business-level operations (high level interface) + * threading and exposes business-level operations (high level interface). */ public class OpenAiRealtimeClient { @@ -19,16 +19,16 @@ public class OpenAiRealtimeClient { final Destination destination; /** - * Created OpenAI Realtime client for a specific destination + * Created OpenAI Realtime client for a specific destination. * - * @param destination - destination to use + * @param destination destination to use. */ public OpenAiRealtimeClient(@Nonnull final Destination destination) { this.destination = destination; } /** - * Creates a realtime channel allowing to input text and voice it (receive audio output) + * Creates a realtime channel allowing to input text and voice it (receive audio output). * *

The input channel should be used with a try-with-resources block to ensure that the * underlying connection is closed. @@ -42,17 +42,17 @@ public OpenAiRealtimeClient(@Nonnull final Destination destination) { * } * } * - * This API implements full duplex (input + output) communication channels. Application should + *

This API implements full duplex (input + output) communication channels. Application should * logically synchronize their state and close the input channel when it is appropriate (e.g. the * last part of the response has been received via the output channel and the application does not * need to send any other input). When the input channel is closed, the output channel will be * closed automatically and the output consumer will not be called anymore. * - * @param audioOutputConsumer - audio consumer of raw PCM mono 24000 Hz little endian output, 16 - * bit depth - * @param params - allows for various additional features (e.g. voice configuration or - * conversation turn recognition options) - * @return input channel, allowing for text input + * @param audioOutputConsumer audio consumer of raw PCM mono 24000 Hz little endian output, 16 bit + * depth. + * @param params allows for various additional features (e.g. voice configuration or conversation + * turn recognition options). + * @return input channel, allowing for text input. */ @Nonnull public TextInputChannel textToSpeech( @@ -77,17 +77,17 @@ public TextInputChannel textToSpeech( * } * } * - * This API implements full duplex (input + output) communication channels. An application should - * logically synchronize their state and close the input channel when it is appropriate (e.g. the - * last part of the response has been received via the output channel and the application does not - * need to send any other input). When the input channel is closed, the output channel will be - * closed automatically and the output consumer will not be called anymore. + *

This API implements full duplex (input + output) communication channels. An application + * should logically synchronize their state and close the input channel when it is appropriate + * (e.g. the last part of the response has been received via the output channel and the + * application does not need to send any other input). When the input channel is closed, the + * output channel will be closed automatically and the output consumer will not be called anymore. * - * @param audioOutputConsumer - audio consumer of raw PCM mono 24000 Hz little endian output, 16 - * bit depth - * @param params - optional configuration params + * @param audioOutputConsumer audio consumer of raw PCM mono 24000 Hz little endian output, 16 bit + * depth. + * @param params optional configuration params. * @return input channel, allowing for audio data input (bytes, PCM mono 24000 Hz little endian 16 - * bit) + * bit). */ @Nonnull public AudioInputChannel speechToSpeech( diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParam.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParam.java index f1ad5a6cd..e27a36c7a 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParam.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParam.java @@ -2,18 +2,18 @@ import javax.annotation.Nonnull; -/** Represents possible configuration params of realtime client Internal sdk usage only */ +/** Represents possible configuration params of realtime client. */ public abstract class RealtimeParam { - /** Represents configurable options */ + /** Represents configurable options. */ enum ParamName { - /** Voice name to use to produce sound */ + /** Voice name to use to produce sound. */ OUTPUT_VOICE, /** * How model will recognize that it is its turn to respond (e.g. explicitly asked, automatically - * detected) + * detected). */ TURN_DETECTION, - /** Override or specify system prompt given to a model */ + /** Override or specify system prompt given to a model. */ SYSTEM_PROMPT, } @@ -21,17 +21,17 @@ enum ParamName { RealtimeParam() {} /** - * Returns param name + * Returns param name. * - * @return name + * @return name. */ @Nonnull abstract ParamName getParamName(); /** - * Returns string value representation of the param + * Returns string value representation of the param. * - * @return string value + * @return string value. */ @Nonnull abstract String getValueAsString(); diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParamSystemPrompt.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParamSystemPrompt.java index b505b6483..5c141666a 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParamSystemPrompt.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParamSystemPrompt.java @@ -4,15 +4,15 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** Allows to configure model system prompt */ +/** Allows to configure model system prompt. */ public final class RealtimeParamSystemPrompt extends RealtimeParam { private final String systemPrompt; /** - * Constructs RealtimeParamSystemPrompt object + * Constructs RealtimeParamSystemPrompt object. * - * @param systemPrompt system prompt to use + * @param systemPrompt system prompt to use. */ public RealtimeParamSystemPrompt(@Nonnull final String systemPrompt) { this.systemPrompt = systemPrompt; diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParamTurnDetection.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParamTurnDetection.java index f1c8433da..18838f1ed 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParamTurnDetection.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParamTurnDetection.java @@ -7,7 +7,7 @@ /** Allows to configure turn detection (how model responds). */ public final class RealtimeParamTurnDetection extends RealtimeParam { - /** Model tries to recognize if/when it should respond automatically */ + /** Model tries to recognize if/when it should respond automatically. */ public static final RealtimeParamTurnDetection BY_MODEL_AUTO = new RealtimeParamTurnDetection("BY_MODEL_AUTO"); diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParamVoice.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParamVoice.java index eb7464550..9e15373bf 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParamVoice.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/RealtimeParamVoice.java @@ -5,13 +5,13 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** Allows to configure model output voice */ +/** Allows to configure model output voice. */ public final class RealtimeParamVoice extends RealtimeParam { - /** Standard voice 1 */ + /** Standard voice 1. */ public static final RealtimeParamVoice DEFAULT_1 = new RealtimeParamVoice("DEFAULT_1"); - /** Standard voice 2 */ + /** Standard voice 2. */ public static final RealtimeParamVoice DEFAULT_2 = new RealtimeParamVoice("DEFAULT_2"); private final String voice; @@ -24,10 +24,10 @@ public final class RealtimeParamVoice extends RealtimeParam { * Allows to configure raw voice name as named by model provider. Unsafe because SDK cannot verify * in advance if the provided voice name is correct and supported by the chosen model and use case * NOTE: this method does not check voice name and incorrect input may produce runtime exceptions - * (unsafe) + * (unsafe). * - * @param voiceName as named by model provider - * @return typed voice client configuration param + * @param voiceName as named by model provider. + * @return typed voice client configuration param. */ @Nonnull @Beta diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/ToAudioRealtimeClient.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/ToAudioRealtimeClient.java index b318e3983..91ba97f31 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/ToAudioRealtimeClient.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/realtime/ToAudioRealtimeClient.java @@ -21,7 +21,7 @@ import javax.annotation.Nonnull; import lombok.extern.slf4j.Slf4j; -/** Implements common functionality for realtime api clients that output audio */ +/** Implements common functionality for realtime api clients that output audio. */ @Slf4j abstract class ToAudioRealtimeClient extends WSOpenAiRealtimeClient { @@ -40,20 +40,20 @@ abstract class ToAudioRealtimeClient extends WSOpenAiRealtimeClient { final AudioOutputChannel outputConsumer; final RealtimeAudioConfigOutput.Voice.UnionMember1 voice; - /** defines if every call to the client should be considered conversation turn */ + /** Defines if every call to the client should be considered conversation turn. */ protected final boolean eagerTurnDetection; final String systemPrompt; /** - * Constructs the object + * Constructs the object. * - * @param url - realtime api endpoint url - * @param httpHeaders - http headers (key - value) for client to use - * @param outputConsumer - consumer of audio bytes in pcm 24000 Hz mono little endian format - * @param defaultTurnDetectionEager - if explicit cfg for turn detection was not specified, this - * turn detection eagerness flag will be used (true results in EACH_CALL_IS_A_TURN handling) - * @param params - possible overrides for default params (e.g. voice, system prompt, etc.) + * @param url realtime api endpoint url. + * @param httpHeaders http headers (key - value) for client to use. + * @param outputConsumer consumer of audio bytes in pcm 24000 Hz mono little endian format. + * @param defaultTurnDetectionEager if explicit cfg for turn detection was not specified, this + * turn detection eagerness flag will be used (true results in EACH_CALL_IS_A_TURN handling). + * @param params possible overrides for default params (e.g. voice, system prompt, etc.). */ public ToAudioRealtimeClient( @Nonnull final String url, diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/spring/OpenAiChatModel.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/spring/OpenAiChatModel.java index 22a998ad4..24edd42f9 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/spring/OpenAiChatModel.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/spring/OpenAiChatModel.java @@ -171,9 +171,9 @@ private static Generation toGeneration( /** * Adds options to the request. * - * @param request the request to modify - * @param options the options to extract - * @return the modified request with options applied + * @param request the request to modify. + * @param options the options to extract. + * @return the modified request with options applied. */ @Nonnull protected static OpenAiChatCompletionRequest extractOptions( diff --git a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/spring/OpenAiSpringEmbeddingModel.java b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/spring/OpenAiSpringEmbeddingModel.java index 68acd0f90..d059fd211 100644 --- a/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/spring/OpenAiSpringEmbeddingModel.java +++ b/foundation-models/openai/src/main/java/com/sap/ai/sdk/foundationmodels/openai/spring/OpenAiSpringEmbeddingModel.java @@ -35,7 +35,7 @@ public class OpenAiSpringEmbeddingModel implements EmbeddingModel { * Constructs an {@code OpenAiSpringEmbeddingModel} with the specified {@link OpenAiClient} of * some model. * - * @param client the OpenAI client + * @param client the OpenAI client. */ public OpenAiSpringEmbeddingModel(@Nonnull final OpenAiClient client) { this(client, MetadataMode.EMBED); @@ -49,8 +49,8 @@ public OpenAiSpringEmbeddingModel(@Nonnull final OpenAiClient client) { * resulting content. Currently, the formatter is only effective for calls to {@link * #embed(Document)}. * - * @param client the OpenAI client - * @param metadataMode the metadata mode + * @param client the OpenAI client. + * @param metadataMode the metadata mode. */ public OpenAiSpringEmbeddingModel( @Nonnull final OpenAiClient client, @Nonnull final MetadataMode metadataMode) { diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java index 66e2e6e2a..213e2a463 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptClient.java @@ -38,9 +38,9 @@ public class RptClient { /** * Creates a new RptClient for the specified foundation model. * - * @param foundationModel The foundation model to use. - * @return A new instance of RptClient. - * @throws DeploymentResolutionException If there is an error resolving the deployment. + * @param foundationModel the foundation model to use. + * @return a new instance of RptClient. + * @throws DeploymentResolutionException if there is an error resolving the deployment. */ @Nonnull public static RptClient forModel(@Nonnull final RptModel foundationModel) @@ -53,8 +53,8 @@ public static RptClient forModel(@Nonnull final RptModel foundationModel) /** * Creates a new RptClient for the specified destination. * - * @param destination The destination to use. - * @return A new instance of RptClient. + * @param destination the destination to use. + * @return a new instance of RptClient. */ static RptClient forDestination( @Nonnull final Destination destination, final boolean contextModePossible) { @@ -77,8 +77,8 @@ static RptClient forDestination( * *

500 - Internal Server Error * - * @param requestBody The prediction request - * @return prediction response from the RPT model + * @param requestBody the prediction request. + * @return prediction response from the RPT model. * @apiNote When used with a model that does not support it, the {@code contextMode} field of the * embedded {@link com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictionConfig} is * set to {@code null} on the passed-in object as a side effect. @@ -117,9 +117,9 @@ private static PredictionConfig configFrom(@Nonnull final PredictRequestPayload * *

500 - Internal Server Error * - * @param parquetFile Parquet file - * @param predictionConfig The prediction configuration - * @return prediction response from the RPT model + * @param parquetFile Parquet file. + * @param predictionConfig the prediction configuration. + * @return prediction response from the RPT model. * @apiNote When used with a model that does not support it, the {@code contextMode} field of the * passed-in {@link com.sap.ai.sdk.foundationmodels.rpt.generated.model.PredictionConfig} is * set to {@code null} as a side effect. diff --git a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptModel.java b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptModel.java index bfc99d5fc..19e44583e 100644 --- a/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptModel.java +++ b/foundation-models/sap-rpt/src/main/java/com/sap/ai/sdk/foundationmodels/rpt/RptModel.java @@ -7,8 +7,8 @@ /** * Represents an SAP Relational Pre-trained Transformer foundation model. * - * @param name The name of the model. - * @param version The version of the model (optional). + * @param name the name of the model. + * @param version the version of the model (optional). * @since 1.16.0 */ public record RptModel(@Nonnull String name, @Nullable String version) implements AiModel { @@ -34,8 +34,8 @@ public record RptModel(@Nonnull String name, @Nullable String version) implement /** * Create a new instance of RptModel with the provided version. * - * @param version The version of the model. - * @return The new instance of RptModel. + * @param version the version of the model. + * @return the new instance of RptModel. */ @Nonnull public RptModel withVersion(@Nonnull final String version) { diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/AssistantMessage.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/AssistantMessage.java index 750ac330a..552deba99 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/AssistantMessage.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/AssistantMessage.java @@ -44,7 +44,7 @@ public class AssistantMessage extends Message { /** * Creates a new assistant message with the given tool calls. * - * @param toolCalls list of tool call objects + * @param toolCalls list of tool call objects. */ AssistantMessage(@Nonnull final List toolCalls) { content = new MessageContent(List.of()); diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/CacheControl.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/CacheControl.java index 99b9cc2c4..1aee0815c 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/CacheControl.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/CacheControl.java @@ -3,15 +3,15 @@ import javax.annotation.Nonnull; import lombok.Getter; -/** Represents CacheControl object, used in prompt caching API */ +/** Represents CacheControl object, used in prompt caching API. */ @Getter public final class CacheControl { private final String ttl; /** - * Constructs cache control object with a ttl + * Constructs cache control object with a ttl. * - * @param ttl time to live for the cache + * @param ttl time to live for the cache. */ public CacheControl(@Nonnull final String ttl) { this.ttl = ttl; diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/CacheablePrompt.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/CacheablePrompt.java index 828ded814..de8cc0ff0 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/CacheablePrompt.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/CacheablePrompt.java @@ -2,13 +2,13 @@ import javax.annotation.Nullable; -/** Prompt objects supporting caching may implement this interface */ +/** Prompt objects supporting caching may implement this interface. */ public sealed interface CacheablePrompt permits TextItem { /** - * Returns cache control for a given cacheable prompt (if set) + * Returns cache control for a given cacheable prompt (if set). * - * @return cacheControl, nullable + * @return the cache control, or {@code null} if not set. */ @Nullable CacheControl getCacheControl(); diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/DpiMasking.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/DpiMasking.java index d6b72eded..a09707e0d 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/DpiMasking.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/DpiMasking.java @@ -43,7 +43,7 @@ public class DpiMasking extends MaskingProvider { /** * Build a configuration applying anonymization. * - * @return A builder configured for anonymization + * @return a builder configured for anonymization. */ @Nonnull public static Builder anonymization() { @@ -53,7 +53,7 @@ public static Builder anonymization() { /** * Build a configuration applying pseudonymization. * - * @return A builder configured for pseudonymization + * @return a builder configured for pseudonymization. */ @Nonnull public static Builder pseudonymization() { @@ -71,9 +71,9 @@ public static class Builder { /** * Specifies which entities should be masked in the input text. * - * @param entity An entity type to mask (required) - * @param entities Additional entity types to mask (optional) - * @return A new {@link DpiMasking} instance + * @param entity an entity type to mask (required). + * @param entities additional entity types to mask (optional). + * @return a new {@link DpiMasking} instance. * @see DPIEntities */ @Nonnull @@ -90,9 +90,9 @@ public DpiMasking withEntities( /** * Adds a custom regex pattern for masking. * - * @param regex The regex pattern to match - * @param replacement The replacement string - * @return A new {@link DpiMasking} instance + * @param regex the regex pattern to match. + * @param replacement the replacement string. + * @return a new {@link DpiMasking} instance. */ @Nonnull public DpiMasking withRegex(@Nonnull final String regex, @Nonnull final String replacement) { @@ -111,9 +111,9 @@ public DpiMasking withRegex(@Nonnull final String regex, @Nonnull final String r /** * Specifies a custom regex pattern for masking. * - * @param regex The regex pattern to match - * @param replacement The replacement string - * @return A new {@link DpiMasking} instance + * @param regex the regex pattern to match. + * @param replacement the replacement string. + * @return a new {@link DpiMasking} instance. */ @Nonnull public DpiMasking withRegex(@Nonnull final String regex, @Nonnull final String replacement) { @@ -132,8 +132,8 @@ public DpiMasking withRegex(@Nonnull final String regex, @Nonnull final String r /** * Set words that should not be masked. * - * @param allowList List of strings that should not be masked - * @return A new {@link DpiMasking} instance + * @param allowList list of strings that should not be masked. + * @return a new {@link DpiMasking} instance. */ @Nonnull public DpiMasking withAllowList(@Nonnull final List allowList) { diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/EmbeddingDeserializer.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/EmbeddingDeserializer.java index 8b7d472b5..f5f3d449f 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/EmbeddingDeserializer.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/EmbeddingDeserializer.java @@ -18,7 +18,7 @@ class EmbeddingDeserializer extends JsonDeserializer { /** * Deserializes JSON into the appropriate {@link Embedding} implementation based on the JSON - * structure: + * structure. * *

    *
  • JSON array → {@link Embedding.ArrayOfFloats} @@ -26,11 +26,11 @@ class EmbeddingDeserializer extends JsonDeserializer { *
  • JSON object → {@link Embedding.InnerEmbeddingMultiFormat} *
* - * @param jsonParser The parser providing the JSON. - * @param deserializationContext The deserialization context. - * @return The deserialized {@link Embedding} object. - * @throws JsonMappingException If the JSON structure is not recognized or deserialization fails. - * @throws IOException If JSON content cannot be consumed. + * @param jsonParser the parser providing the JSON. + * @param deserializationContext the deserialization context. + * @return the deserialized {@link Embedding} object. + * @throws JsonMappingException if the JSON structure is not recognized or deserialization fails. + * @throws IOException if JSON content cannot be consumed. */ @Nonnull @Override diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/FileItem.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/FileItem.java index 90c3c89f0..5895b50b0 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/FileItem.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/FileItem.java @@ -6,8 +6,8 @@ /** * Represents a file item in a {@link MessageContent} object. * - * @param fileData base64 encoded file content - * @param filename optional name of the file + * @param fileData base64 encoded file content. + * @param filename optional name of the file. * @since 1.18.0 */ public record FileItem(@Nonnull String fileData, @Nullable String filename) diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/Grounding.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/Grounding.java index 04aea5d8c..f55a98db6 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/Grounding.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/Grounding.java @@ -40,7 +40,7 @@ public class Grounding extends GroundingProvider { * *

It is by default a document grounding service with a vector data repository. * - * @return The grounding provider. + * @return the grounding provider. */ @Nonnull public static Grounding create() { @@ -50,8 +50,8 @@ public static Grounding create() { /** * Set filters for grounding. * - * @param filters List of filters to set. - * @return The modified grounding configuration. + * @param filters list of filters to set. + * @return the modified grounding configuration. */ @Nonnull @SuppressWarnings("PMD.PublicApiExposesModelType") @@ -65,8 +65,8 @@ public Grounding filters(@Nonnull final GroundingModuleConfigConfigFiltersInner. /** * Set which metadataParams are used in the grounding response. * - * @param metadataParams List of metadataParams to set. - * @return The modified grounding configuration. + * @param metadataParams list of metadataParams to set. + * @return the modified grounding configuration. * @since 1.13.0 */ @Nonnull @@ -81,8 +81,8 @@ public Grounding metadataParams(@Nonnull final String... metadataParams) { *

It uses the inputParams {@code userMessage} for the user message and {@code * groundingContext} for the grounding context. * - * @param message The user message. - * @return The prompt with grounding. + * @param message the user message. + * @return the prompt with grounding. */ @Nonnull public OrchestrationPrompt createGroundingPrompt(@Nonnull final String message) { diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/GroundingProvider.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/GroundingProvider.java index cf0b45d7b..dfd5c2d37 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/GroundingProvider.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/GroundingProvider.java @@ -20,7 +20,7 @@ public abstract class GroundingProvider { /** * Create a grounding configuration. * - * @return the grounding configuration + * @return the grounding configuration. */ @Nonnull abstract GroundingModuleConfig createConfig(); diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ImageItem.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ImageItem.java index dfec057b0..b84b2de5f 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ImageItem.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ImageItem.java @@ -6,8 +6,8 @@ /** * Represents an image item in a {@link MessageContent} object. * - * @param imageUrl the URL of the image - * @param detailLevel the detail level of the image (optional) + * @param imageUrl the URL of the image. + * @param detailLevel the detail level of the image (optional). * @since 1.3.0 */ public record ImageItem(@Nonnull String imageUrl, @Nonnull DetailLevel detailLevel) @@ -16,7 +16,7 @@ public record ImageItem(@Nonnull String imageUrl, @Nonnull DetailLevel detailLev /** * Creates a new image item with the given image URL. * - * @param imageUrl the URL of the image + * @param imageUrl the URL of the image. * @since 1.3.0 */ public ImageItem(@Nonnull final String imageUrl) { @@ -41,8 +41,8 @@ public enum DetailLevel { /** * Converts a string to a detail level. * - * @param str the string to convert - * @return the detail level + * @param str the string to convert. + * @return the detail level. * @since 1.3.0 */ @Nonnull @@ -51,9 +51,9 @@ static DetailLevel fromString(@Nonnull final String str) { } /** - * Get the string representation of the DetailLevel + * Get the string representation of the DetailLevel. * - * @return the DetailLevel as string + * @return the DetailLevel as string. * @since 1.3.0 */ @Nonnull diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/JacksonMixins.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/JacksonMixins.java index 027c03f88..9bbb160ab 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/JacksonMixins.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/JacksonMixins.java @@ -64,7 +64,7 @@ interface ChatMessageMixin {} /** * Mixin used for parsing response "data" field of - * error.intermediate_results.input_filtering.data.azure_content_safety + * error.intermediate_results.input_filtering.data.azure_content_safety. */ abstract static class AzureContentSafetyCaseAgnostic { @JsonProperty("hate") diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/MaskingProvider.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/MaskingProvider.java index 10e5d52aa..37dc5ad48 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/MaskingProvider.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/MaskingProvider.java @@ -20,7 +20,7 @@ public abstract class MaskingProvider { /** * Create a masking configuration. * - * @return the masking configuration + * @return the masking configuration. */ @Nonnull abstract DPIConfig createConfig(); diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/Message.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/Message.java index ae3f37548..b1d7127af 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/Message.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/Message.java @@ -32,10 +32,10 @@ public static UserMessage user(@Nonnull final String message) { /** * A convenience method to create a user message from a string. * - * @since 1.23.0 * @param message the message content. - * @param cacheControl cache checkpoint configuration + * @param cacheControl cache checkpoint configuration. * @return the user message. + * @since 1.23.0 */ @Nonnull public static UserMessage user( @@ -91,12 +91,12 @@ public static SystemMessage system(@Nonnull final String message) { /** * A convenience method to create a system message from a string allowing to configure cache - * checkpoint + * checkpoint. * + * @param message the message content. + * @param cacheControl optional cache checkpoint configuration. + * @return the system message. * @since 1.23.0 - * @param message the message content - * @param cacheControl optional cache checkpoint configuration - * @return the system message */ @Nonnull public static SystemMessage system( diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/MessageContent.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/MessageContent.java index 9e831592b..ff86ca2d5 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/MessageContent.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/MessageContent.java @@ -11,7 +11,7 @@ /** * Represents the content of a chat message. * - * @param items a list of the content items + * @param items a list of the content items. * @since 1.3.0 */ public record MessageContent(@Nonnull List items) { diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ModelPromptCachingSupport.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ModelPromptCachingSupport.java index 111d020e8..8233453aa 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ModelPromptCachingSupport.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ModelPromptCachingSupport.java @@ -8,7 +8,7 @@ import javax.annotation.Nullable; import lombok.Getter; -/** Describes supported caching properties of a model */ +/** Describes supported caching properties of a model. */ class ModelPromptCachingSupport { private static final ModelPromptCachingSupport NOT_SUPPORTED = @@ -45,16 +45,16 @@ class ModelPromptCachingSupport { } }); - /** Caching checkpoint can only be made for so few prompt input tokens and not fewer */ + /** Caching checkpoint can only be made for so few prompt input tokens and not fewer. */ @Getter private final int minTokensPerCheckpoint; - /** Only up to this number of caching points can be created per request */ + /** Only up to this number of caching points can be created per request. */ @Getter private final int maxCheckpointsPerRequest; - /** Pattern of supported TTL values, which can be passed */ + /** Pattern of supported TTL values, which can be passed. */ private final Pattern supportedTTLValues; - /** Caching TTL value to use if TTL has not been explicitly specified */ + /** Caching TTL value to use if TTL has not been explicitly specified. */ @Getter private final String defaultTTLValue; private ModelPromptCachingSupport( @@ -70,10 +70,10 @@ private ModelPromptCachingSupport( /** * Factory method, returns instance of PromptCachingConfig with possible caching configurations. - * If model does not support caching, a special instance will be returned + * If model does not support caching, a special instance will be returned. * - * @param modelName - model name to use - * @return model prompt caching configuration + * @param modelName model name to use. + * @return model prompt caching configuration. */ @Nonnull static ModelPromptCachingSupport forModel(@Nullable final String modelName) { @@ -85,10 +85,10 @@ static ModelPromptCachingSupport forModel(@Nullable final String modelName) { /** * Factory method, returns instance of PromptCachingConfig with possible caching configurations. - * If model does not support caching, a special instance will be returned + * If model does not support caching, a special instance will be returned. * - * @param model - model to use - * @return model prompt caching configuration + * @param model model to use. + * @return model prompt caching configuration. */ @Nonnull static ModelPromptCachingSupport forModel(@Nonnull final OrchestrationAiModel model) { @@ -96,9 +96,9 @@ static ModelPromptCachingSupport forModel(@Nonnull final OrchestrationAiModel mo } /** - * Explicit "no caching" configuration + * Explicit "no caching" configuration. * - * @return "no caching" prompt caching configuration + * @return "no caching" prompt caching configuration. */ @Nonnull static ModelPromptCachingSupport noCaching() { @@ -106,10 +106,10 @@ static ModelPromptCachingSupport noCaching() { } /** - * Checks if passed ttl value correct and supported + * Checks if passed ttl value correct and supported. * - * @param ttlValue ttl value to check - * @return true if ttlValue is supported, else false + * @param ttlValue ttl value to check. + * @return true if ttlValue is supported, else false. */ boolean supportsTTLValue(final String ttlValue) { return supportedTTLValues.matcher(ttlValue).matches(); diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationAiModel.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationAiModel.java index 075dd3be1..67863b111 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationAiModel.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationAiModel.java @@ -21,7 +21,7 @@ @With @AllArgsConstructor public class OrchestrationAiModel { - /** The name of the model */ + /** The name of the model. */ String name; /** @@ -43,190 +43,190 @@ public class OrchestrationAiModel { /** The version of the model, defaults to "latest". */ String version; - /** MistralAI Mistral Medium Instruct model */ + /** MistralAI Mistral Medium Instruct model. */ public static final OrchestrationAiModel MISTRAL_MEDIUM_INSTRUCT = new OrchestrationAiModel("mistralai--mistral-medium-instruct"); - /** MistralAI Mistral Small model */ + /** MistralAI Mistral Small model. */ public static final OrchestrationAiModel MISTRAL_SMALL = new OrchestrationAiModel("mistralai--mistral-small"); - /** MistralAI Mistral Medium model */ + /** MistralAI Mistral Medium model. */ public static final OrchestrationAiModel MISTRAL_MEDIUM = new OrchestrationAiModel("mistralai--mistral-medium"); - /** Meta Llama Cinderella DN model */ + /** Meta Llama Cinderella DN model. */ public static final OrchestrationAiModel LLAMA_CINDERELLA_DN = new OrchestrationAiModel("llama-cinderella-dn"); - /** Cohere Command a Reasoning model */ + /** Cohere Command a Reasoning model. */ public static final OrchestrationAiModel COHERE_COMMAND_A_REASONING = new OrchestrationAiModel("cohere--command-a-reasoning"); - /** Anthropic Claude 4 Opus model */ + /** Anthropic Claude 4 Opus model. */ public static final OrchestrationAiModel CLAUDE_4_OPUS = new OrchestrationAiModel("anthropic--claude-4-opus"); - /** Anthropic Claude 4.5 Opus model */ + /** Anthropic Claude 4.5 Opus model. */ public static final OrchestrationAiModel CLAUDE_4_5_OPUS = new OrchestrationAiModel("anthropic--claude-4.5-opus"); - /** Anthropic Claude 4.5 Sonnet model */ + /** Anthropic Claude 4.5 Sonnet model. */ public static final OrchestrationAiModel CLAUDE_4_5_SONNET = new OrchestrationAiModel("anthropic--claude-4.5-sonnet"); - /** Anthropic Claude 4.5 Haiku model */ + /** Anthropic Claude 4.5 Haiku model. */ public static final OrchestrationAiModel CLAUDE_4_5_HAIKU = new OrchestrationAiModel("anthropic--claude-4.5-haiku"); - /** Anthropic Claude 4.6 Opus model */ + /** Anthropic Claude 4.6 Opus model. */ public static final OrchestrationAiModel CLAUDE_4_6_OPUS = new OrchestrationAiModel("anthropic--claude-4.6-opus"); - /** Anthropic Claude 4.6 Sonnet model */ + /** Anthropic Claude 4.6 Sonnet model. */ public static final OrchestrationAiModel CLAUDE_4_6_SONNET = new OrchestrationAiModel("anthropic--claude-4.6-sonnet"); - /** Anthropic Claude 4.7 Opus model */ + /** Anthropic Claude 4.7 Opus model. */ public static final OrchestrationAiModel CLAUDE_4_7_OPUS = new OrchestrationAiModel("anthropic--claude-4.7-opus"); - /** Anthropic Claude 4.8 Opus model */ + /** Anthropic Claude 4.8 Opus model. */ public static final OrchestrationAiModel CLAUDE_4_8_OPUS = new OrchestrationAiModel("anthropic--claude-4.8-opus"); - /** Amazon Nova Pro model */ + /** Amazon Nova Pro model. */ public static final OrchestrationAiModel NOVA_PRO = new OrchestrationAiModel("amazon--nova-pro"); - /** Amazon Nova Lite model */ + /** Amazon Nova Lite model. */ public static final OrchestrationAiModel NOVA_LITE = new OrchestrationAiModel("amazon--nova-lite"); - /** Amazon Nova Micro model */ + /** Amazon Nova Micro model. */ public static final OrchestrationAiModel NOVA_MICRO = new OrchestrationAiModel("amazon--nova-micro"); - /** Amazon Nova Premier model */ + /** Amazon Nova Premier model. */ public static final OrchestrationAiModel NOVA_PREMIER = new OrchestrationAiModel("amazon--nova-premier"); - /** Azure OpenAI GPT-4.1-mini model */ + /** Azure OpenAI GPT-4.1-mini model. */ public static final OrchestrationAiModel GPT_41_MINI = new OrchestrationAiModel("gpt-4.1-mini"); - /** Azure OpenAI GPT-4.1 model */ + /** Azure OpenAI GPT-4.1 model. */ public static final OrchestrationAiModel GPT_41 = new OrchestrationAiModel("gpt-4.1"); - /** Azure OpenAI GPT-4.1-nano model */ + /** Azure OpenAI GPT-4.1-nano model. */ public static final OrchestrationAiModel GPT_41_NANO = new OrchestrationAiModel("gpt-4.1-nano"); - /** Azure OpenAI GPT-4o model */ + /** Azure OpenAI GPT-4o model. */ public static final OrchestrationAiModel GPT_4O = new OrchestrationAiModel("gpt-4o"); - /** Azure OpenAI o4-mini model */ + /** Azure OpenAI o4-mini model. */ public static final OrchestrationAiModel OPENAI_O4_MINI = new OrchestrationAiModel("o4-mini"); - /** Azure OpenAI o3 model */ + /** Azure OpenAI o3 model. */ public static final OrchestrationAiModel OPENAI_O3 = new OrchestrationAiModel("o3"); - /** Azure OpenAI GPT-5 model */ + /** Azure OpenAI GPT-5 model. */ public static final OrchestrationAiModel GPT_5 = new OrchestrationAiModel("gpt-5"); - /** Azure OpenAI GPT-5-mini model */ + /** Azure OpenAI GPT-5-mini model. */ public static final OrchestrationAiModel GPT_5_MINI = new OrchestrationAiModel("gpt-5-mini"); - /** Azure OpenAI GPT-5-nano model */ + /** Azure OpenAI GPT-5-nano model. */ public static final OrchestrationAiModel GPT_5_NANO = new OrchestrationAiModel("gpt-5-nano"); - /** Azure OpenAI GPT-5.1 model */ + /** Azure OpenAI GPT-5.1 model. */ public static final OrchestrationAiModel GPT_51 = new OrchestrationAiModel("gpt-5.1"); - /** Azure OpenAI GPT-5.2 model */ + /** Azure OpenAI GPT-5.2 model. */ public static final OrchestrationAiModel GPT_52 = new OrchestrationAiModel("gpt-5.2"); - /** Azure OpenAI GPT-5.3-codex model */ + /** Azure OpenAI GPT-5.3-codex model. */ public static final OrchestrationAiModel GPT_53_CODEX = new OrchestrationAiModel("gpt-5.3-codex"); - /** Azure OpenAI GPT-5.4 model */ + /** Azure OpenAI GPT-5.4 model. */ public static final OrchestrationAiModel GPT_54 = new OrchestrationAiModel("gpt-5.4"); - /** Azure OpenAI GPT-5.4-nano model */ + /** Azure OpenAI GPT-5.4-nano model. */ public static final OrchestrationAiModel GPT_54_NANO = new OrchestrationAiModel("gpt-5.4-nano"); - /** Azure OpenAI GPT-5.5 model */ + /** Azure OpenAI GPT-5.5 model. */ public static final OrchestrationAiModel GPT_55 = new OrchestrationAiModel("gpt-5.5"); - /** Azure OpenAI GPT-5.6-sol model */ + /** Azure OpenAI GPT-5.6-sol model. */ public static final OrchestrationAiModel GPT_56_SOL = new OrchestrationAiModel("gpt-5.6-sol"); - /** Azure OpenAI GPT-5.6-luna model */ + /** Azure OpenAI GPT-5.6-luna model. */ public static final OrchestrationAiModel GPT_56_LUNA = new OrchestrationAiModel("gpt-5.6-luna"); - /** Azure OpenAI GPT-5.6-terra model */ + /** Azure OpenAI GPT-5.6-terra model. */ public static final OrchestrationAiModel GPT_56_TERRA = new OrchestrationAiModel("gpt-5.6-terra"); - /** Google Cloud Platform Gemini 2.5 Flash model */ + /** Google Cloud Platform Gemini 2.5 Flash model. */ public static final OrchestrationAiModel GEMINI_2_5_FLASH = new OrchestrationAiModel("gemini-2.5-flash"); - /** Google Cloud Platform Gemini 2.5 Flash Lite model */ + /** Google Cloud Platform Gemini 2.5 Flash Lite model. */ public static final OrchestrationAiModel GEMINI_2_5_FLASH_LITE = new OrchestrationAiModel("gemini-2.5-flash-lite"); - /** Google Cloud Platform Gemini 2.5 Pro model */ + /** Google Cloud Platform Gemini 2.5 Pro model. */ public static final OrchestrationAiModel GEMINI_2_5_PRO = new OrchestrationAiModel("gemini-2.5-pro"); - /** Google Cloud Platform Gemini 3.1 Flash Lite model */ + /** Google Cloud Platform Gemini 3.1 Flash Lite model. */ public static final OrchestrationAiModel GEMINI_3_1_FLASH_LITE = new OrchestrationAiModel("gemini-3.1-flash-lite"); - /** Google Cloud Platform Gemini 3.5 Flash model */ + /** Google Cloud Platform Gemini 3.5 Flash model. */ public static final OrchestrationAiModel GEMINI_3_5_FLASH = new OrchestrationAiModel("gemini-3.5-flash"); - /** Google Cloud Platform Gemini 3.1 Pro preview early access model */ + /** Google Cloud Platform Gemini 3.1 Pro preview early access model. */ public static final OrchestrationAiModel GEMINI_3_1_PRO_PREVIEW_EA = new OrchestrationAiModel("gemini-3.1-pro-preview-ea"); - /** Google Cloud Platform Gemini 3.5 Flash Lite model */ + /** Google Cloud Platform Gemini 3.5 Flash Lite model. */ public static final OrchestrationAiModel GEMINI_3_5_FLASH_LITE = new OrchestrationAiModel("gemini-3.5-flash-lite"); - /** Google Cloud Platform Gemini 3.6 Flash model */ + /** Google Cloud Platform Gemini 3.6 Flash model. */ public static final OrchestrationAiModel GEMINI_3_6_FLASH = new OrchestrationAiModel("gemini-3.6-flash"); - /** Google Cloud Platform Gemini 3.8 Flash model */ + /** Google Cloud Platform Gemini 3.8 Flash model. */ public static final OrchestrationAiModel GEMINI_3_8_FLASH = new OrchestrationAiModel("gemini-3.8-flash"); - /** Perplexity AI Sonar model */ + /** Perplexity AI Sonar model. */ public static final OrchestrationAiModel SONAR = new OrchestrationAiModel("sonar"); - /** Perplexity AI Sonar Pro model */ + /** Perplexity AI Sonar Pro model. */ public static final OrchestrationAiModel SONAR_PRO = new OrchestrationAiModel("sonar-pro"); - /** Perplexity AI Sonar Deep Research model */ + /** Perplexity AI Sonar Deep Research model. */ public static final OrchestrationAiModel SONAR_DEEP_RESEARCH = new OrchestrationAiModel("sonar-deep-research"); - /** SAP ABAP 1 model */ + /** SAP ABAP 1 model. */ public static final OrchestrationAiModel SAP_ABAP_1 = new OrchestrationAiModel("sap-abap-1"); - /** Alibaba Qwen 3 max model */ + /** Alibaba Qwen 3 max model. */ public static final OrchestrationAiModel QWEN_3_MAX = new OrchestrationAiModel("qwen3-max"); - /** Alibaba Qwen 3.6 plus model */ + /** Alibaba Qwen 3.6 plus model. */ public static final OrchestrationAiModel QWEN_3_6_PLUS = new OrchestrationAiModel("qwen3.6-plus"); - /** Alibaba Qwen 3.6 flash model */ + /** Alibaba Qwen 3.6 flash model. */ public static final OrchestrationAiModel QWEN_3_6_FLASH = new OrchestrationAiModel("qwen3.6-flash"); - /** Alibaba Qwen 3.7 max model */ + /** Alibaba Qwen 3.7 max model. */ public static final OrchestrationAiModel QWEN_3_7_MAX = new OrchestrationAiModel("qwen3.7-max"); - /** Alibaba Qwen 3.7 plus model */ + /** Alibaba Qwen 3.7 plus model. */ public static final OrchestrationAiModel QWEN_3_7_PLUS = new OrchestrationAiModel("qwen3.7-plus"); OrchestrationAiModel(@Nonnull final String name) { @@ -242,8 +242,8 @@ LLMModelDetails createConfig() { * Additional parameter on this model. * * @param key the parameter key. - * @param value the parameter value, nullable. - * @return A new model with the additional parameter. + * @param value the parameter value. Can be {@code null} if not applicable. + * @return a new model with the additional parameter. *

SAP * AI Core: Orchestration - Harmonized API @@ -259,9 +259,9 @@ public OrchestrationAiModel withParam(@Nonnull final String key, @Nullable final * Additional parameter on this model. * * @param param the parameter key. - * @param value the parameter value, nullable. + * @param value the parameter value. Can be {@code null} if not applicable. * @param the parameter value type. - * @return A new model with the additional parameter. + * @return a new model with the additional parameter. *

SAP * AI Core: Orchestration - Harmonized API diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationChatResponse.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationChatResponse.java index a6c67efc2..e76555beb 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationChatResponse.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationChatResponse.java @@ -36,7 +36,7 @@ public class OrchestrationChatResponse { /** * Get the message content from the output. * - *

Note: If there are multiple choices only the first one is returned + *

Note: If there are multiple choices only the first one is returned. * * @return the message content or empty string. * @throws OrchestrationFilterException.Output if the content filter filtered the output. @@ -62,7 +62,7 @@ private Map getOutputFilteringChoices() { /** * Get the token usage. * - * @return The token usage. + * @return the token usage. */ @Nonnull public TokenUsage getTokenUsage() { @@ -87,8 +87,8 @@ public String getReasoningText() { /** * Get all messages. This can be used for subsequent prompts as a message history. * + * @return a list of all messages. * @throws IllegalArgumentException if the MultiChatMessage type message in chat. - * @return A list of all messages. */ @Nonnull public List getAllMessages() throws IllegalArgumentException { @@ -141,7 +141,7 @@ public List getAllMessages() throws IllegalArgumentException { /** * Get the LLM response. Useful for accessing the finish reason or further data like logprobs. * - * @return The (first, in case of multiple) {@link LLMChoice}. + * @return the (first, in case of multiple) {@link LLMChoice}. */ @Nonnull public LLMChoice getChoice() { @@ -156,10 +156,10 @@ public LLMChoice getChoice() { * configured into {@link OrchestrationModuleConfig#withTemplateConfig}. * * @param type the class type to deserialize the JSON content into. - * @return the deserialized entity of type T. * @param the type of the entity to deserialize to. + * @return the deserialized entity of type T. * @throws OrchestrationClientException if the model refused to answer the question or if the - * content + * content. */ @Nonnull public T asEntity(@Nonnull final Class type) throws OrchestrationClientException { @@ -191,7 +191,7 @@ public T asEntity(@Nonnull final Class type) throws OrchestrationClientEx /** * Get the last message in the response, which is the assistant's reply. * - * @return The assistant's reply message. + * @return the assistant's reply message. */ @Nonnull public Message getLastMessage() { diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationClient.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationClient.java index a450a092f..5924c91c9 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationClient.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationClient.java @@ -59,7 +59,7 @@ public OrchestrationClient() { * new OrchestrationClient(new AiCoreService().getInferenceDestination("custom-rg").forScenario("orchestration")); * } * - * @param destination The specific {@link HttpDestination} to use. + * @param destination the specific {@link HttpDestination} to use. * @see AiCoreService#getInferenceDestination(String) */ public OrchestrationClient(@Nonnull final HttpDestination destination) { @@ -70,10 +70,10 @@ public OrchestrationClient(@Nonnull final HttpDestination destination) { * Convert the given prompt and config into a low-level request data object. The data object * allows for further customization before sending the request. * - * @param prompt The {@link OrchestrationPrompt} to generate a completion for. - * @param config The {@link OrchestrationConfig } configuration to use for the completion. - * @param fallbackConfigs Fallback configurations to use. - * @return The low-level request data object to send to orchestration. + * @param prompt the {@link OrchestrationPrompt} to generate a completion for. + * @param config the {@link OrchestrationConfig } configuration to use for the completion. + * @param fallbackConfigs fallback configurations to use. + * @return the low-level request data object to send to orchestration. */ @Nonnull public static CompletionRequestConfiguration toCompletionPostRequest( @@ -86,10 +86,10 @@ public static CompletionRequestConfiguration toCompletionPostRequest( /** * Generate a completion for the given prompt. * - * @param prompt The {@link OrchestrationPrompt} to send to orchestration. - * @param config the configuration to use - * @param fallbackConfigs fallback configurations - * @return the completion output + * @param prompt the {@link OrchestrationPrompt} to send to orchestration. + * @param config the configuration to use. + * @param fallbackConfigs fallback configurations. + * @return the completion output. * @throws OrchestrationClientException if the request fails. */ @Nonnull @@ -107,11 +107,11 @@ public OrchestrationChatResponse chatCompletion( * Generate a completion for the given prompt. * * @param prompt a text message. - * @param config the configuration to use - * @param fallbackConfigs fallback configurations - * @return a stream of message deltas + * @param config the configuration to use. + * @param fallbackConfigs fallback configurations. + * @return a stream of message deltas. * @throws OrchestrationClientException if the request fails or if the finish reason is - * content_filter + * content_filter. * @since 1.1.0 */ @Nonnull @@ -161,9 +161,9 @@ private static Map getOutputFilteringChoices( * *

Alternatively, you can call this method directly with a fully custom request object. * - * @param request The request data object to send to orchestration. - * @return The response data object from orchestration. - * @throws OrchestrationClientException If the request fails. + * @param request the request data object to send to orchestration. + * @return the response data object from orchestration. + * @throws OrchestrationClientException if the request fails. */ @SuppressWarnings("PMD.PublicApiExposesModelType") @Nonnull @@ -176,8 +176,8 @@ public CompletionPostResponse executeRequest(@Nonnull final CompletionPostReques /** * Generate a completion using a referenced Orchestration config. * - * @param reference A reference to an Orchestration config stored in prompt registry - * @return The completion output + * @param reference a reference to an Orchestration config stored in prompt registry. + * @return the completion output. * @since 1.15.0 */ @Nonnull @@ -194,8 +194,8 @@ public OrchestrationChatResponse chatCompletionUsingReference( *

Note, that streaming will get enabled on the request object as a side effect. * * @param request the prompt, including messages and other parameters. - * @return A stream of chat completion delta elements. - * @throws OrchestrationClientException if the request fails + * @return a stream of chat completion delta elements. + * @throws OrchestrationClientException if the request fails. * @since 1.1.0 */ @SuppressWarnings("PMD.PublicApiExposesModelType") @@ -250,7 +250,7 @@ private static void enableStreaming( * * @param request the request containing the input text and other parameters. * @return the response containing the embeddings. - * @throws OrchestrationClientException if the request fails + * @throws OrchestrationClientException if the request fails. * @since 1.12.0 */ @Nonnull @@ -266,11 +266,11 @@ public OrchestrationEmbeddingResponse embed(@Nonnull final OrchestrationEmbeddin *

This method provides direct access to the underlying API for advanced use cases. For most * scenarios, prefer {@link #embed(OrchestrationEmbeddingRequest)}. * - * @param request the low-level API request - * @return the low level response object - * @throws OrchestrationClientException if the request fails - * @since 1.12.0 + * @param request the low-level API request. + * @return the low level response object. + * @throws OrchestrationClientException if the request fails. * @see #embed(OrchestrationEmbeddingRequest) + * @since 1.12.0 */ @SuppressWarnings("PMD.PublicApiExposesModelType") @Nonnull @@ -281,10 +281,10 @@ public EmbeddingsPostResponse embed(@Nonnull final EmbeddingsPostRequest request /** * Create a new orchestration client with a custom header added to every call made with this - * client + * client. * - * @param key the key of the custom header to add - * @param value the value of the custom header to add + * @param key the key of the custom header to add. + * @param value the value of the custom header to add. * @return a new client. * @since 1.11.0 */ @@ -298,9 +298,9 @@ public OrchestrationClient withHeader(@Nonnull final String key, @Nonnull final /** * Create a new orchestration client with multiple custom headers added to every call made with - * this client + * this client. * - * @param headers a map of key value pairs for the custom headers to add + * @param headers a map of key value pairs for the custom headers to add. * @return a new client. * @since 1.22.0 */ @@ -317,8 +317,8 @@ public OrchestrationClient withHeaders(@Nonnull final Map header /** * Create a new orchestration client for the given resource group and scenario. * - * @param resourceGroup the resource group - * @param scenario the scenario + * @param resourceGroup the resource group, usually {@code "default"}. + * @param scenario the scenario. * @return a new client configured with the resolved destination. */ @Nonnull diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationClientException.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationClientException.java index 0c16152c6..3dfe12ea6 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationClientException.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationClientException.java @@ -118,7 +118,7 @@ public OrchestrationError getClientError() { /** * Retrieves the {@link ErrorResponse} from the orchestration service, if available. * - * @return The {@link ErrorResponse} object, or {@code null} if not available. + * @return the {@link ErrorResponse} object, or {@code null} if not available. * @since 1.10.0 */ @Nullable @@ -132,7 +132,7 @@ public ErrorResponse getErrorResponse() { /** * Retrieves the {@link ErrorResponseStreaming} from the orchestration service, if available. * - * @return The {@link ErrorResponseStreaming} object, or {@code null} if not available. + * @return the {@link ErrorResponseStreaming} object, or {@code null} if not available. * @since 1.10.0 */ @Nullable @@ -146,7 +146,7 @@ public ErrorResponseStreaming getErrorResponseStreaming() { /** * Retrieves the HTTP status code from the original error response, if available. * - * @return the HTTP status code, or {@code null} if not available + * @return the HTTP status code, or {@code null} if not available. * @since 1.10.0 */ @Nullable diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationConfigReference.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationConfigReference.java index 7e9b3f324..2cd35d2ac 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationConfigReference.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationConfigReference.java @@ -27,8 +27,8 @@ public class OrchestrationConfigReference { /** * Set the chat history. * - * @param messagesHistory The chat history to set. - * @return A new instance of {@link OrchestrationConfigReference} with the specified chat history. + * @param messagesHistory the chat history to set. + * @return a new instance of {@link OrchestrationConfigReference} with the specified chat history. */ @Nonnull public OrchestrationConfigReference withMessageHistory( @@ -47,8 +47,8 @@ public OrchestrationConfigReference withMessageHistory( /** * Set the template parameters. * - * @param templateParameters The template parameters to set. - * @return A new instance of {@link OrchestrationConfigReference} with the specified chat history. + * @param templateParameters the template parameters to set. + * @return a new instance of {@link OrchestrationConfigReference} with the specified chat history. */ @Nonnull public OrchestrationConfigReference withTemplateParameters( @@ -67,8 +67,8 @@ public OrchestrationConfigReference withTemplateParameters( /** * Build a reference from an ID. * - * @param id The id of the reference - * @return A reference object with the specified id + * @param id the id of the reference. + * @return a reference object with the specified id. */ @Nonnull public static OrchestrationConfigReference fromId(@Nonnull final String id) { @@ -78,8 +78,8 @@ public static OrchestrationConfigReference fromId(@Nonnull final String id) { /** * Build a reference from a scenario, name, and version. * - * @param scenario The scenario of the reference - * @return A builder object with the specified scenario + * @param scenario the scenario of the reference. + * @return a builder object with the specified scenario. */ @Nonnull public static Builder fromScenario(@Nonnull final String scenario) { @@ -96,8 +96,8 @@ public interface Builder { /** * Build a reference from a scenario, name, and version. * - * @param name The name of the reference - * @return A builder object with the specified scenario and name + * @param name the name of the reference. + * @return a builder object with the specified scenario and name. */ @Nonnull Builder1 name(@Nonnull final String name); @@ -113,8 +113,8 @@ public interface Builder1 { /** * Build a reference from a scenario, name, and version. * - * @param version The version of the reference - * @return A reference object with the specified scenario, name, and version + * @param version the version of the reference. + * @return a reference object with the specified scenario, name, and version. */ @Nonnull OrchestrationConfigReference version(@Nonnull final String version); diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationEmbeddingModel.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationEmbeddingModel.java index ed1a1b6cf..549b5ca80 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationEmbeddingModel.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationEmbeddingModel.java @@ -35,34 +35,34 @@ public class OrchestrationEmbeddingModel implements AiModel { /** Whether to normalize the embedding vectors. */ @Nullable Boolean normalize; - /** Azure OpenAI Text Embedding 3 Small model */ + /** Azure OpenAI Text Embedding 3 Small model. */ public static final OrchestrationEmbeddingModel TEXT_EMBEDDING_3_SMALL = new OrchestrationEmbeddingModel("text-embedding-3-small"); - /** Azure OpenAI Text Embedding 3 Large model */ + /** Azure OpenAI Text Embedding 3 Large model. */ public static final OrchestrationEmbeddingModel TEXT_EMBEDDING_3_LARGE = new OrchestrationEmbeddingModel("text-embedding-3-large"); - /** Amazon Titan Embed Text model */ + /** Amazon Titan Embed Text model. */ public static final OrchestrationEmbeddingModel AMAZON_TITAN_EMBED_TEXT = new OrchestrationEmbeddingModel("amazon--titan-embed-text"); - /** NVIDIA LLaMA 3.2 7B NV EmbedQA model */ + /** NVIDIA LLaMA 3.2 7B NV EmbedQA model. */ public static final OrchestrationEmbeddingModel NVIDIA_LLAMA_32_NV_EMBEDQA_1B = new OrchestrationEmbeddingModel("nvidia--llama-3.2-nv-embedqa-1b"); - /** Google Cloud Platform Gemini Embedding model */ + /** Google Cloud Platform Gemini Embedding model. */ public static final OrchestrationEmbeddingModel GEMINI_EMBEDDING = new OrchestrationEmbeddingModel("gemini-embedding"); - /** Alibaba text-embedding-4 model */ + /** Alibaba text-embedding-4 model. */ public static final OrchestrationEmbeddingModel ALIBABA_TEXT_EMBEDDING_4 = new OrchestrationEmbeddingModel("text-embedding-4"); /** * Creates a new embedding model configuration with the specified name. * - * @param name the model name + * @param name the model name. */ public OrchestrationEmbeddingModel(@Nonnull final String name) { this(name, null, null, null); diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationEmbeddingRequest.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationEmbeddingRequest.java index 912c9fe74..195f97d64 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationEmbeddingRequest.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationEmbeddingRequest.java @@ -53,8 +53,8 @@ public class OrchestrationEmbeddingRequest { * OrchestrationEmbeddingRequest.forModel(myModel).forInputs("text to embed"); * } * - * @param model the embedding model to use - * @return a step for specifying inputs + * @param model the embedding model to use. + * @return a step for specifying inputs. */ @Nonnull public static InputStep forModel(@Nonnull final OrchestrationEmbeddingModel model) { @@ -68,8 +68,8 @@ public interface InputStep { /** * Specifies text inputs to be embedded. * - * @param inputs the text strings to embed - * @return a new embedding request instance + * @param inputs the text strings to embed. + * @return a new embedding request instance. */ @Nonnull OrchestrationEmbeddingRequest forInputs(@Nonnull final List inputs); @@ -77,9 +77,9 @@ public interface InputStep { /** * Specifies multiple text inputs using variable arguments. * - * @param firstInput string to embed - * @param inputs optional additional strings to embed - * @return a new embedding request instance + * @param firstInput string to embed. + * @param inputs optional additional strings to embed. + * @return a new embedding request instance. */ @Nonnull default OrchestrationEmbeddingRequest forInputs( @@ -91,9 +91,9 @@ default OrchestrationEmbeddingRequest forInputs( /** * Adds data masking providers to enable detection and masking of sensitive information. * - * @param maskingProvider the primary masking provider - * @param maskingProviders additional masking providers - * @return a new request instance with the specified masking providers + * @param maskingProvider the primary masking provider. + * @param maskingProviders additional masking providers. + * @return a new request instance with the specified masking providers. * @see MaskingProvider */ @Tolerate @@ -107,7 +107,7 @@ public OrchestrationEmbeddingRequest withMasking( /** * Configures this request to optimize embeddings for document content. * - * @return a new request instance configured for document embedding + * @return a new request instance configured for document embedding. */ @Nonnull public OrchestrationEmbeddingRequest asDocument() { @@ -117,7 +117,7 @@ public OrchestrationEmbeddingRequest asDocument() { /** * Configures this request to optimize embeddings for general text content. * - * @return a new request instance configured for text embedding + * @return a new request instance configured for text embedding. */ @Nonnull public OrchestrationEmbeddingRequest asText() { @@ -127,7 +127,7 @@ public OrchestrationEmbeddingRequest asText() { /** * Configures this request to optimize embeddings for query content. * - * @return a new request instance configured for query embedding + * @return a new request instance configured for query embedding. */ @Nonnull public OrchestrationEmbeddingRequest asQuery() { diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationEmbeddingResponse.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationEmbeddingResponse.java index c491bc3eb..82943149b 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationEmbeddingResponse.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationEmbeddingResponse.java @@ -29,7 +29,7 @@ public class OrchestrationEmbeddingResponse { /** * Extracts embedding vectors as float arrays. * - * @return list of embedding vectors, never {@code null} + * @return list of embedding vectors, never {@code null}. */ @Nonnull public List getEmbeddingVectors() { diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationFilterException.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationFilterException.java index 583fba8d1..262b20af4 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationFilterException.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationFilterException.java @@ -29,7 +29,7 @@ public class OrchestrationFilterException extends OrchestrationClientException { /** * Retrieves LlamaGuard 3.8b details from {@code filterDetails}, if present. * - * @return The LlamaGuard38b object, or {@code null} if not found or conversion fails. + * @return the LlamaGuard38b object, or {@code null} if not found or conversion fails. * @throws IllegalArgumentException if the conversion of filter details to {@link LlamaGuard38b} * fails due to invalid content. */ @@ -47,7 +47,7 @@ public static class Input extends OrchestrationFilterException { /** * Retrieves Azure Content Safety input details from {@code filterDetails}, if present. * - * @return The AzureContentSafetyInput object, or {@code null} if not found or conversion fails. + * @return the AzureContentSafetyInput object, or {@code null} if not found or conversion fails. * @throws IllegalArgumentException if the conversion of filter details to {@link * AzureContentSafetyInput} fails due to invalid content. */ @@ -71,7 +71,7 @@ public static class Output extends OrchestrationFilterException { /** * Retrieves Azure Content Safety output details from {@code filterDetails}, if present. * - * @return The AzureContentSafetyOutput object, or {@code null} if not found or conversion + * @return the AzureContentSafetyOutput object, or {@code null} if not found or conversion * fails. * @throws IllegalArgumentException if the conversion of filter details to {@link * AzureContentSafetyOutput} fails due to invalid content. diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationJacksonConfiguration.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationJacksonConfiguration.java index de7fbce13..e1d77eda6 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationJacksonConfiguration.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationJacksonConfiguration.java @@ -22,10 +22,12 @@ public class OrchestrationJacksonConfiguration { /** - * Default object mapper used for JSON de-/serialization. Only intended for internal usage - * within this SDK. Largely follows the defaults set by Spring. + * Default object mapper used for JSON de-/serialization. Largely follows the defaults set by + * Spring. * - * @return A new object mapper with the default configuration. + *

For internal use only. + * + * @return a new object mapper with the default configuration. * @see Jackson2ObjectMapperBuilder */ diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfig.java index 16c962520..3bb37fabc 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationModuleConfig.java @@ -170,8 +170,8 @@ public OrchestrationModuleConfig(@Nonnull final OrchestrationAiModel aiModel) { * href="https://help.sap.com/docs/sap-ai-core/sap-ai-core-service-guide/model-configuration">SAP * AI Core: Orchestration - Model Configuration * - * @param aiModel The LLM configuration to use. - * @return A new configuration with the given LLM configuration. + * @param aiModel the LLM configuration to use. + * @return a new configuration with the given LLM configuration. */ @Tolerate @Nonnull @@ -182,8 +182,8 @@ public OrchestrationModuleConfig withLlmConfig(@Nonnull final OrchestrationAiMod /** * Creates a new configuration with the given stream configuration. * - * @param config The stream configuration to use. - * @return A new configuration with the given stream configuration. + * @param config the stream configuration to use. + * @return a new configuration with the given stream configuration. * @since 1.12.0 */ @Nonnull @@ -199,9 +199,9 @@ public OrchestrationModuleConfig withStreamConfig( *

SAP * AI Core: Orchestration - Data Masking * - * @param maskingProvider The Data Masking configuration to use. - * @param maskingProviders Additional Data Masking configurations to use. - * @return A new configuration with the given Data Masking configuration. + * @param maskingProvider the Data Masking configuration to use. + * @param maskingProviders additional Data Masking configurations to use. + * @return a new configuration with the given Data Masking configuration. */ @Tolerate @Nonnull @@ -299,11 +299,11 @@ public OrchestrationModuleConfig withOutputFiltering( /** * Creates a new configuration with the given output filtering stream options. * + * @param outputFilteringStreamOptions the output filtering stream options to use. + * @return a new configuration with the given output filtering stream options. * @see Orchestration * documentation on streaming. - * @param outputFilteringStreamOptions The output filtering stream options to use. - * @return A new configuration with the given output filtering stream options. */ @Nonnull OrchestrationModuleConfig withOutputFilteringStreamOptions( @@ -329,8 +329,8 @@ OrchestrationModuleConfig withOutputFilteringStreamOptions( *

SAP AI * Core: Orchestration - Grounding * - * @param groundingProvider The grounding configuration to use. - * @return A new configuration with the given grounding configuration. + * @param groundingProvider the grounding configuration to use. + * @return a new configuration with the given grounding configuration. */ @Nonnull public OrchestrationModuleConfig withGrounding( @@ -344,8 +344,8 @@ public OrchestrationModuleConfig withGrounding( *

SAP AI * Core: Orchestration - Templating * - * @param templateConfig The template configuration to use. - * @return A new configuration with the given template configuration. + * @param templateConfig the template configuration to use. + * @return a new configuration with the given template configuration. * @since 1.4.0 */ @Tolerate @@ -358,8 +358,8 @@ public OrchestrationModuleConfig withTemplateConfig( /** * Configure input translation using a high-level TranslationConfig. * - * @param translationConfig The translation configuration - * @return A new OrchestrationModuleConfig with input translation configured + * @param translationConfig the translation configuration. + * @return a new OrchestrationModuleConfig with input translation configured. */ @Tolerate @Nonnull @@ -371,8 +371,8 @@ public OrchestrationModuleConfig withInputTranslationConfig( /** * Configure output translation using a high-level TranslationConfig. * - * @param translationConfig The translation configuration - * @return A new OrchestrationModuleConfig with output translation configured + * @param translationConfig the translation configuration. + * @return a new OrchestrationModuleConfig with output translation configured. */ @Tolerate @Nonnull @@ -382,9 +382,9 @@ public OrchestrationModuleConfig withOutputTranslationConfig( } /** - * Creates a copy of the OrchestrationModuleConfig + * Creates a copy of this OrchestrationModuleConfig. * - * @return a copy of the OrchestrationModuleConfig + * @return a copy of this OrchestrationModuleConfig. */ @Nonnull public OrchestrationModuleConfig copy() { diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationPrompt.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationPrompt.java index 4221c9ad8..477b5d351 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationPrompt.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationPrompt.java @@ -29,18 +29,18 @@ public class OrchestrationPrompt { /** * Initialize a prompt with the given user message. * - * @param message A user message. + * @param message a user message. */ public OrchestrationPrompt(@Nonnull final String message) { this(message, null); } /** - * Initialize a prompt with the given user message with optional cache checkpoint configuration + * Initialize a prompt with the given user message with optional cache checkpoint configuration. * + * @param message a user message. + * @param cacheControl optional cache checkpoint configuration. * @since 1.23.0 - * @param message A user message. - * @param cacheControl optional cache checkpoint configuration */ public OrchestrationPrompt( @Nonnull final String message, @Nullable final CacheControl cacheControl) { @@ -50,8 +50,8 @@ public OrchestrationPrompt( /** * Initialize a prompt from the given messages. * - * @param message The first message. - * @param messages Optionally, more messages. + * @param message the first message. + * @param messages optionally, more messages. */ public OrchestrationPrompt(@Nonnull final Message message, @Nonnull final Message... messages) { this.messages.add(message); @@ -61,8 +61,8 @@ 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. + * @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 inputParams, @Nonnull final Message... messages) { @@ -73,8 +73,8 @@ 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. + * @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 messagesHistory) { @@ -86,8 +86,8 @@ public OrchestrationPrompt messageHistory(@Nonnull final List messagesH /** * Set the template parameters of this prompt. * - * @param templateParameters The template parameters to add. - * @return The current instance of {@link OrchestrationPrompt} with the changed template + * @param templateParameters the template parameters to add. + * @return the current instance of {@link OrchestrationPrompt} with the changed template * parameters. */ @Nonnull diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationTemplate.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationTemplate.java index d57082c12..e8752d010 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationTemplate.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationTemplate.java @@ -64,8 +64,8 @@ public class OrchestrationTemplate extends TemplateConfig { /** * Create a new template with the given messages. * - * @param messages The messages to use in the template. - * @return The updated template. + * @param messages the messages to use in the template. + * @return the updated template. */ @Nonnull public OrchestrationTemplate withMessages(@Nonnull final Message... messages) { @@ -75,7 +75,7 @@ public OrchestrationTemplate withMessages(@Nonnull final Message... messages) { /** * Create a low-level representation of the template. * - * @return The low-level representation of the template. + * @return the low-level representation of the template. */ @Override @Nonnull @@ -93,8 +93,8 @@ protected PromptTemplatingModuleConfigPrompt toLowLevel() { /** * Set the response format to the given JSON schema. * - * @param schema The JSON schema to use. - * @return The updated template. + * @param schema the JSON schema to use. + * @return the updated template. */ @Nonnull public OrchestrationTemplate withJsonSchemaResponse(@Nonnull final ResponseJsonSchema schema) { @@ -113,7 +113,7 @@ public OrchestrationTemplate withJsonSchemaResponse(@Nonnull final ResponseJsonS /** * Set the response format to JSON object. * - * @return The updated template. + * @return the updated template. */ @Nonnull public OrchestrationTemplate withJsonResponse() { @@ -125,9 +125,9 @@ public OrchestrationTemplate withJsonResponse() { /** * Create a {@link Template} object from a JSON provided as String. * - * @throws IOException if the JSON cannot be deserialized - * @param inputString the provided JSON - * @return A Template object representing the provided JSON + * @param inputString the provided JSON. + * @return a Template object representing the provided JSON. + * @throws IOException if the JSON cannot be deserialized. * @since 1.7.0 */ @Nullable @@ -141,9 +141,9 @@ private OrchestrationTemplate fromJson(@Nonnull final String inputString) throws /** * Create a {@link Template} object from a YAML provided as String. * - * @throws IOException if the YAML cannot be parsed or deserialized - * @param inputYaml the provided YAML - * @return A Template object representing the provided YAML + * @param inputYaml the provided YAML. + * @return a Template object representing the provided YAML. + * @throws IOException if the YAML cannot be parsed or deserialized. * @since 1.7.0 */ @Nullable diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationTemplateReference.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationTemplateReference.java index 62fd0e067..8be9fa5cf 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationTemplateReference.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/OrchestrationTemplateReference.java @@ -31,7 +31,7 @@ public class OrchestrationTemplateReference extends TemplateConfig { /** * Create a low-level representation of the template. * - * @return The low-level representation of the template. + * @return the low-level representation of the template. */ @Nonnull @Override diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/PolymorphicFallbackDeserializer.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/PolymorphicFallbackDeserializer.java index 5d948d3be..7343de376 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/PolymorphicFallbackDeserializer.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/PolymorphicFallbackDeserializer.java @@ -20,8 +20,8 @@ * explicitly. If deserialization fails for all candidates, a {@link JsonMappingException} is thrown * with suppressed exceptions. * + * @param the base type for deserialization. * @since 1.2.0 - * @param The base type for deserialization. */ @AllArgsConstructor(access = AccessLevel.PROTECTED) class PolymorphicFallbackDeserializer extends JsonDeserializer { @@ -32,8 +32,8 @@ class PolymorphicFallbackDeserializer extends JsonDeserializer { /** * Constructs the deserializer using candidates inferred from the {@link JsonSubTypes} annotation. * - * @param baseClass The base class or interface to be resolved. - * @throws IllegalStateException If no subtypes are found. + * @param baseClass the base class or interface to be resolved. + * @throws IllegalStateException if no subtypes are found. */ @Nonnull protected static PolymorphicFallbackDeserializer fromJsonSubTypes( @@ -54,8 +54,8 @@ protected static PolymorphicFallbackDeserializer fromJsonSubTypes( /** * Constructs the deserializer with an explicit given list of candidate types. * - * @param baseClass The base class or interface to be resolved. - * @param candidates A list of candidate classes to try deserialization. + * @param baseClass the base class or interface to be resolved. + * @param candidates a list of candidate classes to try deserialization. */ @Nonnull protected static PolymorphicFallbackDeserializer fromCandidates( @@ -66,11 +66,11 @@ protected static PolymorphicFallbackDeserializer fromCandidates( /** * Deserializes the JSON into the first matching candidate type. * - * @param jsonParser The parser providing the JSON. - * @param deserializationContext The deserialization context. - * @return The deserialized object of a matching candidate type. - * @throws JsonMappingException If deserialization fails for all candidates. - * @throws IOException If json content cannot be consumed. + * @param jsonParser the parser providing the JSON. + * @param deserializationContext the deserialization context. + * @return the deserialized object of a matching candidate type. + * @throws JsonMappingException if deserialization fails for all candidates. + * @throws IOException if json content cannot be consumed. */ @Nonnull @Override diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ResponseJsonSchema.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ResponseJsonSchema.java index 0ba8b8cde..15713dd2f 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ResponseJsonSchema.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ResponseJsonSchema.java @@ -42,9 +42,9 @@ public class ResponseJsonSchema { /** * Create a new instance of {@link ResponseJsonSchema} with the given schema map and name. * - * @param schemaMap The schema map - * @param name The name of the schema - * @return The new instance of {@link ResponseJsonSchema} + * @param schemaMap the schema map. + * @param name the name of the schema. + * @return the new instance of {@link ResponseJsonSchema}. */ @Nonnull public static ResponseJsonSchema fromMap( @@ -58,8 +58,8 @@ public static ResponseJsonSchema fromMap( *

⚠️ Fields of the schema class should be annotated with {@code @JsonProperty(required = * true)}. * - * @param classType The class to generate the schema from - * @return The new instance of {@link ResponseJsonSchema} + * @param classType the class to generate the schema from. + * @return the new instance of {@link ResponseJsonSchema}. */ @Nonnull public static ResponseJsonSchema fromType(@Nonnull final Type classType) { diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/SystemMessage.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/SystemMessage.java index e2cbc8f0f..f3b6dbb98 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/SystemMessage.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/SystemMessage.java @@ -45,11 +45,11 @@ public SystemMessage(@Nonnull final String message) { } /** - * Creates a new system message from a string, allows for cache checkpoint configuration + * Creates a new system message from a string, allows for cache checkpoint configuration. * - * @since 1.23.0 * @param message the first message. - * @param cacheControl prompt caching configuration to use, nullable + * @param cacheControl prompt caching configuration to use. Can be {@code null} if not applicable. + * @since 1.23.0 */ public SystemMessage( @Nonnull final String message, @@ -70,12 +70,12 @@ public SystemMessage withText(@Nonnull final String message) { } /** - * Add text to the message + * Add text to the message. * + * @param message the text to add. + * @param cacheControl optional cache checkpoint configuration. + * @return the new message. * @since 1.23.0 - * @param message the text to add - * @param cacheControl optional cache checkpoint configuration - * @return the new message */ @SuppressWarnings( "PMD.PublicApiExposesModelType") // false positive: the two CacheControl classes are mixed up diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/TemplateConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/TemplateConfig.java index 3e00ef3a5..4d1e9e5c3 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/TemplateConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/TemplateConfig.java @@ -19,7 +19,7 @@ public abstract class TemplateConfig { /** * Create a low-level representation of the template. * - * @return The low-level representation of the template. + * @return the low-level representation of the template. */ @Nonnull protected abstract PromptTemplatingModuleConfigPrompt toLowLevel(); @@ -27,7 +27,7 @@ public abstract class TemplateConfig { /** * Build a template. * - * @return A new empty template. + * @return a new empty template. */ @Nonnull public static OrchestrationTemplate create() { @@ -37,7 +37,7 @@ public static OrchestrationTemplate create() { /** * Build a template reference with tenant level scope. * - * @return An intermediate object to build the template reference. + * @return an intermediate object to build the template reference. */ @Nonnull public static ReferenceBuilder reference() { @@ -56,8 +56,8 @@ public interface ReferenceBuilder { /** * Build a template reference with the given id for tenant scope. * - * @param id The id of the template. - * @return A template reference with the given id. + * @param id the id of the template. + * @return a template reference with the given id. */ @Nonnull default OrchestrationTemplateReference byId(@Nonnull final String id) { @@ -67,8 +67,8 @@ default OrchestrationTemplateReference byId(@Nonnull final String id) { /** * Build a template reference with the given scenario, name, and version. * - * @param scenario The scenario of the template. - * @return An intermediate object to build the template reference. + * @param scenario the scenario of the template. + * @return an intermediate object to build the template reference. */ @Nonnull ReferenceBuilder1 byScenario(@Nonnull final String scenario); @@ -83,8 +83,8 @@ public interface ReferenceBuilder1 { /** * Build a template reference with the given scenario, name, and version. * - * @param name The name of the template. - * @return An intermediate object to build the template reference. + * @param name the name of the template. + * @return an intermediate object to build the template reference. */ @Nonnull ReferenceBuilder2 name(@Nonnull final String name); @@ -98,8 +98,8 @@ public interface ReferenceBuilder2 { /** * Build a template reference with the given scenario, name, and version. * - * @param version The version of the template. - * @return A template reference with the given scenario, name, and version. + * @param version the version of the template. + * @return a template reference with the given scenario, name, and version. */ @Nonnull OrchestrationTemplateReference version(@Nonnull final String version); diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/TextItem.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/TextItem.java index a830b1281..61a6d5ca7 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/TextItem.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/TextItem.java @@ -19,10 +19,11 @@ public final class TextItem implements ContentItem, CacheablePrompt { private final CacheControl cacheControl; /** - * Constructs text item + * Constructs text item. * - * @param text - text content - * @param cacheControl - nullable cache control param + * @param text text content. + * @param cacheControl optional cache control configuration. Can be {@code null} if not + * applicable. */ public TextItem(@Nonnull final String text, @Nullable final CacheControl cacheControl) { this.text = text; @@ -30,9 +31,9 @@ public TextItem(@Nonnull final String text, @Nullable final CacheControl cacheCo } /** - * Compatibility constructor conforming with the previous API to avoid breaking changes + * Compatibility constructor conforming with the previous API to avoid breaking changes. * - * @param text value of the item + * @param text value of the item. */ public TextItem(@Nonnull final String text) { this(text, null); @@ -40,9 +41,9 @@ public TextItem(@Nonnull final String text) { /** * Compatibility method to support conversion from record to class without breaking changes, the - * same as {@link #getText()} + * same as {@link #getText()}. * - * @return text + * @return text. */ @Nonnull public String text() { diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ToolMessage.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ToolMessage.java index 385244892..c742a394d 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ToolMessage.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/ToolMessage.java @@ -33,10 +33,10 @@ public final class ToolMessage extends Message { @Nullable final CacheControl cacheControl; /** - * Constructs ToolMessage object + * Constructs ToolMessage object. * - * @param id tool call id - * @param content message content + * @param id tool call id. + * @param content message content. */ public ToolMessage(@Nonnull final String id, @Nonnull final String content) { this(id, content, null); diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java index 1d5ec47a1..ab591739d 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/TranslationConfig.java @@ -88,9 +88,9 @@ SAPDocumentTranslationInput createSAPDocumentTranslationInput() { /** * Start an {@code apply_to} selector for placeholder names in {@code placeholder_values}. * - * @param name The first placeholder name to translate. - * @param additionalNames Additional placeholder names to translate. - * @return A selector with {@code category=placeholders} and the given items. + * @param name the first placeholder name to translate. + * @param additionalNames additional placeholder names to translate. + * @return a selector with {@code category=placeholders} and the given items. */ @Nonnull public Input applyToPlaceholders( @@ -105,9 +105,9 @@ public Input applyToPlaceholders( /** * Start an {@code apply_to} selector for prompt template message roles. * - * @param role The first template role to translate. - * @param roles The template roles to translate. - * @return A selector with {@code category=template_roles} and the given items. + * @param role the first template role to translate. + * @param roles the template roles to translate. + * @return a selector with {@code category=template_roles} and the given items. */ @Nonnull public Input applyToTemplateRoles( @@ -133,8 +133,8 @@ public Input applyToTemplateRoles( * Important Note: If no selectors are used, this applies to the whole message. * If selectors are used, this applies to the most recently added selector. * - * @param sourceLanguage The source language code - * @return A new Input with the given source language applied. + * @param sourceLanguage the source language code. + * @return a new Input with the given source language applied. */ @Nonnull public Input withSourceLanguage(@Nonnull final String sourceLanguage) { @@ -179,11 +179,11 @@ SAPDocumentTranslationOutput createSAPDocumentTranslationOutput() { /** * Create a new input translation configuration. * - * @param targetLanguage The target language code + * @param targetLanguage the target language code. *

SAP * AI Core: Orchestration - SAP Translation Hub Table with official languages - * @return A TranslationConfig configured for input translation + * @return a TranslationConfig configured for input translation. */ @Nonnull static TranslationConfig.Input translateInputTo(@Nonnull final String targetLanguage) { @@ -193,11 +193,11 @@ static TranslationConfig.Input translateInputTo(@Nonnull final String targetLang /** * Create a new output translation configuration. * - * @param targetLanguage The target language code + * @param targetLanguage the target language code. *

* SAP AI Core: Orchestration - SAP Translation Hub Table with official languages - * @return A TranslationConfig configured for output translation + * @return a TranslationConfig configured for output translation. */ @Nonnull static TranslationConfig.Output translateOutputTo(@Nonnull final String targetLanguage) { diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/UserMessage.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/UserMessage.java index ec9a8b0c3..dc8f81aa5 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/UserMessage.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/UserMessage.java @@ -57,10 +57,10 @@ public UserMessage(@Nonnull final String message) { } /** - * Creates a new user message from a string with a cache checkpoint + * Creates a new user message from a string with a cache checkpoint. * - * @param message the first message - * @param cacheControl caching checkpoint configuration + * @param message the first message. + * @param cacheControl caching checkpoint configuration. */ @SuppressWarnings( "PMD.PublicApiExposesModelType") // false positive: the two CacheControl classes are mixed up @@ -84,7 +84,7 @@ public UserMessage withText(@Nonnull final String message) { } /** - * Add text to the message with optional cache checkpoint configuration + * Add text to the message with optional cache checkpoint configuration. * * @param message the text to add. * @param cacheControl optional cache checkpoint configuration. diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatModel.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatModel.java index 4b020609b..9efaec967 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatModel.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatModel.java @@ -54,7 +54,7 @@ public OrchestrationChatModel() { /** * Constructor with a custom client. * - * @param client The custom client to use. + * @param client the custom client to use. * @since 1.2.0 */ public OrchestrationChatModel(@Nonnull final OrchestrationClient client) { diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatOptions.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatOptions.java index 6bf998459..a92b76d89 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatOptions.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationChatOptions.java @@ -57,7 +57,7 @@ public class OrchestrationChatOptions implements ToolCallingChatOptions { /** * Returns the model to use for the chat. * - * @return the model to use for the chat + * @return the model to use for the chat. * @see com.sap.ai.sdk.orchestration.OrchestrationAiModel */ @Nonnull @@ -79,7 +79,7 @@ public String getModelVersion() { /** * Returns the frequency penalty to use for the chat. * - * @return the frequency penalty to use for the chat + * @return the frequency penalty to use for the chat. */ @Nullable @Override @@ -90,7 +90,7 @@ public Double getFrequencyPenalty() { /** * Returns the maximum number of tokens to use for the chat. * - * @return the maximum number of tokens to use for the chat + * @return the maximum number of tokens to use for the chat. */ @Nullable @Override @@ -101,7 +101,7 @@ public Integer getMaxTokens() { /** * Returns the presence penalty to use for the chat. * - * @return the presence penalty to use for the chat + * @return the presence penalty to use for the chat. */ @Nullable @Override @@ -112,7 +112,7 @@ public Double getPresencePenalty() { /** * Returns the stop sequences to use for the chat. * - * @return the stop sequences to use for the chat + * @return the stop sequences to use for the chat. */ @Nullable @Override @@ -123,7 +123,7 @@ public List getStopSequences() { /** * Returns the temperature to use for the chat. * - * @return the temperature to use for the chat + * @return the temperature to use for the chat. */ @Nullable @Override @@ -134,7 +134,7 @@ public Double getTemperature() { /** * Returns the top K to use for the chat. * - * @return the top K to use for the chat + * @return the top K to use for the chat. */ @Nullable @Override @@ -145,7 +145,7 @@ public Integer getTopK() { /** * Returns the top P to use for the chat. * - * @return the top P to use for the chat + * @return the top P to use for the chat. */ @Nullable @Override @@ -268,10 +268,10 @@ public Builder maxTokens(@Nullable final Integer v) { } /** - * Sets fallback configs to be used if main config is non-functional + * Sets fallback configs to be used if main config is non-functional. * - * @param configs prioritized list of fallback configs - * @return this builder + * @param configs prioritized list of fallback configs. + * @return this builder. */ @Nonnull public Builder fallbackConfigs(@Nullable final List configs) { diff --git a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationSpringEmbeddingModel.java b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationSpringEmbeddingModel.java index 23081d60a..cb86dcc83 100644 --- a/orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationSpringEmbeddingModel.java +++ b/orchestration/src/main/java/com/sap/ai/sdk/orchestration/spring/OrchestrationSpringEmbeddingModel.java @@ -47,7 +47,7 @@ public class OrchestrationSpringEmbeddingModel implements EmbeddingModel { * Constructs an instance with default options, a new {@link OrchestrationClient}, and sets the * metadata mode to {@link MetadataMode#EMBED}. * - * @param defaultOptions Default embedding options. + * @param defaultOptions default embedding options. */ public OrchestrationSpringEmbeddingModel(@Nonnull final EmbeddingOptions defaultOptions) { this(defaultOptions, new OrchestrationClient(), MetadataMode.EMBED); @@ -58,8 +58,8 @@ public OrchestrationSpringEmbeddingModel(@Nonnull final EmbeddingOptions default * *

Note: The request's options takes precedence over the defaultOptions. * - * @param request The embedding request containing input texts and options. - * @return The embedding response containing results and metadata. + * @param request the embedding request containing input texts and options. + * @return the embedding response containing results and metadata. */ @Override @Nonnull diff --git a/sample-code/spring-app/pom.xml b/sample-code/spring-app/pom.xml index 5bb4fc219..380165e23 100644 --- a/sample-code/spring-app/pom.xml +++ b/sample-code/spring-app/pom.xml @@ -37,6 +37,8 @@ 4.3.0 11.0.26 2.22 + + 11.0.26 true diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/Application.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/Application.java index 7e0cd1ca7..ad3c97f32 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/Application.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/Application.java @@ -22,7 +22,7 @@ public class Application { /** * Changes Spring Boot's default object mapper to fix serialization issues. * - * @return a modified object mapper + * @return a modified object mapper. */ @Bean @Primary @@ -35,7 +35,7 @@ public ObjectMapper objectMapper() { /** * Main method to start the Spring Boot application. * - * @param args Command line arguments. + * @param args command line arguments. */ public static void main(final String[] args) { SpringApplication.run(Application.class, args); diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/WebsocketConfig.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/WebsocketConfig.java index 0b8a56d22..cae6c5565 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/WebsocketConfig.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/WebsocketConfig.java @@ -8,7 +8,7 @@ import org.springframework.web.socket.config.annotation.WebSocketConfigurer; import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; -/** Implements spring Web Socket configuration to expose Web Socket handlers for Realtime API */ +/** Implements spring Web Socket configuration to expose Web Socket handlers for Realtime API. */ @Configuration @EnableWebSocket public class WebsocketConfig implements WebSocketConfigurer { @@ -17,10 +17,10 @@ public class WebsocketConfig implements WebSocketConfigurer { private final SpeechToSpeechWebsocketHandler speechToSpeech; /** - * Constructs configuration object + * Constructs configuration object. * - * @param textToSpeech - text to speech realtime api handler - * @param speechToSpeech - speech to speech realtime api handler + * @param textToSpeech text to speech realtime api handler. + * @param speechToSpeech speech to speech realtime api handler. */ public WebsocketConfig( @Nonnull final TextToSpeechWebsocketHandler textToSpeech, @@ -30,9 +30,9 @@ public WebsocketConfig( } /** - * Registers websocket handlers, implements WebSocketConfigurer contract + * Registers websocket handlers, implements WebSocketConfigurer contract. * - * @param registry - registry where to register handlers + * @param registry registry where to register handlers. */ @Override public void registerWebSocketHandlers(@Nonnull final WebSocketHandlerRegistry registry) { diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/AiCoreOpenAiResponsesController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/AiCoreOpenAiResponsesController.java index 5951ec4d4..da0426d31 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/AiCoreOpenAiResponsesController.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/AiCoreOpenAiResponsesController.java @@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter; -/** Endpoints for OpenAI Responses API operations */ +/** Endpoints for OpenAI Responses API operations. */ @Slf4j @RestController @SuppressWarnings("unused") diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/BatchController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/BatchController.java index 725b89447..9251b0d5f 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/BatchController.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/BatchController.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -/** LLM Batch Service API for managing LLM batch processing jobs */ +/** LLM Batch Service API for managing LLM batch processing jobs. */ @RestController @SuppressWarnings("unused") @RequestMapping("/batch") @@ -34,26 +34,26 @@ public class BatchController { private static final BatchesApi CLIENT = new BatchesApi(); - /** For reading S3 bucket file contents */ + /** For reading S3 bucket file contents. */ public static FileApi FILE_CLIENT = new FileApi().withDefaultHeaders(Map.of("Content-Type", "text/csv")); - /** Resource group that the S3 Bucket Object store is on */ + /** Resource group that the S3 Bucket Object store is on. */ public static final String RESOURCE_GROUP = "ai-sdk-java-e2e"; - /** Input file for batch request */ + /** Input file for batch request. */ public static final String S_3_INPUT_FILE = "s3secret/input-batch.jsonl"; - /** Directory path for batch output files in the object store */ + /** Directory path for batch output files in the object store. */ public static final String S3_OUTPUT_DIRECTORY = "s3secret/batch-output/"; - /** Batch output file name */ + /** Batch output file name. */ public static final String OUTPUT_JSONL = "/output.jsonl"; /** - * Upload the input and create a new batch job + * Upload the input and create a new batch job. * - * @return response object + * @return response object. */ @GetMapping("/create") @Nonnull @@ -71,9 +71,9 @@ public BatchCreateResponse create() { } /** - * List all batch jobs + * List all batch jobs. * - * @return response object + * @return response object. */ @GetMapping("list") @Nonnull @@ -82,10 +82,10 @@ public BatchListResponse list() { } /** - * Get batch job for an id + * Get batch job for an id. * - * @param id the id of the batch job - * @return the response object + * @param id the id of the batch job. + * @return the response object. */ @GetMapping("/get/{id}") @Nonnull @@ -94,10 +94,10 @@ public BatchDetailResponse get(@Nonnull @PathVariable("id") final String id) { } /** - * Delete batch job for an id + * Delete batch job for an id. * - * @param id the id of the batch job - * @return the response object + * @param id the id of the batch job. + * @return the response object. */ @GetMapping("delete/{id}") @Nonnull @@ -106,10 +106,10 @@ public BatchDeleteResponse delete(@Nonnull @PathVariable("id") final String id) } /** - * Read the content of a batch output in the S3 bucket + * Read the content of a batch output in the S3 bucket. * - * @param id the id of the batch job - * @return the content of the batch output file + * @param id the id of the batch job. + * @return the content of the batch output file. */ @GetMapping("/read/{id}") @Nonnull @@ -136,9 +136,9 @@ public String read(@Nonnull @PathVariable("id") final String id) { } /** - * Upload the input.jsonl file to the S3 bucket + * Upload the input.jsonl file to the S3 bucket. * - * @return response message + * @return response message. */ @GetMapping("/uploadInput") @Nonnull diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/ConfigurationController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/ConfigurationController.java index c14a78298..670d8cbfe 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/ConfigurationController.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/ConfigurationController.java @@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -/** Endpoint for Configuration operations */ +/** Endpoint for Configuration operations. */ @SuppressWarnings("unused") // debug class that doesn't need to be tested @RestController class ConfigurationController { diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/DeploymentController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/DeploymentController.java index 6390e4dbc..89c13a9b7 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/DeploymentController.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/DeploymentController.java @@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -/** Endpoints for AI Core AiDeployment operations */ +/** Endpoints for AI Core AiDeployment operations. */ @Slf4j @RestController @SuppressWarnings("unused") @@ -132,7 +132,7 @@ List getAllByConfigId(@Nonnull @PathVariable("id") final String co .toList(); } - /** Get all deployments, including non-Java specific deployments */ + /** Get all deployments, including non-Java specific deployments. */ @GetMapping("/getAll") Object getAll(@Nullable @RequestParam(value = "format", required = false) final String format) { final var deployments = getAll(); @@ -148,7 +148,7 @@ Object getAll(@Nullable @RequestParam(value = "format", required = false) final return "The following deployments are available: %s.".formatted(items); } - /** Get all deployments */ + /** Get all deployments. */ @Nullable AiDeploymentList getAll() { return CLIENT.query(RESOURCE_GROUP); diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/GroundingController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/GroundingController.java index df34792e6..0da223199 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/GroundingController.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/GroundingController.java @@ -46,7 +46,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -/** Endpoints for AI Core Grounding operations */ +/** Endpoints for AI Core Grounding operations. */ @Slf4j @RestController @SuppressWarnings("unused") diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OpenAiController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OpenAiController.java index 88e5e247f..cc61eda6f 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OpenAiController.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OpenAiController.java @@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter; -/** Endpoints for OpenAI operations */ +/** Endpoints for OpenAI operations. */ @Slf4j @RestController @SuppressWarnings("unused") @@ -170,10 +170,10 @@ ResponseEntity streamChatCompletion() { } /** - * Send a chunk to the emitter + * Send a chunk to the emitter. * - * @param emitter The emitter to send the chunk to - * @param chunk The chunk to send + * @param emitter the emitter to send the chunk to. + * @param chunk the chunk to send. */ public static void send(@Nonnull final ResponseBodyEmitter emitter, @Nonnull final String chunk) { try { diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java index 382383f6c..fb3511cab 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/OrchestrationController.java @@ -37,7 +37,7 @@ import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter; -/** Endpoints for the Orchestration service */ +/** Endpoints for the Orchestration service. */ @RestController @Slf4j @SuppressWarnings("unused") diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/PromptRegistryController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/PromptRegistryController.java index a130d425d..babd100f5 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/PromptRegistryController.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/PromptRegistryController.java @@ -44,7 +44,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -/** Endpoint for Prompt Registry operations */ +/** Endpoint for Prompt Registry operations. */ @SuppressWarnings("unused") // debug class that doesn't need to be tested @RestController @RequestMapping("/prompt-registry") diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/RptController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/RptController.java index 017fb504f..462f789a6 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/RptController.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/RptController.java @@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -/** Endpoints for RPT model operations */ +/** Endpoints for RPT model operations. */ @RestController public class RptController { @@ -21,8 +21,8 @@ public class RptController { /** * Endpoint to get table completion predictions from the RPT model. * - * @param format optional query parameter to specify the response format (e.g., "json") - * @return the prediction result in the specified format + * @param format optional query parameter to specify the response format (e.g., "json"). + * @return the prediction result in the specified format. */ @Nonnull @GetMapping("/tableCompletion") @@ -38,8 +38,8 @@ public Object tableCompletion( /** * Endpoint to get table completion predictions from the RPT model with Parquet file input. * - * @param format optional query parameter to specify the response format (e.g., "json") - * @return the prediction result in the specified format + * @param format optional query parameter to specify the response format (e.g., "json"). + * @return the prediction result in the specified format. */ @Nonnull @GetMapping("/tableCompletionWithParquet") diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/ScenarioController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/ScenarioController.java index b04944c81..601f41d86 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/ScenarioController.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/ScenarioController.java @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -/** Endpoint for Scenario operations */ +/** Endpoint for Scenario operations. */ @RestController @SuppressWarnings("unused") // debug method that doesn't need to be tested class ScenarioController { diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/SpringAiAgenticWorkflowController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/SpringAiAgenticWorkflowController.java index ecc5c5a79..5ce2265a1 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/SpringAiAgenticWorkflowController.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/SpringAiAgenticWorkflowController.java @@ -11,7 +11,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -/** Endpoints for the AgenticWorkflow Service */ +/** Endpoints for the AgenticWorkflow Service. */ @SuppressWarnings("unused") @RestController @Slf4j diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/realtime/SpeechToSpeechWebsocketHandler.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/realtime/SpeechToSpeechWebsocketHandler.java index 0beb82a68..e36d1a73e 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/realtime/SpeechToSpeechWebsocketHandler.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/realtime/SpeechToSpeechWebsocketHandler.java @@ -15,7 +15,9 @@ import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.handler.BinaryWebSocketHandler; -/** Implements handler (Web Socket messages handling) for speech to speech realtime api operation */ +/** + * Implements handler (Web Socket messages handling) for speech to speech realtime api operation. + */ @Component @Slf4j public class SpeechToSpeechWebsocketHandler extends BinaryWebSocketHandler { @@ -24,9 +26,9 @@ public class SpeechToSpeechWebsocketHandler extends BinaryWebSocketHandler { private final Map channels; /** - * Constructs handler object + * Constructs handler object. * - * @param service - handling service + * @param service handling service. */ @Autowired public SpeechToSpeechWebsocketHandler(@Nonnull final OpenAiService service) { diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/realtime/TextToSpeechWebsocketHandler.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/realtime/TextToSpeechWebsocketHandler.java index c15f13a03..2b06b1a5b 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/realtime/TextToSpeechWebsocketHandler.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/realtime/TextToSpeechWebsocketHandler.java @@ -16,7 +16,7 @@ import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.handler.BinaryWebSocketHandler; -/** Implements handler (Web Socket messages handling) for text to speech realtime api operation */ +/** Implements handler (Web Socket messages handling) for text to speech realtime api operation. */ @Component @Slf4j public class TextToSpeechWebsocketHandler extends BinaryWebSocketHandler { @@ -25,9 +25,9 @@ public class TextToSpeechWebsocketHandler extends BinaryWebSocketHandler { private final Map channels; /** - * Constructs handler object + * Constructs handler object. * - * @param service - handling service + * @param service handling service. */ @Autowired public TextToSpeechWebsocketHandler(@Nonnull final OpenAiService service) { diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/AiCoreOpenAiService.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/AiCoreOpenAiService.java index 8939a2030..78e9f70a9 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/AiCoreOpenAiService.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/AiCoreOpenAiService.java @@ -28,7 +28,7 @@ import lombok.val; import org.springframework.stereotype.Service; -/** Service class for the OpenAI Responses API */ +/** Service class for the OpenAI Responses API. */ @Service @Slf4j public class AiCoreOpenAiService { @@ -37,10 +37,10 @@ public class AiCoreOpenAiService { AiCoreOpenAiClient.forModel(GPT_5, "ai-sdk-java-e2e").responses(); /** - * Create a simple non-persistent response using the Responses API + * Create a simple non-persistent response using the Responses API. * - * @param input the input text to send to the model - * @return the response object from the Responses API + * @param input the input text to send to the model. + * @return the response object from the Responses API. */ @Nonnull public Response createResponse(@Nonnull final String input) { @@ -49,10 +49,10 @@ public Response createResponse(@Nonnull final String input) { } /** - * Create a non-persistent streaming response using the Responses API + * Create a non-persistent streaming response using the Responses API. * - * @param input the input text to send to the model - * @return the streaming response object from the Responses API + * @param input the input text to send to the model. + * @return the streaming response object from the Responses API. */ @Nonnull public StreamResponse createStreamingResponse(@Nonnull final String input) { @@ -64,9 +64,9 @@ public StreamResponse createStreamingResponse(@Nonnull fina /** * Create a persistent response so it can be retrieved, cancelled, or deleted later. * - * @param input the input text to send to the model - * @param background if true, the response runs asynchronously - * @return the response object from the Responses API + * @param input the input text to send to the model. + * @param background if true, the response runs asynchronously. + * @return the response object from the Responses API. */ @Nonnull public Response createPersistentResponse(@Nonnull final String input, final boolean background) { @@ -78,8 +78,8 @@ public Response createPersistentResponse(@Nonnull final String input, final bool /** * Retrieve a previously created response by its id. * - * @param responseId the id returned by the created persistent response call - * @return the stored response + * @param responseId the id returned by the created persistent response call. + * @return the stored response. */ @Nonnull public Response retrieveResponse(@Nonnull final String responseId) { @@ -90,7 +90,7 @@ public Response retrieveResponse(@Nonnull final String responseId) { /** * Cancel a background response by its id. * - * @param responseId the id of the background response to cancel + * @param responseId the id of the background response to cancel. * @return the response with the new status. */ @Nonnull @@ -102,7 +102,7 @@ public Response cancelResponse(@Nonnull final String responseId) { /** * Delete a stored response by its id. * - * @param responseId the id of the response to delete + * @param responseId the id of the response to delete. */ public void deleteResponse(@Nonnull final String responseId) { val params = ResponseDeleteParams.builder().responseId(responseId).build(); @@ -112,8 +112,8 @@ public void deleteResponse(@Nonnull final String responseId) { /** * Create a background response and poll until it reaches a terminal status. * - * @param input the prompt to run asynchronously - * @return the completed (or failed) response + * @param input the prompt to run asynchronously. + * @return the completed (or failed) response. */ @Nonnull public Response createBackgroundResponseAndPoll(@Nonnull final String input) @@ -132,9 +132,9 @@ public Response createBackgroundResponseAndPoll(@Nonnull final String input) /** * Create a multi-turn follow-up response using a previous response id. * * - * @param input the follow-up question - * @param previousResponseId the id of the prior response to continue from - * @return the response object + * @param input the follow-up question. + * @param previousResponseId the id of the prior response to continue from. + * @return the response object. */ @Nonnull public Response createMultiTurnResponse( @@ -151,8 +151,8 @@ public Response createMultiTurnResponse( /** * Create a response with tool calling enabled. * - * @param input the user question that may trigger a tool call - * @return the response object + * @param input the user question that may trigger a tool call. + * @return the response object. */ @Nonnull public Response createResponseWithTools(@Nonnull final String input) { @@ -196,9 +196,9 @@ public Response createResponseWithTools(@Nonnull final String input) { /** * Create a response with a specific reasoning effort level. * - * @param input the prompt to send - * @param effort the reasoning effort level - * @return the response object + * @param input the prompt to send. + * @param effort the reasoning effort level. + * @return the response object. */ @Nonnull public Response createResponseWithReasoning( @@ -213,8 +213,8 @@ public Response createResponseWithReasoning( /** * Create a response with structured JSON output conforming to a given schema. * - * @param input the extraction prompt - * @return the response object whose output text is valid JSON matching the schema + * @param input the extraction prompt. + * @return the response object whose output text is valid JSON matching the schema. */ @Nonnull public Response createStructuredResponse(@Nonnull final String input) { @@ -242,8 +242,8 @@ public Response createStructuredResponse(@Nonnull final String input) { /** * Create a stateless multi-turn response by passing the full conversation history as input. * - * @param messages the full conversation history - * @return the response object + * @param messages the full conversation history. + * @return the response object. */ @Nonnull public Response createStatelessMultiTurnResponse( @@ -255,9 +255,9 @@ public Response createStatelessMultiTurnResponse( /** * Create a response with truncation enabled so long conversations are automatically trimmed. * - * @param input the follow-up prompt - * @param previousResponseId the id of the prior response - * @return the response object + * @param input the follow-up prompt. + * @param previousResponseId the id of the prior response. + * @return the response object. */ @SuppressWarnings("deprecation") @Nonnull @@ -277,9 +277,9 @@ public Response createResponseWithTruncation( /** * Create a response using a prompt cache key to maximize cache reuse across calls. * - * @param input the prompt - * @param cacheKey an arbitrary cache key shared across related requests - * @return the response object + * @param input the prompt. + * @param cacheKey an arbitrary cache key shared across related requests. + * @return the response object. */ @Nonnull public Response createCachedResponse( diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OpenAiService.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OpenAiService.java index cb1aef04d..52567ebf9 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OpenAiService.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OpenAiService.java @@ -26,15 +26,15 @@ import lombok.val; import org.springframework.stereotype.Service; -/** Service class for OpenAI service using latest convenience api */ +/** Service class for OpenAI service using latest convenience api. */ @Service @Slf4j public class OpenAiService { /** - * Chat request to OpenAI + * Chat request to OpenAI. * - * @param prompt The prompt to send to the assistant - * @return the assistant message response + * @param prompt the prompt to send to the assistant. + * @return the assistant message response. */ @Nonnull public OpenAiChatCompletionResponse chatCompletion(@Nonnull final String prompt) { @@ -43,10 +43,10 @@ public OpenAiChatCompletionResponse chatCompletion(@Nonnull final String prompt) } /** - * Chat requests to OpenAI and updating the messages history + * Chat requests to OpenAI and updating the messages history. * - * @param previousMessage The request to send to the assistant - * @return the assistant message response + * @param previousMessage the request to send to the assistant. + * @return the assistant message response. */ @Nonnull public OpenAiChatCompletionResponse messagesHistory(@Nonnull final String previousMessage) { @@ -65,10 +65,10 @@ public OpenAiChatCompletionResponse messagesHistory(@Nonnull final String previo } /** - * Asynchronous stream of an OpenAI chat request + * 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 + * @param message the message to send to the assistant. + * @return the emitter that streams the assistant message response. */ @Nonnull public Stream streamChatCompletionDeltas( @@ -79,7 +79,7 @@ public Stream streamChatCompletionDeltas( } /** - * Creates realtime channel allowing to input text and voice it (receive audio output) + * Creates realtime channel allowing to input text and voice it (receive audio output). * *

The input channel should be used with a try-with-resources block to ensure that the * underlying connection is closed. @@ -93,14 +93,14 @@ public Stream streamChatCompletionDeltas( * } * } * - * This API implements full duplex (input + output) communication channels. Application should + *

This API implements full duplex (input + output) communication channels. Application should * logically synchronize their state and close input channel when it is appropriate (e.g. last * part of the response has been received via output channel and application does not need to send * any other input). When input channel is closed, output channel will be closed automatically and * output consumer will not be called anymore. * - * @param audioOutputConsumer - audio consumer of raw PCM mono 24000 Hz little endian output - * @return input channel, allowing for text input + * @param audioOutputConsumer audio consumer of raw PCM mono 24000 Hz little endian output. + * @return input channel, allowing for text input. */ @Nonnull public TextInputChannel textToSpeech(@Nonnull final AudioOutputChannel audioOutputConsumer) { @@ -108,7 +108,7 @@ public TextInputChannel textToSpeech(@Nonnull final AudioOutputChannel audioOutp } /** - * Creates realtime channel allowing for audio conversation with a model + * Creates realtime channel allowing for audio conversation with a model. * *

The input channel should be used with a try-with-resources block to ensure that the * underlying connection is closed. @@ -122,17 +122,17 @@ public TextInputChannel textToSpeech(@Nonnull final AudioOutputChannel audioOutp * } * } * - * This API implements full duplex (input + output) communication channels. Application should + *

This API implements full duplex (input + output) communication channels. Application should * logically synchronize their state and close input channel when it is appropriate (e.g. last * part of the response has been received via output channel and application does not need to send * any other input). When input channel is closed, output channel will be closed automatically and * output consumer will not be called anymore. * - * @param audioOutputConsumer - audio consumer of raw PCM mono 24000 Hz little endian output, 16 - * bit depth - * @param realtimeParams - optional additional configuration params + * @param audioOutputConsumer audio consumer of raw PCM mono 24000 Hz little endian output, 16 bit + * depth. + * @param realtimeParams optional additional configuration params. * @return input channel, allowing for audio data input (bytes, PCM mono 24000 Hz little endian 16 - * bit) + * bit). */ @Nonnull public AudioInputChannel speechToSpeech( @@ -142,10 +142,10 @@ public AudioInputChannel speechToSpeech( } /** - * Asynchronous stream of an OpenAI chat request + * 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 + * @param message the message to send to the assistant. + * @return the emitter that streams the assistant message response. */ @Nonnull public Stream streamChatCompletion(@Nonnull final String message) { @@ -155,10 +155,10 @@ public Stream streamChatCompletion(@Nonnull final String message) { } /** - * Chat request to OpenAI with an image + * Chat request to OpenAI with an image. * - * @param linkToImage The link to the image - * @return the assistant message response + * @param linkToImage the link to the image. + * @return the assistant message response. */ @Nonnull public OpenAiChatCompletionResponse chatCompletionImage(@Nonnull final String linkToImage) { @@ -175,9 +175,9 @@ public OpenAiChatCompletionResponse chatCompletionImage(@Nonnull final String li * Chat request to OpenAI with tool that gets the weather for a given location and unit. The tool * executed and the result is sent back to the assistant. * - * @param location The location to get the weather for. - * @param unit The unit of temperature to use. - * @return The assistant message response. + * @param location the location to get the weather for. + * @param unit the unit of temperature to use. + * @return the assistant message response. */ @Nonnull public OpenAiChatCompletionResponse chatCompletionToolExecution( @@ -210,10 +210,10 @@ public OpenAiChatCompletionResponse chatCompletionToolExecution( } /** - * Get the embedding of a text + * Get the embedding of a text. * - * @param input The text to embed - * @return the embedding response + * @param input the text to embed. + * @return the embedding response. */ @Nonnull public OpenAiEmbeddingResponse embedding(@Nonnull final String input) { @@ -223,11 +223,11 @@ public OpenAiEmbeddingResponse embedding(@Nonnull final String input) { } /** - * Chat request to OpenAI filtering by resource group + * Chat request to OpenAI filtering by resource group. * - * @param resourceGroup The resource group to use - * @param prompt The prompt to send to the assistant - * @return the assistant message response + * @param resourceGroup the resource group, usually {@code "default"}. + * @param prompt the prompt to send to the assistant. + * @return the assistant message response. */ @Nonnull public OpenAiChatCompletionResponse chatCompletionWithResource( diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OpenAiServiceDeprecated.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OpenAiServiceDeprecated.java index 88b5f021a..55bb5c6ff 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OpenAiServiceDeprecated.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OpenAiServiceDeprecated.java @@ -29,7 +29,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -/** Service class for OpenAI service */ +/** Service class for OpenAI service. */ @Service @Slf4j @Deprecated @@ -37,10 +37,10 @@ public class OpenAiServiceDeprecated { private static final ObjectMapper JACKSON = new ObjectMapper(); /** - * Chat request to OpenAI + * Chat request to OpenAI. * - * @param prompt The prompt to send to the assistant - * @return the assistant message response + * @param prompt the prompt to send to the assistant. + * @return the assistant message response. */ @Nonnull public OpenAiChatCompletionOutput chatCompletion(@Nonnull final String prompt) { @@ -48,10 +48,10 @@ public OpenAiChatCompletionOutput chatCompletion(@Nonnull final String prompt) { } /** - * Asynchronous stream of an OpenAI chat request + * 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 + * @param message the message to send to the assistant. + * @return the emitter that streams the assistant message response. */ @Nonnull public Stream streamChatCompletionDeltas( @@ -64,10 +64,10 @@ public Stream streamChatCompletionDeltas( } /** - * Asynchronous stream of an OpenAI chat request + * 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 + * @param message the message to send to the assistant. + * @return the emitter that streams the assistant message response. */ @Nonnull public Stream streamChatCompletion(@Nonnull final String message) { @@ -77,10 +77,10 @@ public Stream streamChatCompletion(@Nonnull final String message) { } /** - * Chat request to OpenAI with an image + * Chat request to OpenAI with an image. * - * @param linkToImage The link to the image - * @return the assistant message response + * @param linkToImage the link to the image. + * @return the assistant message response. */ @Nonnull public OpenAiChatCompletionOutput chatCompletionImage(@Nonnull final String linkToImage) { @@ -99,9 +99,9 @@ public OpenAiChatCompletionOutput chatCompletionImage(@Nonnull final String link /** * Executes a chat completion request to OpenAI with a tool that calculates the weather. * - * @param location The location to get the weather for. - * @param unit The unit of temperature to use. - * @return The assistant message response. + * @param location the location to get the weather for. + * @param unit the unit of temperature to use. + * @return the assistant message response. */ @Nonnull public OpenAiChatCompletionOutput chatCompletionToolExecution( @@ -174,10 +174,10 @@ private static Map generateSchema(@Nonnull final Class clazz) } /** - * Get the embedding of a text + * Get the embedding of a text. * - * @param input The text to embed - * @return the embedding response + * @param input the text to embed. + * @return the embedding response. */ @Nonnull public OpenAiEmbeddingOutput embedding(@Nonnull final String input) { @@ -187,11 +187,11 @@ public OpenAiEmbeddingOutput embedding(@Nonnull final String input) { } /** - * Chat request to OpenAI filtering by resource group + * Chat request to OpenAI filtering by resource group. * - * @param resourceGroup The resource group to use - * @param prompt The prompt to send to the assistant - * @return the assistant message response + * @param resourceGroup the resource group, usually {@code "default"}. + * @param prompt the prompt to send to the assistant. + * @return the assistant message response. */ @Nonnull public OpenAiChatCompletionOutput chatCompletionWithResource( diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java index 0dee012fc..210b2b6cb 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/OrchestrationService.java @@ -68,7 +68,7 @@ import lombok.val; import org.springframework.stereotype.Service; -/** Service class for the Orchestration service */ +/** Service class for the Orchestration service. */ @Service @Slf4j public class OrchestrationService { @@ -81,8 +81,8 @@ 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 + * @param famousPhrase the phrase to send to the assistant. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse completion(@Nonnull final String famousPhrase) { @@ -93,8 +93,8 @@ 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 + * @param pathToImage the path to the image. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse imageInput(@Nonnull final String pathToImage) { @@ -109,8 +109,8 @@ 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 + * @param questions the list of questions to send to the assistant. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse multiStringInput(@Nonnull final List questions) { @@ -123,9 +123,9 @@ public OrchestrationChatResponse multiStringInput(@Nonnull final List qu /** * Chat request to OpenAI through the Orchestration service with a file. * - * @param fileUrl the URL to a PDF file - * @param filename optional filename for the file - * @return the assistant response object + * @param fileUrl the URL to a PDF file. + * @param filename optional filename for the file. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse fileInput( @@ -140,8 +140,8 @@ public OrchestrationChatResponse fileInput( /** * Chat request to OpenAI through the Orchestration service with a local file. * - * @param filePath the path to a local PDF file - * @return the assistant response object + * @param filePath the path to a local PDF file. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse fileInput(@Nonnull final Path filePath) { @@ -154,9 +154,9 @@ public OrchestrationChatResponse fileInput(@Nonnull final Path filePath) { /** * Chat request to OpenAI through the Orchestration service with base64 input string. * - * @param base64Data base64-encoded payload - * @param filename the filename - * @return the assistant response object + * @param base64Data base64-encoded payload. + * @param filename the filename. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse fileInputBase64( @@ -169,10 +169,10 @@ public OrchestrationChatResponse fileInputBase64( } /** - * Asynchronous stream of an OpenAI chat request + * Asynchronous stream of an OpenAI chat request. * - * @param topic the topic to send to the assistant - * @return a stream of assistant message responses + * @param topic the topic to send to the assistant. + * @return a stream of assistant message responses. */ @Nonnull public Stream streamChatCompletion(@Nonnull final String topic) { @@ -256,8 +256,8 @@ public ReasoningOutput multiTurnReasoning( * * @link SAP * AI Core: Orchestration - Templating - * @param language the language to use in the template - * @return the assistant response object + * @param language the language to use in the template. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse template(@Nonnull final String language) { @@ -274,8 +274,8 @@ 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 + * @param prevMessage the previous message to send to the assistant. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse messagesHistory(@Nonnull final String prevMessage) { @@ -297,9 +297,9 @@ public OrchestrationChatResponse messagesHistory(@Nonnull final String prevMessa * @link SAP * AI Core: Orchestration - Input Filtering - * @throws OrchestrationClientException if input filter filters the prompt - * @param policy the explicitness of content that should be allowed through the filter - * @return the assistant response object + * @param policy the explicitness of content that should be allowed through the filter. + * @return the assistant response object. + * @throws OrchestrationClientException if input filter filters the prompt. */ @Nonnull public OrchestrationChatResponse inputFiltering(@Nonnull final AzureFilterThreshold policy) @@ -327,9 +327,9 @@ public OrchestrationChatResponse inputFiltering(@Nonnull final AzureFilterThresh * @link SAP * AI Core: Orchestration - Output Filtering - * @param policy the explicitness of content that should be allowed through the filter - * @param isProtected activates the protected material code filtering module when set to true - * @return the assistant response object + * @param policy the explicitness of content that should be allowed through the filter. + * @param isProtected activates the protected material code filtering module when set to true. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse outputFiltering( @@ -359,9 +359,9 @@ public OrchestrationChatResponse outputFiltering( * @link SAP * AI Core: Orchestration - Input Filtering - * @throws OrchestrationClientException if input filter filters the prompt - * @param filter enable or disable the filter - * @return the assistant response object + * @param filter enable or disable the filter. + * @return the assistant response object. + * @throws OrchestrationClientException if input filter filters the prompt. */ @Nonnull public OrchestrationChatResponse llamaGuardInputFilter(final boolean filter) @@ -401,8 +401,8 @@ public OrchestrationChatResponse llamaGuardInputFilter(final boolean filter) * @link SAP AI * Core: Orchestration - Data Masking - * @param entity the entity to be masked - * @return the assistant response object + * @param entity the entity to be masked. + * @return the assistant response object. */ @Nonnull @SuppressWarnings("PMD.PublicApiExposesModelType") @@ -430,7 +430,7 @@ public OrchestrationChatResponse maskingAnonymization(@Nonnull final DPIEntities * @link SAP AI * Core: Orchestration - Data Masking - * @return the assistant response object + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse maskingRegex() { @@ -449,9 +449,9 @@ public OrchestrationChatResponse maskingRegex() { /** * 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 + * @param resourceGroup the resource group, usually {@code "default"}. + * @param famousPhrase the phrase to send to the assistant. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse completionWithResourceGroup( @@ -472,8 +472,8 @@ public OrchestrationChatResponse completionWithResourceGroup( * @link SAP AI * Core: Orchestration - Data Masking - * @param entity the entity to be pseudonymized - * @return the assistant response object + * @param entity the entity to be pseudonymized. + * @return the assistant response object. */ @Nonnull @SuppressWarnings("PMD.PublicApiExposesModelType") @@ -507,9 +507,9 @@ public OrchestrationChatResponse maskingPseudonymization(@Nonnull final DPIEntit * * @link SAP * AI Core: Orchestration - Grounding - * @param userMessage the user message to provide grounding for - * @param maskGroundingInput whether to mask the request sent to the Grounding Service - * @return the assistant response object + * @param userMessage the user message to provide grounding for. + * @param maskGroundingInput whether to mask the request sent to the Grounding Service. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse grounding( @@ -549,8 +549,8 @@ public OrchestrationChatResponse grounding( * * @link SAP * AI Core: Orchestration - Grounding - * @param userMessage the user message to provide grounding for - * @return the assistant response object + * @param userMessage the user message to provide grounding for. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse groundingSharepoint(@Nonnull final String userMessage) { @@ -577,8 +577,8 @@ public OrchestrationChatResponse groundingSharepoint(@Nonnull final String userM * * @link SAP * AI Core: Orchestration - Grounding - * @param userMessage the user message to provide grounding for - * @return the assistant response object + * @param userMessage the user message to provide grounding for. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse groundingHelpSapCom(@Nonnull final String userMessage) { @@ -595,8 +595,8 @@ public OrchestrationChatResponse groundingHelpSapCom(@Nonnull final String userM /** * A simple record to demonstrate the response format feature of the orchestration service. * - * @param translation the translated text - * @param language the language of the translation + * @param translation the translated text. + * @param language the language of the translation. */ public record Translation( @JsonProperty(required = true) String translation, @@ -606,9 +606,9 @@ public record Translation( * Chat request to OpenAI through the Orchestration service using response format with JSON * schema. * - * @param word the word to translate - * @param targetType the class type to use for the JSON schema - * @return the assistant response object + * @param word the word to translate. + * @param targetType the class type to use for the JSON schema. + * @return the assistant response object. * @link SAP * AI Core: Orchestration - Structured Output @@ -641,8 +641,8 @@ public OrchestrationChatResponse responseFormatJsonSchema( * @link SAP * AI Core: Orchestration - Structured Output - * @param word the word to translate - * @return the assistant response object + * @param word the word to translate. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse responseFormatJsonObject(@Nonnull final String word) { @@ -665,8 +665,8 @@ public OrchestrationChatResponse responseFormatJsonObject(@Nonnull final String * @link SAP * AI Core: Orchestration - Structured Output - * @param word the word to translate - * @return the assistant response object + * @param word the word to translate. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse responseFormatText(@Nonnull final String word) { @@ -690,8 +690,8 @@ public OrchestrationChatResponse responseFormatText(@Nonnull final String word) * * @link SAP * AI Core: Orchestration - Templating - * @param topic the topic to send to the assistant - * @return the assistant response object + * @param topic the topic to send to the assistant. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse templateFromPromptRegistryByIdTenant( @@ -713,8 +713,8 @@ public OrchestrationChatResponse templateFromPromptRegistryByIdTenant( * * @link SAP * AI Core: Orchestration - Templating - * @param inputExample the example to send to the assistant - * @return the assistant response object + * @param inputExample the example to send to the assistant. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse templateFromPromptRegistryByIdResourceGroup( @@ -741,8 +741,8 @@ public OrchestrationChatResponse templateFromPromptRegistryByIdResourceGroup( * * @link SAP * AI Core: Orchestration - Templating - * @param topic the topic to send to the assistant - * @return the assistant response object + * @param topic the topic to send to the assistant. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse templateFromPromptRegistryByScenarioTenant( @@ -762,8 +762,8 @@ public OrchestrationChatResponse templateFromPromptRegistryByScenarioTenant( * * @link SAP * AI Core: Orchestration - Templating - * @param inputExample the example to send to the assistant - * @return the assistant response object + * @param inputExample the example to send to the assistant. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse templateFromPromptRegistryByScenarioResourceGroup( @@ -791,9 +791,9 @@ public OrchestrationChatResponse templateFromPromptRegistryByScenarioResourceGro * * @link SAP * AI Core: Orchestration - Templating - * @param promptTemplate the YAML prompt template to use - * @throws IOException if the YAML cannot be parsed - * @return the assistant response object + * @param promptTemplate the YAML prompt template to use. + * @return the assistant response object. + * @throws IOException if the YAML cannot be parsed. */ @Nonnull public OrchestrationChatResponse localPromptTemplate(@Nonnull final String promptTemplate) @@ -814,7 +814,7 @@ public OrchestrationChatResponse localPromptTemplate(@Nonnull final String promp /** * Chat request to an LLM through the Orchestration service using translation. * - * @return the assistant response object + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse translation() { @@ -851,8 +851,8 @@ public OrchestrationChatResponse translation() { * * @link AI * Core: Orchestration - Embedding - * @param texts the list of texts to embed - * @return the embedding response object + * @param texts the list of texts to embed. + * @return the embedding response object. */ @Nonnull public OrchestrationEmbeddingResponse embed(@Nonnull final List texts) { @@ -872,7 +872,7 @@ public OrchestrationEmbeddingResponse embed(@Nonnull final List texts) { * Chat request to an LLM through the Orchestration service using a template from the prompt * registry identified by a reference. * - * @return the assistant response object + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse executeConfigFromReference() { @@ -936,8 +936,8 @@ private PromptRegistryOrchestrationConfig buildOrchestrationConfig() { * Chat request to OpenAI through the Orchestration service with a list of modules. If the first * request fails (which will happen here), the next module is used as a fallback. * - * @param famousPhrase the phrase to send to the assistant - * @return the assistant response object + * @param famousPhrase the phrase to send to the assistant. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse completionWithFallback(@Nonnull final String famousPhrase) { @@ -955,8 +955,8 @@ public OrchestrationChatResponse completionWithFallback(@Nonnull final String fa * Streaming chat completion using a {@link * com.sap.ai.sdk.orchestration.model.CompletionRequestConfiguration} (inline config). * - * @param famousPhrase the phrase to send to the assistant - * @return a stream of chat completion deltas + * @param famousPhrase the phrase to send to the assistant. + * @return a stream of chat completion deltas. */ @Nonnull public Stream streamDeltasWithInlineConfig( @@ -972,7 +972,7 @@ public Stream streamDeltasWithInlineConfig( * com.sap.ai.sdk.orchestration.model.CompletionRequestConfigurationReferenceById} (config * referenced by ID from the orchestration config registry). * - * @return a stream of chat completion deltas + * @return a stream of chat completion deltas. */ @Nonnull public Stream streamDeltasWithReferenceById() { @@ -999,7 +999,7 @@ public Stream streamDeltasWithReferenceById() * com.sap.ai.sdk.orchestration.model.CompletionRequestConfigurationReferenceByNameScenarioVersion} * (config referenced by scenario, name, and version). * - * @return a stream of chat completion deltas + * @return a stream of chat completion deltas. */ @Nonnull public Stream streamDeltasWithReferenceByScenario() { @@ -1020,8 +1020,8 @@ public Stream streamDeltasWithReferenceByScena * modules. If the first request fails (which will happen here), the next module is used as a * fallback. * - * @param famousPhrase the phrase to send to the assistant - * @return a stream of assistant message responses + * @param famousPhrase the phrase to send to the assistant. + * @return a stream of assistant message responses. */ @Nonnull public Stream streamCompletionWithFallback(@Nonnull final String famousPhrase) { @@ -1036,8 +1036,8 @@ public Stream streamCompletionWithFallback(@Nonnull final String famousP * Chat request to OpenAI through the Orchestration service with a list of modules. Here, both the * original and the fallback request fail. * - * @param famousPhrase the phrase to send to the assistant - * @return the assistant response object + * @param famousPhrase the phrase to send to the assistant. + * @return the assistant response object. */ @Nonnull public OrchestrationChatResponse completionWithFallbackAllFail( @@ -1054,7 +1054,7 @@ public OrchestrationChatResponse completionWithFallbackAllFail( /** * Chat request using the SONAR model which provides citations. * - * @return the assistant response object with citations + * @return the assistant response object with citations. */ @Nonnull public OrchestrationChatResponse citations() { diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RestaurantMethod.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RestaurantMethod.java index 4927cdcef..1d753ebb6 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RestaurantMethod.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RestaurantMethod.java @@ -8,20 +8,20 @@ import org.springframework.ai.tool.annotation.Tool; import org.springframework.ai.tool.annotation.ToolParam; -/** Mock tool for agentic workflow */ +/** Mock tool for agentic workflow. */ class RestaurantMethod { /** - * Request for list of restaurants + * Request for list of restaurants. * - * @param location the city + * @param location the city. */ record Request(String location) {} /** - * Response for restaurant recommendations + * Response for restaurant recommendations. * - * @param restaurants the list of restaurants + * @param restaurants the list of restaurants. */ record Response(List restaurants) {} diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java index 8f6c69267..6e06d0870 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/RptService.java @@ -31,7 +31,7 @@ public class RptService { /** * Makes a prediction request to the RPT model. * * - * @return the prediction response payload from the RPT model + * @return the prediction response payload from the RPT model. */ @Nonnull public PredictResponsePayload predict() { @@ -87,7 +87,7 @@ public PredictResponsePayload predict() { /** * Makes a prediction request to the RPT model using a Parquet file as input. * - * @return the prediction response payload from the RPT model + * @return the prediction response payload from the RPT model. */ @Nonnull public PredictResponsePayload predictParquet() { diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/SpringAiAgenticWorkflowService.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/SpringAiAgenticWorkflowService.java index d67586f2b..ed43e4bc3 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/SpringAiAgenticWorkflowService.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/SpringAiAgenticWorkflowService.java @@ -21,7 +21,7 @@ import org.springframework.ai.support.ToolCallbacks; import org.springframework.stereotype.Service; -/** Service class for the AgenticWorkflow service */ +/** Service class for the AgenticWorkflow service. */ @Service @Slf4j public class SpringAiAgenticWorkflowService { @@ -32,8 +32,8 @@ public class SpringAiAgenticWorkflowService { * Simple agentic workflow using chain-like structure. The agent is generating a travel itinerary * for a given city. * - * @param userInput the user input including the target city - * @return a short travel itinerary + * @param userInput the user input including the target city. + * @return a short travel itinerary. */ @Nonnull public ChatResponse runAgent(@Nonnull final String userInput) { diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/SpringAiOpenAiService.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/SpringAiOpenAiService.java index b6700c342..be33f386a 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/SpringAiOpenAiService.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/SpringAiOpenAiService.java @@ -25,7 +25,7 @@ import org.springframework.stereotype.Service; import reactor.core.publisher.Flux; -/** Service class for Spring AI integration with OpenAI */ +/** Service class for Spring AI integration with OpenAI. */ @Service public class SpringAiOpenAiService { @@ -37,7 +37,7 @@ public class SpringAiOpenAiService { /** * Embeds a list of strings using the OpenAI embedding model. * - * @return an {@code EmbeddingResponse} containing the embeddings and metadata + * @return an {@code EmbeddingResponse} containing the embeddings and metadata. */ @Nonnull public EmbeddingResponse embedStrings() { @@ -51,7 +51,7 @@ public EmbeddingResponse embedStrings() { /** * Embeds the content of a document using the OpenAI embedding model. * - * @return a float array representing the embedding of the document's content + * @return a float array representing the embedding of the document's content. */ @Nonnull public float[] embedDocument() { @@ -62,7 +62,7 @@ public float[] embedDocument() { /** * Chat request to OpenAI through the OpenAI service with a simple prompt. * - * @return the assistant response object + * @return the assistant response object. */ @Nonnull public ChatResponse completion() { @@ -71,9 +71,9 @@ public ChatResponse completion() { } /** - * Asynchronous stream of an OpenAI chat request + * Asynchronous stream of an OpenAI chat request. * - * @return a stream of assistant message responses + * @return a stream of assistant message responses. */ @Nonnull public Flux streamChatCompletion() { @@ -86,8 +86,8 @@ public Flux streamChatCompletion() { * href="https://docs.spring.io/spring-ai/reference/api/tools.html#_methods_as_tools">Spring AI * Tool Method Declarative Specification * - * @param callTools whether the internal tool execution is enabled - * @return the assistant response object + * @param callTools whether the internal tool execution is enabled. + * @return the assistant response object. */ @Nonnull public ChatResponse toolCalling(final boolean callTools) { @@ -107,7 +107,7 @@ public ChatResponse toolCalling(final boolean callTools) { /** * Chat request to OpenAI through the OpenAI service using chat memory. * - * @return the assistant response object + * @return the assistant response object. */ @Nonnull public ChatResponse chatMemory() { diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/SpringAiOrchestrationService.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/SpringAiOrchestrationService.java index e5a8fe8cc..8566846e8 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/SpringAiOrchestrationService.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/SpringAiOrchestrationService.java @@ -41,7 +41,7 @@ import org.springframework.stereotype.Service; import reactor.core.publisher.Flux; -/** Service class for the Orchestration service */ +/** Service class for the Orchestration service. */ @Service public class SpringAiOrchestrationService { private final ChatModel client = new OrchestrationChatModel(); @@ -58,7 +58,7 @@ public class SpringAiOrchestrationService { /** * Chat request to OpenAI through the Orchestration service with a simple prompt. * - * @return the assistant response object + * @return the assistant response object. */ @Nonnull public ChatResponse completion() { @@ -68,9 +68,9 @@ public ChatResponse completion() { } /** - * Asynchronous stream of an OpenAI chat request + * Asynchronous stream of an OpenAI chat request. * - * @return a stream of assistant message responses + * @return a stream of assistant message responses. */ @Nonnull public Flux streamChatCompletion() { @@ -83,7 +83,7 @@ public Flux streamChatCompletion() { /** * Chat request to OpenAI through the Orchestration service with a template. * - * @return the assistant response object + * @return the assistant response object. */ @Nonnull public ChatResponse template() { @@ -101,7 +101,7 @@ public ChatResponse template() { * @link SAP AI * Core: Orchestration - Data Masking - * @return the assistant response object + * @return the assistant response object. */ @Nonnull public ChatResponse masking() { @@ -124,8 +124,8 @@ public ChatResponse masking() { * @link SAP * AI Core: Orchestration - Input Filtering - * @param policy the explicitness of content that should be allowed through the filter - * @return the assistant response object + * @param policy the explicitness of content that should be allowed through the filter. + * @return the assistant response object. */ @Nonnull public ChatResponse inputFiltering(@Nonnull final AzureFilterThreshold policy) @@ -150,8 +150,8 @@ public ChatResponse inputFiltering(@Nonnull final AzureFilterThreshold policy) * @link SAP * AI Core: Orchestration - Output Filtering - * @param policy the explicitness of content that should be allowed through the filter - * @return the assistant response object + * @param policy the explicitness of content that should be allowed through the filter. + * @return the assistant response object. */ @Nonnull public ChatResponse outputFiltering(@Nonnull final AzureFilterThreshold policy) { @@ -175,8 +175,8 @@ public ChatResponse outputFiltering(@Nonnull final AzureFilterThreshold policy) * href="https://docs.spring.io/spring-ai/reference/api/tools.html#_methods_as_tools">Spring AI * Tool Method Declarative Specification * - * @param internalToolExecutionEnabled whether the internal tool execution is enabled - * @return the assistant response object + * @param internalToolExecutionEnabled whether the internal tool execution is enabled. + * @return the assistant response object. */ @Nonnull public ChatResponse toolCalling(final boolean internalToolExecutionEnabled) { @@ -199,7 +199,7 @@ public ChatResponse toolCalling(final boolean internalToolExecutionEnabled) { * Example using an MCP client to use a file system tool. Enabled via dedicated Spring profile, * since it requires an actual MCP server to run. * - * @return the assistant response object + * @return the assistant response object. */ @Nonnull public ChatResponse toolCallingMcp() { @@ -235,7 +235,7 @@ public ChatResponse toolCallingMcp() { /** * Chat request to OpenAI through the Orchestration service using chat memory. * - * @return the assistant response object + * @return the assistant response object. */ @Nonnull public ChatResponse chatMemory() { @@ -262,7 +262,7 @@ public ChatResponse chatMemory() { * Chat request using the Spring AI integration with fallback configs. The first config uses an * invalid model name, so the orchestration service falls back to the second config. * - * @return the assistant response object + * @return the assistant response object. */ @Nonnull public ChatResponse completionWithFallback() { @@ -281,8 +281,8 @@ public ChatResponse completionWithFallback() { /** * A simple record to demonstrate the response format feature of the orchestration service. * - * @param translation the translated text - * @param language the language of the translation + * @param translation the translated text. + * @param language the language of the translation. */ public record Translation( @JsonProperty(required = true) String translation, @@ -294,7 +294,7 @@ public record Translation( * *

In this case, we expect a {@code Translation} of the input text into Dutch. * - * @return The translated text. + * @return the translated text. */ @Nullable public Translation responseFormat() { @@ -309,8 +309,8 @@ public Translation responseFormat() { /** * Create an embedding for a given text using the Orchestration service. * - * @param inputText the text to embed - * @return the embedding as a float array + * @param inputText the text to embed. + * @return the embedding as a float array. */ @Nonnull public float[] embed(@Nonnull final String inputText) { diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/WeatherMethod.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/WeatherMethod.java index b55f216e9..73864dba5 100644 --- a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/WeatherMethod.java +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/services/WeatherMethod.java @@ -6,29 +6,29 @@ class WeatherMethod { - /** Unit of temperature */ + /** Unit of temperature. */ enum Unit { - /** Celsius */ + /** Celsius. */ @SuppressWarnings("unused") C, - /** Fahrenheit */ + /** Fahrenheit. */ @SuppressWarnings("unused") F } /** - * Request for the weather + * Request for the weather. * - * @param location the city - * @param unit the unit of temperature + * @param location the city. + * @param unit the unit of temperature. */ record Request(String location, Unit unit) {} /** - * Response for the weather + * Response for the weather. * - * @param temp the temperature - * @param unit the unit of temperature + * @param temp the temperature. + * @param unit the unit of temperature. */ record Response(double temp, Unit unit) {}