diff --git a/core/src/main/java/com/sap/ai/sdk/core/AiCoreDeployment.java b/core/src/main/java/com/sap/ai/sdk/core/AiCoreDeployment.java index d14c0f87..90da8b6b 100644 --- a/core/src/main/java/com/sap/ai/sdk/core/AiCoreDeployment.java +++ b/core/src/main/java/com/sap/ai/sdk/core/AiCoreDeployment.java @@ -8,13 +8,19 @@ import javax.annotation.Nonnull; import lombok.RequiredArgsConstructor; +/** Connectivity convenience methods for AI Core with deployment. */ @RequiredArgsConstructor public class AiCoreDeployment implements AiCoreDestination { private final AiCoreService aiCoreService; - // the deployment id handler to be used, based on instance @Nonnull private final Function deploymentId; + /** + * Set the resource group. + * + * @param resourceGroup The resource group. + * @return A new instance of the AI Core service. + */ @Nonnull public AiCoreDeployment withResourceGroup(@Nonnull final String resourceGroup) { aiCoreService.setResourceGroup(resourceGroup); @@ -22,12 +28,14 @@ public AiCoreDeployment withResourceGroup(@Nonnull final String resourceGroup) { } @Nonnull + @Override public Destination destination() throws DestinationAccessException, DestinationNotFoundException { aiCoreService.deploymentId = deploymentId.apply(this); return aiCoreService.destination(); } @Nonnull + @Override public ApiClient client() { aiCoreService.deploymentId = deploymentId.apply(this); return aiCoreService.client(); 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 9ebdb89a..cfb84b3b 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 @@ -79,6 +79,12 @@ public Destination destination() { return builder.build(); } + /** + * Update and set the URL for the destination. + * + * @param builder The destination builder. + * @param dest The original destination reference. + */ protected void destinationSetUrl( @Nonnull final DefaultHttpDestination.Builder builder, @Nonnull final Destination dest) { String uri = dest.get(DestinationProperty.URI).get(); @@ -88,6 +94,11 @@ protected void destinationSetUrl( builder.uri(uri + "v2/inference/deployments/%s/".formatted(deploymentId)); } + /** + * Update and set the default request headers for the destination. + * + * @param builder The destination builder. + */ protected void destinationSetHeaders(@Nonnull final DefaultHttpDestination.Builder builder) { builder.property(AI_RESOURCE_GROUP, getResourceGroup()); }