diff --git a/.github/workflows/spec-update.yaml b/.github/workflows/spec-update.yaml index a1619fba8..18b62844f 100644 --- a/.github/workflows/spec-update.yaml +++ b/.github/workflows/spec-update.yaml @@ -87,7 +87,7 @@ jobs: FILE_PATH='orchestration/src/main/resources/spec/orchestration.yaml' ;; prompt-registry) - API_URL="$API_BASE_URL/AI/prompt-registry/contents/src/spec/prompt-registry.yaml?ref=$REF" + API_URL="$API_BASE_URL/AI/prompt-registry/contents/src/spec/generated/prompt-registry-combined.yaml?ref=$REF" FILE_PATH='core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml' ;; esac diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/OrchestrationConfigsApi.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/OrchestrationConfigsApi.java index 008c1fb3d..6046f78e1 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/OrchestrationConfigsApi.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/OrchestrationConfigsApi.java @@ -57,10 +57,10 @@ public OrchestrationConfigsApi(@Nonnull final ApiClient apiClient) { * *

200 - Successful response * - *

403 - Forbidden Error - * *

400 - Bad Request * + *

403 - Forbidden Error + * *

0 - Common Error * * @param orchestrationConfigPostRequest (required) The value for the parameter @@ -83,7 +83,7 @@ public OrchestrationConfigPostResponse createUpdateOrchestrationConfig( } final String localVarPath = - UriComponentsBuilder.fromPath("/lm/orchestrationConfigs").build().toUriString(); + UriComponentsBuilder.fromPath("/registry/v2/orchestrationConfigs").build().toUriString(); final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); @@ -121,10 +121,10 @@ public OrchestrationConfigPostResponse createUpdateOrchestrationConfig( * *

200 - Successful response * - *

403 - Forbidden Error - * *

400 - Bad Request * + *

403 - Forbidden Error + * *

0 - Common Error * * @param orchestrationConfigPostRequest The value for the parameter @@ -144,10 +144,10 @@ public OrchestrationConfigPostResponse createUpdateOrchestrationConfig( * *

200 - Successful response * - *

404 - Bad Request - * *

403 - Forbidden Error * + *

404 - Bad Request + * *

0 - Common Error * * @param orchestrationConfigId (required) The value for the parameter orchestrationConfigId @@ -171,7 +171,7 @@ public OrchestrationConfigDeleteResponse deleteOrchestrationConfig( final Map localVarPathParams = new HashMap(); localVarPathParams.put("orchestrationConfigId", orchestrationConfigId); final String localVarPath = - UriComponentsBuilder.fromPath("/lm/orchestrationConfigs/{orchestrationConfigId}") + UriComponentsBuilder.fromPath("/registry/v2/orchestrationConfigs/{orchestrationConfigId}") .buildAndExpand(localVarPathParams) .toUriString(); @@ -211,10 +211,10 @@ public OrchestrationConfigDeleteResponse deleteOrchestrationConfig( * *

200 - Successful response * - *

404 - Bad Request - * *

403 - Forbidden Error * + *

404 - Bad Request + * *

0 - Common Error * * @param orchestrationConfigId The value for the parameter orchestrationConfigId @@ -257,7 +257,8 @@ public File exportOrchestrationConfig( final Map localVarPathParams = new HashMap(); localVarPathParams.put("orchestrationConfigId", orchestrationConfigId); final String localVarPath = - UriComponentsBuilder.fromPath("/lm/orchestrationConfigs/{orchestrationConfigId}/export") + UriComponentsBuilder.fromPath( + "/registry/v2/orchestrationConfigs/{orchestrationConfigId}/export") .buildAndExpand(localVarPathParams) .toUriString(); @@ -347,7 +348,7 @@ public OrchestrationConfigGetResponse getOrchestrationConfigByUuid( final Map localVarPathParams = new HashMap(); localVarPathParams.put("orchestrationConfigId", orchestrationConfigId); final String localVarPath = - UriComponentsBuilder.fromPath("/lm/orchestrationConfigs/{orchestrationConfigId}") + UriComponentsBuilder.fromPath("/registry/v2/orchestrationConfigs/{orchestrationConfigId}") .buildAndExpand(localVarPathParams) .toUriString(); @@ -427,7 +428,9 @@ public OrchestrationConfigPostResponse importOrchestrationConfig( final Object localVarPostBody = null; final String localVarPath = - UriComponentsBuilder.fromPath("/lm/orchestrationConfigs/import").build().toUriString(); + UriComponentsBuilder.fromPath("/registry/v2/orchestrationConfigs/import") + .build() + .toUriString(); final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); @@ -546,7 +549,7 @@ public OrchestrationConfigListResponse listOrchestrationConfigHistory( localVarPathParams.put("model_name", modelName); final String localVarPath = UriComponentsBuilder.fromPath( - "/lm/scenarios/{scenario}/orchestrationConfigs/{name}/versions/{version}/models/{model_name}/history") + "/registry/v2/scenarios/{scenario}/orchestrationConfigs/{name}/versions/{version}/models/{model_name}/history") .buildAndExpand(localVarPathParams) .toUriString(); @@ -651,7 +654,7 @@ public OrchestrationConfigListResponse listOrchestrationConfigs( final Object localVarPostBody = null; final String localVarPath = - UriComponentsBuilder.fromPath("/lm/orchestrationConfigs").build().toUriString(); + UriComponentsBuilder.fromPath("/registry/v2/orchestrationConfigs").build().toUriString(); final MultiValueMap localVarQueryParams = new LinkedMultiValueMap(); diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/PromptTemplatesApi.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/PromptTemplatesApi.java index 0934b0541..93d4aca31 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/PromptTemplatesApi.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/client/PromptTemplatesApi.java @@ -59,22 +59,24 @@ public PromptTemplatesApi(@Nonnull final ApiClient apiClient) { * *

200 - Successful response * - *

403 - Forbidden Error - * *

400 - Bad Request * + *

403 - Forbidden Error + * *

0 - Common Error * * @param promptTemplatePostRequest (required) The value for the parameter * promptTemplatePostRequest * @param aiResourceGroup (optional) Specify a resource group id to use + * @param aiResourceGroupScope (optional) Specify whether the resource group scope is to be used * @return PromptTemplatePostResponse * @throws OpenApiRequestException if an error occurs while attempting to invoke the API */ @Nonnull public PromptTemplatePostResponse createUpdatePromptTemplate( @Nonnull final PromptTemplatePostRequest promptTemplatePostRequest, - @Nullable final String aiResourceGroup) + @Nullable final String aiResourceGroup, + @Nullable final String aiResourceGroupScope) throws OpenApiRequestException { final Object localVarPostBody = promptTemplatePostRequest; @@ -95,6 +97,9 @@ public PromptTemplatePostResponse createUpdatePromptTemplate( if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if (aiResourceGroupScope != null) + localVarHeaderParams.add( + "AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); final String[] localVarAccepts = {"application/json"}; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -123,10 +128,10 @@ public PromptTemplatePostResponse createUpdatePromptTemplate( * *

200 - Successful response * - *

403 - Forbidden Error - * *

400 - Bad Request * + *

403 - Forbidden Error + * *

0 - Common Error * * @param promptTemplatePostRequest The value for the parameter promptTemplatePostRequest @@ -137,7 +142,7 @@ public PromptTemplatePostResponse createUpdatePromptTemplate( public PromptTemplatePostResponse createUpdatePromptTemplate( @Nonnull final PromptTemplatePostRequest promptTemplatePostRequest) throws OpenApiRequestException { - return createUpdatePromptTemplate(promptTemplatePostRequest, null); + return createUpdatePromptTemplate(promptTemplatePostRequest, null, null); } /** @@ -145,20 +150,23 @@ public PromptTemplatePostResponse createUpdatePromptTemplate( * *

200 - Successful response * - *

404 - Bad Request - * *

403 - Forbidden Error * + *

404 - Bad Request + * *

0 - Common Error * * @param promptTemplateId (required) The value for the parameter promptTemplateId * @param aiResourceGroup (optional) Specify a resource group id to use + * @param aiResourceGroupScope (optional) Specify whether the resource group scope is to be used * @return PromptTemplateDeleteResponse * @throws OpenApiRequestException if an error occurs while attempting to invoke the API */ @Nonnull public PromptTemplateDeleteResponse deletePromptTemplate( - @Nonnull final UUID promptTemplateId, @Nullable final String aiResourceGroup) + @Nonnull final UUID promptTemplateId, + @Nullable final String aiResourceGroup, + @Nullable final String aiResourceGroupScope) throws OpenApiRequestException { final Object localVarPostBody = null; @@ -184,6 +192,9 @@ public PromptTemplateDeleteResponse deletePromptTemplate( if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if (aiResourceGroupScope != null) + localVarHeaderParams.add( + "AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); final String[] localVarAccepts = {"application/json"}; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -212,10 +223,10 @@ public PromptTemplateDeleteResponse deletePromptTemplate( * *

200 - Successful response * - *

404 - Bad Request - * *

403 - Forbidden Error * + *

404 - Bad Request + * *

0 - Common Error * * @param promptTemplateId The value for the parameter promptTemplateId @@ -225,7 +236,7 @@ public PromptTemplateDeleteResponse deletePromptTemplate( @Nonnull public PromptTemplateDeleteResponse deletePromptTemplate(@Nonnull final UUID promptTemplateId) throws OpenApiRequestException { - return deletePromptTemplate(promptTemplateId, null); + return deletePromptTemplate(promptTemplateId, null, null); } /** @@ -239,12 +250,15 @@ public PromptTemplateDeleteResponse deletePromptTemplate(@Nonnull final UUID pro * * @param promptTemplateId (required) The value for the parameter promptTemplateId * @param aiResourceGroup (optional) Specify a resource group id to use + * @param aiResourceGroupScope (optional) Specify whether the resource group scope is to be used * @return File * @throws OpenApiRequestException if an error occurs while attempting to invoke the API */ @Nonnull public File exportPromptTemplate( - @Nonnull final UUID promptTemplateId, @Nullable final String aiResourceGroup) + @Nonnull final UUID promptTemplateId, + @Nullable final String aiResourceGroup, + @Nullable final String aiResourceGroupScope) throws OpenApiRequestException { final Object localVarPostBody = null; @@ -270,6 +284,9 @@ public File exportPromptTemplate( if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if (aiResourceGroupScope != null) + localVarHeaderParams.add( + "AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); final String[] localVarAccepts = {"application/octet-stream", "application/json"}; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -309,7 +326,7 @@ public File exportPromptTemplate( @Nonnull public File exportPromptTemplate(@Nonnull final UUID promptTemplateId) throws OpenApiRequestException { - return exportPromptTemplate(promptTemplateId, null); + return exportPromptTemplate(promptTemplateId, null, null); } /** @@ -325,12 +342,15 @@ public File exportPromptTemplate(@Nonnull final UUID promptTemplateId) * * @param promptTemplateId (required) The value for the parameter promptTemplateId * @param aiResourceGroup (optional) Specify a resource group id to use + * @param aiResourceGroupScope (optional) Specify whether the resource group scope is to be used * @return PromptTemplateGetResponse * @throws OpenApiRequestException if an error occurs while attempting to invoke the API */ @Nonnull public PromptTemplateGetResponse getPromptTemplateByUuid( - @Nonnull final UUID promptTemplateId, @Nullable final String aiResourceGroup) + @Nonnull final UUID promptTemplateId, + @Nullable final String aiResourceGroup, + @Nullable final String aiResourceGroupScope) throws OpenApiRequestException { final Object localVarPostBody = null; @@ -356,6 +376,9 @@ public PromptTemplateGetResponse getPromptTemplateByUuid( if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if (aiResourceGroupScope != null) + localVarHeaderParams.add( + "AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); final String[] localVarAccepts = {"application/json"}; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -397,7 +420,7 @@ public PromptTemplateGetResponse getPromptTemplateByUuid( @Nonnull public PromptTemplateGetResponse getPromptTemplateByUuid(@Nonnull final UUID promptTemplateId) throws OpenApiRequestException { - return getPromptTemplateByUuid(promptTemplateId, null); + return getPromptTemplateByUuid(promptTemplateId, null, null); } /** @@ -410,13 +433,16 @@ public PromptTemplateGetResponse getPromptTemplateByUuid(@Nonnull final UUID pro *

0 - Common Error * * @param aiResourceGroup (optional) Specify a resource group id to use + * @param aiResourceGroupScope (optional) Specify whether the resource group scope is to be used * @param _file (optional) The value for the parameter _file * @return PromptTemplatePostResponse * @throws OpenApiRequestException if an error occurs while attempting to invoke the API */ @Nonnull public PromptTemplatePostResponse importPromptTemplate( - @Nullable final String aiResourceGroup, @Nullable final File _file) + @Nullable final String aiResourceGroup, + @Nullable final String aiResourceGroupScope, + @Nullable final File _file) throws OpenApiRequestException { final Object localVarPostBody = null; @@ -431,6 +457,9 @@ public PromptTemplatePostResponse importPromptTemplate( if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if (aiResourceGroupScope != null) + localVarHeaderParams.add( + "AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); if (_file != null) localVarFormParams.add("file", new FileSystemResource(_file)); @@ -470,7 +499,7 @@ public PromptTemplatePostResponse importPromptTemplate( */ @Nonnull public PromptTemplatePostResponse importPromptTemplate() throws OpenApiRequestException { - return importPromptTemplate(null, null); + return importPromptTemplate(null, null, null); } /** @@ -488,6 +517,7 @@ public PromptTemplatePostResponse importPromptTemplate() throws OpenApiRequestEx * @param version (required) The value for the parameter version * @param name (required) The value for the parameter name * @param aiResourceGroup (optional) Specify a resource group id to use + * @param aiResourceGroupScope (optional) Specify whether the resource group scope is to be used * @return PromptTemplateListResponse * @throws OpenApiRequestException if an error occurs while attempting to invoke the API */ @@ -496,7 +526,8 @@ public PromptTemplateListResponse listPromptTemplateHistory( @Nonnull final String scenario, @Nonnull final String version, @Nonnull final String name, - @Nullable final String aiResourceGroup) + @Nullable final String aiResourceGroup, + @Nullable final String aiResourceGroupScope) throws OpenApiRequestException { final Object localVarPostBody = null; @@ -537,6 +568,9 @@ public PromptTemplateListResponse listPromptTemplateHistory( if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if (aiResourceGroupScope != null) + localVarHeaderParams.add( + "AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); final String[] localVarAccepts = {"application/json"}; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -581,7 +615,7 @@ public PromptTemplateListResponse listPromptTemplateHistory( public PromptTemplateListResponse listPromptTemplateHistory( @Nonnull final String scenario, @Nonnull final String version, @Nonnull final String name) throws OpenApiRequestException { - return listPromptTemplateHistory(scenario, version, name, null); + return listPromptTemplateHistory(scenario, version, name, null, null); } /** @@ -596,6 +630,7 @@ public PromptTemplateListResponse listPromptTemplateHistory( *

0 - Common Error * * @param aiResourceGroup (optional) Specify a resource group id to use + * @param aiResourceGroupScope (optional) Specify whether the resource group scope is to be used * @param scenario (optional) The value for the parameter scenario * @param name (optional) The value for the parameter name * @param version (optional) The value for the parameter version @@ -607,6 +642,7 @@ public PromptTemplateListResponse listPromptTemplateHistory( @Nonnull public PromptTemplateListResponse listPromptTemplates( @Nullable final String aiResourceGroup, + @Nullable final String aiResourceGroupScope, @Nullable final String scenario, @Nullable final String name, @Nullable final String version, @@ -633,6 +669,9 @@ public PromptTemplateListResponse listPromptTemplates( if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if (aiResourceGroupScope != null) + localVarHeaderParams.add( + "AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); final String[] localVarAccepts = {"application/json"}; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -672,7 +711,7 @@ public PromptTemplateListResponse listPromptTemplates( */ @Nonnull public PromptTemplateListResponse listPromptTemplates() throws OpenApiRequestException { - return listPromptTemplates(null, null, null, null, null, null); + return listPromptTemplates(null, null, null, null, null, null, null); } /** @@ -688,6 +727,7 @@ public PromptTemplateListResponse listPromptTemplates() throws OpenApiRequestExc * * @param promptTemplateId (required) The value for the parameter promptTemplateId * @param aiResourceGroup (optional) Specify a resource group id to use + * @param aiResourceGroupScope (optional) Specify whether the resource group scope is to be used * @param metadata (optional, default to false) The value for the parameter metadata * @param promptTemplateSubstitutionRequest (optional) The value for the parameter * promptTemplateSubstitutionRequest @@ -698,6 +738,7 @@ public PromptTemplateListResponse listPromptTemplates() throws OpenApiRequestExc public PromptTemplateSubstitutionResponse parsePromptTemplateById( @Nonnull final UUID promptTemplateId, @Nullable final String aiResourceGroup, + @Nullable final String aiResourceGroupScope, @Nullable final Boolean metadata, @Nullable final PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest) throws OpenApiRequestException { @@ -727,6 +768,9 @@ public PromptTemplateSubstitutionResponse parsePromptTemplateById( if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if (aiResourceGroupScope != null) + localVarHeaderParams.add( + "AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); final String[] localVarAccepts = {"application/json"}; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -768,7 +812,7 @@ public PromptTemplateSubstitutionResponse parsePromptTemplateById( @Nonnull public PromptTemplateSubstitutionResponse parsePromptTemplateById( @Nonnull final UUID promptTemplateId) throws OpenApiRequestException { - return parsePromptTemplateById(promptTemplateId, null, null, null); + return parsePromptTemplateById(promptTemplateId, null, null, null, null); } /** @@ -786,6 +830,7 @@ public PromptTemplateSubstitutionResponse parsePromptTemplateById( * @param version (required) The value for the parameter version * @param name (required) The value for the parameter name * @param aiResourceGroup (optional) Specify a resource group id to use + * @param aiResourceGroupScope (optional) Specify whether the resource group scope is to be used * @param metadata (optional, default to false) The value for the parameter metadata * @param promptTemplateSubstitutionRequest (optional) The value for the parameter * promptTemplateSubstitutionRequest @@ -798,6 +843,7 @@ public PromptTemplateSubstitutionResponse parsePromptTemplateByNameVersion( @Nonnull final String version, @Nonnull final String name, @Nullable final String aiResourceGroup, + @Nullable final String aiResourceGroupScope, @Nullable final Boolean metadata, @Nullable final PromptTemplateSubstitutionRequest promptTemplateSubstitutionRequest) throws OpenApiRequestException { @@ -842,6 +888,9 @@ public PromptTemplateSubstitutionResponse parsePromptTemplateByNameVersion( if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + if (aiResourceGroupScope != null) + localVarHeaderParams.add( + "AI-Resource-Group-Scope", apiClient.parameterToString(aiResourceGroupScope)); final String[] localVarAccepts = {"application/json"}; final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); @@ -886,6 +935,6 @@ public PromptTemplateSubstitutionResponse parsePromptTemplateByNameVersion( public PromptTemplateSubstitutionResponse parsePromptTemplateByNameVersion( @Nonnull final String scenario, @Nonnull final String version, @Nonnull final String name) throws OpenApiRequestException { - return parsePromptTemplateByNameVersion(scenario, version, name, null, null, null); + return parsePromptTemplateByNameVersion(scenario, version, name, null, null, null, null); } } diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AssistantChatMessage.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AssistantChatMessage.java new file mode 100644 index 000000000..071584883 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AssistantChatMessage.java @@ -0,0 +1,369 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** AssistantChatMessage */ +// CHECKSTYLE:OFF +public class AssistantChatMessage implements ChatMessage +// CHECKSTYLE:ON +{ + /** Gets or Sets role */ + public enum RoleEnum { + /** The ASSISTANT option of this AssistantChatMessage */ + ASSISTANT("assistant"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this AssistantChatMessage */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + RoleEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type AssistantChatMessage + */ + @JsonCreator + @Nonnull + public static RoleEnum fromValue(@Nonnull final String value) { + for (RoleEnum b : RoleEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("role") + private RoleEnum role; + + @JsonProperty("content") + private ChatMessageContent content; + + @JsonProperty("refusal") + private String refusal; + + @JsonProperty("tool_calls") + private List toolCalls = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for AssistantChatMessage. */ + protected AssistantChatMessage() {} + + /** + * Set the role of this {@link AssistantChatMessage} instance and return the same instance. + * + * @param role The role of this {@link AssistantChatMessage} + * @return The same instance of this {@link AssistantChatMessage} class + */ + @Nonnull + public AssistantChatMessage role(@Nonnull final RoleEnum role) { + this.role = role; + return this; + } + + /** + * Get role + * + * @return role The role of this {@link AssistantChatMessage} instance. + */ + @Nonnull + public RoleEnum getRole() { + return role; + } + + /** + * Set the role of this {@link AssistantChatMessage} instance. + * + * @param role The role of this {@link AssistantChatMessage} + */ + public void setRole(@Nonnull final RoleEnum role) { + this.role = role; + } + + /** + * Set the content of this {@link AssistantChatMessage} instance and return the same instance. + * + * @param content The content of this {@link AssistantChatMessage} + * @return The same instance of this {@link AssistantChatMessage} class + */ + @Nonnull + public AssistantChatMessage content(@Nullable final ChatMessageContent content) { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link AssistantChatMessage} instance. + */ + @Nonnull + public ChatMessageContent getContent() { + return content; + } + + /** + * Set the content of this {@link AssistantChatMessage} instance. + * + * @param content The content of this {@link AssistantChatMessage} + */ + public void setContent(@Nullable final ChatMessageContent content) { + this.content = content; + } + + /** + * Set the refusal of this {@link AssistantChatMessage} instance and return the same instance. + * + * @param refusal The refusal of this {@link AssistantChatMessage} + * @return The same instance of this {@link AssistantChatMessage} class + */ + @Nonnull + public AssistantChatMessage refusal(@Nullable final String refusal) { + this.refusal = refusal; + return this; + } + + /** + * Get refusal + * + * @return refusal The refusal of this {@link AssistantChatMessage} instance. + */ + @Nonnull + public String getRefusal() { + return refusal; + } + + /** + * Set the refusal of this {@link AssistantChatMessage} instance. + * + * @param refusal The refusal of this {@link AssistantChatMessage} + */ + public void setRefusal(@Nullable final String refusal) { + this.refusal = refusal; + } + + /** + * Set the toolCalls of this {@link AssistantChatMessage} instance and return the same instance. + * + * @param toolCalls The tool calls generated by the model, such as function calls. + * @return The same instance of this {@link AssistantChatMessage} class + */ + @Nonnull + public AssistantChatMessage toolCalls(@Nullable final List toolCalls) { + this.toolCalls = toolCalls; + return this; + } + + /** + * Add one toolCalls instance to this {@link AssistantChatMessage}. + * + * @param toolCallsItem The toolCalls that should be added + * @return The same instance of type {@link AssistantChatMessage} + */ + @Nonnull + public AssistantChatMessage addToolCallsItem(@Nonnull final MessageToolCall toolCallsItem) { + if (this.toolCalls == null) { + this.toolCalls = new ArrayList<>(); + } + this.toolCalls.add(toolCallsItem); + return this; + } + + /** + * The tool calls generated by the model, such as function calls. + * + * @return toolCalls The toolCalls of this {@link AssistantChatMessage} instance. + */ + @Nonnull + public List getToolCalls() { + return toolCalls; + } + + /** + * Set the toolCalls of this {@link AssistantChatMessage} instance. + * + * @param toolCalls The tool calls generated by the model, such as function calls. + */ + public void setToolCalls(@Nullable final List toolCalls) { + this.toolCalls = toolCalls; + } + + /** + * Get the names of the unrecognizable properties of the {@link AssistantChatMessage}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link AssistantChatMessage} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "AssistantChatMessage has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AssistantChatMessage} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (role != null) declaredFields.put("role", role); + if (content != null) declaredFields.put("content", content); + if (refusal != null) declaredFields.put("refusal", refusal); + if (toolCalls != null) declaredFields.put("toolCalls", toolCalls); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AssistantChatMessage} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final AssistantChatMessage assistantChatMessage = (AssistantChatMessage) o; + return Objects.equals(this.cloudSdkCustomFields, assistantChatMessage.cloudSdkCustomFields) + && Objects.equals(this.role, assistantChatMessage.role) + && Objects.equals(this.content, assistantChatMessage.content) + && Objects.equals(this.refusal, assistantChatMessage.refusal) + && Objects.equals(this.toolCalls, assistantChatMessage.toolCalls); + } + + @Override + public int hashCode() { + return Objects.hash(role, content, refusal, toolCalls, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class AssistantChatMessage {\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" refusal: ").append(toIndentedString(refusal)).append("\n"); + sb.append(" toolCalls: ").append(toIndentedString(toolCalls)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link AssistantChatMessage} + * instance with all required arguments. + */ + public static Builder create() { + return (role) -> new AssistantChatMessage().role(role); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the role of this {@link AssistantChatMessage} instance. + * + * @param role The role of this {@link AssistantChatMessage} + * @return The AssistantChatMessage instance. + */ + AssistantChatMessage role(@Nonnull final RoleEnum role); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureContentSafetyInput.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureContentSafetyInput.java new file mode 100644 index 000000000..474dbaacc --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureContentSafetyInput.java @@ -0,0 +1,320 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** Filter configuration for Azure Content Safety */ +// CHECKSTYLE:OFF +public class AzureContentSafetyInput +// CHECKSTYLE:ON +{ + @JsonProperty("hate") + private AzureThreshold hate; + + @JsonProperty("self_harm") + private AzureThreshold selfHarm; + + @JsonProperty("sexual") + private AzureThreshold sexual; + + @JsonProperty("violence") + private AzureThreshold violence; + + @JsonProperty("prompt_shield") + private Boolean promptShield = false; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for AzureContentSafetyInput. */ + protected AzureContentSafetyInput() {} + + /** + * Set the hate of this {@link AzureContentSafetyInput} instance and return the same instance. + * + * @param hate The hate of this {@link AzureContentSafetyInput} + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput hate(@Nullable final AzureThreshold hate) { + this.hate = hate; + return this; + } + + /** + * Get hate + * + * @return hate The hate of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public AzureThreshold getHate() { + return hate; + } + + /** + * Set the hate of this {@link AzureContentSafetyInput} instance. + * + * @param hate The hate of this {@link AzureContentSafetyInput} + */ + public void setHate(@Nullable final AzureThreshold hate) { + this.hate = hate; + } + + /** + * Set the selfHarm of this {@link AzureContentSafetyInput} instance and return the same instance. + * + * @param selfHarm The selfHarm of this {@link AzureContentSafetyInput} + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput selfHarm(@Nullable final AzureThreshold selfHarm) { + this.selfHarm = selfHarm; + return this; + } + + /** + * Get selfHarm + * + * @return selfHarm The selfHarm of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public AzureThreshold getSelfHarm() { + return selfHarm; + } + + /** + * Set the selfHarm of this {@link AzureContentSafetyInput} instance. + * + * @param selfHarm The selfHarm of this {@link AzureContentSafetyInput} + */ + public void setSelfHarm(@Nullable final AzureThreshold selfHarm) { + this.selfHarm = selfHarm; + } + + /** + * Set the sexual of this {@link AzureContentSafetyInput} instance and return the same instance. + * + * @param sexual The sexual of this {@link AzureContentSafetyInput} + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput sexual(@Nullable final AzureThreshold sexual) { + this.sexual = sexual; + return this; + } + + /** + * Get sexual + * + * @return sexual The sexual of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public AzureThreshold getSexual() { + return sexual; + } + + /** + * Set the sexual of this {@link AzureContentSafetyInput} instance. + * + * @param sexual The sexual of this {@link AzureContentSafetyInput} + */ + public void setSexual(@Nullable final AzureThreshold sexual) { + this.sexual = sexual; + } + + /** + * Set the violence of this {@link AzureContentSafetyInput} instance and return the same instance. + * + * @param violence The violence of this {@link AzureContentSafetyInput} + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput violence(@Nullable final AzureThreshold violence) { + this.violence = violence; + return this; + } + + /** + * Get violence + * + * @return violence The violence of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public AzureThreshold getViolence() { + return violence; + } + + /** + * Set the violence of this {@link AzureContentSafetyInput} instance. + * + * @param violence The violence of this {@link AzureContentSafetyInput} + */ + public void setViolence(@Nullable final AzureThreshold violence) { + this.violence = violence; + } + + /** + * Set the promptShield of this {@link AzureContentSafetyInput} instance and return the same + * instance. + * + * @param promptShield A flag to use prompt shield + * @return The same instance of this {@link AzureContentSafetyInput} class + */ + @Nonnull + public AzureContentSafetyInput promptShield(@Nullable final Boolean promptShield) { + this.promptShield = promptShield; + return this; + } + + /** + * A flag to use prompt shield + * + * @return promptShield The promptShield of this {@link AzureContentSafetyInput} instance. + */ + @Nonnull + public Boolean isPromptShield() { + return promptShield; + } + + /** + * Set the promptShield of this {@link AzureContentSafetyInput} instance. + * + * @param promptShield A flag to use prompt shield + */ + public void setPromptShield(@Nullable final Boolean promptShield) { + this.promptShield = promptShield; + } + + /** + * Get the names of the unrecognizable properties of the {@link AzureContentSafetyInput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link AzureContentSafetyInput} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "AzureContentSafetyInput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AzureContentSafetyInput} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (hate != null) declaredFields.put("hate", hate); + if (selfHarm != null) declaredFields.put("selfHarm", selfHarm); + if (sexual != null) declaredFields.put("sexual", sexual); + if (violence != null) declaredFields.put("violence", violence); + if (promptShield != null) declaredFields.put("promptShield", promptShield); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AzureContentSafetyInput} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final AzureContentSafetyInput azureContentSafetyInput = (AzureContentSafetyInput) o; + return Objects.equals(this.cloudSdkCustomFields, azureContentSafetyInput.cloudSdkCustomFields) + && Objects.equals(this.hate, azureContentSafetyInput.hate) + && Objects.equals(this.selfHarm, azureContentSafetyInput.selfHarm) + && Objects.equals(this.sexual, azureContentSafetyInput.sexual) + && Objects.equals(this.violence, azureContentSafetyInput.violence) + && Objects.equals(this.promptShield, azureContentSafetyInput.promptShield); + } + + @Override + public int hashCode() { + return Objects.hash(hate, selfHarm, sexual, violence, promptShield, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class AzureContentSafetyInput {\n"); + sb.append(" hate: ").append(toIndentedString(hate)).append("\n"); + sb.append(" selfHarm: ").append(toIndentedString(selfHarm)).append("\n"); + sb.append(" sexual: ").append(toIndentedString(sexual)).append("\n"); + sb.append(" violence: ").append(toIndentedString(violence)).append("\n"); + sb.append(" promptShield: ").append(toIndentedString(promptShield)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link AzureContentSafetyInput} instance. No arguments are required. */ + public static AzureContentSafetyInput create() { + return new AzureContentSafetyInput(); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureContentSafetyInputFilterConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureContentSafetyInputFilterConfig.java new file mode 100644 index 000000000..56ff702f6 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureContentSafetyInputFilterConfig.java @@ -0,0 +1,286 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** AzureContentSafetyInputFilterConfig */ +// CHECKSTYLE:OFF +public class AzureContentSafetyInputFilterConfig implements InputFilterConfig +// CHECKSTYLE:ON +{ + /** Name of the filter provider type */ + public enum TypeEnum { + /** The AZURE_CONTENT_SAFETY option of this AzureContentSafetyInputFilterConfig */ + AZURE_CONTENT_SAFETY("azure_content_safety"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this AzureContentSafetyInputFilterConfig */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type AzureContentSafetyInputFilterConfig + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("type") + private TypeEnum type; + + @JsonProperty("config") + private AzureContentSafetyInput config; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for AzureContentSafetyInputFilterConfig. */ + protected AzureContentSafetyInputFilterConfig() {} + + /** + * Set the type of this {@link AzureContentSafetyInputFilterConfig} instance and return the same + * instance. + * + * @param type Name of the filter provider type + * @return The same instance of this {@link AzureContentSafetyInputFilterConfig} class + */ + @Nonnull + public AzureContentSafetyInputFilterConfig type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Name of the filter provider type + * + * @return type The type of this {@link AzureContentSafetyInputFilterConfig} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link AzureContentSafetyInputFilterConfig} instance. + * + * @param type Name of the filter provider type + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the config of this {@link AzureContentSafetyInputFilterConfig} instance and return the same + * instance. + * + * @param config The config of this {@link AzureContentSafetyInputFilterConfig} + * @return The same instance of this {@link AzureContentSafetyInputFilterConfig} class + */ + @Nonnull + public AzureContentSafetyInputFilterConfig config( + @Nullable final AzureContentSafetyInput config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link AzureContentSafetyInputFilterConfig} instance. + */ + @Nonnull + public AzureContentSafetyInput getConfig() { + return config; + } + + /** + * Set the config of this {@link AzureContentSafetyInputFilterConfig} instance. + * + * @param config The config of this {@link AzureContentSafetyInputFilterConfig} + */ + public void setConfig(@Nullable final AzureContentSafetyInput config) { + this.config = config; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * AzureContentSafetyInputFilterConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link AzureContentSafetyInputFilterConfig} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "AzureContentSafetyInputFilterConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AzureContentSafetyInputFilterConfig} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (config != null) declaredFields.put("config", config); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AzureContentSafetyInputFilterConfig} instance. If + * the map previously contained a mapping for the key, the old value is replaced by the specified + * value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final AzureContentSafetyInputFilterConfig azureContentSafetyInputFilterConfig = + (AzureContentSafetyInputFilterConfig) o; + return Objects.equals( + this.cloudSdkCustomFields, azureContentSafetyInputFilterConfig.cloudSdkCustomFields) + && Objects.equals(this.type, azureContentSafetyInputFilterConfig.type) + && Objects.equals(this.config, azureContentSafetyInputFilterConfig.config); + } + + @Override + public int hashCode() { + return Objects.hash(type, config, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class AzureContentSafetyInputFilterConfig {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * AzureContentSafetyInputFilterConfig} instance with all required arguments. + */ + public static Builder create() { + return (type) -> new AzureContentSafetyInputFilterConfig().type(type); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link AzureContentSafetyInputFilterConfig} instance. + * + * @param type Name of the filter provider type + * @return The AzureContentSafetyInputFilterConfig instance. + */ + AzureContentSafetyInputFilterConfig type(@Nonnull final TypeEnum type); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureContentSafetyOutput.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureContentSafetyOutput.java new file mode 100644 index 000000000..c506e8c37 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureContentSafetyOutput.java @@ -0,0 +1,284 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** Filter configuration for Azure Content Safety */ +// CHECKSTYLE:OFF +public class AzureContentSafetyOutput +// CHECKSTYLE:ON +{ + @JsonProperty("hate") + private AzureThreshold hate; + + @JsonProperty("self_harm") + private AzureThreshold selfHarm; + + @JsonProperty("sexual") + private AzureThreshold sexual; + + @JsonProperty("violence") + private AzureThreshold violence; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for AzureContentSafetyOutput. */ + protected AzureContentSafetyOutput() {} + + /** + * Set the hate of this {@link AzureContentSafetyOutput} instance and return the same instance. + * + * @param hate The hate of this {@link AzureContentSafetyOutput} + * @return The same instance of this {@link AzureContentSafetyOutput} class + */ + @Nonnull + public AzureContentSafetyOutput hate(@Nullable final AzureThreshold hate) { + this.hate = hate; + return this; + } + + /** + * Get hate + * + * @return hate The hate of this {@link AzureContentSafetyOutput} instance. + */ + @Nonnull + public AzureThreshold getHate() { + return hate; + } + + /** + * Set the hate of this {@link AzureContentSafetyOutput} instance. + * + * @param hate The hate of this {@link AzureContentSafetyOutput} + */ + public void setHate(@Nullable final AzureThreshold hate) { + this.hate = hate; + } + + /** + * Set the selfHarm of this {@link AzureContentSafetyOutput} instance and return the same + * instance. + * + * @param selfHarm The selfHarm of this {@link AzureContentSafetyOutput} + * @return The same instance of this {@link AzureContentSafetyOutput} class + */ + @Nonnull + public AzureContentSafetyOutput selfHarm(@Nullable final AzureThreshold selfHarm) { + this.selfHarm = selfHarm; + return this; + } + + /** + * Get selfHarm + * + * @return selfHarm The selfHarm of this {@link AzureContentSafetyOutput} instance. + */ + @Nonnull + public AzureThreshold getSelfHarm() { + return selfHarm; + } + + /** + * Set the selfHarm of this {@link AzureContentSafetyOutput} instance. + * + * @param selfHarm The selfHarm of this {@link AzureContentSafetyOutput} + */ + public void setSelfHarm(@Nullable final AzureThreshold selfHarm) { + this.selfHarm = selfHarm; + } + + /** + * Set the sexual of this {@link AzureContentSafetyOutput} instance and return the same instance. + * + * @param sexual The sexual of this {@link AzureContentSafetyOutput} + * @return The same instance of this {@link AzureContentSafetyOutput} class + */ + @Nonnull + public AzureContentSafetyOutput sexual(@Nullable final AzureThreshold sexual) { + this.sexual = sexual; + return this; + } + + /** + * Get sexual + * + * @return sexual The sexual of this {@link AzureContentSafetyOutput} instance. + */ + @Nonnull + public AzureThreshold getSexual() { + return sexual; + } + + /** + * Set the sexual of this {@link AzureContentSafetyOutput} instance. + * + * @param sexual The sexual of this {@link AzureContentSafetyOutput} + */ + public void setSexual(@Nullable final AzureThreshold sexual) { + this.sexual = sexual; + } + + /** + * Set the violence of this {@link AzureContentSafetyOutput} instance and return the same + * instance. + * + * @param violence The violence of this {@link AzureContentSafetyOutput} + * @return The same instance of this {@link AzureContentSafetyOutput} class + */ + @Nonnull + public AzureContentSafetyOutput violence(@Nullable final AzureThreshold violence) { + this.violence = violence; + return this; + } + + /** + * Get violence + * + * @return violence The violence of this {@link AzureContentSafetyOutput} instance. + */ + @Nonnull + public AzureThreshold getViolence() { + return violence; + } + + /** + * Set the violence of this {@link AzureContentSafetyOutput} instance. + * + * @param violence The violence of this {@link AzureContentSafetyOutput} + */ + public void setViolence(@Nullable final AzureThreshold violence) { + this.violence = violence; + } + + /** + * Get the names of the unrecognizable properties of the {@link AzureContentSafetyOutput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link AzureContentSafetyOutput} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "AzureContentSafetyOutput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AzureContentSafetyOutput} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (hate != null) declaredFields.put("hate", hate); + if (selfHarm != null) declaredFields.put("selfHarm", selfHarm); + if (sexual != null) declaredFields.put("sexual", sexual); + if (violence != null) declaredFields.put("violence", violence); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AzureContentSafetyOutput} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final AzureContentSafetyOutput azureContentSafetyOutput = (AzureContentSafetyOutput) o; + return Objects.equals(this.cloudSdkCustomFields, azureContentSafetyOutput.cloudSdkCustomFields) + && Objects.equals(this.hate, azureContentSafetyOutput.hate) + && Objects.equals(this.selfHarm, azureContentSafetyOutput.selfHarm) + && Objects.equals(this.sexual, azureContentSafetyOutput.sexual) + && Objects.equals(this.violence, azureContentSafetyOutput.violence); + } + + @Override + public int hashCode() { + return Objects.hash(hate, selfHarm, sexual, violence, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class AzureContentSafetyOutput {\n"); + sb.append(" hate: ").append(toIndentedString(hate)).append("\n"); + sb.append(" selfHarm: ").append(toIndentedString(selfHarm)).append("\n"); + sb.append(" sexual: ").append(toIndentedString(sexual)).append("\n"); + sb.append(" violence: ").append(toIndentedString(violence)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link AzureContentSafetyOutput} instance. No arguments are required. */ + public static AzureContentSafetyOutput create() { + return new AzureContentSafetyOutput(); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureContentSafetyOutputFilterConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureContentSafetyOutputFilterConfig.java new file mode 100644 index 000000000..b33efe0ec --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureContentSafetyOutputFilterConfig.java @@ -0,0 +1,286 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** AzureContentSafetyOutputFilterConfig */ +// CHECKSTYLE:OFF +public class AzureContentSafetyOutputFilterConfig implements OutputFilterConfig +// CHECKSTYLE:ON +{ + /** Name of the filter provider type */ + public enum TypeEnum { + /** The AZURE_CONTENT_SAFETY option of this AzureContentSafetyOutputFilterConfig */ + AZURE_CONTENT_SAFETY("azure_content_safety"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this AzureContentSafetyOutputFilterConfig */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type AzureContentSafetyOutputFilterConfig + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("type") + private TypeEnum type; + + @JsonProperty("config") + private AzureContentSafetyOutput config; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for AzureContentSafetyOutputFilterConfig. */ + protected AzureContentSafetyOutputFilterConfig() {} + + /** + * Set the type of this {@link AzureContentSafetyOutputFilterConfig} instance and return the same + * instance. + * + * @param type Name of the filter provider type + * @return The same instance of this {@link AzureContentSafetyOutputFilterConfig} class + */ + @Nonnull + public AzureContentSafetyOutputFilterConfig type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Name of the filter provider type + * + * @return type The type of this {@link AzureContentSafetyOutputFilterConfig} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link AzureContentSafetyOutputFilterConfig} instance. + * + * @param type Name of the filter provider type + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the config of this {@link AzureContentSafetyOutputFilterConfig} instance and return the + * same instance. + * + * @param config The config of this {@link AzureContentSafetyOutputFilterConfig} + * @return The same instance of this {@link AzureContentSafetyOutputFilterConfig} class + */ + @Nonnull + public AzureContentSafetyOutputFilterConfig config( + @Nullable final AzureContentSafetyOutput config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link AzureContentSafetyOutputFilterConfig} instance. + */ + @Nonnull + public AzureContentSafetyOutput getConfig() { + return config; + } + + /** + * Set the config of this {@link AzureContentSafetyOutputFilterConfig} instance. + * + * @param config The config of this {@link AzureContentSafetyOutputFilterConfig} + */ + public void setConfig(@Nullable final AzureContentSafetyOutput config) { + this.config = config; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * AzureContentSafetyOutputFilterConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link + * AzureContentSafetyOutputFilterConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "AzureContentSafetyOutputFilterConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link AzureContentSafetyOutputFilterConfig} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (config != null) declaredFields.put("config", config); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link AzureContentSafetyOutputFilterConfig} instance. + * If the map previously contained a mapping for the key, the old value is replaced by the + * specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final AzureContentSafetyOutputFilterConfig azureContentSafetyOutputFilterConfig = + (AzureContentSafetyOutputFilterConfig) o; + return Objects.equals( + this.cloudSdkCustomFields, azureContentSafetyOutputFilterConfig.cloudSdkCustomFields) + && Objects.equals(this.type, azureContentSafetyOutputFilterConfig.type) + && Objects.equals(this.config, azureContentSafetyOutputFilterConfig.config); + } + + @Override + public int hashCode() { + return Objects.hash(type, config, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class AzureContentSafetyOutputFilterConfig {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * AzureContentSafetyOutputFilterConfig} instance with all required arguments. + */ + public static Builder create() { + return (type) -> new AzureContentSafetyOutputFilterConfig().type(type); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link AzureContentSafetyOutputFilterConfig} instance. + * + * @param type Name of the filter provider type + * @return The AzureContentSafetyOutputFilterConfig instance. + */ + AzureContentSafetyOutputFilterConfig type(@Nonnull final TypeEnum type); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureThreshold.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureThreshold.java new file mode 100644 index 000000000..9a6e5048a --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/AzureThreshold.java @@ -0,0 +1,68 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.annotation.Nonnull; + +/** Gets or Sets AzureThreshold */ +public enum AzureThreshold { + NUMBER_0(0), + + NUMBER_2(2), + + NUMBER_4(4), + + NUMBER_6(6), + + NUMBER_unknown_default_open_api(11184809); + + private final Integer value; + + AzureThreshold(Integer value) { + this.value = value; + } + + /** + * @return The enum value. + */ + @JsonValue + public Integer getValue() { + return value; + } + + /** + * @return The String representation of the enum value. + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Converts the given value to its enum representation. + * + * @param value The input value. + * @return The enum representation of the given value. + */ + @JsonCreator + public static AzureThreshold fromValue(@Nonnull final Integer value) { + for (final AzureThreshold b : AzureThreshold.values()) { + if (b.value.equals(value)) { + return b; + } + } + return NUMBER_unknown_default_open_api; + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ChatMessage.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ChatMessage.java new file mode 100644 index 000000000..a525a4bd0 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ChatMessage.java @@ -0,0 +1,26 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** ChatMessage */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = AssistantChatMessage.class), + @JsonSubTypes.Type(value = DeveloperChatMessage.class), + @JsonSubTypes.Type(value = SystemChatMessage.class), + @JsonSubTypes.Type(value = ToolChatMessage.class), + @JsonSubTypes.Type(value = UserChatMessage.class), +}) +public interface ChatMessage {} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ChatMessageContent.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ChatMessageContent.java new file mode 100644 index 000000000..885b279b8 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ChatMessageContent.java @@ -0,0 +1,51 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import java.util.List; +import javax.annotation.Nonnull; + +/** ChatMessageContent */ +public interface ChatMessageContent { + /** Helper class to create a String that implements {@link ChatMessageContent}. */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) + implements ChatMessageContent {} + + /** + * Creator to enable deserialization of a String. + * + * @param val the value to use + * @return a new instance of {@link InnerString}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerString create(@Nonnull final String val) { + return new InnerString(val); + } + + /** Helper class to create a list of TextContent that implements {@link ChatMessageContent}. */ + record InnerTextContents( + @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) + implements ChatMessageContent {} + + /** + * Creator to enable deserialization of a list of TextContent. + * + * @param val the value to use + * @return a new instance of {@link InnerTextContents}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerTextContents create(@Nonnull final List val) { + return new InnerTextContents(val); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIConfig.java new file mode 100644 index 000000000..0d609b103 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIConfig.java @@ -0,0 +1,514 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** DPIConfig */ +// CHECKSTYLE:OFF +public class DPIConfig +// CHECKSTYLE:ON +{ + /** Type of masking service provider */ + public enum TypeEnum { + /** The SAP_DATA_PRIVACY_INTEGRATION option of this DPIConfig */ + SAP_DATA_PRIVACY_INTEGRATION("sap_data_privacy_integration"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this DPIConfig */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type DPIConfig + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("type") + private TypeEnum type; + + /** Type of masking method to be used */ + public enum MethodEnum { + /** The ANONYMIZATION option of this DPIConfig */ + ANONYMIZATION("anonymization"), + + /** The PSEUDONYMIZATION option of this DPIConfig */ + PSEUDONYMIZATION("pseudonymization"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this DPIConfig */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + MethodEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type DPIConfig + */ + @JsonCreator + @Nonnull + public static MethodEnum fromValue(@Nonnull final String value) { + for (MethodEnum b : MethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("method") + private MethodEnum method; + + @JsonProperty("entities") + private List entities = new ArrayList<>(); + + @JsonProperty("allowlist") + private List allowlist = new ArrayList<>(); + + @JsonProperty("mask_grounding_input") + private DPIConfigMaskGroundingInput maskGroundingInput; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DPIConfig. */ + protected DPIConfig() {} + + /** + * Set the type of this {@link DPIConfig} instance and return the same instance. + * + * @param type Type of masking service provider + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of masking service provider + * + * @return type The type of this {@link DPIConfig} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link DPIConfig} instance. + * + * @param type Type of masking service provider + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the method of this {@link DPIConfig} instance and return the same instance. + * + * @param method Type of masking method to be used + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig method(@Nonnull final MethodEnum method) { + this.method = method; + return this; + } + + /** + * Type of masking method to be used + * + * @return method The method of this {@link DPIConfig} instance. + */ + @Nonnull + public MethodEnum getMethod() { + return method; + } + + /** + * Set the method of this {@link DPIConfig} instance. + * + * @param method Type of masking method to be used + */ + public void setMethod(@Nonnull final MethodEnum method) { + this.method = method; + } + + /** + * Set the entities of this {@link DPIConfig} instance and return the same instance. + * + * @param entities List of entities to be masked + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig entities(@Nonnull final List entities) { + this.entities = entities; + return this; + } + + /** + * Add one entities instance to this {@link DPIConfig}. + * + * @param entitiesItem The entities that should be added + * @return The same instance of type {@link DPIConfig} + */ + @Nonnull + public DPIConfig addEntitiesItem(@Nonnull final DPIEntityConfig entitiesItem) { + if (this.entities == null) { + this.entities = new ArrayList<>(); + } + this.entities.add(entitiesItem); + return this; + } + + /** + * List of entities to be masked + * + * @return entities The entities of this {@link DPIConfig} instance. + */ + @Nonnull + public List getEntities() { + return entities; + } + + /** + * Set the entities of this {@link DPIConfig} instance. + * + * @param entities List of entities to be masked + */ + public void setEntities(@Nonnull final List entities) { + this.entities = entities; + } + + /** + * Set the allowlist of this {@link DPIConfig} instance and return the same instance. + * + * @param allowlist List of strings that should not be masked + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig allowlist(@Nullable final List allowlist) { + this.allowlist = allowlist; + return this; + } + + /** + * Add one allowlist instance to this {@link DPIConfig}. + * + * @param allowlistItem The allowlist that should be added + * @return The same instance of type {@link DPIConfig} + */ + @Nonnull + public DPIConfig addAllowlistItem(@Nonnull final String allowlistItem) { + if (this.allowlist == null) { + this.allowlist = new ArrayList<>(); + } + this.allowlist.add(allowlistItem); + return this; + } + + /** + * List of strings that should not be masked + * + * @return allowlist The allowlist of this {@link DPIConfig} instance. + */ + @Nonnull + public List getAllowlist() { + return allowlist; + } + + /** + * Set the allowlist of this {@link DPIConfig} instance. + * + * @param allowlist List of strings that should not be masked + */ + public void setAllowlist(@Nullable final List allowlist) { + this.allowlist = allowlist; + } + + /** + * Set the maskGroundingInput of this {@link DPIConfig} instance and return the same instance. + * + * @param maskGroundingInput The maskGroundingInput of this {@link DPIConfig} + * @return The same instance of this {@link DPIConfig} class + */ + @Nonnull + public DPIConfig maskGroundingInput( + @Nullable final DPIConfigMaskGroundingInput maskGroundingInput) { + this.maskGroundingInput = maskGroundingInput; + return this; + } + + /** + * Get maskGroundingInput + * + * @return maskGroundingInput The maskGroundingInput of this {@link DPIConfig} instance. + */ + @Nonnull + public DPIConfigMaskGroundingInput getMaskGroundingInput() { + return maskGroundingInput; + } + + /** + * Set the maskGroundingInput of this {@link DPIConfig} instance. + * + * @param maskGroundingInput The maskGroundingInput of this {@link DPIConfig} + */ + public void setMaskGroundingInput( + @Nullable final DPIConfigMaskGroundingInput maskGroundingInput) { + this.maskGroundingInput = maskGroundingInput; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("DPIConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPIConfig} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (method != null) declaredFields.put("method", method); + if (entities != null) declaredFields.put("entities", entities); + if (allowlist != null) declaredFields.put("allowlist", allowlist); + if (maskGroundingInput != null) declaredFields.put("maskGroundingInput", maskGroundingInput); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPIConfig} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final DPIConfig dpIConfig = (DPIConfig) o; + return Objects.equals(this.cloudSdkCustomFields, dpIConfig.cloudSdkCustomFields) + && Objects.equals(this.type, dpIConfig.type) + && Objects.equals(this.method, dpIConfig.method) + && Objects.equals(this.entities, dpIConfig.entities) + && Objects.equals(this.allowlist, dpIConfig.allowlist) + && Objects.equals(this.maskGroundingInput, dpIConfig.maskGroundingInput); + } + + @Override + public int hashCode() { + return Objects.hash( + type, method, entities, allowlist, maskGroundingInput, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIConfig {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" entities: ").append(toIndentedString(entities)).append("\n"); + sb.append(" allowlist: ").append(toIndentedString(allowlist)).append("\n"); + sb.append(" maskGroundingInput: ").append(toIndentedString(maskGroundingInput)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link DPIConfig} instance + * with all required arguments. + */ + public static Builder create() { + return (type) -> + (method) -> (entities) -> new DPIConfig().type(type).method(method).entities(entities); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link DPIConfig} instance. + * + * @param type Type of masking service provider + * @return The DPIConfig builder. + */ + Builder1 type(@Nonnull final TypeEnum type); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the method of this {@link DPIConfig} instance. + * + * @param method Type of masking method to be used + * @return The DPIConfig builder. + */ + Builder2 method(@Nonnull final MethodEnum method); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the entities of this {@link DPIConfig} instance. + * + * @param entities List of entities to be masked + * @return The DPIConfig instance. + */ + DPIConfig entities(@Nonnull final List entities); + + /** + * Set the entities of this {@link DPIConfig} instance. + * + * @param entities List of entities to be masked + * @return The DPIConfig instance. + */ + default DPIConfig entities(@Nonnull final DPIEntityConfig... entities) { + return entities(Arrays.asList(entities)); + } + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIConfigMaskGroundingInput.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIConfigMaskGroundingInput.java new file mode 100644 index 000000000..17906fb12 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIConfigMaskGroundingInput.java @@ -0,0 +1,177 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** DPIConfigMaskGroundingInput */ +// CHECKSTYLE:OFF +public class DPIConfigMaskGroundingInput +// CHECKSTYLE:ON +{ + @JsonProperty("enabled") + private Boolean enabled = false; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DPIConfigMaskGroundingInput. */ + protected DPIConfigMaskGroundingInput() {} + + /** + * Set the enabled of this {@link DPIConfigMaskGroundingInput} instance and return the same + * instance. + * + * @param enabled controls whether the input to the grounding module will be masked with the + * configuration supplied in the masking module + * @return The same instance of this {@link DPIConfigMaskGroundingInput} class + */ + @Nonnull + public DPIConfigMaskGroundingInput enabled(@Nullable final Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * controls whether the input to the grounding module will be masked with the configuration + * supplied in the masking module + * + * @return enabled The enabled of this {@link DPIConfigMaskGroundingInput} instance. + */ + @Nonnull + public Boolean isEnabled() { + return enabled; + } + + /** + * Set the enabled of this {@link DPIConfigMaskGroundingInput} instance. + * + * @param enabled controls whether the input to the grounding module will be masked with the + * configuration supplied in the masking module + */ + public void setEnabled(@Nullable final Boolean enabled) { + this.enabled = enabled; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIConfigMaskGroundingInput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIConfigMaskGroundingInput} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "DPIConfigMaskGroundingInput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPIConfigMaskGroundingInput} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (enabled != null) declaredFields.put("enabled", enabled); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPIConfigMaskGroundingInput} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final DPIConfigMaskGroundingInput dpIConfigMaskGroundingInput = (DPIConfigMaskGroundingInput) o; + return Objects.equals( + this.cloudSdkCustomFields, dpIConfigMaskGroundingInput.cloudSdkCustomFields) + && Objects.equals(this.enabled, dpIConfigMaskGroundingInput.enabled); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIConfigMaskGroundingInput {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link DPIConfigMaskGroundingInput} instance. No arguments are required. */ + public static DPIConfigMaskGroundingInput create() { + return new DPIConfigMaskGroundingInput(); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPICustomEntity.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPICustomEntity.java new file mode 100644 index 000000000..4c2be68dd --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPICustomEntity.java @@ -0,0 +1,237 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** DPICustomEntity */ +// CHECKSTYLE:OFF +public class DPICustomEntity implements DPIEntityConfig +// CHECKSTYLE:ON +{ + @JsonProperty("regex") + private String regex; + + @JsonProperty("replacement_strategy") + private DPIMethodConstant replacementStrategy; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DPICustomEntity. */ + protected DPICustomEntity() {} + + /** + * Set the regex of this {@link DPICustomEntity} instance and return the same instance. + * + * @param regex Regular expression to match the entity + * @return The same instance of this {@link DPICustomEntity} class + */ + @Nonnull + public DPICustomEntity regex(@Nonnull final String regex) { + this.regex = regex; + return this; + } + + /** + * Regular expression to match the entity + * + * @return regex The regex of this {@link DPICustomEntity} instance. + */ + @Nonnull + public String getRegex() { + return regex; + } + + /** + * Set the regex of this {@link DPICustomEntity} instance. + * + * @param regex Regular expression to match the entity + */ + public void setRegex(@Nonnull final String regex) { + this.regex = regex; + } + + /** + * Set the replacementStrategy of this {@link DPICustomEntity} instance and return the same + * instance. + * + * @param replacementStrategy The replacementStrategy of this {@link DPICustomEntity} + * @return The same instance of this {@link DPICustomEntity} class + */ + @Nonnull + public DPICustomEntity replacementStrategy(@Nonnull final DPIMethodConstant replacementStrategy) { + this.replacementStrategy = replacementStrategy; + return this; + } + + /** + * Get replacementStrategy + * + * @return replacementStrategy The replacementStrategy of this {@link DPICustomEntity} instance. + */ + @Nonnull + public DPIMethodConstant getReplacementStrategy() { + return replacementStrategy; + } + + /** + * Set the replacementStrategy of this {@link DPICustomEntity} instance. + * + * @param replacementStrategy The replacementStrategy of this {@link DPICustomEntity} + */ + public void setReplacementStrategy(@Nonnull final DPIMethodConstant replacementStrategy) { + this.replacementStrategy = replacementStrategy; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPICustomEntity}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPICustomEntity} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("DPICustomEntity has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPICustomEntity} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (regex != null) declaredFields.put("regex", regex); + if (replacementStrategy != null) declaredFields.put("replacementStrategy", replacementStrategy); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPICustomEntity} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final DPICustomEntity dpICustomEntity = (DPICustomEntity) o; + return Objects.equals(this.cloudSdkCustomFields, dpICustomEntity.cloudSdkCustomFields) + && Objects.equals(this.regex, dpICustomEntity.regex) + && Objects.equals(this.replacementStrategy, dpICustomEntity.replacementStrategy); + } + + @Override + public int hashCode() { + return Objects.hash(regex, replacementStrategy, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPICustomEntity {\n"); + sb.append(" regex: ").append(toIndentedString(regex)).append("\n"); + sb.append(" replacementStrategy: ") + .append(toIndentedString(replacementStrategy)) + .append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link DPICustomEntity} + * instance with all required arguments. + */ + public static Builder create() { + return (regex) -> + (replacementStrategy) -> + new DPICustomEntity().regex(regex).replacementStrategy(replacementStrategy); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the regex of this {@link DPICustomEntity} instance. + * + * @param regex Regular expression to match the entity + * @return The DPICustomEntity builder. + */ + Builder1 regex(@Nonnull final String regex); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the replacementStrategy of this {@link DPICustomEntity} instance. + * + * @param replacementStrategy The replacementStrategy of this {@link DPICustomEntity} + * @return The DPICustomEntity instance. + */ + DPICustomEntity replacementStrategy(@Nonnull final DPIMethodConstant replacementStrategy); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIEntities.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIEntities.java new file mode 100644 index 000000000..874bc8ed5 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIEntities.java @@ -0,0 +1,112 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.annotation.Nonnull; + +/** Default entities supported by data privacy and integration service */ +public enum DPIEntities { + PROFILE_PERSON("profile-person"), + + PROFILE_ORG("profile-org"), + + PROFILE_UNIVERSITY("profile-university"), + + PROFILE_LOCATION("profile-location"), + + PROFILE_EMAIL("profile-email"), + + PROFILE_PHONE("profile-phone"), + + PROFILE_ADDRESS("profile-address"), + + PROFILE_SAPIDS_INTERNAL("profile-sapids-internal"), + + PROFILE_SAPIDS_PUBLIC("profile-sapids-public"), + + PROFILE_URL("profile-url"), + + PROFILE_USERNAME_PASSWORD("profile-username-password"), + + PROFILE_NATIONALID("profile-nationalid"), + + PROFILE_IBAN("profile-iban"), + + PROFILE_SSN("profile-ssn"), + + PROFILE_CREDIT_CARD_NUMBER("profile-credit-card-number"), + + PROFILE_PASSPORT("profile-passport"), + + PROFILE_DRIVERLICENSE("profile-driverlicense"), + + PROFILE_NATIONALITY("profile-nationality"), + + PROFILE_RELIGIOUS_GROUP("profile-religious-group"), + + PROFILE_POLITICAL_GROUP("profile-political-group"), + + PROFILE_PRONOUNS_GENDER("profile-pronouns-gender"), + + PROFILE_ETHNICITY("profile-ethnicity"), + + PROFILE_GENDER("profile-gender"), + + PROFILE_SEXUAL_ORIENTATION("profile-sexual-orientation"), + + PROFILE_TRADE_UNION("profile-trade-union"), + + PROFILE_SENSITIVE_DATA("profile-sensitive-data"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + DPIEntities(String value) { + this.value = value; + } + + /** + * @return The enum value. + */ + @JsonValue + public String getValue() { + return value; + } + + /** + * @return The String representation of the enum value. + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Converts the given value to its enum representation. + * + * @param value The input value. + * @return The enum representation of the given value. + */ + @JsonCreator + public static DPIEntities fromValue(@Nonnull final String value) { + for (final DPIEntities b : DPIEntities.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIEntityConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIEntityConfig.java new file mode 100644 index 000000000..9e6a99a72 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIEntityConfig.java @@ -0,0 +1,23 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** DPIEntityConfig */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = DPICustomEntity.class), + @JsonSubTypes.Type(value = DPIStandardEntity.class), +}) +public interface DPIEntityConfig {} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIMethodConstant.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIMethodConstant.java new file mode 100644 index 000000000..6993443b6 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIMethodConstant.java @@ -0,0 +1,288 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** Replaces the entity with the specified value followed by an incrementing number */ +// CHECKSTYLE:OFF +public class DPIMethodConstant implements DPIStandardEntityReplacementStrategy +// CHECKSTYLE:ON +{ + /** Gets or Sets method */ + public enum MethodEnum { + /** The CONSTANT option of this DPIMethodConstant */ + CONSTANT("constant"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this DPIMethodConstant */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + MethodEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type DPIMethodConstant + */ + @JsonCreator + @Nonnull + public static MethodEnum fromValue(@Nonnull final String value) { + for (MethodEnum b : MethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("method") + private MethodEnum method; + + @JsonProperty("value") + private String value; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DPIMethodConstant. */ + protected DPIMethodConstant() {} + + /** + * Set the method of this {@link DPIMethodConstant} instance and return the same instance. + * + * @param method The method of this {@link DPIMethodConstant} + * @return The same instance of this {@link DPIMethodConstant} class + */ + @Nonnull + public DPIMethodConstant method(@Nonnull final MethodEnum method) { + this.method = method; + return this; + } + + /** + * Get method + * + * @return method The method of this {@link DPIMethodConstant} instance. + */ + @Nonnull + public MethodEnum getMethod() { + return method; + } + + /** + * Set the method of this {@link DPIMethodConstant} instance. + * + * @param method The method of this {@link DPIMethodConstant} + */ + public void setMethod(@Nonnull final MethodEnum method) { + this.method = method; + } + + /** + * Set the value of this {@link DPIMethodConstant} instance and return the same instance. + * + * @param value Value to be used for replacement + * @return The same instance of this {@link DPIMethodConstant} class + */ + @Nonnull + public DPIMethodConstant value(@Nonnull final String value) { + this.value = value; + return this; + } + + /** + * Value to be used for replacement + * + * @return value The value of this {@link DPIMethodConstant} instance. + */ + @Nonnull + public String getValue() { + return value; + } + + /** + * Set the value of this {@link DPIMethodConstant} instance. + * + * @param value Value to be used for replacement + */ + public void setValue(@Nonnull final String value) { + this.value = value; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIMethodConstant}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIMethodConstant} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("DPIMethodConstant has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPIMethodConstant} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (method != null) declaredFields.put("method", method); + if (value != null) declaredFields.put("value", value); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPIMethodConstant} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final DPIMethodConstant dpIMethodConstant = (DPIMethodConstant) o; + return Objects.equals(this.cloudSdkCustomFields, dpIMethodConstant.cloudSdkCustomFields) + && Objects.equals(this.method, dpIMethodConstant.method) + && Objects.equals(this.value, dpIMethodConstant.value); + } + + @Override + public int hashCode() { + return Objects.hash(method, value, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIMethodConstant {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link DPIMethodConstant} + * instance with all required arguments. + */ + public static Builder create() { + return (method) -> (value) -> new DPIMethodConstant().method(method).value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the method of this {@link DPIMethodConstant} instance. + * + * @param method The method of this {@link DPIMethodConstant} + * @return The DPIMethodConstant builder. + */ + Builder1 method(@Nonnull final MethodEnum method); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the value of this {@link DPIMethodConstant} instance. + * + * @param value Value to be used for replacement + * @return The DPIMethodConstant instance. + */ + DPIMethodConstant value(@Nonnull final String value); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIMethodFabricatedData.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIMethodFabricatedData.java new file mode 100644 index 000000000..86ab4b038 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIMethodFabricatedData.java @@ -0,0 +1,241 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** Replaces the entity with a randomly generated value appropriate to its type. */ +// CHECKSTYLE:OFF +public class DPIMethodFabricatedData implements DPIStandardEntityReplacementStrategy +// CHECKSTYLE:ON +{ + /** Gets or Sets method */ + public enum MethodEnum { + /** The FABRICATED_DATA option of this DPIMethodFabricatedData */ + FABRICATED_DATA("fabricated_data"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this DPIMethodFabricatedData */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + MethodEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type DPIMethodFabricatedData + */ + @JsonCreator + @Nonnull + public static MethodEnum fromValue(@Nonnull final String value) { + for (MethodEnum b : MethodEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("method") + private MethodEnum method; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DPIMethodFabricatedData. */ + protected DPIMethodFabricatedData() {} + + /** + * Set the method of this {@link DPIMethodFabricatedData} instance and return the same instance. + * + * @param method The method of this {@link DPIMethodFabricatedData} + * @return The same instance of this {@link DPIMethodFabricatedData} class + */ + @Nonnull + public DPIMethodFabricatedData method(@Nonnull final MethodEnum method) { + this.method = method; + return this; + } + + /** + * Get method + * + * @return method The method of this {@link DPIMethodFabricatedData} instance. + */ + @Nonnull + public MethodEnum getMethod() { + return method; + } + + /** + * Set the method of this {@link DPIMethodFabricatedData} instance. + * + * @param method The method of this {@link DPIMethodFabricatedData} + */ + public void setMethod(@Nonnull final MethodEnum method) { + this.method = method; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIMethodFabricatedData}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIMethodFabricatedData} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "DPIMethodFabricatedData has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPIMethodFabricatedData} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (method != null) declaredFields.put("method", method); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPIMethodFabricatedData} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final DPIMethodFabricatedData dpIMethodFabricatedData = (DPIMethodFabricatedData) o; + return Objects.equals(this.cloudSdkCustomFields, dpIMethodFabricatedData.cloudSdkCustomFields) + && Objects.equals(this.method, dpIMethodFabricatedData.method); + } + + @Override + public int hashCode() { + return Objects.hash(method, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIMethodFabricatedData {\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * DPIMethodFabricatedData} instance with all required arguments. + */ + public static Builder create() { + return (method) -> new DPIMethodFabricatedData().method(method); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the method of this {@link DPIMethodFabricatedData} instance. + * + * @param method The method of this {@link DPIMethodFabricatedData} + * @return The DPIMethodFabricatedData instance. + */ + DPIMethodFabricatedData method(@Nonnull final MethodEnum method); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIStandardEntity.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIStandardEntity.java new file mode 100644 index 000000000..a99bab563 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIStandardEntity.java @@ -0,0 +1,226 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** DPIStandardEntity */ +// CHECKSTYLE:OFF +public class DPIStandardEntity implements DPIEntityConfig +// CHECKSTYLE:ON +{ + @JsonProperty("type") + private DPIEntities type; + + @JsonProperty("replacement_strategy") + private DPIStandardEntityReplacementStrategy replacementStrategy; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DPIStandardEntity. */ + protected DPIStandardEntity() {} + + /** + * Set the type of this {@link DPIStandardEntity} instance and return the same instance. + * + * @param type The type of this {@link DPIStandardEntity} + * @return The same instance of this {@link DPIStandardEntity} class + */ + @Nonnull + public DPIStandardEntity type(@Nonnull final DPIEntities type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link DPIStandardEntity} instance. + */ + @Nonnull + public DPIEntities getType() { + return type; + } + + /** + * Set the type of this {@link DPIStandardEntity} instance. + * + * @param type The type of this {@link DPIStandardEntity} + */ + public void setType(@Nonnull final DPIEntities type) { + this.type = type; + } + + /** + * Set the replacementStrategy of this {@link DPIStandardEntity} instance and return the same + * instance. + * + * @param replacementStrategy The replacementStrategy of this {@link DPIStandardEntity} + * @return The same instance of this {@link DPIStandardEntity} class + */ + @Nonnull + public DPIStandardEntity replacementStrategy( + @Nullable final DPIStandardEntityReplacementStrategy replacementStrategy) { + this.replacementStrategy = replacementStrategy; + return this; + } + + /** + * Get replacementStrategy + * + * @return replacementStrategy The replacementStrategy of this {@link DPIStandardEntity} instance. + */ + @Nonnull + public DPIStandardEntityReplacementStrategy getReplacementStrategy() { + return replacementStrategy; + } + + /** + * Set the replacementStrategy of this {@link DPIStandardEntity} instance. + * + * @param replacementStrategy The replacementStrategy of this {@link DPIStandardEntity} + */ + public void setReplacementStrategy( + @Nullable final DPIStandardEntityReplacementStrategy replacementStrategy) { + this.replacementStrategy = replacementStrategy; + } + + /** + * Get the names of the unrecognizable properties of the {@link DPIStandardEntity}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DPIStandardEntity} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("DPIStandardEntity has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DPIStandardEntity} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (replacementStrategy != null) declaredFields.put("replacementStrategy", replacementStrategy); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DPIStandardEntity} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final DPIStandardEntity dpIStandardEntity = (DPIStandardEntity) o; + return Objects.equals(this.cloudSdkCustomFields, dpIStandardEntity.cloudSdkCustomFields) + && Objects.equals(this.type, dpIStandardEntity.type) + && Objects.equals(this.replacementStrategy, dpIStandardEntity.replacementStrategy); + } + + @Override + public int hashCode() { + return Objects.hash(type, replacementStrategy, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DPIStandardEntity {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" replacementStrategy: ") + .append(toIndentedString(replacementStrategy)) + .append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link DPIStandardEntity} + * instance with all required arguments. + */ + public static Builder create() { + return (type) -> new DPIStandardEntity().type(type); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link DPIStandardEntity} instance. + * + * @param type The type of this {@link DPIStandardEntity} + * @return The DPIStandardEntity instance. + */ + DPIStandardEntity type(@Nonnull final DPIEntities type); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIStandardEntityReplacementStrategy.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIStandardEntityReplacementStrategy.java new file mode 100644 index 000000000..8f2dbc248 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DPIStandardEntityReplacementStrategy.java @@ -0,0 +1,23 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** Replacement strategy to be used for the entity */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = DPIMethodConstant.class), + @JsonSubTypes.Type(value = DPIMethodFabricatedData.class), +}) +public interface DPIStandardEntityReplacementStrategy {} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DataRepositoryType.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DataRepositoryType.java new file mode 100644 index 000000000..0948d9f3d --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DataRepositoryType.java @@ -0,0 +1,64 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.annotation.Nonnull; + +/** Only include DataRepositories with the given type. */ +public enum DataRepositoryType { + VECTOR("vector"), + + HELP_SAP_COM("help.sap.com"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + DataRepositoryType(String value) { + this.value = value; + } + + /** + * @return The enum value. + */ + @JsonValue + public String getValue() { + return value; + } + + /** + * @return The String representation of the enum value. + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Converts the given value to its enum representation. + * + * @param value The input value. + * @return The enum representation of the given value. + */ + @JsonCreator + public static DataRepositoryType fromValue(@Nonnull final String value) { + for (final DataRepositoryType b : DataRepositoryType.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DeveloperChatMessage.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DeveloperChatMessage.java new file mode 100644 index 000000000..94632396e --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DeveloperChatMessage.java @@ -0,0 +1,289 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** DeveloperChatMessage */ +// CHECKSTYLE:OFF +public class DeveloperChatMessage implements ChatMessage +// CHECKSTYLE:ON +{ + /** Gets or Sets role */ + public enum RoleEnum { + /** The DEVELOPER option of this DeveloperChatMessage */ + DEVELOPER("developer"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this DeveloperChatMessage */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + RoleEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type DeveloperChatMessage + */ + @JsonCreator + @Nonnull + public static RoleEnum fromValue(@Nonnull final String value) { + for (RoleEnum b : RoleEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("role") + private RoleEnum role; + + @JsonProperty("content") + private ChatMessageContent content; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DeveloperChatMessage. */ + protected DeveloperChatMessage() {} + + /** + * Set the role of this {@link DeveloperChatMessage} instance and return the same instance. + * + * @param role The role of this {@link DeveloperChatMessage} + * @return The same instance of this {@link DeveloperChatMessage} class + */ + @Nonnull + public DeveloperChatMessage role(@Nonnull final RoleEnum role) { + this.role = role; + return this; + } + + /** + * Get role + * + * @return role The role of this {@link DeveloperChatMessage} instance. + */ + @Nonnull + public RoleEnum getRole() { + return role; + } + + /** + * Set the role of this {@link DeveloperChatMessage} instance. + * + * @param role The role of this {@link DeveloperChatMessage} + */ + public void setRole(@Nonnull final RoleEnum role) { + this.role = role; + } + + /** + * Set the content of this {@link DeveloperChatMessage} instance and return the same instance. + * + * @param content The content of this {@link DeveloperChatMessage} + * @return The same instance of this {@link DeveloperChatMessage} class + */ + @Nonnull + public DeveloperChatMessage content(@Nonnull final ChatMessageContent content) { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link DeveloperChatMessage} instance. + */ + @Nonnull + public ChatMessageContent getContent() { + return content; + } + + /** + * Set the content of this {@link DeveloperChatMessage} instance. + * + * @param content The content of this {@link DeveloperChatMessage} + */ + public void setContent(@Nonnull final ChatMessageContent content) { + this.content = content; + } + + /** + * Get the names of the unrecognizable properties of the {@link DeveloperChatMessage}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DeveloperChatMessage} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "DeveloperChatMessage has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DeveloperChatMessage} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (role != null) declaredFields.put("role", role); + if (content != null) declaredFields.put("content", content); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DeveloperChatMessage} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final DeveloperChatMessage developerChatMessage = (DeveloperChatMessage) o; + return Objects.equals(this.cloudSdkCustomFields, developerChatMessage.cloudSdkCustomFields) + && Objects.equals(this.role, developerChatMessage.role) + && Objects.equals(this.content, developerChatMessage.content); + } + + @Override + public int hashCode() { + return Objects.hash(role, content, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DeveloperChatMessage {\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link DeveloperChatMessage} + * instance with all required arguments. + */ + public static Builder create() { + return (role) -> (content) -> new DeveloperChatMessage().role(role).content(content); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the role of this {@link DeveloperChatMessage} instance. + * + * @param role The role of this {@link DeveloperChatMessage} + * @return The DeveloperChatMessage builder. + */ + Builder1 role(@Nonnull final RoleEnum role); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the content of this {@link DeveloperChatMessage} instance. + * + * @param content The content of this {@link DeveloperChatMessage} + * @return The DeveloperChatMessage instance. + */ + DeveloperChatMessage content(@Nonnull final ChatMessageContent content); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DocumentGroundingFilter.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DocumentGroundingFilter.java new file mode 100644 index 000000000..cef21fbcc --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/DocumentGroundingFilter.java @@ -0,0 +1,513 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** DocumentGroundingFilter */ +// CHECKSTYLE:OFF +public class DocumentGroundingFilter implements GroundingModuleConfigConfigFiltersInner +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + @JsonProperty("search_config") + private GroundingFilterSearchConfiguration searchConfig; + + @JsonProperty("data_repositories") + private List dataRepositories = new ArrayList<>(Arrays.asList("*")); + + @JsonProperty("data_repository_type") + private DataRepositoryType dataRepositoryType; + + @JsonProperty("data_repository_metadata") + private List dataRepositoryMetadata = new ArrayList<>(); + + @JsonProperty("document_metadata") + private List documentMetadata = new ArrayList<>(); + + @JsonProperty("chunk_metadata") + private List chunkMetadata = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DocumentGroundingFilter. */ + protected DocumentGroundingFilter() {} + + /** + * Set the id of this {@link DocumentGroundingFilter} instance and return the same instance. + * + * @param id Identifier of this SearchFilter - unique per request. + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter id(@Nullable final String id) { + this.id = id; + return this; + } + + /** + * Identifier of this SearchFilter - unique per request. + * + * @return id The id of this {@link DocumentGroundingFilter} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link DocumentGroundingFilter} instance. + * + * @param id Identifier of this SearchFilter - unique per request. + */ + public void setId(@Nullable final String id) { + this.id = id; + } + + /** + * Set the searchConfig of this {@link DocumentGroundingFilter} instance and return the same + * instance. + * + * @param searchConfig The searchConfig of this {@link DocumentGroundingFilter} + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter searchConfig( + @Nullable final GroundingFilterSearchConfiguration searchConfig) { + this.searchConfig = searchConfig; + return this; + } + + /** + * Get searchConfig + * + * @return searchConfig The searchConfig of this {@link DocumentGroundingFilter} instance. + */ + @Nonnull + public GroundingFilterSearchConfiguration getSearchConfig() { + return searchConfig; + } + + /** + * Set the searchConfig of this {@link DocumentGroundingFilter} instance. + * + * @param searchConfig The searchConfig of this {@link DocumentGroundingFilter} + */ + public void setSearchConfig(@Nullable final GroundingFilterSearchConfiguration searchConfig) { + this.searchConfig = searchConfig; + } + + /** + * Set the dataRepositories of this {@link DocumentGroundingFilter} instance and return the same + * instance. + * + * @param dataRepositories Specify ['*'] to search across all DataRepositories or give a + * specific list of DataRepository ids. + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter dataRepositories(@Nullable final List dataRepositories) { + this.dataRepositories = dataRepositories; + return this; + } + + /** + * Add one dataRepositories instance to this {@link DocumentGroundingFilter}. + * + * @param dataRepositoriesItem The dataRepositories that should be added + * @return The same instance of type {@link DocumentGroundingFilter} + */ + @Nonnull + public DocumentGroundingFilter addDataRepositoriesItem( + @Nonnull final String dataRepositoriesItem) { + if (this.dataRepositories == null) { + this.dataRepositories = new ArrayList<>(Arrays.asList("*")); + } + this.dataRepositories.add(dataRepositoriesItem); + return this; + } + + /** + * Specify ['*'] to search across all DataRepositories or give a specific list of + * DataRepository ids. + * + * @return dataRepositories The dataRepositories of this {@link DocumentGroundingFilter} instance. + */ + @Nonnull + public List getDataRepositories() { + return dataRepositories; + } + + /** + * Set the dataRepositories of this {@link DocumentGroundingFilter} instance. + * + * @param dataRepositories Specify ['*'] to search across all DataRepositories or give a + * specific list of DataRepository ids. + */ + public void setDataRepositories(@Nullable final List dataRepositories) { + this.dataRepositories = dataRepositories; + } + + /** + * Set the dataRepositoryType of this {@link DocumentGroundingFilter} instance and return the same + * instance. + * + * @param dataRepositoryType The dataRepositoryType of this {@link DocumentGroundingFilter} + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter dataRepositoryType( + @Nonnull final DataRepositoryType dataRepositoryType) { + this.dataRepositoryType = dataRepositoryType; + return this; + } + + /** + * Get dataRepositoryType + * + * @return dataRepositoryType The dataRepositoryType of this {@link DocumentGroundingFilter} + * instance. + */ + @Nonnull + public DataRepositoryType getDataRepositoryType() { + return dataRepositoryType; + } + + /** + * Set the dataRepositoryType of this {@link DocumentGroundingFilter} instance. + * + * @param dataRepositoryType The dataRepositoryType of this {@link DocumentGroundingFilter} + */ + public void setDataRepositoryType(@Nonnull final DataRepositoryType dataRepositoryType) { + this.dataRepositoryType = dataRepositoryType; + } + + /** + * Set the dataRepositoryMetadata of this {@link DocumentGroundingFilter} instance and return the + * same instance. + * + * @param dataRepositoryMetadata Restrict DataRepositories considered during search to those + * annotated with the given metadata. Useful when combined with + * dataRepositories=['*'] + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter dataRepositoryMetadata( + @Nullable final List dataRepositoryMetadata) { + this.dataRepositoryMetadata = dataRepositoryMetadata; + return this; + } + + /** + * Add one dataRepositoryMetadata instance to this {@link DocumentGroundingFilter}. + * + * @param dataRepositoryMetadataItem The dataRepositoryMetadata that should be added + * @return The same instance of type {@link DocumentGroundingFilter} + */ + @Nonnull + public DocumentGroundingFilter addDataRepositoryMetadataItem( + @Nonnull final KeyValueListPair dataRepositoryMetadataItem) { + if (this.dataRepositoryMetadata == null) { + this.dataRepositoryMetadata = new ArrayList<>(); + } + this.dataRepositoryMetadata.add(dataRepositoryMetadataItem); + return this; + } + + /** + * Restrict DataRepositories considered during search to those annotated with the given metadata. + * Useful when combined with dataRepositories=['*'] + * + * @return dataRepositoryMetadata The dataRepositoryMetadata of this {@link + * DocumentGroundingFilter} instance. + */ + @Nonnull + public List getDataRepositoryMetadata() { + return dataRepositoryMetadata; + } + + /** + * Set the dataRepositoryMetadata of this {@link DocumentGroundingFilter} instance. + * + * @param dataRepositoryMetadata Restrict DataRepositories considered during search to those + * annotated with the given metadata. Useful when combined with + * dataRepositories=['*'] + */ + public void setDataRepositoryMetadata( + @Nullable final List dataRepositoryMetadata) { + this.dataRepositoryMetadata = dataRepositoryMetadata; + } + + /** + * Set the documentMetadata of this {@link DocumentGroundingFilter} instance and return the same + * instance. + * + * @param documentMetadata Restrict documents considered during search to those annotated with the + * given metadata. + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter documentMetadata( + @Nullable final List documentMetadata) { + this.documentMetadata = documentMetadata; + return this; + } + + /** + * Add one documentMetadata instance to this {@link DocumentGroundingFilter}. + * + * @param documentMetadataItem The documentMetadata that should be added + * @return The same instance of type {@link DocumentGroundingFilter} + */ + @Nonnull + public DocumentGroundingFilter addDocumentMetadataItem( + @Nonnull final SearchDocumentKeyValueListPair documentMetadataItem) { + if (this.documentMetadata == null) { + this.documentMetadata = new ArrayList<>(); + } + this.documentMetadata.add(documentMetadataItem); + return this; + } + + /** + * Restrict documents considered during search to those annotated with the given metadata. + * + * @return documentMetadata The documentMetadata of this {@link DocumentGroundingFilter} instance. + */ + @Nonnull + public List getDocumentMetadata() { + return documentMetadata; + } + + /** + * Set the documentMetadata of this {@link DocumentGroundingFilter} instance. + * + * @param documentMetadata Restrict documents considered during search to those annotated with the + * given metadata. + */ + public void setDocumentMetadata( + @Nullable final List documentMetadata) { + this.documentMetadata = documentMetadata; + } + + /** + * Set the chunkMetadata of this {@link DocumentGroundingFilter} instance and return the same + * instance. + * + * @param chunkMetadata Restrict chunks considered during search to those with the given metadata. + * @return The same instance of this {@link DocumentGroundingFilter} class + */ + @Nonnull + public DocumentGroundingFilter chunkMetadata( + @Nullable final List chunkMetadata) { + this.chunkMetadata = chunkMetadata; + return this; + } + + /** + * Add one chunkMetadata instance to this {@link DocumentGroundingFilter}. + * + * @param chunkMetadataItem The chunkMetadata that should be added + * @return The same instance of type {@link DocumentGroundingFilter} + */ + @Nonnull + public DocumentGroundingFilter addChunkMetadataItem( + @Nonnull final KeyValueListPair chunkMetadataItem) { + if (this.chunkMetadata == null) { + this.chunkMetadata = new ArrayList<>(); + } + this.chunkMetadata.add(chunkMetadataItem); + return this; + } + + /** + * Restrict chunks considered during search to those with the given metadata. + * + * @return chunkMetadata The chunkMetadata of this {@link DocumentGroundingFilter} instance. + */ + @Nonnull + public List getChunkMetadata() { + return chunkMetadata; + } + + /** + * Set the chunkMetadata of this {@link DocumentGroundingFilter} instance. + * + * @param chunkMetadata Restrict chunks considered during search to those with the given metadata. + */ + public void setChunkMetadata(@Nullable final List chunkMetadata) { + this.chunkMetadata = chunkMetadata; + } + + /** + * Get the names of the unrecognizable properties of the {@link DocumentGroundingFilter}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DocumentGroundingFilter} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "DocumentGroundingFilter has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DocumentGroundingFilter} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (id != null) declaredFields.put("id", id); + if (searchConfig != null) declaredFields.put("searchConfig", searchConfig); + if (dataRepositories != null) declaredFields.put("dataRepositories", dataRepositories); + if (dataRepositoryType != null) declaredFields.put("dataRepositoryType", dataRepositoryType); + if (dataRepositoryMetadata != null) + declaredFields.put("dataRepositoryMetadata", dataRepositoryMetadata); + if (documentMetadata != null) declaredFields.put("documentMetadata", documentMetadata); + if (chunkMetadata != null) declaredFields.put("chunkMetadata", chunkMetadata); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DocumentGroundingFilter} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final DocumentGroundingFilter documentGroundingFilter = (DocumentGroundingFilter) o; + return Objects.equals(this.cloudSdkCustomFields, documentGroundingFilter.cloudSdkCustomFields) + && Objects.equals(this.id, documentGroundingFilter.id) + && Objects.equals(this.searchConfig, documentGroundingFilter.searchConfig) + && Objects.equals(this.dataRepositories, documentGroundingFilter.dataRepositories) + && Objects.equals(this.dataRepositoryType, documentGroundingFilter.dataRepositoryType) + && Objects.equals( + this.dataRepositoryMetadata, documentGroundingFilter.dataRepositoryMetadata) + && Objects.equals(this.documentMetadata, documentGroundingFilter.documentMetadata) + && Objects.equals(this.chunkMetadata, documentGroundingFilter.chunkMetadata); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + searchConfig, + dataRepositories, + dataRepositoryType, + dataRepositoryMetadata, + documentMetadata, + chunkMetadata, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DocumentGroundingFilter {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" searchConfig: ").append(toIndentedString(searchConfig)).append("\n"); + sb.append(" dataRepositories: ").append(toIndentedString(dataRepositories)).append("\n"); + sb.append(" dataRepositoryType: ").append(toIndentedString(dataRepositoryType)).append("\n"); + sb.append(" dataRepositoryMetadata: ") + .append(toIndentedString(dataRepositoryMetadata)) + .append("\n"); + sb.append(" documentMetadata: ").append(toIndentedString(documentMetadata)).append("\n"); + sb.append(" chunkMetadata: ").append(toIndentedString(chunkMetadata)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * DocumentGroundingFilter} instance with all required arguments. + */ + public static Builder create() { + return (dataRepositoryType) -> + new DocumentGroundingFilter().dataRepositoryType(dataRepositoryType); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the dataRepositoryType of this {@link DocumentGroundingFilter} instance. + * + * @param dataRepositoryType The dataRepositoryType of this {@link DocumentGroundingFilter} + * @return The DocumentGroundingFilter instance. + */ + DocumentGroundingFilter dataRepositoryType( + @Nonnull final DataRepositoryType dataRepositoryType); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/FilteringModuleConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/FilteringModuleConfig.java new file mode 100644 index 000000000..76082517c --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/FilteringModuleConfig.java @@ -0,0 +1,208 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** FilteringModuleConfig */ +// CHECKSTYLE:OFF +public class FilteringModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty("input") + private InputFilteringConfig input; + + @JsonProperty("output") + private OutputFilteringConfig output; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for FilteringModuleConfig. */ + protected FilteringModuleConfig() {} + + /** + * Set the input of this {@link FilteringModuleConfig} instance and return the same instance. + * + * @param input List of provider type and filters + * @return The same instance of this {@link FilteringModuleConfig} class + */ + @Nonnull + public FilteringModuleConfig input(@Nullable final InputFilteringConfig input) { + this.input = input; + return this; + } + + /** + * List of provider type and filters + * + * @return input The input of this {@link FilteringModuleConfig} instance. + */ + @Nonnull + public InputFilteringConfig getInput() { + return input; + } + + /** + * Set the input of this {@link FilteringModuleConfig} instance. + * + * @param input List of provider type and filters + */ + public void setInput(@Nullable final InputFilteringConfig input) { + this.input = input; + } + + /** + * Set the output of this {@link FilteringModuleConfig} instance and return the same instance. + * + * @param output List of provider type and filters + * @return The same instance of this {@link FilteringModuleConfig} class + */ + @Nonnull + public FilteringModuleConfig output(@Nullable final OutputFilteringConfig output) { + this.output = output; + return this; + } + + /** + * List of provider type and filters + * + * @return output The output of this {@link FilteringModuleConfig} instance. + */ + @Nonnull + public OutputFilteringConfig getOutput() { + return output; + } + + /** + * Set the output of this {@link FilteringModuleConfig} instance. + * + * @param output List of provider type and filters + */ + public void setOutput(@Nullable final OutputFilteringConfig output) { + this.output = output; + } + + /** + * Get the names of the unrecognizable properties of the {@link FilteringModuleConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link FilteringModuleConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "FilteringModuleConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link FilteringModuleConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (input != null) declaredFields.put("input", input); + if (output != null) declaredFields.put("output", output); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link FilteringModuleConfig} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final FilteringModuleConfig filteringModuleConfig = (FilteringModuleConfig) o; + return Objects.equals(this.cloudSdkCustomFields, filteringModuleConfig.cloudSdkCustomFields) + && Objects.equals(this.input, filteringModuleConfig.input) + && Objects.equals(this.output, filteringModuleConfig.output); + } + + @Override + public int hashCode() { + return Objects.hash(input, output, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class FilteringModuleConfig {\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link FilteringModuleConfig} instance. No arguments are required. */ + public static FilteringModuleConfig create() { + return new FilteringModuleConfig(); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/FilteringStreamOptions.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/FilteringStreamOptions.java new file mode 100644 index 000000000..a635ce815 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/FilteringStreamOptions.java @@ -0,0 +1,174 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** Stream options for output filtering. Will be ignored if stream is false. */ +// CHECKSTYLE:OFF +public class FilteringStreamOptions +// CHECKSTYLE:ON +{ + @JsonProperty("overlap") + private Integer overlap = 0; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for FilteringStreamOptions. */ + protected FilteringStreamOptions() {} + + /** + * Set the overlap of this {@link FilteringStreamOptions} instance and return the same instance. + * + * @param overlap Number of characters that should be additionally sent to content filtering + * services from previous chunks as additional context. Minimum: 0 Maximum: 10000 + * @return The same instance of this {@link FilteringStreamOptions} class + */ + @Nonnull + public FilteringStreamOptions overlap(@Nullable final Integer overlap) { + this.overlap = overlap; + return this; + } + + /** + * Number of characters that should be additionally sent to content filtering services from + * previous chunks as additional context. minimum: 0 maximum: 10000 + * + * @return overlap The overlap of this {@link FilteringStreamOptions} instance. + */ + @Nonnull + public Integer getOverlap() { + return overlap; + } + + /** + * Set the overlap of this {@link FilteringStreamOptions} instance. + * + * @param overlap Number of characters that should be additionally sent to content filtering + * services from previous chunks as additional context. Minimum: 0 Maximum: 10000 + */ + public void setOverlap(@Nullable final Integer overlap) { + this.overlap = overlap; + } + + /** + * Get the names of the unrecognizable properties of the {@link FilteringStreamOptions}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link FilteringStreamOptions} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "FilteringStreamOptions has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link FilteringStreamOptions} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (overlap != null) declaredFields.put("overlap", overlap); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link FilteringStreamOptions} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final FilteringStreamOptions filteringStreamOptions = (FilteringStreamOptions) o; + return Objects.equals(this.cloudSdkCustomFields, filteringStreamOptions.cloudSdkCustomFields) + && Objects.equals(this.overlap, filteringStreamOptions.overlap); + } + + @Override + public int hashCode() { + return Objects.hash(overlap, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class FilteringStreamOptions {\n"); + sb.append(" overlap: ").append(toIndentedString(overlap)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link FilteringStreamOptions} instance. No arguments are required. */ + public static FilteringStreamOptions create() { + return new FilteringStreamOptions(); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GlobalStreamOptions.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GlobalStreamOptions.java new file mode 100644 index 000000000..a99db9805 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GlobalStreamOptions.java @@ -0,0 +1,271 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** Options for streaming. Will be ignored if enabled is false. */ +// CHECKSTYLE:OFF +public class GlobalStreamOptions +// CHECKSTYLE:ON +{ + @JsonProperty("enabled") + private Boolean enabled = false; + + @JsonProperty("chunk_size") + private Integer chunkSize = 100; + + @JsonProperty("delimiters") + private List delimiters = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for GlobalStreamOptions. */ + protected GlobalStreamOptions() {} + + /** + * Set the enabled of this {@link GlobalStreamOptions} instance and return the same instance. + * + * @param enabled If true, the response will be streamed back to the client + * @return The same instance of this {@link GlobalStreamOptions} class + */ + @Nonnull + public GlobalStreamOptions enabled(@Nullable final Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * If true, the response will be streamed back to the client + * + * @return enabled The enabled of this {@link GlobalStreamOptions} instance. + */ + @Nonnull + public Boolean isEnabled() { + return enabled; + } + + /** + * Set the enabled of this {@link GlobalStreamOptions} instance. + * + * @param enabled If true, the response will be streamed back to the client + */ + public void setEnabled(@Nullable final Boolean enabled) { + this.enabled = enabled; + } + + /** + * Set the chunkSize of this {@link GlobalStreamOptions} instance and return the same instance. + * + * @param chunkSize Minimum number of characters per chunk that post-LLM modules operate on. + * Minimum: 1 Maximum: 10000 + * @return The same instance of this {@link GlobalStreamOptions} class + */ + @Nonnull + public GlobalStreamOptions chunkSize(@Nullable final Integer chunkSize) { + this.chunkSize = chunkSize; + return this; + } + + /** + * Minimum number of characters per chunk that post-LLM modules operate on. minimum: 1 maximum: + * 10000 + * + * @return chunkSize The chunkSize of this {@link GlobalStreamOptions} instance. + */ + @Nonnull + public Integer getChunkSize() { + return chunkSize; + } + + /** + * Set the chunkSize of this {@link GlobalStreamOptions} instance. + * + * @param chunkSize Minimum number of characters per chunk that post-LLM modules operate on. + * Minimum: 1 Maximum: 10000 + */ + public void setChunkSize(@Nullable final Integer chunkSize) { + this.chunkSize = chunkSize; + } + + /** + * Set the delimiters of this {@link GlobalStreamOptions} instance and return the same instance. + * + * @param delimiters List of delimiters to split the input text into chunks.Please note, this is a + * required parameter when `input_translation_module_config` or + * `output_translation_module_config` are configured. + * @return The same instance of this {@link GlobalStreamOptions} class + */ + @Nonnull + public GlobalStreamOptions delimiters(@Nullable final List delimiters) { + this.delimiters = delimiters; + return this; + } + + /** + * Add one delimiters instance to this {@link GlobalStreamOptions}. + * + * @param delimitersItem The delimiters that should be added + * @return The same instance of type {@link GlobalStreamOptions} + */ + @Nonnull + public GlobalStreamOptions addDelimitersItem(@Nonnull final String delimitersItem) { + if (this.delimiters == null) { + this.delimiters = new ArrayList<>(); + } + this.delimiters.add(delimitersItem); + return this; + } + + /** + * List of delimiters to split the input text into chunks.Please note, this is a required + * parameter when `input_translation_module_config` or + * `output_translation_module_config` are configured. + * + * @return delimiters The delimiters of this {@link GlobalStreamOptions} instance. + */ + @Nonnull + public List getDelimiters() { + return delimiters; + } + + /** + * Set the delimiters of this {@link GlobalStreamOptions} instance. + * + * @param delimiters List of delimiters to split the input text into chunks.Please note, this is a + * required parameter when `input_translation_module_config` or + * `output_translation_module_config` are configured. + */ + public void setDelimiters(@Nullable final List delimiters) { + this.delimiters = delimiters; + } + + /** + * Get the names of the unrecognizable properties of the {@link GlobalStreamOptions}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link GlobalStreamOptions} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "GlobalStreamOptions has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link GlobalStreamOptions} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (enabled != null) declaredFields.put("enabled", enabled); + if (chunkSize != null) declaredFields.put("chunkSize", chunkSize); + if (delimiters != null) declaredFields.put("delimiters", delimiters); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link GlobalStreamOptions} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final GlobalStreamOptions globalStreamOptions = (GlobalStreamOptions) o; + return Objects.equals(this.cloudSdkCustomFields, globalStreamOptions.cloudSdkCustomFields) + && Objects.equals(this.enabled, globalStreamOptions.enabled) + && Objects.equals(this.chunkSize, globalStreamOptions.chunkSize) + && Objects.equals(this.delimiters, globalStreamOptions.delimiters); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, chunkSize, delimiters, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class GlobalStreamOptions {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" chunkSize: ").append(toIndentedString(chunkSize)).append("\n"); + sb.append(" delimiters: ").append(toIndentedString(delimiters)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link GlobalStreamOptions} instance. No arguments are required. */ + public static GlobalStreamOptions create() { + return new GlobalStreamOptions(); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingFilterSearchConfiguration.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingFilterSearchConfiguration.java new file mode 100644 index 000000000..5db135230 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingFilterSearchConfiguration.java @@ -0,0 +1,230 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** GroundingFilterSearchConfiguration */ +// CHECKSTYLE:OFF +public class GroundingFilterSearchConfiguration +// CHECKSTYLE:ON +{ + @JsonProperty("max_chunk_count") + private Integer maxChunkCount; + + @JsonProperty("max_document_count") + private Integer maxDocumentCount; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for GroundingFilterSearchConfiguration. */ + protected GroundingFilterSearchConfiguration() {} + + /** + * Set the maxChunkCount of this {@link GroundingFilterSearchConfiguration} instance and return + * the same instance. + * + * @param maxChunkCount Maximum number of chunks to be returned. Cannot be used with + * 'maxDocumentCount'. Minimum: 0 + * @return The same instance of this {@link GroundingFilterSearchConfiguration} class + */ + @Nonnull + public GroundingFilterSearchConfiguration maxChunkCount(@Nullable final Integer maxChunkCount) { + this.maxChunkCount = maxChunkCount; + return this; + } + + /** + * Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. + * minimum: 0 + * + * @return maxChunkCount The maxChunkCount of this {@link GroundingFilterSearchConfiguration} + * instance. + */ + @Nonnull + public Integer getMaxChunkCount() { + return maxChunkCount; + } + + /** + * Set the maxChunkCount of this {@link GroundingFilterSearchConfiguration} instance. + * + * @param maxChunkCount Maximum number of chunks to be returned. Cannot be used with + * 'maxDocumentCount'. Minimum: 0 + */ + public void setMaxChunkCount(@Nullable final Integer maxChunkCount) { + this.maxChunkCount = maxChunkCount; + } + + /** + * Set the maxDocumentCount of this {@link GroundingFilterSearchConfiguration} instance and return + * the same instance. + * + * @param maxDocumentCount [Only supports 'vector' dataRepositoryType] - Maximum number of + * documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount + * is given, then only one chunk per document is returned. Minimum: 0 + * @return The same instance of this {@link GroundingFilterSearchConfiguration} class + */ + @Nonnull + public GroundingFilterSearchConfiguration maxDocumentCount( + @Nullable final Integer maxDocumentCount) { + this.maxDocumentCount = maxDocumentCount; + return this; + } + + /** + * [Only supports 'vector' dataRepositoryType] - Maximum number of documents to be + * returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only + * one chunk per document is returned. minimum: 0 + * + * @return maxDocumentCount The maxDocumentCount of this {@link + * GroundingFilterSearchConfiguration} instance. + */ + @Nonnull + public Integer getMaxDocumentCount() { + return maxDocumentCount; + } + + /** + * Set the maxDocumentCount of this {@link GroundingFilterSearchConfiguration} instance. + * + * @param maxDocumentCount [Only supports 'vector' dataRepositoryType] - Maximum number of + * documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount + * is given, then only one chunk per document is returned. Minimum: 0 + */ + public void setMaxDocumentCount(@Nullable final Integer maxDocumentCount) { + this.maxDocumentCount = maxDocumentCount; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * GroundingFilterSearchConfiguration}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link GroundingFilterSearchConfiguration} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "GroundingFilterSearchConfiguration has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link GroundingFilterSearchConfiguration} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (maxChunkCount != null) declaredFields.put("maxChunkCount", maxChunkCount); + if (maxDocumentCount != null) declaredFields.put("maxDocumentCount", maxDocumentCount); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link GroundingFilterSearchConfiguration} instance. If + * the map previously contained a mapping for the key, the old value is replaced by the specified + * value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final GroundingFilterSearchConfiguration groundingFilterSearchConfiguration = + (GroundingFilterSearchConfiguration) o; + return Objects.equals( + this.cloudSdkCustomFields, groundingFilterSearchConfiguration.cloudSdkCustomFields) + && Objects.equals(this.maxChunkCount, groundingFilterSearchConfiguration.maxChunkCount) + && Objects.equals( + this.maxDocumentCount, groundingFilterSearchConfiguration.maxDocumentCount); + } + + @Override + public int hashCode() { + return Objects.hash(maxChunkCount, maxDocumentCount, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class GroundingFilterSearchConfiguration {\n"); + sb.append(" maxChunkCount: ").append(toIndentedString(maxChunkCount)).append("\n"); + sb.append(" maxDocumentCount: ").append(toIndentedString(maxDocumentCount)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a new {@link GroundingFilterSearchConfiguration} instance. No arguments are required. + */ + public static GroundingFilterSearchConfiguration create() { + return new GroundingFilterSearchConfiguration(); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingModuleConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingModuleConfig.java new file mode 100644 index 000000000..1df217d50 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingModuleConfig.java @@ -0,0 +1,289 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** GroundingModuleConfig */ +// CHECKSTYLE:OFF +public class GroundingModuleConfig +// CHECKSTYLE:ON +{ + /** Gets or Sets type */ + public enum TypeEnum { + /** The DOCUMENT_GROUNDING_SERVICE option of this GroundingModuleConfig */ + DOCUMENT_GROUNDING_SERVICE("document_grounding_service"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this GroundingModuleConfig */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type GroundingModuleConfig + */ + @JsonCreator + @Nullable + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + } + + @JsonProperty("type") + private TypeEnum type; + + @JsonProperty("config") + private GroundingModuleConfigConfig config; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for GroundingModuleConfig. */ + protected GroundingModuleConfig() {} + + /** + * Set the type of this {@link GroundingModuleConfig} instance and return the same instance. + * + * @param type The type of this {@link GroundingModuleConfig} + * @return The same instance of this {@link GroundingModuleConfig} class + */ + @Nonnull + public GroundingModuleConfig type(@Nullable final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link GroundingModuleConfig} instance. + */ + @Nullable + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link GroundingModuleConfig} instance. + * + * @param type The type of this {@link GroundingModuleConfig} + */ + public void setType(@Nullable final TypeEnum type) { + this.type = type; + } + + /** + * Set the config of this {@link GroundingModuleConfig} instance and return the same instance. + * + * @param config The config of this {@link GroundingModuleConfig} + * @return The same instance of this {@link GroundingModuleConfig} class + */ + @Nonnull + public GroundingModuleConfig config(@Nonnull final GroundingModuleConfigConfig config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link GroundingModuleConfig} instance. + */ + @Nonnull + public GroundingModuleConfigConfig getConfig() { + return config; + } + + /** + * Set the config of this {@link GroundingModuleConfig} instance. + * + * @param config The config of this {@link GroundingModuleConfig} + */ + public void setConfig(@Nonnull final GroundingModuleConfigConfig config) { + this.config = config; + } + + /** + * Get the names of the unrecognizable properties of the {@link GroundingModuleConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link GroundingModuleConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "GroundingModuleConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link GroundingModuleConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (config != null) declaredFields.put("config", config); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link GroundingModuleConfig} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final GroundingModuleConfig groundingModuleConfig = (GroundingModuleConfig) o; + return Objects.equals(this.cloudSdkCustomFields, groundingModuleConfig.cloudSdkCustomFields) + && Objects.equals(this.type, groundingModuleConfig.type) + && Objects.equals(this.config, groundingModuleConfig.config); + } + + @Override + public int hashCode() { + return Objects.hash(type, config, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class GroundingModuleConfig {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link GroundingModuleConfig} + * instance with all required arguments. + */ + public static Builder create() { + return (type) -> (config) -> new GroundingModuleConfig().type(type).config(config); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link GroundingModuleConfig} instance. + * + * @param type The type of this {@link GroundingModuleConfig} + * @return The GroundingModuleConfig builder. + */ + Builder1 type(@Nullable final TypeEnum type); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the config of this {@link GroundingModuleConfig} instance. + * + * @param config The config of this {@link GroundingModuleConfig} + * @return The GroundingModuleConfig instance. + */ + GroundingModuleConfig config(@Nonnull final GroundingModuleConfigConfig config); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingModuleConfigConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingModuleConfigConfig.java new file mode 100644 index 000000000..58300b2b7 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingModuleConfigConfig.java @@ -0,0 +1,301 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** GroundingModuleConfigConfig */ +// CHECKSTYLE:OFF +public class GroundingModuleConfigConfig +// CHECKSTYLE:ON +{ + @JsonProperty("filters") + private List filters = new ArrayList<>(); + + @JsonProperty("placeholders") + private GroundingModuleConfigConfigPlaceholders placeholders; + + @JsonProperty("metadata_params") + private List metadataParams = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for GroundingModuleConfigConfig. */ + protected GroundingModuleConfigConfig() {} + + /** + * Set the filters of this {@link GroundingModuleConfigConfig} instance and return the same + * instance. + * + * @param filters Document grounding service filters to be used + * @return The same instance of this {@link GroundingModuleConfigConfig} class + */ + @Nonnull + public GroundingModuleConfigConfig filters( + @Nullable final List filters) { + this.filters = filters; + return this; + } + + /** + * Add one filters instance to this {@link GroundingModuleConfigConfig}. + * + * @param filtersItem The filters that should be added + * @return The same instance of type {@link GroundingModuleConfigConfig} + */ + @Nonnull + public GroundingModuleConfigConfig addFiltersItem( + @Nonnull final GroundingModuleConfigConfigFiltersInner filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * Document grounding service filters to be used + * + * @return filters The filters of this {@link GroundingModuleConfigConfig} instance. + */ + @Nonnull + public List getFilters() { + return filters; + } + + /** + * Set the filters of this {@link GroundingModuleConfigConfig} instance. + * + * @param filters Document grounding service filters to be used + */ + public void setFilters(@Nullable final List filters) { + this.filters = filters; + } + + /** + * Set the placeholders of this {@link GroundingModuleConfigConfig} instance and return the same + * instance. + * + * @param placeholders The placeholders of this {@link GroundingModuleConfigConfig} + * @return The same instance of this {@link GroundingModuleConfigConfig} class + */ + @Nonnull + public GroundingModuleConfigConfig placeholders( + @Nonnull final GroundingModuleConfigConfigPlaceholders placeholders) { + this.placeholders = placeholders; + return this; + } + + /** + * Get placeholders + * + * @return placeholders The placeholders of this {@link GroundingModuleConfigConfig} instance. + */ + @Nonnull + public GroundingModuleConfigConfigPlaceholders getPlaceholders() { + return placeholders; + } + + /** + * Set the placeholders of this {@link GroundingModuleConfigConfig} instance. + * + * @param placeholders The placeholders of this {@link GroundingModuleConfigConfig} + */ + public void setPlaceholders(@Nonnull final GroundingModuleConfigConfigPlaceholders placeholders) { + this.placeholders = placeholders; + } + + /** + * Set the metadataParams of this {@link GroundingModuleConfigConfig} instance and return the same + * instance. + * + * @param metadataParams Parameter name used for specifying metadata parameters + * @return The same instance of this {@link GroundingModuleConfigConfig} class + */ + @Nonnull + public GroundingModuleConfigConfig metadataParams(@Nullable final List metadataParams) { + this.metadataParams = metadataParams; + return this; + } + + /** + * Add one metadataParams instance to this {@link GroundingModuleConfigConfig}. + * + * @param metadataParamsItem The metadataParams that should be added + * @return The same instance of type {@link GroundingModuleConfigConfig} + */ + @Nonnull + public GroundingModuleConfigConfig addMetadataParamsItem( + @Nonnull final String metadataParamsItem) { + if (this.metadataParams == null) { + this.metadataParams = new ArrayList<>(); + } + this.metadataParams.add(metadataParamsItem); + return this; + } + + /** + * Parameter name used for specifying metadata parameters + * + * @return metadataParams The metadataParams of this {@link GroundingModuleConfigConfig} instance. + */ + @Nonnull + public List getMetadataParams() { + return metadataParams; + } + + /** + * Set the metadataParams of this {@link GroundingModuleConfigConfig} instance. + * + * @param metadataParams Parameter name used for specifying metadata parameters + */ + public void setMetadataParams(@Nullable final List metadataParams) { + this.metadataParams = metadataParams; + } + + /** + * Get the names of the unrecognizable properties of the {@link GroundingModuleConfigConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link GroundingModuleConfigConfig} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "GroundingModuleConfigConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link GroundingModuleConfigConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (filters != null) declaredFields.put("filters", filters); + if (placeholders != null) declaredFields.put("placeholders", placeholders); + if (metadataParams != null) declaredFields.put("metadataParams", metadataParams); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link GroundingModuleConfigConfig} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final GroundingModuleConfigConfig groundingModuleConfigConfig = (GroundingModuleConfigConfig) o; + return Objects.equals( + this.cloudSdkCustomFields, groundingModuleConfigConfig.cloudSdkCustomFields) + && Objects.equals(this.filters, groundingModuleConfigConfig.filters) + && Objects.equals(this.placeholders, groundingModuleConfigConfig.placeholders) + && Objects.equals(this.metadataParams, groundingModuleConfigConfig.metadataParams); + } + + @Override + public int hashCode() { + return Objects.hash(filters, placeholders, metadataParams, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class GroundingModuleConfigConfig {\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" placeholders: ").append(toIndentedString(placeholders)).append("\n"); + sb.append(" metadataParams: ").append(toIndentedString(metadataParams)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * GroundingModuleConfigConfig} instance with all required arguments. + */ + public static Builder create() { + return (placeholders) -> new GroundingModuleConfigConfig().placeholders(placeholders); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the placeholders of this {@link GroundingModuleConfigConfig} instance. + * + * @param placeholders The placeholders of this {@link GroundingModuleConfigConfig} + * @return The GroundingModuleConfigConfig instance. + */ + GroundingModuleConfigConfig placeholders( + @Nonnull final GroundingModuleConfigConfigPlaceholders placeholders); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingModuleConfigConfigFiltersInner.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingModuleConfigConfigFiltersInner.java new file mode 100644 index 000000000..3b8cfef76 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingModuleConfigConfigFiltersInner.java @@ -0,0 +1,22 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** GroundingModuleConfigConfigFiltersInner */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = DocumentGroundingFilter.class), +}) +public interface GroundingModuleConfigConfigFiltersInner {} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingModuleConfigConfigPlaceholders.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingModuleConfigConfigPlaceholders.java new file mode 100644 index 000000000..4c7c1773e --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/GroundingModuleConfigConfigPlaceholders.java @@ -0,0 +1,269 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** Placeholders to be used for grounding input questions and output */ +// CHECKSTYLE:OFF +public class GroundingModuleConfigConfigPlaceholders +// CHECKSTYLE:ON +{ + @JsonProperty("input") + private List input = new ArrayList<>(); + + @JsonProperty("output") + private String output; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for GroundingModuleConfigConfigPlaceholders. */ + protected GroundingModuleConfigConfigPlaceholders() {} + + /** + * Set the input of this {@link GroundingModuleConfigConfigPlaceholders} instance and return the + * same instance. + * + * @param input Contains the input parameters used for grounding input questions + * @return The same instance of this {@link GroundingModuleConfigConfigPlaceholders} class + */ + @Nonnull + public GroundingModuleConfigConfigPlaceholders input(@Nonnull final List input) { + this.input = input; + return this; + } + + /** + * Add one input instance to this {@link GroundingModuleConfigConfigPlaceholders}. + * + * @param inputItem The input that should be added + * @return The same instance of type {@link GroundingModuleConfigConfigPlaceholders} + */ + @Nonnull + public GroundingModuleConfigConfigPlaceholders addInputItem(@Nonnull final String inputItem) { + if (this.input == null) { + this.input = new ArrayList<>(); + } + this.input.add(inputItem); + return this; + } + + /** + * Contains the input parameters used for grounding input questions + * + * @return input The input of this {@link GroundingModuleConfigConfigPlaceholders} instance. + */ + @Nonnull + public List getInput() { + return input; + } + + /** + * Set the input of this {@link GroundingModuleConfigConfigPlaceholders} instance. + * + * @param input Contains the input parameters used for grounding input questions + */ + public void setInput(@Nonnull final List input) { + this.input = input; + } + + /** + * Set the output of this {@link GroundingModuleConfigConfigPlaceholders} instance and return the + * same instance. + * + * @param output Placeholder name for grounding output + * @return The same instance of this {@link GroundingModuleConfigConfigPlaceholders} class + */ + @Nonnull + public GroundingModuleConfigConfigPlaceholders output(@Nonnull final String output) { + this.output = output; + return this; + } + + /** + * Placeholder name for grounding output + * + * @return output The output of this {@link GroundingModuleConfigConfigPlaceholders} instance. + */ + @Nonnull + public String getOutput() { + return output; + } + + /** + * Set the output of this {@link GroundingModuleConfigConfigPlaceholders} instance. + * + * @param output Placeholder name for grounding output + */ + public void setOutput(@Nonnull final String output) { + this.output = output; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * GroundingModuleConfigConfigPlaceholders}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link + * GroundingModuleConfigConfigPlaceholders} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "GroundingModuleConfigConfigPlaceholders has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link GroundingModuleConfigConfigPlaceholders} + * instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (input != null) declaredFields.put("input", input); + if (output != null) declaredFields.put("output", output); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link GroundingModuleConfigConfigPlaceholders} + * instance. If the map previously contained a mapping for the key, the old value is replaced by + * the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final GroundingModuleConfigConfigPlaceholders groundingModuleConfigConfigPlaceholders = + (GroundingModuleConfigConfigPlaceholders) o; + return Objects.equals( + this.cloudSdkCustomFields, groundingModuleConfigConfigPlaceholders.cloudSdkCustomFields) + && Objects.equals(this.input, groundingModuleConfigConfigPlaceholders.input) + && Objects.equals(this.output, groundingModuleConfigConfigPlaceholders.output); + } + + @Override + public int hashCode() { + return Objects.hash(input, output, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class GroundingModuleConfigConfigPlaceholders {\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * GroundingModuleConfigConfigPlaceholders} instance with all required arguments. + */ + public static Builder create() { + return (input) -> + (output) -> new GroundingModuleConfigConfigPlaceholders().input(input).output(output); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the input of this {@link GroundingModuleConfigConfigPlaceholders} instance. + * + * @param input Contains the input parameters used for grounding input questions + * @return The GroundingModuleConfigConfigPlaceholders builder. + */ + Builder1 input(@Nonnull final List input); + + /** + * Set the input of this {@link GroundingModuleConfigConfigPlaceholders} instance. + * + * @param input Contains the input parameters used for grounding input questions + * @return The GroundingModuleConfigConfigPlaceholders builder. + */ + default Builder1 input(@Nonnull final String... input) { + return input(Arrays.asList(input)); + } + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the output of this {@link GroundingModuleConfigConfigPlaceholders} instance. + * + * @param output Placeholder name for grounding output + * @return The GroundingModuleConfigConfigPlaceholders instance. + */ + GroundingModuleConfigConfigPlaceholders output(@Nonnull final String output); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ImageContentUrl.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ImageContentUrl.java new file mode 100644 index 000000000..81c8087dc --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ImageContentUrl.java @@ -0,0 +1,221 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** ImageContentUrl */ +// CHECKSTYLE:OFF +public class ImageContentUrl +// CHECKSTYLE:ON +{ + @JsonProperty("url") + private String url; + + @JsonProperty("detail") + private String detail = "auto"; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ImageContentUrl. */ + protected ImageContentUrl() {} + + /** + * Set the url of this {@link ImageContentUrl} instance and return the same instance. + * + * @param url The url of this {@link ImageContentUrl} + * @return The same instance of this {@link ImageContentUrl} class + */ + @Nonnull + public ImageContentUrl url(@Nonnull final String url) { + this.url = url; + return this; + } + + /** + * Get url + * + * @return url The url of this {@link ImageContentUrl} instance. + */ + @Nonnull + public String getUrl() { + return url; + } + + /** + * Set the url of this {@link ImageContentUrl} instance. + * + * @param url The url of this {@link ImageContentUrl} + */ + public void setUrl(@Nonnull final String url) { + this.url = url; + } + + /** + * Set the detail of this {@link ImageContentUrl} instance and return the same instance. + * + * @param detail The detail of this {@link ImageContentUrl} + * @return The same instance of this {@link ImageContentUrl} class + */ + @Nonnull + public ImageContentUrl detail(@Nullable final String detail) { + this.detail = detail; + return this; + } + + /** + * Get detail + * + * @return detail The detail of this {@link ImageContentUrl} instance. + */ + @Nonnull + public String getDetail() { + return detail; + } + + /** + * Set the detail of this {@link ImageContentUrl} instance. + * + * @param detail The detail of this {@link ImageContentUrl} + */ + public void setDetail(@Nullable final String detail) { + this.detail = detail; + } + + /** + * Get the names of the unrecognizable properties of the {@link ImageContentUrl}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ImageContentUrl} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("ImageContentUrl has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ImageContentUrl} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (url != null) declaredFields.put("url", url); + if (detail != null) declaredFields.put("detail", detail); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ImageContentUrl} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final ImageContentUrl imageContentUrl = (ImageContentUrl) o; + return Objects.equals(this.cloudSdkCustomFields, imageContentUrl.cloudSdkCustomFields) + && Objects.equals(this.url, imageContentUrl.url) + && Objects.equals(this.detail, imageContentUrl.detail); + } + + @Override + public int hashCode() { + return Objects.hash(url, detail, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ImageContentUrl {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" detail: ").append(toIndentedString(detail)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link ImageContentUrl} + * instance with all required arguments. + */ + public static Builder create() { + return (url) -> new ImageContentUrl().url(url); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the url of this {@link ImageContentUrl} instance. + * + * @param url The url of this {@link ImageContentUrl} + * @return The ImageContentUrl instance. + */ + ImageContentUrl url(@Nonnull final String url); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/InputFilterConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/InputFilterConfig.java new file mode 100644 index 000000000..879a5c91b --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/InputFilterConfig.java @@ -0,0 +1,23 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** InputFilterConfig */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = AzureContentSafetyInputFilterConfig.class), + @JsonSubTypes.Type(value = LlamaGuard38bFilterConfig.class), +}) +public interface InputFilterConfig {} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/InputFilteringConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/InputFilteringConfig.java new file mode 100644 index 000000000..19d54e79f --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/InputFilteringConfig.java @@ -0,0 +1,218 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** InputFilteringConfig */ +// CHECKSTYLE:OFF +public class InputFilteringConfig +// CHECKSTYLE:ON +{ + @JsonProperty("filters") + private List filters = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for InputFilteringConfig. */ + protected InputFilteringConfig() {} + + /** + * Set the filters of this {@link InputFilteringConfig} instance and return the same instance. + * + * @param filters Configuration for content filtering services that should be used for the given + * filtering step (input filtering). + * @return The same instance of this {@link InputFilteringConfig} class + */ + @Nonnull + public InputFilteringConfig filters(@Nonnull final List filters) { + this.filters = filters; + return this; + } + + /** + * Add one filters instance to this {@link InputFilteringConfig}. + * + * @param filtersItem The filters that should be added + * @return The same instance of type {@link InputFilteringConfig} + */ + @Nonnull + public InputFilteringConfig addFiltersItem(@Nonnull final InputFilterConfig filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * Configuration for content filtering services that should be used for the given filtering step + * (input filtering). + * + * @return filters The filters of this {@link InputFilteringConfig} instance. + */ + @Nonnull + public List getFilters() { + return filters; + } + + /** + * Set the filters of this {@link InputFilteringConfig} instance. + * + * @param filters Configuration for content filtering services that should be used for the given + * filtering step (input filtering). + */ + public void setFilters(@Nonnull final List filters) { + this.filters = filters; + } + + /** + * Get the names of the unrecognizable properties of the {@link InputFilteringConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link InputFilteringConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "InputFilteringConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link InputFilteringConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (filters != null) declaredFields.put("filters", filters); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link InputFilteringConfig} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final InputFilteringConfig inputFilteringConfig = (InputFilteringConfig) o; + return Objects.equals(this.cloudSdkCustomFields, inputFilteringConfig.cloudSdkCustomFields) + && Objects.equals(this.filters, inputFilteringConfig.filters); + } + + @Override + public int hashCode() { + return Objects.hash(filters, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class InputFilteringConfig {\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link InputFilteringConfig} + * instance with all required arguments. + */ + public static Builder create() { + return (filters) -> new InputFilteringConfig().filters(filters); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the filters of this {@link InputFilteringConfig} instance. + * + * @param filters Configuration for content filtering services that should be used for the given + * filtering step (input filtering). + * @return The InputFilteringConfig instance. + */ + InputFilteringConfig filters(@Nonnull final List filters); + + /** + * Set the filters of this {@link InputFilteringConfig} instance. + * + * @param filters Configuration for content filtering services that should be used for the given + * filtering step (input filtering). + * @return The InputFilteringConfig instance. + */ + default InputFilteringConfig filters(@Nonnull final InputFilterConfig... filters) { + return filters(Arrays.asList(filters)); + } + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/KeyValueListPair.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/KeyValueListPair.java new file mode 100644 index 000000000..f5ed72bda --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/KeyValueListPair.java @@ -0,0 +1,260 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** KeyValueListPair */ +// CHECKSTYLE:OFF +public class KeyValueListPair +// CHECKSTYLE:ON +{ + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for KeyValueListPair. */ + protected KeyValueListPair() {} + + /** + * Set the key of this {@link KeyValueListPair} instance and return the same instance. + * + * @param key The key of this {@link KeyValueListPair} + * @return The same instance of this {@link KeyValueListPair} class + */ + @Nonnull + public KeyValueListPair key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link KeyValueListPair} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link KeyValueListPair} instance. + * + * @param key The key of this {@link KeyValueListPair} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link KeyValueListPair} instance and return the same instance. + * + * @param value The value of this {@link KeyValueListPair} + * @return The same instance of this {@link KeyValueListPair} class + */ + @Nonnull + public KeyValueListPair value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link KeyValueListPair}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link KeyValueListPair} + */ + @Nonnull + public KeyValueListPair addValueItem(@Nonnull final String valueItem) { + if (this.value == null) { + this.value = new ArrayList<>(); + } + this.value.add(valueItem); + return this; + } + + /** + * Get value + * + * @return value The value of this {@link KeyValueListPair} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link KeyValueListPair} instance. + * + * @param value The value of this {@link KeyValueListPair} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Get the names of the unrecognizable properties of the {@link KeyValueListPair}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link KeyValueListPair} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("KeyValueListPair has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link KeyValueListPair} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (key != null) declaredFields.put("key", key); + if (value != null) declaredFields.put("value", value); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link KeyValueListPair} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final KeyValueListPair keyValueListPair = (KeyValueListPair) o; + return Objects.equals(this.cloudSdkCustomFields, keyValueListPair.cloudSdkCustomFields) + && Objects.equals(this.key, keyValueListPair.key) + && Objects.equals(this.value, keyValueListPair.value); + } + + @Override + public int hashCode() { + return Objects.hash(key, value, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class KeyValueListPair {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link KeyValueListPair} + * instance with all required arguments. + */ + public static Builder create() { + return (key) -> (value) -> new KeyValueListPair().key(key).value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the key of this {@link KeyValueListPair} instance. + * + * @param key The key of this {@link KeyValueListPair} + * @return The KeyValueListPair builder. + */ + Builder1 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the value of this {@link KeyValueListPair} instance. + * + * @param value The value of this {@link KeyValueListPair} + * @return The KeyValueListPair instance. + */ + KeyValueListPair value(@Nonnull final List value); + + /** + * Set the value of this {@link KeyValueListPair} instance. + * + * @param value The value of this {@link KeyValueListPair} + * @return The KeyValueListPair instance. + */ + default KeyValueListPair value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/LLMModelDetails.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/LLMModelDetails.java new file mode 100644 index 000000000..4b0cd3f18 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/LLMModelDetails.java @@ -0,0 +1,361 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** + * The model and parameters to be used for the prompt templating. This is the model that will be + * used to generate the response. + */ +// CHECKSTYLE:OFF +public class LLMModelDetails +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("version") + private String version = "latest"; + + @JsonProperty("params") + private Map params = new HashMap<>(); + + @JsonProperty("timeout") + private Integer timeout = 600; + + @JsonProperty("max_retries") + private Integer maxRetries = 2; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for LLMModelDetails. */ + protected LLMModelDetails() {} + + /** + * Set the name of this {@link LLMModelDetails} instance and return the same instance. + * + * @param name Name of the model as in LLM Access configuration + * @return The same instance of this {@link LLMModelDetails} class + */ + @Nonnull + public LLMModelDetails name(@Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Name of the model as in LLM Access configuration + * + * @return name The name of this {@link LLMModelDetails} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link LLMModelDetails} instance. + * + * @param name Name of the model as in LLM Access configuration + */ + public void setName(@Nonnull final String name) { + this.name = name; + } + + /** + * Set the version of this {@link LLMModelDetails} instance and return the same instance. + * + * @param version Version of the model to be used + * @return The same instance of this {@link LLMModelDetails} class + */ + @Nonnull + public LLMModelDetails version(@Nullable final String version) { + this.version = version; + return this; + } + + /** + * Version of the model to be used + * + * @return version The version of this {@link LLMModelDetails} instance. + */ + @Nonnull + public String getVersion() { + return version; + } + + /** + * Set the version of this {@link LLMModelDetails} instance. + * + * @param version Version of the model to be used + */ + public void setVersion(@Nullable final String version) { + this.version = version; + } + + /** + * Set the params of this {@link LLMModelDetails} instance and return the same instance. + * + * @param params Additional parameters for the model. Default values are used for mandatory + * parameters. + * @return The same instance of this {@link LLMModelDetails} class + */ + @Nonnull + public LLMModelDetails params(@Nullable final Map params) { + this.params = params; + return this; + } + + /** + * Put one params instance to this {@link LLMModelDetails} instance. + * + * @param key The String key of this params instance + * @param paramsItem The params that should be added under the given key + * @return The same instance of type {@link LLMModelDetails} + */ + @Nonnull + public LLMModelDetails putparamsItem( + @Nonnull final String key, @Nullable final Object paramsItem) { + if (this.params == null) { + this.params = new HashMap<>(); + } + this.params.put(key, paramsItem); + return this; + } + + /** + * Additional parameters for the model. Default values are used for mandatory parameters. + * + * @return params The params of this {@link LLMModelDetails} instance. + */ + @Nonnull + public Map getParams() { + return params; + } + + /** + * Set the params of this {@link LLMModelDetails} instance. + * + * @param params Additional parameters for the model. Default values are used for mandatory + * parameters. + */ + public void setParams(@Nullable final Map params) { + this.params = params; + } + + /** + * Set the timeout of this {@link LLMModelDetails} instance and return the same instance. + * + * @param timeout Timeout for the LLM request in seconds. This parameter is currently ignored for + * Vertex AI models. Minimum: 1 Maximum: 600 + * @return The same instance of this {@link LLMModelDetails} class + */ + @Nonnull + public LLMModelDetails timeout(@Nullable final Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI + * models. minimum: 1 maximum: 600 + * + * @return timeout The timeout of this {@link LLMModelDetails} instance. + */ + @Nonnull + public Integer getTimeout() { + return timeout; + } + + /** + * Set the timeout of this {@link LLMModelDetails} instance. + * + * @param timeout Timeout for the LLM request in seconds. This parameter is currently ignored for + * Vertex AI models. Minimum: 1 Maximum: 600 + */ + public void setTimeout(@Nullable final Integer timeout) { + this.timeout = timeout; + } + + /** + * Set the maxRetries of this {@link LLMModelDetails} instance and return the same instance. + * + * @param maxRetries Maximum number of retries for the LLM request. This parameter is currently + * ignored for Vertex AI models. Minimum: 0 Maximum: 5 + * @return The same instance of this {@link LLMModelDetails} class + */ + @Nonnull + public LLMModelDetails maxRetries(@Nullable final Integer maxRetries) { + this.maxRetries = maxRetries; + return this; + } + + /** + * Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex + * AI models. minimum: 0 maximum: 5 + * + * @return maxRetries The maxRetries of this {@link LLMModelDetails} instance. + */ + @Nonnull + public Integer getMaxRetries() { + return maxRetries; + } + + /** + * Set the maxRetries of this {@link LLMModelDetails} instance. + * + * @param maxRetries Maximum number of retries for the LLM request. This parameter is currently + * ignored for Vertex AI models. Minimum: 0 Maximum: 5 + */ + public void setMaxRetries(@Nullable final Integer maxRetries) { + this.maxRetries = maxRetries; + } + + /** + * Get the names of the unrecognizable properties of the {@link LLMModelDetails}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link LLMModelDetails} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("LLMModelDetails has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link LLMModelDetails} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (name != null) declaredFields.put("name", name); + if (version != null) declaredFields.put("version", version); + if (params != null) declaredFields.put("params", params); + if (timeout != null) declaredFields.put("timeout", timeout); + if (maxRetries != null) declaredFields.put("maxRetries", maxRetries); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link LLMModelDetails} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final LLMModelDetails llMModelDetails = (LLMModelDetails) o; + return Objects.equals(this.cloudSdkCustomFields, llMModelDetails.cloudSdkCustomFields) + && Objects.equals(this.name, llMModelDetails.name) + && Objects.equals(this.version, llMModelDetails.version) + && Objects.equals(this.params, llMModelDetails.params) + && Objects.equals(this.timeout, llMModelDetails.timeout) + && Objects.equals(this.maxRetries, llMModelDetails.maxRetries); + } + + @Override + public int hashCode() { + return Objects.hash(name, version, params, timeout, maxRetries, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class LLMModelDetails {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append(" timeout: ").append(toIndentedString(timeout)).append("\n"); + sb.append(" maxRetries: ").append(toIndentedString(maxRetries)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link LLMModelDetails} + * instance with all required arguments. + */ + public static Builder create() { + return (name) -> new LLMModelDetails().name(name); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the name of this {@link LLMModelDetails} instance. + * + * @param name Name of the model as in LLM Access configuration + * @return The LLMModelDetails instance. + */ + LLMModelDetails name(@Nonnull final String name); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/LlamaGuard38b.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/LlamaGuard38b.java new file mode 100644 index 000000000..682d4dcb1 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/LlamaGuard38b.java @@ -0,0 +1,678 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** Filter configuration for Llama Guard 3 8B */ +// CHECKSTYLE:OFF +public class LlamaGuard38b +// CHECKSTYLE:ON +{ + @JsonProperty("violent_crimes") + private Boolean violentCrimes; + + @JsonProperty("non_violent_crimes") + private Boolean nonViolentCrimes; + + @JsonProperty("sex_crimes") + private Boolean sexCrimes; + + @JsonProperty("child_exploitation") + private Boolean childExploitation; + + @JsonProperty("defamation") + private Boolean defamation; + + @JsonProperty("specialized_advice") + private Boolean specializedAdvice; + + @JsonProperty("privacy") + private Boolean privacy; + + @JsonProperty("intellectual_property") + private Boolean intellectualProperty; + + @JsonProperty("indiscriminate_weapons") + private Boolean indiscriminateWeapons; + + @JsonProperty("hate") + private Boolean hate; + + @JsonProperty("self_harm") + private Boolean selfHarm; + + @JsonProperty("sexual_content") + private Boolean sexualContent; + + @JsonProperty("elections") + private Boolean elections; + + @JsonProperty("code_interpreter_abuse") + private Boolean codeInterpreterAbuse; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for LlamaGuard38b. */ + protected LlamaGuard38b() {} + + /** + * Set the violentCrimes of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param violentCrimes The violentCrimes of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b violentCrimes(@Nullable final Boolean violentCrimes) { + this.violentCrimes = violentCrimes; + return this; + } + + /** + * Get violentCrimes + * + * @return violentCrimes The violentCrimes of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isViolentCrimes() { + return violentCrimes; + } + + /** + * Set the violentCrimes of this {@link LlamaGuard38b} instance. + * + * @param violentCrimes The violentCrimes of this {@link LlamaGuard38b} + */ + public void setViolentCrimes(@Nullable final Boolean violentCrimes) { + this.violentCrimes = violentCrimes; + } + + /** + * Set the nonViolentCrimes of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param nonViolentCrimes The nonViolentCrimes of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b nonViolentCrimes(@Nullable final Boolean nonViolentCrimes) { + this.nonViolentCrimes = nonViolentCrimes; + return this; + } + + /** + * Get nonViolentCrimes + * + * @return nonViolentCrimes The nonViolentCrimes of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isNonViolentCrimes() { + return nonViolentCrimes; + } + + /** + * Set the nonViolentCrimes of this {@link LlamaGuard38b} instance. + * + * @param nonViolentCrimes The nonViolentCrimes of this {@link LlamaGuard38b} + */ + public void setNonViolentCrimes(@Nullable final Boolean nonViolentCrimes) { + this.nonViolentCrimes = nonViolentCrimes; + } + + /** + * Set the sexCrimes of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param sexCrimes The sexCrimes of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b sexCrimes(@Nullable final Boolean sexCrimes) { + this.sexCrimes = sexCrimes; + return this; + } + + /** + * Get sexCrimes + * + * @return sexCrimes The sexCrimes of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isSexCrimes() { + return sexCrimes; + } + + /** + * Set the sexCrimes of this {@link LlamaGuard38b} instance. + * + * @param sexCrimes The sexCrimes of this {@link LlamaGuard38b} + */ + public void setSexCrimes(@Nullable final Boolean sexCrimes) { + this.sexCrimes = sexCrimes; + } + + /** + * Set the childExploitation of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param childExploitation The childExploitation of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b childExploitation(@Nullable final Boolean childExploitation) { + this.childExploitation = childExploitation; + return this; + } + + /** + * Get childExploitation + * + * @return childExploitation The childExploitation of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isChildExploitation() { + return childExploitation; + } + + /** + * Set the childExploitation of this {@link LlamaGuard38b} instance. + * + * @param childExploitation The childExploitation of this {@link LlamaGuard38b} + */ + public void setChildExploitation(@Nullable final Boolean childExploitation) { + this.childExploitation = childExploitation; + } + + /** + * Set the defamation of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param defamation The defamation of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b defamation(@Nullable final Boolean defamation) { + this.defamation = defamation; + return this; + } + + /** + * Get defamation + * + * @return defamation The defamation of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isDefamation() { + return defamation; + } + + /** + * Set the defamation of this {@link LlamaGuard38b} instance. + * + * @param defamation The defamation of this {@link LlamaGuard38b} + */ + public void setDefamation(@Nullable final Boolean defamation) { + this.defamation = defamation; + } + + /** + * Set the specializedAdvice of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param specializedAdvice The specializedAdvice of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b specializedAdvice(@Nullable final Boolean specializedAdvice) { + this.specializedAdvice = specializedAdvice; + return this; + } + + /** + * Get specializedAdvice + * + * @return specializedAdvice The specializedAdvice of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isSpecializedAdvice() { + return specializedAdvice; + } + + /** + * Set the specializedAdvice of this {@link LlamaGuard38b} instance. + * + * @param specializedAdvice The specializedAdvice of this {@link LlamaGuard38b} + */ + public void setSpecializedAdvice(@Nullable final Boolean specializedAdvice) { + this.specializedAdvice = specializedAdvice; + } + + /** + * Set the privacy of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param privacy The privacy of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b privacy(@Nullable final Boolean privacy) { + this.privacy = privacy; + return this; + } + + /** + * Get privacy + * + * @return privacy The privacy of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isPrivacy() { + return privacy; + } + + /** + * Set the privacy of this {@link LlamaGuard38b} instance. + * + * @param privacy The privacy of this {@link LlamaGuard38b} + */ + public void setPrivacy(@Nullable final Boolean privacy) { + this.privacy = privacy; + } + + /** + * Set the intellectualProperty of this {@link LlamaGuard38b} instance and return the same + * instance. + * + * @param intellectualProperty The intellectualProperty of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b intellectualProperty(@Nullable final Boolean intellectualProperty) { + this.intellectualProperty = intellectualProperty; + return this; + } + + /** + * Get intellectualProperty + * + * @return intellectualProperty The intellectualProperty of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isIntellectualProperty() { + return intellectualProperty; + } + + /** + * Set the intellectualProperty of this {@link LlamaGuard38b} instance. + * + * @param intellectualProperty The intellectualProperty of this {@link LlamaGuard38b} + */ + public void setIntellectualProperty(@Nullable final Boolean intellectualProperty) { + this.intellectualProperty = intellectualProperty; + } + + /** + * Set the indiscriminateWeapons of this {@link LlamaGuard38b} instance and return the same + * instance. + * + * @param indiscriminateWeapons The indiscriminateWeapons of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b indiscriminateWeapons(@Nullable final Boolean indiscriminateWeapons) { + this.indiscriminateWeapons = indiscriminateWeapons; + return this; + } + + /** + * Get indiscriminateWeapons + * + * @return indiscriminateWeapons The indiscriminateWeapons of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isIndiscriminateWeapons() { + return indiscriminateWeapons; + } + + /** + * Set the indiscriminateWeapons of this {@link LlamaGuard38b} instance. + * + * @param indiscriminateWeapons The indiscriminateWeapons of this {@link LlamaGuard38b} + */ + public void setIndiscriminateWeapons(@Nullable final Boolean indiscriminateWeapons) { + this.indiscriminateWeapons = indiscriminateWeapons; + } + + /** + * Set the hate of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param hate The hate of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b hate(@Nullable final Boolean hate) { + this.hate = hate; + return this; + } + + /** + * Get hate + * + * @return hate The hate of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isHate() { + return hate; + } + + /** + * Set the hate of this {@link LlamaGuard38b} instance. + * + * @param hate The hate of this {@link LlamaGuard38b} + */ + public void setHate(@Nullable final Boolean hate) { + this.hate = hate; + } + + /** + * Set the selfHarm of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param selfHarm The selfHarm of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b selfHarm(@Nullable final Boolean selfHarm) { + this.selfHarm = selfHarm; + return this; + } + + /** + * Get selfHarm + * + * @return selfHarm The selfHarm of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isSelfHarm() { + return selfHarm; + } + + /** + * Set the selfHarm of this {@link LlamaGuard38b} instance. + * + * @param selfHarm The selfHarm of this {@link LlamaGuard38b} + */ + public void setSelfHarm(@Nullable final Boolean selfHarm) { + this.selfHarm = selfHarm; + } + + /** + * Set the sexualContent of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param sexualContent The sexualContent of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b sexualContent(@Nullable final Boolean sexualContent) { + this.sexualContent = sexualContent; + return this; + } + + /** + * Get sexualContent + * + * @return sexualContent The sexualContent of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isSexualContent() { + return sexualContent; + } + + /** + * Set the sexualContent of this {@link LlamaGuard38b} instance. + * + * @param sexualContent The sexualContent of this {@link LlamaGuard38b} + */ + public void setSexualContent(@Nullable final Boolean sexualContent) { + this.sexualContent = sexualContent; + } + + /** + * Set the elections of this {@link LlamaGuard38b} instance and return the same instance. + * + * @param elections The elections of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b elections(@Nullable final Boolean elections) { + this.elections = elections; + return this; + } + + /** + * Get elections + * + * @return elections The elections of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isElections() { + return elections; + } + + /** + * Set the elections of this {@link LlamaGuard38b} instance. + * + * @param elections The elections of this {@link LlamaGuard38b} + */ + public void setElections(@Nullable final Boolean elections) { + this.elections = elections; + } + + /** + * Set the codeInterpreterAbuse of this {@link LlamaGuard38b} instance and return the same + * instance. + * + * @param codeInterpreterAbuse The codeInterpreterAbuse of this {@link LlamaGuard38b} + * @return The same instance of this {@link LlamaGuard38b} class + */ + @Nonnull + public LlamaGuard38b codeInterpreterAbuse(@Nullable final Boolean codeInterpreterAbuse) { + this.codeInterpreterAbuse = codeInterpreterAbuse; + return this; + } + + /** + * Get codeInterpreterAbuse + * + * @return codeInterpreterAbuse The codeInterpreterAbuse of this {@link LlamaGuard38b} instance. + */ + @Nonnull + public Boolean isCodeInterpreterAbuse() { + return codeInterpreterAbuse; + } + + /** + * Set the codeInterpreterAbuse of this {@link LlamaGuard38b} instance. + * + * @param codeInterpreterAbuse The codeInterpreterAbuse of this {@link LlamaGuard38b} + */ + public void setCodeInterpreterAbuse(@Nullable final Boolean codeInterpreterAbuse) { + this.codeInterpreterAbuse = codeInterpreterAbuse; + } + + /** + * Get the names of the unrecognizable properties of the {@link LlamaGuard38b}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link LlamaGuard38b} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("LlamaGuard38b has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link LlamaGuard38b} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (violentCrimes != null) declaredFields.put("violentCrimes", violentCrimes); + if (nonViolentCrimes != null) declaredFields.put("nonViolentCrimes", nonViolentCrimes); + if (sexCrimes != null) declaredFields.put("sexCrimes", sexCrimes); + if (childExploitation != null) declaredFields.put("childExploitation", childExploitation); + if (defamation != null) declaredFields.put("defamation", defamation); + if (specializedAdvice != null) declaredFields.put("specializedAdvice", specializedAdvice); + if (privacy != null) declaredFields.put("privacy", privacy); + if (intellectualProperty != null) + declaredFields.put("intellectualProperty", intellectualProperty); + if (indiscriminateWeapons != null) + declaredFields.put("indiscriminateWeapons", indiscriminateWeapons); + if (hate != null) declaredFields.put("hate", hate); + if (selfHarm != null) declaredFields.put("selfHarm", selfHarm); + if (sexualContent != null) declaredFields.put("sexualContent", sexualContent); + if (elections != null) declaredFields.put("elections", elections); + if (codeInterpreterAbuse != null) + declaredFields.put("codeInterpreterAbuse", codeInterpreterAbuse); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link LlamaGuard38b} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final LlamaGuard38b llamaGuard38b = (LlamaGuard38b) o; + return Objects.equals(this.cloudSdkCustomFields, llamaGuard38b.cloudSdkCustomFields) + && Objects.equals(this.violentCrimes, llamaGuard38b.violentCrimes) + && Objects.equals(this.nonViolentCrimes, llamaGuard38b.nonViolentCrimes) + && Objects.equals(this.sexCrimes, llamaGuard38b.sexCrimes) + && Objects.equals(this.childExploitation, llamaGuard38b.childExploitation) + && Objects.equals(this.defamation, llamaGuard38b.defamation) + && Objects.equals(this.specializedAdvice, llamaGuard38b.specializedAdvice) + && Objects.equals(this.privacy, llamaGuard38b.privacy) + && Objects.equals(this.intellectualProperty, llamaGuard38b.intellectualProperty) + && Objects.equals(this.indiscriminateWeapons, llamaGuard38b.indiscriminateWeapons) + && Objects.equals(this.hate, llamaGuard38b.hate) + && Objects.equals(this.selfHarm, llamaGuard38b.selfHarm) + && Objects.equals(this.sexualContent, llamaGuard38b.sexualContent) + && Objects.equals(this.elections, llamaGuard38b.elections) + && Objects.equals(this.codeInterpreterAbuse, llamaGuard38b.codeInterpreterAbuse); + } + + @Override + public int hashCode() { + return Objects.hash( + violentCrimes, + nonViolentCrimes, + sexCrimes, + childExploitation, + defamation, + specializedAdvice, + privacy, + intellectualProperty, + indiscriminateWeapons, + hate, + selfHarm, + sexualContent, + elections, + codeInterpreterAbuse, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class LlamaGuard38b {\n"); + sb.append(" violentCrimes: ").append(toIndentedString(violentCrimes)).append("\n"); + sb.append(" nonViolentCrimes: ").append(toIndentedString(nonViolentCrimes)).append("\n"); + sb.append(" sexCrimes: ").append(toIndentedString(sexCrimes)).append("\n"); + sb.append(" childExploitation: ").append(toIndentedString(childExploitation)).append("\n"); + sb.append(" defamation: ").append(toIndentedString(defamation)).append("\n"); + sb.append(" specializedAdvice: ").append(toIndentedString(specializedAdvice)).append("\n"); + sb.append(" privacy: ").append(toIndentedString(privacy)).append("\n"); + sb.append(" intellectualProperty: ") + .append(toIndentedString(intellectualProperty)) + .append("\n"); + sb.append(" indiscriminateWeapons: ") + .append(toIndentedString(indiscriminateWeapons)) + .append("\n"); + sb.append(" hate: ").append(toIndentedString(hate)).append("\n"); + sb.append(" selfHarm: ").append(toIndentedString(selfHarm)).append("\n"); + sb.append(" sexualContent: ").append(toIndentedString(sexualContent)).append("\n"); + sb.append(" elections: ").append(toIndentedString(elections)).append("\n"); + sb.append(" codeInterpreterAbuse: ") + .append(toIndentedString(codeInterpreterAbuse)) + .append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link LlamaGuard38b} instance. No arguments are required. */ + public static LlamaGuard38b create() { + return new LlamaGuard38b(); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/LlamaGuard38bFilterConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/LlamaGuard38bFilterConfig.java new file mode 100644 index 000000000..11948a983 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/LlamaGuard38bFilterConfig.java @@ -0,0 +1,289 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** LlamaGuard38bFilterConfig */ +// CHECKSTYLE:OFF +public class LlamaGuard38bFilterConfig implements InputFilterConfig, OutputFilterConfig +// CHECKSTYLE:ON +{ + /** Name of the filter provider type */ + public enum TypeEnum { + /** The LLAMA_GUARD_3_8B option of this LlamaGuard38bFilterConfig */ + LLAMA_GUARD_3_8B("llama_guard_3_8b"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this LlamaGuard38bFilterConfig */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type LlamaGuard38bFilterConfig + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("type") + private TypeEnum type; + + @JsonProperty("config") + private LlamaGuard38b config; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for LlamaGuard38bFilterConfig. */ + protected LlamaGuard38bFilterConfig() {} + + /** + * Set the type of this {@link LlamaGuard38bFilterConfig} instance and return the same instance. + * + * @param type Name of the filter provider type + * @return The same instance of this {@link LlamaGuard38bFilterConfig} class + */ + @Nonnull + public LlamaGuard38bFilterConfig type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Name of the filter provider type + * + * @return type The type of this {@link LlamaGuard38bFilterConfig} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link LlamaGuard38bFilterConfig} instance. + * + * @param type Name of the filter provider type + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the config of this {@link LlamaGuard38bFilterConfig} instance and return the same instance. + * + * @param config The config of this {@link LlamaGuard38bFilterConfig} + * @return The same instance of this {@link LlamaGuard38bFilterConfig} class + */ + @Nonnull + public LlamaGuard38bFilterConfig config(@Nonnull final LlamaGuard38b config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link LlamaGuard38bFilterConfig} instance. + */ + @Nonnull + public LlamaGuard38b getConfig() { + return config; + } + + /** + * Set the config of this {@link LlamaGuard38bFilterConfig} instance. + * + * @param config The config of this {@link LlamaGuard38bFilterConfig} + */ + public void setConfig(@Nonnull final LlamaGuard38b config) { + this.config = config; + } + + /** + * Get the names of the unrecognizable properties of the {@link LlamaGuard38bFilterConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link LlamaGuard38bFilterConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "LlamaGuard38bFilterConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link LlamaGuard38bFilterConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (config != null) declaredFields.put("config", config); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link LlamaGuard38bFilterConfig} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final LlamaGuard38bFilterConfig llamaGuard38bFilterConfig = (LlamaGuard38bFilterConfig) o; + return Objects.equals(this.cloudSdkCustomFields, llamaGuard38bFilterConfig.cloudSdkCustomFields) + && Objects.equals(this.type, llamaGuard38bFilterConfig.type) + && Objects.equals(this.config, llamaGuard38bFilterConfig.config); + } + + @Override + public int hashCode() { + return Objects.hash(type, config, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class LlamaGuard38bFilterConfig {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * LlamaGuard38bFilterConfig} instance with all required arguments. + */ + public static Builder create() { + return (type) -> (config) -> new LlamaGuard38bFilterConfig().type(type).config(config); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link LlamaGuard38bFilterConfig} instance. + * + * @param type Name of the filter provider type + * @return The LlamaGuard38bFilterConfig builder. + */ + Builder1 type(@Nonnull final TypeEnum type); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the config of this {@link LlamaGuard38bFilterConfig} instance. + * + * @param config The config of this {@link LlamaGuard38bFilterConfig} + * @return The LlamaGuard38bFilterConfig instance. + */ + LlamaGuard38bFilterConfig config(@Nonnull final LlamaGuard38b config); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MaskingModuleConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MaskingModuleConfig.java new file mode 100644 index 000000000..c39891dbe --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MaskingModuleConfig.java @@ -0,0 +1,23 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** MaskingModuleConfig */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = MaskingModuleConfigMaskingProviders.class), + @JsonSubTypes.Type(value = MaskingModuleConfigProviders.class), +}) +public interface MaskingModuleConfig {} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MaskingModuleConfigMaskingProviders.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MaskingModuleConfigMaskingProviders.java new file mode 100644 index 000000000..82d83c44c --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MaskingModuleConfigMaskingProviders.java @@ -0,0 +1,233 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** MaskingModuleConfigMaskingProviders */ +// CHECKSTYLE:OFF +public class MaskingModuleConfigMaskingProviders implements MaskingModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty("masking_providers") + private List maskingProviders = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MaskingModuleConfigMaskingProviders. */ + protected MaskingModuleConfigMaskingProviders() {} + + /** + * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance and + * return the same instance. + * + * @param maskingProviders This field is **DEPRECATED** and will be removed on August 05, 2026. + * Use `providers` property instead. List of masking service providers. + * @return The same instance of this {@link MaskingModuleConfigMaskingProviders} class + */ + @Nonnull + public MaskingModuleConfigMaskingProviders maskingProviders( + @Nonnull final List maskingProviders) { + this.maskingProviders = maskingProviders; + return this; + } + + /** + * Add one maskingProviders instance to this {@link MaskingModuleConfigMaskingProviders}. + * + * @param maskingProvidersItem The maskingProviders that should be added + * @return The same instance of type {@link MaskingModuleConfigMaskingProviders} + */ + @Nonnull + public MaskingModuleConfigMaskingProviders addMaskingProvidersItem( + @Nonnull final DPIConfig maskingProvidersItem) { + if (this.maskingProviders == null) { + this.maskingProviders = new ArrayList<>(); + } + this.maskingProviders.add(maskingProvidersItem); + return this; + } + + /** + * This field is **DEPRECATED** and will be removed on August 05, 2026. Use `providers` + * property instead. List of masking service providers. + * + * @return maskingProviders The maskingProviders of this {@link + * MaskingModuleConfigMaskingProviders} instance. + * @deprecated + */ + @Deprecated + @Nonnull + public List getMaskingProviders() { + return maskingProviders; + } + + /** + * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. + * + * @param maskingProviders This field is **DEPRECATED** and will be removed on August 05, 2026. + * Use `providers` property instead. List of masking service providers. + */ + public void setMaskingProviders(@Nonnull final List maskingProviders) { + this.maskingProviders = maskingProviders; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * MaskingModuleConfigMaskingProviders}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MaskingModuleConfigMaskingProviders} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "MaskingModuleConfigMaskingProviders has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MaskingModuleConfigMaskingProviders} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (maskingProviders != null) declaredFields.put("maskingProviders", maskingProviders); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MaskingModuleConfigMaskingProviders} instance. If + * the map previously contained a mapping for the key, the old value is replaced by the specified + * value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final MaskingModuleConfigMaskingProviders maskingModuleConfigMaskingProviders = + (MaskingModuleConfigMaskingProviders) o; + return Objects.equals( + this.cloudSdkCustomFields, maskingModuleConfigMaskingProviders.cloudSdkCustomFields) + && Objects.equals( + this.maskingProviders, maskingModuleConfigMaskingProviders.maskingProviders); + } + + @Override + public int hashCode() { + return Objects.hash(maskingProviders, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MaskingModuleConfigMaskingProviders {\n"); + sb.append(" maskingProviders: ").append(toIndentedString(maskingProviders)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * MaskingModuleConfigMaskingProviders} instance with all required arguments. + */ + public static Builder create() { + return (maskingProviders) -> + new MaskingModuleConfigMaskingProviders().maskingProviders(maskingProviders); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. + * + * @param maskingProviders This field is **DEPRECATED** and will be removed on August 05, 2026. + * Use `providers` property instead. List of masking service providers. + * @return The MaskingModuleConfigMaskingProviders instance. + */ + MaskingModuleConfigMaskingProviders maskingProviders( + @Nonnull final List maskingProviders); + + /** + * Set the maskingProviders of this {@link MaskingModuleConfigMaskingProviders} instance. + * + * @param maskingProviders This field is **DEPRECATED** and will be removed on August 05, 2026. + * Use `providers` property instead. List of masking service providers. + * @return The MaskingModuleConfigMaskingProviders instance. + */ + default MaskingModuleConfigMaskingProviders maskingProviders( + @Nonnull final DPIConfig... maskingProviders) { + return maskingProviders(Arrays.asList(maskingProviders)); + } + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MaskingModuleConfigProviders.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MaskingModuleConfigProviders.java new file mode 100644 index 000000000..b291564be --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MaskingModuleConfigProviders.java @@ -0,0 +1,218 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** MaskingModuleConfigProviders */ +// CHECKSTYLE:OFF +public class MaskingModuleConfigProviders implements MaskingModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty("providers") + private List providers = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MaskingModuleConfigProviders. */ + protected MaskingModuleConfigProviders() {} + + /** + * Set the providers of this {@link MaskingModuleConfigProviders} instance and return the same + * instance. + * + * @param providers List of masking service providers + * @return The same instance of this {@link MaskingModuleConfigProviders} class + */ + @Nonnull + public MaskingModuleConfigProviders providers(@Nonnull final List providers) { + this.providers = providers; + return this; + } + + /** + * Add one providers instance to this {@link MaskingModuleConfigProviders}. + * + * @param providersItem The providers that should be added + * @return The same instance of type {@link MaskingModuleConfigProviders} + */ + @Nonnull + public MaskingModuleConfigProviders addProvidersItem(@Nonnull final DPIConfig providersItem) { + if (this.providers == null) { + this.providers = new ArrayList<>(); + } + this.providers.add(providersItem); + return this; + } + + /** + * List of masking service providers + * + * @return providers The providers of this {@link MaskingModuleConfigProviders} instance. + */ + @Nonnull + public List getProviders() { + return providers; + } + + /** + * Set the providers of this {@link MaskingModuleConfigProviders} instance. + * + * @param providers List of masking service providers + */ + public void setProviders(@Nonnull final List providers) { + this.providers = providers; + } + + /** + * Get the names of the unrecognizable properties of the {@link MaskingModuleConfigProviders}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MaskingModuleConfigProviders} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "MaskingModuleConfigProviders has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MaskingModuleConfigProviders} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (providers != null) declaredFields.put("providers", providers); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MaskingModuleConfigProviders} instance. If the + * map previously contained a mapping for the key, the old value is replaced by the specified + * value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final MaskingModuleConfigProviders maskingModuleConfigProviders = + (MaskingModuleConfigProviders) o; + return Objects.equals( + this.cloudSdkCustomFields, maskingModuleConfigProviders.cloudSdkCustomFields) + && Objects.equals(this.providers, maskingModuleConfigProviders.providers); + } + + @Override + public int hashCode() { + return Objects.hash(providers, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MaskingModuleConfigProviders {\n"); + sb.append(" providers: ").append(toIndentedString(providers)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * MaskingModuleConfigProviders} instance with all required arguments. + */ + public static Builder create() { + return (providers) -> new MaskingModuleConfigProviders().providers(providers); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the providers of this {@link MaskingModuleConfigProviders} instance. + * + * @param providers List of masking service providers + * @return The MaskingModuleConfigProviders instance. + */ + MaskingModuleConfigProviders providers(@Nonnull final List providers); + + /** + * Set the providers of this {@link MaskingModuleConfigProviders} instance. + * + * @param providers List of masking service providers + * @return The MaskingModuleConfigProviders instance. + */ + default MaskingModuleConfigProviders providers(@Nonnull final DPIConfig... providers) { + return providers(Arrays.asList(providers)); + } + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MessageToolCall.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MessageToolCall.java new file mode 100644 index 000000000..24a30b898 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MessageToolCall.java @@ -0,0 +1,337 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** MessageToolCall */ +// CHECKSTYLE:OFF +public class MessageToolCall +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + /** The type of the tool. Currently, only `function` is supported. */ + public enum TypeEnum { + /** The FUNCTION option of this MessageToolCall */ + FUNCTION("function"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this MessageToolCall */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type MessageToolCall + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("type") + private TypeEnum type; + + @JsonProperty("function") + private MessageToolCallFunction function; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MessageToolCall. */ + protected MessageToolCall() {} + + /** + * Set the id of this {@link MessageToolCall} instance and return the same instance. + * + * @param id The ID of the tool call. + * @return The same instance of this {@link MessageToolCall} class + */ + @Nonnull + public MessageToolCall id(@Nonnull final String id) { + this.id = id; + return this; + } + + /** + * The ID of the tool call. + * + * @return id The id of this {@link MessageToolCall} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link MessageToolCall} instance. + * + * @param id The ID of the tool call. + */ + public void setId(@Nonnull final String id) { + this.id = id; + } + + /** + * Set the type of this {@link MessageToolCall} instance and return the same instance. + * + * @param type The type of the tool. Currently, only `function` is supported. + * @return The same instance of this {@link MessageToolCall} class + */ + @Nonnull + public MessageToolCall type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * The type of the tool. Currently, only `function` is supported. + * + * @return type The type of this {@link MessageToolCall} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link MessageToolCall} instance. + * + * @param type The type of the tool. Currently, only `function` is supported. + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the function of this {@link MessageToolCall} instance and return the same instance. + * + * @param function The function of this {@link MessageToolCall} + * @return The same instance of this {@link MessageToolCall} class + */ + @Nonnull + public MessageToolCall function(@Nonnull final MessageToolCallFunction function) { + this.function = function; + return this; + } + + /** + * Get function + * + * @return function The function of this {@link MessageToolCall} instance. + */ + @Nonnull + public MessageToolCallFunction getFunction() { + return function; + } + + /** + * Set the function of this {@link MessageToolCall} instance. + * + * @param function The function of this {@link MessageToolCall} + */ + public void setFunction(@Nonnull final MessageToolCallFunction function) { + this.function = function; + } + + /** + * Get the names of the unrecognizable properties of the {@link MessageToolCall}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MessageToolCall} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("MessageToolCall has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MessageToolCall} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (id != null) declaredFields.put("id", id); + if (type != null) declaredFields.put("type", type); + if (function != null) declaredFields.put("function", function); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MessageToolCall} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final MessageToolCall messageToolCall = (MessageToolCall) o; + return Objects.equals(this.cloudSdkCustomFields, messageToolCall.cloudSdkCustomFields) + && Objects.equals(this.id, messageToolCall.id) + && Objects.equals(this.type, messageToolCall.type) + && Objects.equals(this.function, messageToolCall.function); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, function, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MessageToolCall {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" function: ").append(toIndentedString(function)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link MessageToolCall} + * instance with all required arguments. + */ + public static Builder create() { + return (id) -> + (type) -> (function) -> new MessageToolCall().id(id).type(type).function(function); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link MessageToolCall} instance. + * + * @param id The ID of the tool call. + * @return The MessageToolCall builder. + */ + Builder1 id(@Nonnull final String id); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the type of this {@link MessageToolCall} instance. + * + * @param type The type of the tool. Currently, only `function` is supported. + * @return The MessageToolCall builder. + */ + Builder2 type(@Nonnull final TypeEnum type); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the function of this {@link MessageToolCall} instance. + * + * @param function The function of this {@link MessageToolCall} + * @return The MessageToolCall instance. + */ + MessageToolCall function(@Nonnull final MessageToolCallFunction function); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MessageToolCallFunction.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MessageToolCallFunction.java new file mode 100644 index 000000000..8307db42f --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/MessageToolCallFunction.java @@ -0,0 +1,245 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** The function that the model called. */ +// CHECKSTYLE:OFF +public class MessageToolCallFunction +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("arguments") + private String arguments; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MessageToolCallFunction. */ + protected MessageToolCallFunction() {} + + /** + * Set the name of this {@link MessageToolCallFunction} instance and return the same instance. + * + * @param name The name of the function to call. + * @return The same instance of this {@link MessageToolCallFunction} class + */ + @Nonnull + public MessageToolCallFunction name(@Nonnull final String name) { + this.name = name; + return this; + } + + /** + * The name of the function to call. + * + * @return name The name of this {@link MessageToolCallFunction} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link MessageToolCallFunction} instance. + * + * @param name The name of the function to call. + */ + public void setName(@Nonnull final String name) { + this.name = name; + } + + /** + * Set the arguments of this {@link MessageToolCallFunction} instance and return the same + * instance. + * + * @param arguments The arguments to call the function with, as generated by the model in JSON + * format. Note that the model does not always generate valid JSON, and may hallucinate + * parameters not defined by your function schema. Validate the arguments in your code before + * calling your function. + * @return The same instance of this {@link MessageToolCallFunction} class + */ + @Nonnull + public MessageToolCallFunction arguments(@Nonnull final String arguments) { + this.arguments = arguments; + return this; + } + + /** + * The arguments to call the function with, as generated by the model in JSON format. Note that + * the model does not always generate valid JSON, and may hallucinate parameters not defined by + * your function schema. Validate the arguments in your code before calling your function. + * + * @return arguments The arguments of this {@link MessageToolCallFunction} instance. + */ + @Nonnull + public String getArguments() { + return arguments; + } + + /** + * Set the arguments of this {@link MessageToolCallFunction} instance. + * + * @param arguments The arguments to call the function with, as generated by the model in JSON + * format. Note that the model does not always generate valid JSON, and may hallucinate + * parameters not defined by your function schema. Validate the arguments in your code before + * calling your function. + */ + public void setArguments(@Nonnull final String arguments) { + this.arguments = arguments; + } + + /** + * Get the names of the unrecognizable properties of the {@link MessageToolCallFunction}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MessageToolCallFunction} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "MessageToolCallFunction has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MessageToolCallFunction} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (name != null) declaredFields.put("name", name); + if (arguments != null) declaredFields.put("arguments", arguments); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MessageToolCallFunction} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final MessageToolCallFunction messageToolCallFunction = (MessageToolCallFunction) o; + return Objects.equals(this.cloudSdkCustomFields, messageToolCallFunction.cloudSdkCustomFields) + && Objects.equals(this.name, messageToolCallFunction.name) + && Objects.equals(this.arguments, messageToolCallFunction.arguments); + } + + @Override + public int hashCode() { + return Objects.hash(name, arguments, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MessageToolCallFunction {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" arguments: ").append(toIndentedString(arguments)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * MessageToolCallFunction} instance with all required arguments. + */ + public static Builder create() { + return (name) -> (arguments) -> new MessageToolCallFunction().name(name).arguments(arguments); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the name of this {@link MessageToolCallFunction} instance. + * + * @param name The name of the function to call. + * @return The MessageToolCallFunction builder. + */ + Builder1 name(@Nonnull final String name); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the arguments of this {@link MessageToolCallFunction} instance. + * + * @param arguments The arguments to call the function with, as generated by the model in JSON + * format. Note that the model does not always generate valid JSON, and may hallucinate + * parameters not defined by your function schema. Validate the arguments in your code + * before calling your function. + * @return The MessageToolCallFunction instance. + */ + MessageToolCallFunction arguments(@Nonnull final String arguments); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ModuleConfigs.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ModuleConfigs.java new file mode 100644 index 000000000..aa356bbab --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ModuleConfigs.java @@ -0,0 +1,334 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** ModuleConfigs */ +// CHECKSTYLE:OFF +public class ModuleConfigs +// CHECKSTYLE:ON +{ + @JsonProperty("prompt_templating") + private PromptTemplatingModuleConfig promptTemplating; + + @JsonProperty("filtering") + private FilteringModuleConfig filtering; + + @JsonProperty("masking") + private MaskingModuleConfig masking; + + @JsonProperty("grounding") + private GroundingModuleConfig grounding; + + @JsonProperty("translation") + private TranslationModuleConfig translation; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ModuleConfigs. */ + protected ModuleConfigs() {} + + /** + * Set the promptTemplating of this {@link ModuleConfigs} instance and return the same instance. + * + * @param promptTemplating The promptTemplating of this {@link ModuleConfigs} + * @return The same instance of this {@link ModuleConfigs} class + */ + @Nonnull + public ModuleConfigs promptTemplating( + @Nonnull final PromptTemplatingModuleConfig promptTemplating) { + this.promptTemplating = promptTemplating; + return this; + } + + /** + * Get promptTemplating + * + * @return promptTemplating The promptTemplating of this {@link ModuleConfigs} instance. + */ + @Nonnull + public PromptTemplatingModuleConfig getPromptTemplating() { + return promptTemplating; + } + + /** + * Set the promptTemplating of this {@link ModuleConfigs} instance. + * + * @param promptTemplating The promptTemplating of this {@link ModuleConfigs} + */ + public void setPromptTemplating(@Nonnull final PromptTemplatingModuleConfig promptTemplating) { + this.promptTemplating = promptTemplating; + } + + /** + * Set the filtering of this {@link ModuleConfigs} instance and return the same instance. + * + * @param filtering The filtering of this {@link ModuleConfigs} + * @return The same instance of this {@link ModuleConfigs} class + */ + @Nonnull + public ModuleConfigs filtering(@Nullable final FilteringModuleConfig filtering) { + this.filtering = filtering; + return this; + } + + /** + * Get filtering + * + * @return filtering The filtering of this {@link ModuleConfigs} instance. + */ + @Nonnull + public FilteringModuleConfig getFiltering() { + return filtering; + } + + /** + * Set the filtering of this {@link ModuleConfigs} instance. + * + * @param filtering The filtering of this {@link ModuleConfigs} + */ + public void setFiltering(@Nullable final FilteringModuleConfig filtering) { + this.filtering = filtering; + } + + /** + * Set the masking of this {@link ModuleConfigs} instance and return the same instance. + * + * @param masking The masking of this {@link ModuleConfigs} + * @return The same instance of this {@link ModuleConfigs} class + */ + @Nonnull + public ModuleConfigs masking(@Nullable final MaskingModuleConfig masking) { + this.masking = masking; + return this; + } + + /** + * Get masking + * + * @return masking The masking of this {@link ModuleConfigs} instance. + */ + @Nonnull + public MaskingModuleConfig getMasking() { + return masking; + } + + /** + * Set the masking of this {@link ModuleConfigs} instance. + * + * @param masking The masking of this {@link ModuleConfigs} + */ + public void setMasking(@Nullable final MaskingModuleConfig masking) { + this.masking = masking; + } + + /** + * Set the grounding of this {@link ModuleConfigs} instance and return the same instance. + * + * @param grounding The grounding of this {@link ModuleConfigs} + * @return The same instance of this {@link ModuleConfigs} class + */ + @Nonnull + public ModuleConfigs grounding(@Nullable final GroundingModuleConfig grounding) { + this.grounding = grounding; + return this; + } + + /** + * Get grounding + * + * @return grounding The grounding of this {@link ModuleConfigs} instance. + */ + @Nonnull + public GroundingModuleConfig getGrounding() { + return grounding; + } + + /** + * Set the grounding of this {@link ModuleConfigs} instance. + * + * @param grounding The grounding of this {@link ModuleConfigs} + */ + public void setGrounding(@Nullable final GroundingModuleConfig grounding) { + this.grounding = grounding; + } + + /** + * Set the translation of this {@link ModuleConfigs} instance and return the same instance. + * + * @param translation The translation of this {@link ModuleConfigs} + * @return The same instance of this {@link ModuleConfigs} class + */ + @Nonnull + public ModuleConfigs translation(@Nullable final TranslationModuleConfig translation) { + this.translation = translation; + return this; + } + + /** + * Get translation + * + * @return translation The translation of this {@link ModuleConfigs} instance. + */ + @Nonnull + public TranslationModuleConfig getTranslation() { + return translation; + } + + /** + * Set the translation of this {@link ModuleConfigs} instance. + * + * @param translation The translation of this {@link ModuleConfigs} + */ + public void setTranslation(@Nullable final TranslationModuleConfig translation) { + this.translation = translation; + } + + /** + * Get the names of the unrecognizable properties of the {@link ModuleConfigs}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ModuleConfigs} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("ModuleConfigs has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ModuleConfigs} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (promptTemplating != null) declaredFields.put("promptTemplating", promptTemplating); + if (filtering != null) declaredFields.put("filtering", filtering); + if (masking != null) declaredFields.put("masking", masking); + if (grounding != null) declaredFields.put("grounding", grounding); + if (translation != null) declaredFields.put("translation", translation); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ModuleConfigs} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final ModuleConfigs moduleConfigs = (ModuleConfigs) o; + return Objects.equals(this.cloudSdkCustomFields, moduleConfigs.cloudSdkCustomFields) + && Objects.equals(this.promptTemplating, moduleConfigs.promptTemplating) + && Objects.equals(this.filtering, moduleConfigs.filtering) + && Objects.equals(this.masking, moduleConfigs.masking) + && Objects.equals(this.grounding, moduleConfigs.grounding) + && Objects.equals(this.translation, moduleConfigs.translation); + } + + @Override + public int hashCode() { + return Objects.hash( + promptTemplating, filtering, masking, grounding, translation, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ModuleConfigs {\n"); + sb.append(" promptTemplating: ").append(toIndentedString(promptTemplating)).append("\n"); + sb.append(" filtering: ").append(toIndentedString(filtering)).append("\n"); + sb.append(" masking: ").append(toIndentedString(masking)).append("\n"); + sb.append(" grounding: ").append(toIndentedString(grounding)).append("\n"); + sb.append(" translation: ").append(toIndentedString(translation)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link ModuleConfigs} instance + * with all required arguments. + */ + public static Builder create() { + return (promptTemplating) -> new ModuleConfigs().promptTemplating(promptTemplating); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the promptTemplating of this {@link ModuleConfigs} instance. + * + * @param promptTemplating The promptTemplating of this {@link ModuleConfigs} + * @return The ModuleConfigs instance. + */ + ModuleConfigs promptTemplating(@Nonnull final PromptTemplatingModuleConfig promptTemplating); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfig.java new file mode 100644 index 000000000..ab6472801 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfig.java @@ -0,0 +1,222 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** OrchestrationConfig */ +// CHECKSTYLE:OFF +public class OrchestrationConfig +// CHECKSTYLE:ON +{ + @JsonProperty("modules") + private ModuleConfigs modules; + + @JsonProperty("stream") + private GlobalStreamOptions stream; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for OrchestrationConfig. */ + protected OrchestrationConfig() {} + + /** + * Set the modules of this {@link OrchestrationConfig} instance and return the same instance. + * + * @param modules The modules of this {@link OrchestrationConfig} + * @return The same instance of this {@link OrchestrationConfig} class + */ + @Nonnull + public OrchestrationConfig modules(@Nonnull final ModuleConfigs modules) { + this.modules = modules; + return this; + } + + /** + * Get modules + * + * @return modules The modules of this {@link OrchestrationConfig} instance. + */ + @Nonnull + public ModuleConfigs getModules() { + return modules; + } + + /** + * Set the modules of this {@link OrchestrationConfig} instance. + * + * @param modules The modules of this {@link OrchestrationConfig} + */ + public void setModules(@Nonnull final ModuleConfigs modules) { + this.modules = modules; + } + + /** + * Set the stream of this {@link OrchestrationConfig} instance and return the same instance. + * + * @param stream The stream of this {@link OrchestrationConfig} + * @return The same instance of this {@link OrchestrationConfig} class + */ + @Nonnull + public OrchestrationConfig stream(@Nullable final GlobalStreamOptions stream) { + this.stream = stream; + return this; + } + + /** + * Get stream + * + * @return stream The stream of this {@link OrchestrationConfig} instance. + */ + @Nonnull + public GlobalStreamOptions getStream() { + return stream; + } + + /** + * Set the stream of this {@link OrchestrationConfig} instance. + * + * @param stream The stream of this {@link OrchestrationConfig} + */ + public void setStream(@Nullable final GlobalStreamOptions stream) { + this.stream = stream; + } + + /** + * Get the names of the unrecognizable properties of the {@link OrchestrationConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link OrchestrationConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "OrchestrationConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link OrchestrationConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (modules != null) declaredFields.put("modules", modules); + if (stream != null) declaredFields.put("stream", stream); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link OrchestrationConfig} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final OrchestrationConfig orchestrationConfig = (OrchestrationConfig) o; + return Objects.equals(this.cloudSdkCustomFields, orchestrationConfig.cloudSdkCustomFields) + && Objects.equals(this.modules, orchestrationConfig.modules) + && Objects.equals(this.stream, orchestrationConfig.stream); + } + + @Override + public int hashCode() { + return Objects.hash(modules, stream, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class OrchestrationConfig {\n"); + sb.append(" modules: ").append(toIndentedString(modules)).append("\n"); + sb.append(" stream: ").append(toIndentedString(stream)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link OrchestrationConfig} + * instance with all required arguments. + */ + public static Builder create() { + return (modules) -> new OrchestrationConfig().modules(modules); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the modules of this {@link OrchestrationConfig} instance. + * + * @param modules The modules of this {@link OrchestrationConfig} + * @return The OrchestrationConfig instance. + */ + OrchestrationConfig modules(@Nonnull final ModuleConfigs modules); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigGetResponse.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigGetResponse.java index f44624dff..a46317a62 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigGetResponse.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigGetResponse.java @@ -57,7 +57,7 @@ public class OrchestrationConfigGetResponse private String resourceGroupId; @JsonProperty("spec") - private Object spec = null; + private OrchestrationConfig spec; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -365,7 +365,7 @@ public void setResourceGroupId(@Nullable final String resourceGroupId) { * @return The same instance of this {@link OrchestrationConfigGetResponse} class */ @Nonnull - public OrchestrationConfigGetResponse spec(@Nullable final Object spec) { + public OrchestrationConfigGetResponse spec(@Nullable final OrchestrationConfig spec) { this.spec = spec; return this; } @@ -376,7 +376,7 @@ public OrchestrationConfigGetResponse spec(@Nullable final Object spec) { * @return spec The spec of this {@link OrchestrationConfigGetResponse} instance. */ @Nonnull - public Object getSpec() { + public OrchestrationConfig getSpec() { return spec; } @@ -385,7 +385,7 @@ public Object getSpec() { * * @param spec The spec of this {@link OrchestrationConfigGetResponse} */ - public void setSpec(@Nullable final Object spec) { + public void setSpec(@Nullable final OrchestrationConfig spec) { this.spec = spec; } diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigPostRequest.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigPostRequest.java index 98f805439..2e6688b7e 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigPostRequest.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigPostRequest.java @@ -38,7 +38,7 @@ public class OrchestrationConfigPostRequest private String scenario; @JsonProperty("spec") - private Object spec = null; + private OrchestrationConfig spec; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -150,7 +150,7 @@ public void setScenario(@Nonnull final String scenario) { * @return The same instance of this {@link OrchestrationConfigPostRequest} class */ @Nonnull - public OrchestrationConfigPostRequest spec(@Nonnull final Object spec) { + public OrchestrationConfigPostRequest spec(@Nonnull final OrchestrationConfig spec) { this.spec = spec; return this; } @@ -161,7 +161,7 @@ public OrchestrationConfigPostRequest spec(@Nonnull final Object spec) { * @return spec The spec of this {@link OrchestrationConfigPostRequest} instance. */ @Nonnull - public Object getSpec() { + public OrchestrationConfig getSpec() { return spec; } @@ -170,7 +170,7 @@ public Object getSpec() { * * @param spec The spec of this {@link OrchestrationConfigPostRequest} */ - public void setSpec(@Nonnull final Object spec) { + public void setSpec(@Nonnull final OrchestrationConfig spec) { this.spec = spec; } @@ -340,6 +340,6 @@ public interface Builder3 { * @param spec The spec of this {@link OrchestrationConfigPostRequest} * @return The OrchestrationConfigPostRequest instance. */ - OrchestrationConfigPostRequest spec(@Nonnull final Object spec); + OrchestrationConfigPostRequest spec(@Nonnull final OrchestrationConfig spec); } } diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigResource.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigResource.java index 700714997..e84b996db 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigResource.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OrchestrationConfigResource.java @@ -54,7 +54,7 @@ public class OrchestrationConfigResource private String resourceGroupId; @JsonProperty("spec") - private Object spec = null; + private OrchestrationConfig spec; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -325,7 +325,7 @@ public void setResourceGroupId(@Nullable final String resourceGroupId) { * @return The same instance of this {@link OrchestrationConfigResource} class */ @Nonnull - public OrchestrationConfigResource spec(@Nullable final Object spec) { + public OrchestrationConfigResource spec(@Nullable final OrchestrationConfig spec) { this.spec = spec; return this; } @@ -336,7 +336,7 @@ public OrchestrationConfigResource spec(@Nullable final Object spec) { * @return spec The spec of this {@link OrchestrationConfigResource} instance. */ @Nonnull - public Object getSpec() { + public OrchestrationConfig getSpec() { return spec; } @@ -345,7 +345,7 @@ public Object getSpec() { * * @param spec The spec of this {@link OrchestrationConfigResource} */ - public void setSpec(@Nullable final Object spec) { + public void setSpec(@Nullable final OrchestrationConfig spec) { this.spec = spec; } diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OutputFilterConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OutputFilterConfig.java new file mode 100644 index 000000000..da6d2d408 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OutputFilterConfig.java @@ -0,0 +1,23 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** OutputFilterConfig */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = AzureContentSafetyOutputFilterConfig.class), + @JsonSubTypes.Type(value = LlamaGuard38bFilterConfig.class), +}) +public interface OutputFilterConfig {} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OutputFilteringConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OutputFilteringConfig.java new file mode 100644 index 000000000..3bd622726 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/OutputFilteringConfig.java @@ -0,0 +1,256 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** OutputFilteringConfig */ +// CHECKSTYLE:OFF +public class OutputFilteringConfig +// CHECKSTYLE:ON +{ + @JsonProperty("filters") + private List filters = new ArrayList<>(); + + @JsonProperty("stream_options") + private FilteringStreamOptions streamOptions; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for OutputFilteringConfig. */ + protected OutputFilteringConfig() {} + + /** + * Set the filters of this {@link OutputFilteringConfig} instance and return the same instance. + * + * @param filters Configuration for content filtering services that should be used for the given + * filtering step (output filtering). + * @return The same instance of this {@link OutputFilteringConfig} class + */ + @Nonnull + public OutputFilteringConfig filters(@Nonnull final List filters) { + this.filters = filters; + return this; + } + + /** + * Add one filters instance to this {@link OutputFilteringConfig}. + * + * @param filtersItem The filters that should be added + * @return The same instance of type {@link OutputFilteringConfig} + */ + @Nonnull + public OutputFilteringConfig addFiltersItem(@Nonnull final OutputFilterConfig filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * Configuration for content filtering services that should be used for the given filtering step + * (output filtering). + * + * @return filters The filters of this {@link OutputFilteringConfig} instance. + */ + @Nonnull + public List getFilters() { + return filters; + } + + /** + * Set the filters of this {@link OutputFilteringConfig} instance. + * + * @param filters Configuration for content filtering services that should be used for the given + * filtering step (output filtering). + */ + public void setFilters(@Nonnull final List filters) { + this.filters = filters; + } + + /** + * Set the streamOptions of this {@link OutputFilteringConfig} instance and return the same + * instance. + * + * @param streamOptions The streamOptions of this {@link OutputFilteringConfig} + * @return The same instance of this {@link OutputFilteringConfig} class + */ + @Nonnull + public OutputFilteringConfig streamOptions(@Nullable final FilteringStreamOptions streamOptions) { + this.streamOptions = streamOptions; + return this; + } + + /** + * Get streamOptions + * + * @return streamOptions The streamOptions of this {@link OutputFilteringConfig} instance. + */ + @Nonnull + public FilteringStreamOptions getStreamOptions() { + return streamOptions; + } + + /** + * Set the streamOptions of this {@link OutputFilteringConfig} instance. + * + * @param streamOptions The streamOptions of this {@link OutputFilteringConfig} + */ + public void setStreamOptions(@Nullable final FilteringStreamOptions streamOptions) { + this.streamOptions = streamOptions; + } + + /** + * Get the names of the unrecognizable properties of the {@link OutputFilteringConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link OutputFilteringConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "OutputFilteringConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link OutputFilteringConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (filters != null) declaredFields.put("filters", filters); + if (streamOptions != null) declaredFields.put("streamOptions", streamOptions); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link OutputFilteringConfig} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final OutputFilteringConfig outputFilteringConfig = (OutputFilteringConfig) o; + return Objects.equals(this.cloudSdkCustomFields, outputFilteringConfig.cloudSdkCustomFields) + && Objects.equals(this.filters, outputFilteringConfig.filters) + && Objects.equals(this.streamOptions, outputFilteringConfig.streamOptions); + } + + @Override + public int hashCode() { + return Objects.hash(filters, streamOptions, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class OutputFilteringConfig {\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" streamOptions: ").append(toIndentedString(streamOptions)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link OutputFilteringConfig} + * instance with all required arguments. + */ + public static Builder create() { + return (filters) -> new OutputFilteringConfig().filters(filters); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the filters of this {@link OutputFilteringConfig} instance. + * + * @param filters Configuration for content filtering services that should be used for the given + * filtering step (output filtering). + * @return The OutputFilteringConfig instance. + */ + OutputFilteringConfig filters(@Nonnull final List filters); + + /** + * Set the filters of this {@link OutputFilteringConfig} instance. + * + * @param filters Configuration for content filtering services that should be used for the given + * filtering step (output filtering). + * @return The OutputFilteringConfig instance. + */ + default OutputFilteringConfig filters(@Nonnull final OutputFilterConfig... filters) { + return filters(Arrays.asList(filters)); + } + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfig.java new file mode 100644 index 000000000..b68654454 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfig.java @@ -0,0 +1,240 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** PromptTemplatingModuleConfig */ +// CHECKSTYLE:OFF +public class PromptTemplatingModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty("prompt") + private PromptTemplatingModuleConfigPrompt prompt; + + @JsonProperty("model") + private LLMModelDetails model; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PromptTemplatingModuleConfig. */ + protected PromptTemplatingModuleConfig() {} + + /** + * Set the prompt of this {@link PromptTemplatingModuleConfig} instance and return the same + * instance. + * + * @param prompt The prompt of this {@link PromptTemplatingModuleConfig} + * @return The same instance of this {@link PromptTemplatingModuleConfig} class + */ + @Nonnull + public PromptTemplatingModuleConfig prompt( + @Nonnull final PromptTemplatingModuleConfigPrompt prompt) { + this.prompt = prompt; + return this; + } + + /** + * Get prompt + * + * @return prompt The prompt of this {@link PromptTemplatingModuleConfig} instance. + */ + @Nonnull + public PromptTemplatingModuleConfigPrompt getPrompt() { + return prompt; + } + + /** + * Set the prompt of this {@link PromptTemplatingModuleConfig} instance. + * + * @param prompt The prompt of this {@link PromptTemplatingModuleConfig} + */ + public void setPrompt(@Nonnull final PromptTemplatingModuleConfigPrompt prompt) { + this.prompt = prompt; + } + + /** + * Set the model of this {@link PromptTemplatingModuleConfig} instance and return the same + * instance. + * + * @param model The model of this {@link PromptTemplatingModuleConfig} + * @return The same instance of this {@link PromptTemplatingModuleConfig} class + */ + @Nonnull + public PromptTemplatingModuleConfig model(@Nonnull final LLMModelDetails model) { + this.model = model; + return this; + } + + /** + * Get model + * + * @return model The model of this {@link PromptTemplatingModuleConfig} instance. + */ + @Nonnull + public LLMModelDetails getModel() { + return model; + } + + /** + * Set the model of this {@link PromptTemplatingModuleConfig} instance. + * + * @param model The model of this {@link PromptTemplatingModuleConfig} + */ + public void setModel(@Nonnull final LLMModelDetails model) { + this.model = model; + } + + /** + * Get the names of the unrecognizable properties of the {@link PromptTemplatingModuleConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PromptTemplatingModuleConfig} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "PromptTemplatingModuleConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PromptTemplatingModuleConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (prompt != null) declaredFields.put("prompt", prompt); + if (model != null) declaredFields.put("model", model); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PromptTemplatingModuleConfig} instance. If the + * map previously contained a mapping for the key, the old value is replaced by the specified + * value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final PromptTemplatingModuleConfig promptTemplatingModuleConfig = + (PromptTemplatingModuleConfig) o; + return Objects.equals( + this.cloudSdkCustomFields, promptTemplatingModuleConfig.cloudSdkCustomFields) + && Objects.equals(this.prompt, promptTemplatingModuleConfig.prompt) + && Objects.equals(this.model, promptTemplatingModuleConfig.model); + } + + @Override + public int hashCode() { + return Objects.hash(prompt, model, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PromptTemplatingModuleConfig {\n"); + sb.append(" prompt: ").append(toIndentedString(prompt)).append("\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * PromptTemplatingModuleConfig} instance with all required arguments. + */ + public static Builder create() { + return (prompt) -> (model) -> new PromptTemplatingModuleConfig().prompt(prompt).model(model); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the prompt of this {@link PromptTemplatingModuleConfig} instance. + * + * @param prompt The prompt of this {@link PromptTemplatingModuleConfig} + * @return The PromptTemplatingModuleConfig builder. + */ + Builder1 prompt(@Nonnull final PromptTemplatingModuleConfigPrompt prompt); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the model of this {@link PromptTemplatingModuleConfig} instance. + * + * @param model The model of this {@link PromptTemplatingModuleConfig} + * @return The PromptTemplatingModuleConfig instance. + */ + PromptTemplatingModuleConfig model(@Nonnull final LLMModelDetails model); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfigPrompt.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfigPrompt.java new file mode 100644 index 000000000..d34042e67 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/PromptTemplatingModuleConfigPrompt.java @@ -0,0 +1,26 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** + * The prompt template to be used. Can be either a user defined template or a reference to a + * template in the prompt registry. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Template.class), + @JsonSubTypes.Type(value = TemplateRef.class), +}) +public interface PromptTemplatingModuleConfigPrompt {} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ResponseFormatJsonObject.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ResponseFormatJsonObject.java index 37c2ffdeb..8fd1becb9 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ResponseFormatJsonObject.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ResponseFormatJsonObject.java @@ -27,7 +27,8 @@ /** ResponseFormatJsonObject */ // CHECKSTYLE:OFF -public class ResponseFormatJsonObject implements PromptTemplateSpecResponseFormat +public class ResponseFormatJsonObject + implements PromptTemplateSpecResponseFormat, TemplateResponseFormat // CHECKSTYLE:ON { /** The type of response format being defined: `json_object` */ diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ResponseFormatJsonSchema.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ResponseFormatJsonSchema.java index 44208b271..9a740694a 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ResponseFormatJsonSchema.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ResponseFormatJsonSchema.java @@ -27,7 +27,8 @@ /** ResponseFormatJsonSchema */ // CHECKSTYLE:OFF -public class ResponseFormatJsonSchema implements PromptTemplateSpecResponseFormat +public class ResponseFormatJsonSchema + implements PromptTemplateSpecResponseFormat, TemplateResponseFormat // CHECKSTYLE:ON { /** The type of response format being defined: `json_schema` */ diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ResponseFormatText.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ResponseFormatText.java index 86edd916f..a43a99006 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ResponseFormatText.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ResponseFormatText.java @@ -27,7 +27,7 @@ /** ResponseFormatText */ // CHECKSTYLE:OFF -public class ResponseFormatText implements PromptTemplateSpecResponseFormat +public class ResponseFormatText implements PromptTemplateSpecResponseFormat, TemplateResponseFormat // CHECKSTYLE:ON { /** The type of response format being defined: `text` */ diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/RuntimeOrchestrationConfigFile.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/RuntimeOrchestrationConfigFile.java index 5f4e4c594..b09fdd764 100644 --- a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/RuntimeOrchestrationConfigFile.java +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/RuntimeOrchestrationConfigFile.java @@ -38,7 +38,7 @@ public class RuntimeOrchestrationConfigFile private RuntimePromptTemplateFileMetadata metadata; @JsonProperty("spec") - private Object spec = null; + private OrchestrationConfig spec; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -151,7 +151,7 @@ public void setMetadata(@Nullable final RuntimePromptTemplateFileMetadata metada * @return The same instance of this {@link RuntimeOrchestrationConfigFile} class */ @Nonnull - public RuntimeOrchestrationConfigFile spec(@Nullable final Object spec) { + public RuntimeOrchestrationConfigFile spec(@Nullable final OrchestrationConfig spec) { this.spec = spec; return this; } @@ -162,7 +162,7 @@ public RuntimeOrchestrationConfigFile spec(@Nullable final Object spec) { * @return spec The spec of this {@link RuntimeOrchestrationConfigFile} instance. */ @Nonnull - public Object getSpec() { + public OrchestrationConfig getSpec() { return spec; } @@ -171,7 +171,7 @@ public Object getSpec() { * * @param spec The spec of this {@link RuntimeOrchestrationConfigFile} */ - public void setSpec(@Nullable final Object spec) { + public void setSpec(@Nullable final OrchestrationConfig spec) { this.spec = spec; } diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SAPDocumentTranslation.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SAPDocumentTranslation.java new file mode 100644 index 000000000..00e4ade4c --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SAPDocumentTranslation.java @@ -0,0 +1,289 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** SAPDocumentTranslation */ +// CHECKSTYLE:OFF +public class SAPDocumentTranslation +// CHECKSTYLE:ON +{ + /** Type of document translation provider */ + public enum TypeEnum { + /** The SAP_DOCUMENT_TRANSLATION option of this SAPDocumentTranslation */ + SAP_DOCUMENT_TRANSLATION("sap_document_translation"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this SAPDocumentTranslation */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type SAPDocumentTranslation + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("type") + private TypeEnum type; + + @JsonProperty("config") + private SAPDocumentTranslationConfig config; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for SAPDocumentTranslation. */ + protected SAPDocumentTranslation() {} + + /** + * Set the type of this {@link SAPDocumentTranslation} instance and return the same instance. + * + * @param type Type of document translation provider + * @return The same instance of this {@link SAPDocumentTranslation} class + */ + @Nonnull + public SAPDocumentTranslation type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Type of document translation provider + * + * @return type The type of this {@link SAPDocumentTranslation} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link SAPDocumentTranslation} instance. + * + * @param type Type of document translation provider + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the config of this {@link SAPDocumentTranslation} instance and return the same instance. + * + * @param config The config of this {@link SAPDocumentTranslation} + * @return The same instance of this {@link SAPDocumentTranslation} class + */ + @Nonnull + public SAPDocumentTranslation config(@Nonnull final SAPDocumentTranslationConfig config) { + this.config = config; + return this; + } + + /** + * Get config + * + * @return config The config of this {@link SAPDocumentTranslation} instance. + */ + @Nonnull + public SAPDocumentTranslationConfig getConfig() { + return config; + } + + /** + * Set the config of this {@link SAPDocumentTranslation} instance. + * + * @param config The config of this {@link SAPDocumentTranslation} + */ + public void setConfig(@Nonnull final SAPDocumentTranslationConfig config) { + this.config = config; + } + + /** + * Get the names of the unrecognizable properties of the {@link SAPDocumentTranslation}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SAPDocumentTranslation} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "SAPDocumentTranslation has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SAPDocumentTranslation} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (config != null) declaredFields.put("config", config); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SAPDocumentTranslation} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final SAPDocumentTranslation saPDocumentTranslation = (SAPDocumentTranslation) o; + return Objects.equals(this.cloudSdkCustomFields, saPDocumentTranslation.cloudSdkCustomFields) + && Objects.equals(this.type, saPDocumentTranslation.type) + && Objects.equals(this.config, saPDocumentTranslation.config); + } + + @Override + public int hashCode() { + return Objects.hash(type, config, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SAPDocumentTranslation {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" config: ").append(toIndentedString(config)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link SAPDocumentTranslation} + * instance with all required arguments. + */ + public static Builder create() { + return (type) -> (config) -> new SAPDocumentTranslation().type(type).config(config); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link SAPDocumentTranslation} instance. + * + * @param type Type of document translation provider + * @return The SAPDocumentTranslation builder. + */ + Builder1 type(@Nonnull final TypeEnum type); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the config of this {@link SAPDocumentTranslation} instance. + * + * @param config The config of this {@link SAPDocumentTranslation} + * @return The SAPDocumentTranslation instance. + */ + SAPDocumentTranslation config(@Nonnull final SAPDocumentTranslationConfig config); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SAPDocumentTranslationConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SAPDocumentTranslationConfig.java new file mode 100644 index 000000000..5f92fcd14 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SAPDocumentTranslationConfig.java @@ -0,0 +1,230 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** Configuration for `sap_document_translation` translation provider. */ +// CHECKSTYLE:OFF +public class SAPDocumentTranslationConfig +// CHECKSTYLE:ON +{ + @JsonProperty("source_language") + private String sourceLanguage; + + @JsonProperty("target_language") + private String targetLanguage; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for SAPDocumentTranslationConfig. */ + protected SAPDocumentTranslationConfig() {} + + /** + * Set the sourceLanguage of this {@link SAPDocumentTranslationConfig} instance and return the + * same instance. + * + * @param sourceLanguage Language of the text to be translated. + * @return The same instance of this {@link SAPDocumentTranslationConfig} class + */ + @Nonnull + public SAPDocumentTranslationConfig sourceLanguage(@Nullable final String sourceLanguage) { + this.sourceLanguage = sourceLanguage; + return this; + } + + /** + * Language of the text to be translated. + * + * @return sourceLanguage The sourceLanguage of this {@link SAPDocumentTranslationConfig} + * instance. + */ + @Nonnull + public String getSourceLanguage() { + return sourceLanguage; + } + + /** + * Set the sourceLanguage of this {@link SAPDocumentTranslationConfig} instance. + * + * @param sourceLanguage Language of the text to be translated. + */ + public void setSourceLanguage(@Nullable final String sourceLanguage) { + this.sourceLanguage = sourceLanguage; + } + + /** + * Set the targetLanguage of this {@link SAPDocumentTranslationConfig} instance and return the + * same instance. + * + * @param targetLanguage Language to which the text should be translated. + * @return The same instance of this {@link SAPDocumentTranslationConfig} class + */ + @Nonnull + public SAPDocumentTranslationConfig targetLanguage(@Nonnull final String targetLanguage) { + this.targetLanguage = targetLanguage; + return this; + } + + /** + * Language to which the text should be translated. + * + * @return targetLanguage The targetLanguage of this {@link SAPDocumentTranslationConfig} + * instance. + */ + @Nonnull + public String getTargetLanguage() { + return targetLanguage; + } + + /** + * Set the targetLanguage of this {@link SAPDocumentTranslationConfig} instance. + * + * @param targetLanguage Language to which the text should be translated. + */ + public void setTargetLanguage(@Nonnull final String targetLanguage) { + this.targetLanguage = targetLanguage; + } + + /** + * Get the names of the unrecognizable properties of the {@link SAPDocumentTranslationConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SAPDocumentTranslationConfig} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "SAPDocumentTranslationConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SAPDocumentTranslationConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (sourceLanguage != null) declaredFields.put("sourceLanguage", sourceLanguage); + if (targetLanguage != null) declaredFields.put("targetLanguage", targetLanguage); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SAPDocumentTranslationConfig} instance. If the + * map previously contained a mapping for the key, the old value is replaced by the specified + * value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final SAPDocumentTranslationConfig saPDocumentTranslationConfig = + (SAPDocumentTranslationConfig) o; + return Objects.equals( + this.cloudSdkCustomFields, saPDocumentTranslationConfig.cloudSdkCustomFields) + && Objects.equals(this.sourceLanguage, saPDocumentTranslationConfig.sourceLanguage) + && Objects.equals(this.targetLanguage, saPDocumentTranslationConfig.targetLanguage); + } + + @Override + public int hashCode() { + return Objects.hash(sourceLanguage, targetLanguage, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SAPDocumentTranslationConfig {\n"); + sb.append(" sourceLanguage: ").append(toIndentedString(sourceLanguage)).append("\n"); + sb.append(" targetLanguage: ").append(toIndentedString(targetLanguage)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * SAPDocumentTranslationConfig} instance with all required arguments. + */ + public static Builder create() { + return (targetLanguage) -> new SAPDocumentTranslationConfig().targetLanguage(targetLanguage); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the targetLanguage of this {@link SAPDocumentTranslationConfig} instance. + * + * @param targetLanguage Language to which the text should be translated. + * @return The SAPDocumentTranslationConfig instance. + */ + SAPDocumentTranslationConfig targetLanguage(@Nonnull final String targetLanguage); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SearchDocumentKeyValueListPair.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SearchDocumentKeyValueListPair.java new file mode 100644 index 000000000..87d8ee034 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SearchDocumentKeyValueListPair.java @@ -0,0 +1,322 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** SearchDocumentKeyValueListPair */ +// CHECKSTYLE:OFF +public class SearchDocumentKeyValueListPair +// CHECKSTYLE:ON +{ + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + @JsonProperty("select_mode") + private List selectMode = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for SearchDocumentKeyValueListPair. */ + protected SearchDocumentKeyValueListPair() {} + + /** + * Set the key of this {@link SearchDocumentKeyValueListPair} instance and return the same + * instance. + * + * @param key The key of this {@link SearchDocumentKeyValueListPair} + * @return The same instance of this {@link SearchDocumentKeyValueListPair} class + */ + @Nonnull + public SearchDocumentKeyValueListPair key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link SearchDocumentKeyValueListPair} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param key The key of this {@link SearchDocumentKeyValueListPair} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link SearchDocumentKeyValueListPair} instance and return the same + * instance. + * + * @param value The value of this {@link SearchDocumentKeyValueListPair} + * @return The same instance of this {@link SearchDocumentKeyValueListPair} class + */ + @Nonnull + public SearchDocumentKeyValueListPair value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link SearchDocumentKeyValueListPair}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link SearchDocumentKeyValueListPair} + */ + @Nonnull + public SearchDocumentKeyValueListPair addValueItem(@Nonnull final String valueItem) { + if (this.value == null) { + this.value = new ArrayList<>(); + } + this.value.add(valueItem); + return this; + } + + /** + * Get value + * + * @return value The value of this {@link SearchDocumentKeyValueListPair} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param value The value of this {@link SearchDocumentKeyValueListPair} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Set the selectMode of this {@link SearchDocumentKeyValueListPair} instance and return the same + * instance. + * + * @param selectMode Select mode for search filters + * @return The same instance of this {@link SearchDocumentKeyValueListPair} class + */ + @Nonnull + public SearchDocumentKeyValueListPair selectMode( + @Nullable final List selectMode) { + this.selectMode = selectMode; + return this; + } + + /** + * Add one selectMode instance to this {@link SearchDocumentKeyValueListPair}. + * + * @param selectModeItem The selectMode that should be added + * @return The same instance of type {@link SearchDocumentKeyValueListPair} + */ + @Nonnull + public SearchDocumentKeyValueListPair addSelectModeItem( + @Nonnull final SearchSelectOptionEnum selectModeItem) { + if (this.selectMode == null) { + this.selectMode = new ArrayList<>(); + } + this.selectMode.add(selectModeItem); + return this; + } + + /** + * Select mode for search filters + * + * @return selectMode The selectMode of this {@link SearchDocumentKeyValueListPair} instance. + */ + @Nonnull + public List getSelectMode() { + return selectMode; + } + + /** + * Set the selectMode of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param selectMode Select mode for search filters + */ + public void setSelectMode(@Nullable final List selectMode) { + this.selectMode = selectMode; + } + + /** + * Get the names of the unrecognizable properties of the {@link SearchDocumentKeyValueListPair}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SearchDocumentKeyValueListPair} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "SearchDocumentKeyValueListPair has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SearchDocumentKeyValueListPair} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (key != null) declaredFields.put("key", key); + if (value != null) declaredFields.put("value", value); + if (selectMode != null) declaredFields.put("selectMode", selectMode); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SearchDocumentKeyValueListPair} instance. If the + * map previously contained a mapping for the key, the old value is replaced by the specified + * value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final SearchDocumentKeyValueListPair searchDocumentKeyValueListPair = + (SearchDocumentKeyValueListPair) o; + return Objects.equals( + this.cloudSdkCustomFields, searchDocumentKeyValueListPair.cloudSdkCustomFields) + && Objects.equals(this.key, searchDocumentKeyValueListPair.key) + && Objects.equals(this.value, searchDocumentKeyValueListPair.value) + && Objects.equals(this.selectMode, searchDocumentKeyValueListPair.selectMode); + } + + @Override + public int hashCode() { + return Objects.hash(key, value, selectMode, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SearchDocumentKeyValueListPair {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" selectMode: ").append(toIndentedString(selectMode)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * SearchDocumentKeyValueListPair} instance with all required arguments. + */ + public static Builder create() { + return (key) -> (value) -> new SearchDocumentKeyValueListPair().key(key).value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the key of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param key The key of this {@link SearchDocumentKeyValueListPair} + * @return The SearchDocumentKeyValueListPair builder. + */ + Builder1 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the value of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param value The value of this {@link SearchDocumentKeyValueListPair} + * @return The SearchDocumentKeyValueListPair instance. + */ + SearchDocumentKeyValueListPair value(@Nonnull final List value); + + /** + * Set the value of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param value The value of this {@link SearchDocumentKeyValueListPair} + * @return The SearchDocumentKeyValueListPair instance. + */ + default SearchDocumentKeyValueListPair value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SearchSelectOptionEnum.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SearchSelectOptionEnum.java new file mode 100644 index 000000000..8c8e444df --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SearchSelectOptionEnum.java @@ -0,0 +1,62 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.annotation.Nonnull; + +/** Gets or Sets SearchSelectOptionEnum */ +public enum SearchSelectOptionEnum { + IGNORE_IF_KEY_ABSENT("ignoreIfKeyAbsent"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + SearchSelectOptionEnum(String value) { + this.value = value; + } + + /** + * @return The enum value. + */ + @JsonValue + public String getValue() { + return value; + } + + /** + * @return The String representation of the enum value. + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Converts the given value to its enum representation. + * + * @param value The input value. + * @return The enum representation of the given value. + */ + @JsonCreator + public static SearchSelectOptionEnum fromValue(@Nonnull final String value) { + for (final SearchSelectOptionEnum b : SearchSelectOptionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SystemChatMessage.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SystemChatMessage.java new file mode 100644 index 000000000..cb9439e4e --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/SystemChatMessage.java @@ -0,0 +1,288 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** SystemChatMessage */ +// CHECKSTYLE:OFF +public class SystemChatMessage implements ChatMessage +// CHECKSTYLE:ON +{ + /** Gets or Sets role */ + public enum RoleEnum { + /** The SYSTEM option of this SystemChatMessage */ + SYSTEM("system"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this SystemChatMessage */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + RoleEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type SystemChatMessage + */ + @JsonCreator + @Nonnull + public static RoleEnum fromValue(@Nonnull final String value) { + for (RoleEnum b : RoleEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("role") + private RoleEnum role; + + @JsonProperty("content") + private ChatMessageContent content; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for SystemChatMessage. */ + protected SystemChatMessage() {} + + /** + * Set the role of this {@link SystemChatMessage} instance and return the same instance. + * + * @param role The role of this {@link SystemChatMessage} + * @return The same instance of this {@link SystemChatMessage} class + */ + @Nonnull + public SystemChatMessage role(@Nonnull final RoleEnum role) { + this.role = role; + return this; + } + + /** + * Get role + * + * @return role The role of this {@link SystemChatMessage} instance. + */ + @Nonnull + public RoleEnum getRole() { + return role; + } + + /** + * Set the role of this {@link SystemChatMessage} instance. + * + * @param role The role of this {@link SystemChatMessage} + */ + public void setRole(@Nonnull final RoleEnum role) { + this.role = role; + } + + /** + * Set the content of this {@link SystemChatMessage} instance and return the same instance. + * + * @param content The content of this {@link SystemChatMessage} + * @return The same instance of this {@link SystemChatMessage} class + */ + @Nonnull + public SystemChatMessage content(@Nonnull final ChatMessageContent content) { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link SystemChatMessage} instance. + */ + @Nonnull + public ChatMessageContent getContent() { + return content; + } + + /** + * Set the content of this {@link SystemChatMessage} instance. + * + * @param content The content of this {@link SystemChatMessage} + */ + public void setContent(@Nonnull final ChatMessageContent content) { + this.content = content; + } + + /** + * Get the names of the unrecognizable properties of the {@link SystemChatMessage}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SystemChatMessage} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("SystemChatMessage has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SystemChatMessage} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (role != null) declaredFields.put("role", role); + if (content != null) declaredFields.put("content", content); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SystemChatMessage} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final SystemChatMessage systemChatMessage = (SystemChatMessage) o; + return Objects.equals(this.cloudSdkCustomFields, systemChatMessage.cloudSdkCustomFields) + && Objects.equals(this.role, systemChatMessage.role) + && Objects.equals(this.content, systemChatMessage.content); + } + + @Override + public int hashCode() { + return Objects.hash(role, content, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SystemChatMessage {\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link SystemChatMessage} + * instance with all required arguments. + */ + public static Builder create() { + return (role) -> (content) -> new SystemChatMessage().role(role).content(content); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the role of this {@link SystemChatMessage} instance. + * + * @param role The role of this {@link SystemChatMessage} + * @return The SystemChatMessage builder. + */ + Builder1 role(@Nonnull final RoleEnum role); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the content of this {@link SystemChatMessage} instance. + * + * @param content The content of this {@link SystemChatMessage} + * @return The SystemChatMessage instance. + */ + SystemChatMessage content(@Nonnull final ChatMessageContent content); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/Template.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/Template.java new file mode 100644 index 000000000..9c00093b7 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/Template.java @@ -0,0 +1,369 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** Template */ +// CHECKSTYLE:OFF +public class Template implements PromptTemplatingModuleConfigPrompt +// CHECKSTYLE:ON +{ + @JsonProperty("template") + private List template; + + @JsonProperty("defaults") + private Map defaults = new HashMap<>(); + + @JsonProperty("response_format") + private TemplateResponseFormat responseFormat; + + @JsonProperty("tools") + private List tools = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for Template. */ + protected Template() {} + + /** + * Set the template of this {@link Template} instance and return the same instance. + * + * @param template A chat message array to be formatted with values from input_params. Both role + * and content can be templated. If messages_history is provided, the templated messages will + * be appended. + * @return The same instance of this {@link Template} class + */ + @Nonnull + public Template template(@Nonnull final List template) { + this.template = template; + return this; + } + + /** + * Add one template instance to this {@link Template}. + * + * @param templateItem The template that should be added + * @return The same instance of type {@link Template} + */ + @Nonnull + public Template addTemplateItem(@Nonnull final ChatMessage templateItem) { + if (this.template == null) { + this.template = new ArrayList<>(); + } + this.template.add(templateItem); + return this; + } + + /** + * A chat message array to be formatted with values from input_params. Both role and content can + * be templated. If messages_history is provided, the templated messages will be appended. + * + * @return template The template of this {@link Template} instance. + */ + @Nonnull + public List getTemplate() { + return template; + } + + /** + * Set the template of this {@link Template} instance. + * + * @param template A chat message array to be formatted with values from input_params. Both role + * and content can be templated. If messages_history is provided, the templated messages will + * be appended. + */ + public void setTemplate(@Nonnull final List template) { + this.template = template; + } + + /** + * Set the defaults of this {@link Template} instance and return the same instance. + * + * @param defaults Optional default values for the template. If a parameter has no default it is + * required. + * @return The same instance of this {@link Template} class + */ + @Nonnull + public Template defaults(@Nullable final Map defaults) { + this.defaults = defaults; + return this; + } + + /** + * Put one defaults instance to this {@link Template} instance. + * + * @param key The String key of this defaults instance + * @param defaultsItem The defaults that should be added under the given key + * @return The same instance of type {@link Template} + */ + @Nonnull + public Template putdefaultsItem(@Nonnull final String key, @Nonnull final String defaultsItem) { + if (this.defaults == null) { + this.defaults = new HashMap<>(); + } + this.defaults.put(key, defaultsItem); + return this; + } + + /** + * Optional default values for the template. If a parameter has no default it is required. + * + * @return defaults The defaults of this {@link Template} instance. + */ + @Nonnull + public Map getDefaults() { + return defaults; + } + + /** + * Set the defaults of this {@link Template} instance. + * + * @param defaults Optional default values for the template. If a parameter has no default it is + * required. + */ + public void setDefaults(@Nullable final Map defaults) { + this.defaults = defaults; + } + + /** + * Set the responseFormat of this {@link Template} instance and return the same instance. + * + * @param responseFormat The responseFormat of this {@link Template} + * @return The same instance of this {@link Template} class + */ + @Nonnull + public Template responseFormat(@Nullable final TemplateResponseFormat responseFormat) { + this.responseFormat = responseFormat; + return this; + } + + /** + * Get responseFormat + * + * @return responseFormat The responseFormat of this {@link Template} instance. + */ + @Nonnull + public TemplateResponseFormat getResponseFormat() { + return responseFormat; + } + + /** + * Set the responseFormat of this {@link Template} instance. + * + * @param responseFormat The responseFormat of this {@link Template} + */ + public void setResponseFormat(@Nullable final TemplateResponseFormat responseFormat) { + this.responseFormat = responseFormat; + } + + /** + * Set the tools of this {@link Template} instance and return the same instance. + * + * @param tools A list of tools the model may call. Used to provide a list of functions the model + * may generate JSON inputs for. This is the same as the OpenAI definition. + * @return The same instance of this {@link Template} class + */ + @Nonnull + public Template tools(@Nullable final List tools) { + this.tools = tools; + return this; + } + + /** + * Add one tools instance to this {@link Template}. + * + * @param toolsItem The tools that should be added + * @return The same instance of type {@link Template} + */ + @Nonnull + public Template addToolsItem(@Nonnull final ChatCompletionTool toolsItem) { + if (this.tools == null) { + this.tools = new ArrayList<>(); + } + this.tools.add(toolsItem); + return this; + } + + /** + * A list of tools the model may call. Used to provide a list of functions the model may generate + * JSON inputs for. This is the same as the OpenAI definition. + * + * @return tools The tools of this {@link Template} instance. + */ + @Nonnull + public List getTools() { + return tools; + } + + /** + * Set the tools of this {@link Template} instance. + * + * @param tools A list of tools the model may call. Used to provide a list of functions the model + * may generate JSON inputs for. This is the same as the OpenAI definition. + */ + public void setTools(@Nullable final List tools) { + this.tools = tools; + } + + /** + * Get the names of the unrecognizable properties of the {@link Template}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Template} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("Template has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Template} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (template != null) declaredFields.put("template", template); + if (defaults != null) declaredFields.put("defaults", defaults); + if (responseFormat != null) declaredFields.put("responseFormat", responseFormat); + if (tools != null) declaredFields.put("tools", tools); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Template} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final Template template = (Template) o; + return Objects.equals(this.cloudSdkCustomFields, template.cloudSdkCustomFields) + && Objects.equals(this.template, template.template) + && Objects.equals(this.defaults, template.defaults) + && Objects.equals(this.responseFormat, template.responseFormat) + && Objects.equals(this.tools, template.tools); + } + + @Override + public int hashCode() { + return Objects.hash(template, defaults, responseFormat, tools, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Template {\n"); + sb.append(" template: ").append(toIndentedString(template)).append("\n"); + sb.append(" defaults: ").append(toIndentedString(defaults)).append("\n"); + sb.append(" responseFormat: ").append(toIndentedString(responseFormat)).append("\n"); + sb.append(" tools: ").append(toIndentedString(tools)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link Template} instance with + * all required arguments. + */ + public static Builder create() { + return (template) -> new Template().template(template); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the template of this {@link Template} instance. + * + * @param template A chat message array to be formatted with values from input_params. Both role + * and content can be templated. If messages_history is provided, the templated messages + * will be appended. + * @return The Template instance. + */ + Template template(@Nonnull final List template); + + /** + * Set the template of this {@link Template} instance. + * + * @param template A chat message array to be formatted with values from input_params. Both role + * and content can be templated. If messages_history is provided, the templated messages + * will be appended. + * @return The Template instance. + */ + default Template template(@Nonnull final ChatMessage... template) { + return template(Arrays.asList(template)); + } + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRef.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRef.java new file mode 100644 index 000000000..931805dd6 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRef.java @@ -0,0 +1,184 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** TemplateRef */ +// CHECKSTYLE:OFF +public class TemplateRef implements PromptTemplatingModuleConfigPrompt +// CHECKSTYLE:ON +{ + @JsonProperty("template_ref") + private TemplateRefTemplateRef templateRef; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for TemplateRef. */ + protected TemplateRef() {} + + /** + * Set the templateRef of this {@link TemplateRef} instance and return the same instance. + * + * @param templateRef The templateRef of this {@link TemplateRef} + * @return The same instance of this {@link TemplateRef} class + */ + @Nonnull + public TemplateRef templateRef(@Nonnull final TemplateRefTemplateRef templateRef) { + this.templateRef = templateRef; + return this; + } + + /** + * Get templateRef + * + * @return templateRef The templateRef of this {@link TemplateRef} instance. + */ + @Nonnull + public TemplateRefTemplateRef getTemplateRef() { + return templateRef; + } + + /** + * Set the templateRef of this {@link TemplateRef} instance. + * + * @param templateRef The templateRef of this {@link TemplateRef} + */ + public void setTemplateRef(@Nonnull final TemplateRefTemplateRef templateRef) { + this.templateRef = templateRef; + } + + /** + * Get the names of the unrecognizable properties of the {@link TemplateRef}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TemplateRef} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("TemplateRef has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TemplateRef} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (templateRef != null) declaredFields.put("templateRef", templateRef); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TemplateRef} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final TemplateRef templateRef = (TemplateRef) o; + return Objects.equals(this.cloudSdkCustomFields, templateRef.cloudSdkCustomFields) + && Objects.equals(this.templateRef, templateRef.templateRef); + } + + @Override + public int hashCode() { + return Objects.hash(templateRef, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class TemplateRef {\n"); + sb.append(" templateRef: ").append(toIndentedString(templateRef)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link TemplateRef} instance + * with all required arguments. + */ + public static Builder create() { + return (templateRef) -> new TemplateRef().templateRef(templateRef); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the templateRef of this {@link TemplateRef} instance. + * + * @param templateRef The templateRef of this {@link TemplateRef} + * @return The TemplateRef instance. + */ + TemplateRef templateRef(@Nonnull final TemplateRefTemplateRef templateRef); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRefByID.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRefByID.java new file mode 100644 index 000000000..b0e074890 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRefByID.java @@ -0,0 +1,184 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** TemplateRefByID */ +// CHECKSTYLE:OFF +public class TemplateRefByID implements TemplateRefTemplateRef +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for TemplateRefByID. */ + protected TemplateRefByID() {} + + /** + * Set the id of this {@link TemplateRefByID} instance and return the same instance. + * + * @param id ID of the template in prompt registry + * @return The same instance of this {@link TemplateRefByID} class + */ + @Nonnull + public TemplateRefByID id(@Nonnull final String id) { + this.id = id; + return this; + } + + /** + * ID of the template in prompt registry + * + * @return id The id of this {@link TemplateRefByID} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link TemplateRefByID} instance. + * + * @param id ID of the template in prompt registry + */ + public void setId(@Nonnull final String id) { + this.id = id; + } + + /** + * Get the names of the unrecognizable properties of the {@link TemplateRefByID}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TemplateRefByID} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("TemplateRefByID has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TemplateRefByID} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (id != null) declaredFields.put("id", id); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TemplateRefByID} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final TemplateRefByID templateRefByID = (TemplateRefByID) o; + return Objects.equals(this.cloudSdkCustomFields, templateRefByID.cloudSdkCustomFields) + && Objects.equals(this.id, templateRefByID.id); + } + + @Override + public int hashCode() { + return Objects.hash(id, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class TemplateRefByID {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link TemplateRefByID} + * instance with all required arguments. + */ + public static Builder create() { + return (id) -> new TemplateRefByID().id(id); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link TemplateRefByID} instance. + * + * @param id ID of the template in prompt registry + * @return The TemplateRefByID instance. + */ + TemplateRefByID id(@Nonnull final String id); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRefByScenarioNameVersion.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRefByScenarioNameVersion.java new file mode 100644 index 000000000..3cba00a82 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRefByScenarioNameVersion.java @@ -0,0 +1,294 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** TemplateRefByScenarioNameVersion */ +// CHECKSTYLE:OFF +public class TemplateRefByScenarioNameVersion implements TemplateRefTemplateRef +// CHECKSTYLE:ON +{ + @JsonProperty("scenario") + private String scenario; + + @JsonProperty("name") + private String name; + + @JsonProperty("version") + private String version; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for TemplateRefByScenarioNameVersion. */ + protected TemplateRefByScenarioNameVersion() {} + + /** + * Set the scenario of this {@link TemplateRefByScenarioNameVersion} instance and return the same + * instance. + * + * @param scenario Scenario name + * @return The same instance of this {@link TemplateRefByScenarioNameVersion} class + */ + @Nonnull + public TemplateRefByScenarioNameVersion scenario(@Nonnull final String scenario) { + this.scenario = scenario; + return this; + } + + /** + * Scenario name + * + * @return scenario The scenario of this {@link TemplateRefByScenarioNameVersion} instance. + */ + @Nonnull + public String getScenario() { + return scenario; + } + + /** + * Set the scenario of this {@link TemplateRefByScenarioNameVersion} instance. + * + * @param scenario Scenario name + */ + public void setScenario(@Nonnull final String scenario) { + this.scenario = scenario; + } + + /** + * Set the name of this {@link TemplateRefByScenarioNameVersion} instance and return the same + * instance. + * + * @param name Name of the template + * @return The same instance of this {@link TemplateRefByScenarioNameVersion} class + */ + @Nonnull + public TemplateRefByScenarioNameVersion name(@Nonnull final String name) { + this.name = name; + return this; + } + + /** + * Name of the template + * + * @return name The name of this {@link TemplateRefByScenarioNameVersion} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link TemplateRefByScenarioNameVersion} instance. + * + * @param name Name of the template + */ + public void setName(@Nonnull final String name) { + this.name = name; + } + + /** + * Set the version of this {@link TemplateRefByScenarioNameVersion} instance and return the same + * instance. + * + * @param version Version of the template + * @return The same instance of this {@link TemplateRefByScenarioNameVersion} class + */ + @Nonnull + public TemplateRefByScenarioNameVersion version(@Nonnull final String version) { + this.version = version; + return this; + } + + /** + * Version of the template + * + * @return version The version of this {@link TemplateRefByScenarioNameVersion} instance. + */ + @Nonnull + public String getVersion() { + return version; + } + + /** + * Set the version of this {@link TemplateRefByScenarioNameVersion} instance. + * + * @param version Version of the template + */ + public void setVersion(@Nonnull final String version) { + this.version = version; + } + + /** + * Get the names of the unrecognizable properties of the {@link TemplateRefByScenarioNameVersion}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TemplateRefByScenarioNameVersion} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "TemplateRefByScenarioNameVersion has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TemplateRefByScenarioNameVersion} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (scenario != null) declaredFields.put("scenario", scenario); + if (name != null) declaredFields.put("name", name); + if (version != null) declaredFields.put("version", version); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TemplateRefByScenarioNameVersion} instance. If + * the map previously contained a mapping for the key, the old value is replaced by the specified + * value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final TemplateRefByScenarioNameVersion templateRefByScenarioNameVersion = + (TemplateRefByScenarioNameVersion) o; + return Objects.equals( + this.cloudSdkCustomFields, templateRefByScenarioNameVersion.cloudSdkCustomFields) + && Objects.equals(this.scenario, templateRefByScenarioNameVersion.scenario) + && Objects.equals(this.name, templateRefByScenarioNameVersion.name) + && Objects.equals(this.version, templateRefByScenarioNameVersion.version); + } + + @Override + public int hashCode() { + return Objects.hash(scenario, name, version, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class TemplateRefByScenarioNameVersion {\n"); + sb.append(" scenario: ").append(toIndentedString(scenario)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * TemplateRefByScenarioNameVersion} instance with all required arguments. + */ + public static Builder create() { + return (scenario) -> + (name) -> + (version) -> + new TemplateRefByScenarioNameVersion() + .scenario(scenario) + .name(name) + .version(version); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the scenario of this {@link TemplateRefByScenarioNameVersion} instance. + * + * @param scenario Scenario name + * @return The TemplateRefByScenarioNameVersion builder. + */ + Builder1 scenario(@Nonnull final String scenario); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the name of this {@link TemplateRefByScenarioNameVersion} instance. + * + * @param name Name of the template + * @return The TemplateRefByScenarioNameVersion builder. + */ + Builder2 name(@Nonnull final String name); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the version of this {@link TemplateRefByScenarioNameVersion} instance. + * + * @param version Version of the template + * @return The TemplateRefByScenarioNameVersion instance. + */ + TemplateRefByScenarioNameVersion version(@Nonnull final String version); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRefTemplateRef.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRefTemplateRef.java new file mode 100644 index 000000000..1b1403b8b --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateRefTemplateRef.java @@ -0,0 +1,23 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** Reference to a template in the prompt registry by ID or by scenario, name and version */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = TemplateRefByID.class), + @JsonSubTypes.Type(value = TemplateRefByScenarioNameVersion.class), +}) +public interface TemplateRefTemplateRef {} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateResponseFormat.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateResponseFormat.java new file mode 100644 index 000000000..c561bac7a --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TemplateResponseFormat.java @@ -0,0 +1,27 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** + * Response format that the model output should adhere to. This is the same as the OpenAI + * definition. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = ResponseFormatJsonObject.class), + @JsonSubTypes.Type(value = ResponseFormatJsonSchema.class), + @JsonSubTypes.Type(value = ResponseFormatText.class), +}) +public interface TemplateResponseFormat {} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ToolChatMessage.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ToolChatMessage.java new file mode 100644 index 000000000..32f435e05 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/ToolChatMessage.java @@ -0,0 +1,338 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** ToolChatMessage */ +// CHECKSTYLE:OFF +public class ToolChatMessage implements ChatMessage +// CHECKSTYLE:ON +{ + /** Gets or Sets role */ + public enum RoleEnum { + /** The TOOL option of this ToolChatMessage */ + TOOL("tool"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this ToolChatMessage */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + RoleEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type ToolChatMessage + */ + @JsonCreator + @Nonnull + public static RoleEnum fromValue(@Nonnull final String value) { + for (RoleEnum b : RoleEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("role") + private RoleEnum role; + + @JsonProperty("tool_call_id") + private String toolCallId; + + @JsonProperty("content") + private ChatMessageContent content; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ToolChatMessage. */ + protected ToolChatMessage() {} + + /** + * Set the role of this {@link ToolChatMessage} instance and return the same instance. + * + * @param role The role of this {@link ToolChatMessage} + * @return The same instance of this {@link ToolChatMessage} class + */ + @Nonnull + public ToolChatMessage role(@Nonnull final RoleEnum role) { + this.role = role; + return this; + } + + /** + * Get role + * + * @return role The role of this {@link ToolChatMessage} instance. + */ + @Nonnull + public RoleEnum getRole() { + return role; + } + + /** + * Set the role of this {@link ToolChatMessage} instance. + * + * @param role The role of this {@link ToolChatMessage} + */ + public void setRole(@Nonnull final RoleEnum role) { + this.role = role; + } + + /** + * Set the toolCallId of this {@link ToolChatMessage} instance and return the same instance. + * + * @param toolCallId The toolCallId of this {@link ToolChatMessage} + * @return The same instance of this {@link ToolChatMessage} class + */ + @Nonnull + public ToolChatMessage toolCallId(@Nonnull final String toolCallId) { + this.toolCallId = toolCallId; + return this; + } + + /** + * Get toolCallId + * + * @return toolCallId The toolCallId of this {@link ToolChatMessage} instance. + */ + @Nonnull + public String getToolCallId() { + return toolCallId; + } + + /** + * Set the toolCallId of this {@link ToolChatMessage} instance. + * + * @param toolCallId The toolCallId of this {@link ToolChatMessage} + */ + public void setToolCallId(@Nonnull final String toolCallId) { + this.toolCallId = toolCallId; + } + + /** + * Set the content of this {@link ToolChatMessage} instance and return the same instance. + * + * @param content The content of this {@link ToolChatMessage} + * @return The same instance of this {@link ToolChatMessage} class + */ + @Nonnull + public ToolChatMessage content(@Nonnull final ChatMessageContent content) { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link ToolChatMessage} instance. + */ + @Nonnull + public ChatMessageContent getContent() { + return content; + } + + /** + * Set the content of this {@link ToolChatMessage} instance. + * + * @param content The content of this {@link ToolChatMessage} + */ + public void setContent(@Nonnull final ChatMessageContent content) { + this.content = content; + } + + /** + * Get the names of the unrecognizable properties of the {@link ToolChatMessage}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ToolChatMessage} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("ToolChatMessage has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ToolChatMessage} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (role != null) declaredFields.put("role", role); + if (toolCallId != null) declaredFields.put("toolCallId", toolCallId); + if (content != null) declaredFields.put("content", content); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ToolChatMessage} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final ToolChatMessage toolChatMessage = (ToolChatMessage) o; + return Objects.equals(this.cloudSdkCustomFields, toolChatMessage.cloudSdkCustomFields) + && Objects.equals(this.role, toolChatMessage.role) + && Objects.equals(this.toolCallId, toolChatMessage.toolCallId) + && Objects.equals(this.content, toolChatMessage.content); + } + + @Override + public int hashCode() { + return Objects.hash(role, toolCallId, content, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ToolChatMessage {\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" toolCallId: ").append(toIndentedString(toolCallId)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link ToolChatMessage} + * instance with all required arguments. + */ + public static Builder create() { + return (role) -> + (toolCallId) -> + (content) -> new ToolChatMessage().role(role).toolCallId(toolCallId).content(content); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the role of this {@link ToolChatMessage} instance. + * + * @param role The role of this {@link ToolChatMessage} + * @return The ToolChatMessage builder. + */ + Builder1 role(@Nonnull final RoleEnum role); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the toolCallId of this {@link ToolChatMessage} instance. + * + * @param toolCallId The toolCallId of this {@link ToolChatMessage} + * @return The ToolChatMessage builder. + */ + Builder2 toolCallId(@Nonnull final String toolCallId); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the content of this {@link ToolChatMessage} instance. + * + * @param content The content of this {@link ToolChatMessage} + * @return The ToolChatMessage instance. + */ + ToolChatMessage content(@Nonnull final ChatMessageContent content); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TranslationModuleConfig.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TranslationModuleConfig.java new file mode 100644 index 000000000..fd9c0a9ed --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/TranslationModuleConfig.java @@ -0,0 +1,208 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** Configuration for translation module */ +// CHECKSTYLE:OFF +public class TranslationModuleConfig +// CHECKSTYLE:ON +{ + @JsonProperty("input") + private SAPDocumentTranslation input; + + @JsonProperty("output") + private SAPDocumentTranslation output; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for TranslationModuleConfig. */ + protected TranslationModuleConfig() {} + + /** + * Set the input of this {@link TranslationModuleConfig} instance and return the same instance. + * + * @param input The input of this {@link TranslationModuleConfig} + * @return The same instance of this {@link TranslationModuleConfig} class + */ + @Nonnull + public TranslationModuleConfig input(@Nullable final SAPDocumentTranslation input) { + this.input = input; + return this; + } + + /** + * Get input + * + * @return input The input of this {@link TranslationModuleConfig} instance. + */ + @Nonnull + public SAPDocumentTranslation getInput() { + return input; + } + + /** + * Set the input of this {@link TranslationModuleConfig} instance. + * + * @param input The input of this {@link TranslationModuleConfig} + */ + public void setInput(@Nullable final SAPDocumentTranslation input) { + this.input = input; + } + + /** + * Set the output of this {@link TranslationModuleConfig} instance and return the same instance. + * + * @param output The output of this {@link TranslationModuleConfig} + * @return The same instance of this {@link TranslationModuleConfig} class + */ + @Nonnull + public TranslationModuleConfig output(@Nullable final SAPDocumentTranslation output) { + this.output = output; + return this; + } + + /** + * Get output + * + * @return output The output of this {@link TranslationModuleConfig} instance. + */ + @Nonnull + public SAPDocumentTranslation getOutput() { + return output; + } + + /** + * Set the output of this {@link TranslationModuleConfig} instance. + * + * @param output The output of this {@link TranslationModuleConfig} + */ + public void setOutput(@Nullable final SAPDocumentTranslation output) { + this.output = output; + } + + /** + * Get the names of the unrecognizable properties of the {@link TranslationModuleConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TranslationModuleConfig} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "TranslationModuleConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TranslationModuleConfig} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (input != null) declaredFields.put("input", input); + if (output != null) declaredFields.put("output", output); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TranslationModuleConfig} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final TranslationModuleConfig translationModuleConfig = (TranslationModuleConfig) o; + return Objects.equals(this.cloudSdkCustomFields, translationModuleConfig.cloudSdkCustomFields) + && Objects.equals(this.input, translationModuleConfig.input) + && Objects.equals(this.output, translationModuleConfig.output); + } + + @Override + public int hashCode() { + return Objects.hash(input, output, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class TranslationModuleConfig {\n"); + sb.append(" input: ").append(toIndentedString(input)).append("\n"); + sb.append(" output: ").append(toIndentedString(output)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link TranslationModuleConfig} instance. No arguments are required. */ + public static TranslationModuleConfig create() { + return new TranslationModuleConfig(); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessage.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessage.java new file mode 100644 index 000000000..3011a85d4 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessage.java @@ -0,0 +1,288 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** UserChatMessage */ +// CHECKSTYLE:OFF +public class UserChatMessage implements ChatMessage +// CHECKSTYLE:ON +{ + @JsonProperty("content") + private UserChatMessageContent content; + + /** Gets or Sets role */ + public enum RoleEnum { + /** The USER option of this UserChatMessage */ + USER("user"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this UserChatMessage */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + RoleEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type UserChatMessage + */ + @JsonCreator + @Nonnull + public static RoleEnum fromValue(@Nonnull final String value) { + for (RoleEnum b : RoleEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("role") + private RoleEnum role; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for UserChatMessage. */ + protected UserChatMessage() {} + + /** + * Set the content of this {@link UserChatMessage} instance and return the same instance. + * + * @param content The content of this {@link UserChatMessage} + * @return The same instance of this {@link UserChatMessage} class + */ + @Nonnull + public UserChatMessage content(@Nonnull final UserChatMessageContent content) { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link UserChatMessage} instance. + */ + @Nonnull + public UserChatMessageContent getContent() { + return content; + } + + /** + * Set the content of this {@link UserChatMessage} instance. + * + * @param content The content of this {@link UserChatMessage} + */ + public void setContent(@Nonnull final UserChatMessageContent content) { + this.content = content; + } + + /** + * Set the role of this {@link UserChatMessage} instance and return the same instance. + * + * @param role The role of this {@link UserChatMessage} + * @return The same instance of this {@link UserChatMessage} class + */ + @Nonnull + public UserChatMessage role(@Nonnull final RoleEnum role) { + this.role = role; + return this; + } + + /** + * Get role + * + * @return role The role of this {@link UserChatMessage} instance. + */ + @Nonnull + public RoleEnum getRole() { + return role; + } + + /** + * Set the role of this {@link UserChatMessage} instance. + * + * @param role The role of this {@link UserChatMessage} + */ + public void setRole(@Nonnull final RoleEnum role) { + this.role = role; + } + + /** + * Get the names of the unrecognizable properties of the {@link UserChatMessage}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link UserChatMessage} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("UserChatMessage has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link UserChatMessage} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (content != null) declaredFields.put("content", content); + if (role != null) declaredFields.put("role", role); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link UserChatMessage} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final UserChatMessage userChatMessage = (UserChatMessage) o; + return Objects.equals(this.cloudSdkCustomFields, userChatMessage.cloudSdkCustomFields) + && Objects.equals(this.content, userChatMessage.content) + && Objects.equals(this.role, userChatMessage.role); + } + + @Override + public int hashCode() { + return Objects.hash(content, role, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class UserChatMessage {\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link UserChatMessage} + * instance with all required arguments. + */ + public static Builder create() { + return (content) -> (role) -> new UserChatMessage().content(content).role(role); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the content of this {@link UserChatMessage} instance. + * + * @param content The content of this {@link UserChatMessage} + * @return The UserChatMessage builder. + */ + Builder1 content(@Nonnull final UserChatMessageContent content); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the role of this {@link UserChatMessage} instance. + * + * @param role The role of this {@link UserChatMessage} + * @return The UserChatMessage instance. + */ + UserChatMessage role(@Nonnull final RoleEnum role); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContent.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContent.java new file mode 100644 index 000000000..7bf1eeca3 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContent.java @@ -0,0 +1,55 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import java.util.List; +import javax.annotation.Nonnull; + +/** UserChatMessageContent */ +public interface UserChatMessageContent { + /** Helper class to create a String that implements {@link UserChatMessageContent}. */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) + implements UserChatMessageContent {} + + /** + * Creator to enable deserialization of a String. + * + * @param val the value to use + * @return a new instance of {@link InnerString}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerString create(@Nonnull final String val) { + return new InnerString(val); + } + + /** + * Helper class to create a list of UserChatMessageContentItem that implements {@link + * UserChatMessageContent}. + */ + record InnerUserChatMessageContentItems( + @com.fasterxml.jackson.annotation.JsonValue @Nonnull List values) + implements UserChatMessageContent {} + + /** + * Creator to enable deserialization of a list of UserChatMessageContentItem. + * + * @param val the value to use + * @return a new instance of {@link InnerUserChatMessageContentItems}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerUserChatMessageContentItems create( + @Nonnull final List val) { + return new InnerUserChatMessageContentItems(val); + } +} diff --git a/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContentItem.java b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContentItem.java new file mode 100644 index 000000000..0890aa675 --- /dev/null +++ b/core-services/prompt-registry/src/main/java/com/sap/ai/sdk/prompt/registry/model/UserChatMessageContentItem.java @@ -0,0 +1,321 @@ +/* + * Prompt Registry API + * Prompt Storage service for Design time & Runtime prompt templates. + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +package com.sap.ai.sdk.prompt.registry.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** UserChatMessageContentItem */ +// CHECKSTYLE:OFF +public class UserChatMessageContentItem +// CHECKSTYLE:ON +{ + /** Gets or Sets type */ + public enum TypeEnum { + /** The TEXT option of this UserChatMessageContentItem */ + TEXT("text"), + + /** The IMAGE_URL option of this UserChatMessageContentItem */ + IMAGE_URL("image_url"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this UserChatMessageContentItem */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + TypeEnum(String value) { + this.value = value; + } + + /** + * Get the value of the enum + * + * @return The enum value + */ + @JsonValue + @Nonnull + public String getValue() { + return value; + } + + /** + * Get the String value of the enum value. + * + * @return The enum value as String + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Get the enum value from a String value + * + * @param value The String value + * @return The enum value of type UserChatMessageContentItem + */ + @JsonCreator + @Nonnull + public static TypeEnum fromValue(@Nonnull final String value) { + for (TypeEnum b : TypeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("type") + private TypeEnum type; + + @JsonProperty("text") + private String text; + + @JsonProperty("image_url") + private ImageContentUrl imageUrl; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for UserChatMessageContentItem. */ + protected UserChatMessageContentItem() {} + + /** + * Set the type of this {@link UserChatMessageContentItem} instance and return the same instance. + * + * @param type The type of this {@link UserChatMessageContentItem} + * @return The same instance of this {@link UserChatMessageContentItem} class + */ + @Nonnull + public UserChatMessageContentItem type(@Nonnull final TypeEnum type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link UserChatMessageContentItem} instance. + */ + @Nonnull + public TypeEnum getType() { + return type; + } + + /** + * Set the type of this {@link UserChatMessageContentItem} instance. + * + * @param type The type of this {@link UserChatMessageContentItem} + */ + public void setType(@Nonnull final TypeEnum type) { + this.type = type; + } + + /** + * Set the text of this {@link UserChatMessageContentItem} instance and return the same instance. + * + * @param text The text of this {@link UserChatMessageContentItem} + * @return The same instance of this {@link UserChatMessageContentItem} class + */ + @Nonnull + public UserChatMessageContentItem text(@Nullable final String text) { + this.text = text; + return this; + } + + /** + * Get text + * + * @return text The text of this {@link UserChatMessageContentItem} instance. + */ + @Nonnull + public String getText() { + return text; + } + + /** + * Set the text of this {@link UserChatMessageContentItem} instance. + * + * @param text The text of this {@link UserChatMessageContentItem} + */ + public void setText(@Nullable final String text) { + this.text = text; + } + + /** + * Set the imageUrl of this {@link UserChatMessageContentItem} instance and return the same + * instance. + * + * @param imageUrl The imageUrl of this {@link UserChatMessageContentItem} + * @return The same instance of this {@link UserChatMessageContentItem} class + */ + @Nonnull + public UserChatMessageContentItem imageUrl(@Nullable final ImageContentUrl imageUrl) { + this.imageUrl = imageUrl; + return this; + } + + /** + * Get imageUrl + * + * @return imageUrl The imageUrl of this {@link UserChatMessageContentItem} instance. + */ + @Nonnull + public ImageContentUrl getImageUrl() { + return imageUrl; + } + + /** + * Set the imageUrl of this {@link UserChatMessageContentItem} instance. + * + * @param imageUrl The imageUrl of this {@link UserChatMessageContentItem} + */ + public void setImageUrl(@Nullable final ImageContentUrl imageUrl) { + this.imageUrl = imageUrl; + } + + /** + * Get the names of the unrecognizable properties of the {@link UserChatMessageContentItem}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link UserChatMessageContentItem} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "UserChatMessageContentItem has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link UserChatMessageContentItem} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (type != null) declaredFields.put("type", type); + if (text != null) declaredFields.put("text", text); + if (imageUrl != null) declaredFields.put("imageUrl", imageUrl); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link UserChatMessageContentItem} instance. If the map + * previously contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final UserChatMessageContentItem userChatMessageContentItem = (UserChatMessageContentItem) o; + return Objects.equals( + this.cloudSdkCustomFields, userChatMessageContentItem.cloudSdkCustomFields) + && Objects.equals(this.type, userChatMessageContentItem.type) + && Objects.equals(this.text, userChatMessageContentItem.text) + && Objects.equals(this.imageUrl, userChatMessageContentItem.imageUrl); + } + + @Override + public int hashCode() { + return Objects.hash(type, text, imageUrl, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class UserChatMessageContentItem {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" imageUrl: ").append(toIndentedString(imageUrl)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * UserChatMessageContentItem} instance with all required arguments. + */ + public static Builder create() { + return (type) -> new UserChatMessageContentItem().type(type); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link UserChatMessageContentItem} instance. + * + * @param type The type of this {@link UserChatMessageContentItem} + * @return The UserChatMessageContentItem instance. + */ + UserChatMessageContentItem type(@Nonnull final TypeEnum type); + } +} diff --git a/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml b/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml index b511b8fbf..d5c173e72 100644 --- a/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml +++ b/core-services/prompt-registry/src/main/resources/spec/prompt-registry.yaml @@ -1,16 +1,13 @@ openapi: 3.0.0 - info: version: 0.0.1 title: Prompt Registry API description: Prompt Storage service for Design time & Runtime prompt templates. - tags: - name: prompt templates description: Tag for prompt templates operations - name: orchestration configs description: Tag for orchestration configs operations - paths: /lm/promptTemplates: post: @@ -20,26 +17,27 @@ paths: tags: - prompt templates parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/PromptTemplatePostRequest" + $ref: '#/components/schemas/PromptTemplatePostRequest' responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/PromptTemplatePostResponse" - 403: - $ref: "#/components/responses/ForbiddenError" - 400: - $ref: "#/components/responses/BadRequest" + $ref: '#/components/schemas/PromptTemplatePostResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' default: - $ref: "#/components/responses/CommonError" + $ref: '#/components/responses/CommonError' get: operationId: registry.controller.prompt_controller.list_prompt_templates x-sap-cloud-sdk-operation-name: listPromptTemplates @@ -47,7 +45,8 @@ paths: tags: - prompt templates parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' - name: scenario in: query schema: @@ -71,18 +70,18 @@ paths: type: boolean default: false responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/PromptTemplateListResponse" - 400: - $ref: "#/components/responses/BadRequest" - 403: - $ref: "#/components/responses/ForbiddenError" + $ref: '#/components/schemas/PromptTemplateListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' default: - $ref: "#/components/responses/CommonError" + $ref: '#/components/responses/CommonError' /lm/scenarios/{scenario}/promptTemplates/{name}/versions/{version}/history: get: operationId: registry.controller.prompt_controller.list_prompt_template_history @@ -91,7 +90,8 @@ paths: tags: - prompt templates parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' - name: scenario in: path required: true @@ -108,18 +108,18 @@ paths: schema: type: string responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/PromptTemplateListResponse" - 400: - $ref: "#/components/responses/BadRequest" - 403: - $ref: "#/components/responses/ForbiddenError" + $ref: '#/components/schemas/PromptTemplateListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' default: - $ref: "#/components/responses/CommonError" + $ref: '#/components/responses/CommonError' /lm/promptTemplates/{promptTemplateId}: get: operationId: registry.controller.prompt_controller.get_prompt_template_by_uuid @@ -128,7 +128,8 @@ paths: tags: - prompt templates parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' - name: promptTemplateId in: path required: true @@ -136,18 +137,18 @@ paths: type: string format: uuid responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/PromptTemplateGetResponse" - 400: - $ref: "#/components/responses/BadRequest" - 403: - $ref: "#/components/responses/ForbiddenError" + $ref: '#/components/schemas/PromptTemplateGetResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' default: - $ref: "#/components/responses/CommonError" + $ref: '#/components/responses/CommonError' delete: operationId: registry.controller.prompt_controller.delete_prompt_template x-sap-cloud-sdk-operation-name: deletePromptTemplate @@ -155,7 +156,8 @@ paths: tags: - prompt templates parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' - name: promptTemplateId in: path required: true @@ -163,18 +165,18 @@ paths: type: string format: uuid responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/PromptTemplateDeleteResponse" - 404: - $ref: "#/components/responses/NotFound" - 403: - $ref: "#/components/responses/ForbiddenError" + $ref: '#/components/schemas/PromptTemplateDeleteResponse' + '403': + $ref: '#/components/responses/ForbiddenError' + '404': + $ref: '#/components/responses/NotFound' default: - $ref: "#/components/responses/CommonError" + $ref: '#/components/responses/CommonError' /lm/promptTemplates/import: post: operationId: registry.controller.prompt_controller.import_prompt_template @@ -183,7 +185,8 @@ paths: tags: - prompt templates parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' requestBody: content: multipart/form-data: @@ -194,16 +197,16 @@ paths: type: string format: binary responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/PromptTemplatePostResponse" - 400: - $ref: "#/components/responses/BadRequest" + $ref: '#/components/schemas/PromptTemplatePostResponse' + '400': + $ref: '#/components/responses/BadRequest' default: - $ref: "#/components/responses/CommonError" + $ref: '#/components/responses/CommonError' /lm/promptTemplates/{promptTemplateId}/export: get: operationId: registry.controller.prompt_controller.export_prompt_template @@ -212,7 +215,8 @@ paths: tags: - prompt templates parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' - name: promptTemplateId in: path required: true @@ -220,17 +224,17 @@ paths: type: string format: uuid responses: - 200: + '200': description: Successful response content: application/octet-stream: schema: type: string format: binary - 400: - $ref: "#/components/responses/BadRequest" + '400': + $ref: '#/components/responses/BadRequest' default: - $ref: "#/components/responses/CommonError" + $ref: '#/components/responses/CommonError' /lm/promptTemplates/{promptTemplateId}/substitution: post: operationId: registry.controller.prompt_controller.parse_prompt_template_by_id @@ -239,7 +243,8 @@ paths: tags: - prompt templates parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' - name: promptTemplateId in: path required: true @@ -255,20 +260,20 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PromptTemplateSubstitutionRequest" + $ref: '#/components/schemas/PromptTemplateSubstitutionRequest' responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/PromptTemplateSubstitutionResponse" - 400: - $ref: "#/components/responses/BadRequest" - 403: - $ref: "#/components/responses/ForbiddenError" + $ref: '#/components/schemas/PromptTemplateSubstitutionResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' default: - $ref: "#/components/responses/CommonError" + $ref: '#/components/responses/CommonError' /lm/scenarios/{scenario}/promptTemplates/{name}/versions/{version}/substitution: post: operationId: registry.controller.prompt_controller.parse_prompt_template_by_name_version @@ -277,7 +282,8 @@ paths: tags: - prompt templates parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' + - $ref: '#/components/parameters/ai-resource-group-scope' - name: scenario in: path required: true @@ -302,21 +308,21 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/PromptTemplateSubstitutionRequest" + $ref: '#/components/schemas/PromptTemplateSubstitutionRequest' responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/PromptTemplateSubstitutionResponse" - 400: - $ref: "#/components/responses/BadRequest" - 403: - $ref: "#/components/responses/ForbiddenError" + $ref: '#/components/schemas/PromptTemplateSubstitutionResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' default: - $ref: "#/components/responses/CommonError" - /lm/orchestrationConfigs: + $ref: '#/components/responses/CommonError' + /registry/v2/orchestrationConfigs: post: operationId: registry.controller.orchestration_config_controller.create_update_orchestration_config x-sap-cloud-sdk-operation-name: createUpdateOrchestrationConfig @@ -324,26 +330,26 @@ paths: tags: - orchestration configs parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/OrchestrationConfigPostRequest" + $ref: '#/components/schemas/OrchestrationConfigPostRequest' responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/OrchestrationConfigPostResponse" - 403: - $ref: "#/components/responses/ForbiddenError" - 400: - $ref: "#/components/responses/BadRequest" + $ref: '#/components/schemas/OrchestrationConfigPostResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' default: - $ref: "#/components/responses/CommonError" + $ref: '#/components/responses/CommonError' get: operationId: registry.controller.orchestration_config_controller.list_orchestration_configs x-sap-cloud-sdk-operation-name: listOrchestrationConfigs @@ -351,7 +357,7 @@ paths: tags: - orchestration configs parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' - name: scenario in: query schema: @@ -388,19 +394,19 @@ paths: type: boolean default: false responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/OrchestrationConfigListResponse" - 400: - $ref: "#/components/responses/BadRequest" - 403: - $ref: "#/components/responses/ForbiddenError" + $ref: '#/components/schemas/OrchestrationConfigListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' default: - $ref: "#/components/responses/CommonError" - /lm/scenarios/{scenario}/orchestrationConfigs/{name}/versions/{version}/models/{model_name}/history: + $ref: '#/components/responses/CommonError' + /registry/v2/scenarios/{scenario}/orchestrationConfigs/{name}/versions/{version}/models/{model_name}/history: get: operationId: registry.controller.orchestration_config_controller.list_orchestration_config_history x-sap-cloud-sdk-operation-name: listOrchestrationConfigHistory @@ -408,7 +414,7 @@ paths: tags: - orchestration configs parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' - name: scenario in: path required: true @@ -440,19 +446,19 @@ paths: type: boolean default: false responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/OrchestrationConfigListResponse" - 400: - $ref: "#/components/responses/BadRequest" - 403: - $ref: "#/components/responses/ForbiddenError" + $ref: '#/components/schemas/OrchestrationConfigListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' default: - $ref: "#/components/responses/CommonError" - /lm/orchestrationConfigs/{orchestrationConfigId}: + $ref: '#/components/responses/CommonError' + /registry/v2/orchestrationConfigs/{orchestrationConfigId}: get: operationId: registry.controller.orchestration_config_controller.get_orchestration_config_by_uuid x-sap-cloud-sdk-operation-name: getOrchestrationConfigByUuid @@ -460,7 +466,7 @@ paths: tags: - orchestration configs parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' - name: orchestrationConfigId in: path required: true @@ -473,18 +479,18 @@ paths: type: boolean default: false responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/OrchestrationConfigGetResponse" - 400: - $ref: "#/components/responses/BadRequest" - 403: - $ref: "#/components/responses/ForbiddenError" + $ref: '#/components/schemas/OrchestrationConfigGetResponse' + '400': + $ref: '#/components/responses/BadRequest' + '403': + $ref: '#/components/responses/ForbiddenError' default: - $ref: "#/components/responses/CommonError" + $ref: '#/components/responses/CommonError' delete: operationId: registry.controller.orchestration_config_controller.delete_orchestration_config x-sap-cloud-sdk-operation-name: deleteOrchestrationConfig @@ -492,7 +498,7 @@ paths: tags: - orchestration configs parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' - name: orchestrationConfigId in: path required: true @@ -500,19 +506,19 @@ paths: type: string format: uuid responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/OrchestrationConfigDeleteResponse" - 404: - $ref: "#/components/responses/NotFound" - 403: - $ref: "#/components/responses/ForbiddenError" + $ref: '#/components/schemas/OrchestrationConfigDeleteResponse' + '403': + $ref: '#/components/responses/ForbiddenError' + '404': + $ref: '#/components/responses/NotFound' default: - $ref: "#/components/responses/CommonError" - /lm/orchestrationConfigs/import: + $ref: '#/components/responses/CommonError' + /registry/v2/orchestrationConfigs/import: post: operationId: registry.controller.orchestration_config_controller.import_orchestration_config x-sap-cloud-sdk-operation-name: importOrchestrationConfig @@ -520,7 +526,7 @@ paths: tags: - orchestration configs parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' requestBody: content: multipart/form-data: @@ -531,17 +537,17 @@ paths: type: string format: binary responses: - 200: + '200': description: Successful response content: application/json: schema: - $ref: "#/components/schemas/OrchestrationConfigPostResponse" - 400: - $ref: "#/components/responses/BadRequest" + $ref: '#/components/schemas/OrchestrationConfigPostResponse' + '400': + $ref: '#/components/responses/BadRequest' default: - $ref: "#/components/responses/CommonError" - /lm/orchestrationConfigs/{orchestrationConfigId}/export: + $ref: '#/components/responses/CommonError' + /registry/v2/orchestrationConfigs/{orchestrationConfigId}/export: get: operationId: registry.controller.orchestration_config_controller.export_orchestration_config x-sap-cloud-sdk-operation-name: exportOrchestrationConfig @@ -549,7 +555,7 @@ paths: tags: - orchestration configs parameters: - - $ref: "#/components/parameters/ai-resource-group" + - $ref: '#/components/parameters/ai-resource-group' - name: orchestrationConfigId in: path required: true @@ -557,24 +563,23 @@ paths: type: string format: uuid responses: - 200: + '200': description: Successful response content: application/octet-stream: schema: type: string format: binary - 400: - $ref: "#/components/responses/BadRequest" + '400': + $ref: '#/components/responses/BadRequest' default: - $ref: "#/components/responses/CommonError" - + $ref: '#/components/responses/CommonError' components: schemas: PromptTemplate: oneOf: - - $ref: "#/components/schemas/SingleChatTemplate" - - $ref: "#/components/schemas/MultiChatTemplate" + - $ref: '#/components/schemas/SingleChatTemplate' + - $ref: '#/components/schemas/MultiChatTemplate' SingleChatTemplate: type: object required: @@ -598,11 +603,11 @@ components: content: type: array items: - $ref: "#/components/schemas/MultiChatContent" + $ref: '#/components/schemas/MultiChatContent' MultiChatContent: oneOf: - - $ref: "#/components/schemas/ImageContent" - - $ref: "#/components/schemas/TextContent" + - $ref: '#/components/schemas/ImageContent' + - $ref: '#/components/schemas/TextContent' TextContent: type: object required: @@ -612,7 +617,8 @@ components: properties: type: type: string - enum: ["text"] + enum: + - text text: type: string ImageContent: @@ -623,7 +629,8 @@ components: properties: type: type: string - enum: ["image_url"] + enum: + - image_url image_url: type: object required: @@ -634,7 +641,7 @@ components: type: string detail: type: string - default: "auto" + default: auto PromptTemplateSpec: type: object required: @@ -645,40 +652,35 @@ components: template: type: array items: - $ref: "#/components/schemas/PromptTemplate" + $ref: '#/components/schemas/PromptTemplate' defaults: type: object additionalFields: type: object - description: > + description: | DEPRECATED. Please use additional_fields instead. deprecated: true response_format: - description: > - Response format that the model output should adhere to. - This is the same as the OpenAI definition. - + description: | + Response format that the model output should adhere to. This is the same as the OpenAI definition. Compatible with GPT-4o, GPT-4o mini, GPT-4 (Turbo) and all GPT-3.5 Turbo models newer than gpt-3.5-turbo-1106. oneOf: - - $ref: "#/components/schemas/ResponseFormatText" - - $ref: "#/components/schemas/ResponseFormatJsonObject" - - $ref: "#/components/schemas/ResponseFormatJsonSchema" + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/ResponseFormatJsonObject' + - $ref: '#/components/schemas/ResponseFormatJsonSchema' tools: type: array - description: > - A list of tools the model may call. Used to provide a list of functions the model may generate JSON inputs for. - This is the same as the OpenAI definition. + description: | + A list of tools the model may call. Used to provide a list of functions the model may generate JSON inputs for. This is the same as the OpenAI definition. items: - $ref: "#/components/schemas/ChatCompletionTool" - - # below ReponseFormats are copied from openapi spec: https://github.com/openai/openai-openapi/blob/e0cb2d721753e13e69e918465795d6e9f87ab15a/openapi.yaml#L12286 + $ref: '#/components/schemas/ChatCompletionTool' ResponseFormatText: type: object additionalProperties: false properties: type: type: string - description: "The type of response format being defined: `text`" + description: 'The type of response format being defined: `text`' enum: - text required: @@ -689,7 +691,7 @@ components: properties: type: type: string - description: "The type of response format being defined: `json_object`" + description: 'The type of response format being defined: `json_object`' enum: - json_object required: @@ -700,7 +702,7 @@ components: properties: type: type: string - description: "The type of response format being defined: `json_schema`" + description: 'The type of response format being defined: `json_schema`' enum: - json_schema json_schema: @@ -709,28 +711,19 @@ components: properties: description: type: string - description: - A description of what the response format is for, used by the model - to determine how to respond in the format. + description: A description of what the response format is for, used by the model to determine how to respond in the format. name: type: string - description: - The name of the response format. Must be a-z, A-Z, 0-9, or contain - underscores and dashes, with a maximum length of 64. - pattern: '^[a-zA-Z0-9-_]+$' + description: The name of the response format. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + pattern: ^[a-zA-Z0-9-_]+$ maxLength: 64 schema: - $ref: "#/components/schemas/ResponseFormatJsonSchemaSchema" + $ref: '#/components/schemas/ResponseFormatJsonSchemaSchema' strict: type: boolean nullable: true default: false - description: - Whether to enable strict schema adherence when generating the - output. If set to true, the model will always follow the exact - schema defined in the `schema` field. Only a subset of JSON - Schema is supported when `strict` is `true`. To learn more, read - the [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). + description: Whether to enable strict schema adherence when generating the output. If set to true, the model will always follow the exact schema defined in the `schema` field. Only a subset of JSON Schema is supported when `strict` is `true`. To learn more, read the [Structured Outputs guide](https://platform.openai.com/docs/guides/structured-outputs). required: - name required: @@ -740,8 +733,6 @@ components: type: object description: The schema for the response format, described as a JSON Schema object. additionalProperties: true - - # below tool-related definitions are copied from openai spec: https://github.com/openai/openai-openapi/blob/e0cb2d721753e13e69e918465795d6e9f87ab15a/openapi.yaml#L11547 ChatCompletionTool: type: object additionalProperties: false @@ -752,7 +743,7 @@ components: - function description: The type of the tool. Currently, only `function` is supported. function: - $ref: "#/components/schemas/FunctionObject" + $ref: '#/components/schemas/FunctionObject' required: - type - function @@ -762,42 +753,25 @@ components: properties: description: type: string - description: - A description of what the function does, used by the model to - choose when and how to call the function. + description: A description of what the function does, used by the model to choose when and how to call the function. name: type: string - description: - The name of the function to be called. Must be a-z, A-Z, 0-9, or - contain underscores and dashes, with a maximum length of 64. - pattern: '^[a-zA-Z0-9-_]+$' + description: The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + pattern: ^[a-zA-Z0-9-_]+$ maxLength: 64 parameters: - $ref: "#/components/schemas/FunctionParameters" + $ref: '#/components/schemas/FunctionParameters' strict: type: boolean nullable: true default: false - description: - Whether to enable strict schema adherence when generating the - function call. If set to true, the model will follow the exact - schema defined in the `parameters` field. Only a subset of JSON - Schema is supported when `strict` is `true`. Learn more about - Structured Outputs in the [function calling - guide](docs/guides/function-calling). + description: Whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the `parameters` field. Only a subset of JSON Schema is supported when `strict` is `true`. Learn more about Structured Outputs in the [function calling guide](docs/guides/function-calling). required: - name FunctionParameters: type: object - description: >- - The parameters the functions accepts, described as a JSON Schema object. - See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the - [JSON Schema - reference](https://json-schema.org/understanding-json-schema/) for - documentation about the format. - Omitting `parameters` defines a function with an empty parameter list. + description: The parameters the functions accepts, described as a JSON Schema object. See the [guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. Omitting `parameters` defines a function with an empty parameter list. additionalProperties: true - PromptTemplatePostRequest: type: object required: @@ -809,17 +783,17 @@ components: name: type: string maxLength: 120 - pattern: "^[a-zA-Z0-9_-]+$" + pattern: ^[a-zA-Z0-9_-]+$ version: type: string maxLength: 10 - pattern: "^[a-zA-Z0-9._-]+$" + pattern: ^[a-zA-Z0-9._-]+$ scenario: type: string maxLength: 120 - pattern: "^[a-zA-Z0-9_-]+$" + pattern: ^[a-zA-Z0-9_-]+$ spec: - $ref: "#/components/schemas/PromptTemplateSpec" + $ref: '#/components/schemas/PromptTemplateSpec' PromptTemplatePostResponse: type: object required: @@ -862,7 +836,7 @@ components: resourceGroupId: type: string spec: - $ref: "#/components/schemas/PromptTemplateSpec" + $ref: '#/components/schemas/PromptTemplateSpec' PromptTemplateListResponse: type: object required: @@ -874,7 +848,7 @@ components: resources: type: array items: - $ref: "#/components/schemas/PromptTemplateGetResponse" + $ref: '#/components/schemas/PromptTemplateGetResponse' PromptTemplateDeleteResponse: type: object required: @@ -899,7 +873,7 @@ components: scenario: type: string spec: - $ref: "#/components/schemas/PromptTemplateSpec" + $ref: '#/components/schemas/PromptTemplateSpec' PromptTemplateSubstitutionRequest: type: object properties: @@ -911,9 +885,9 @@ components: parsedPrompt: type: array items: - $ref: "#/components/schemas/PromptTemplate" + $ref: '#/components/schemas/PromptTemplate' resource: - $ref: "#/components/schemas/PromptTemplateGetResponse" + $ref: '#/components/schemas/PromptTemplateGetResponse' ErrorResponse: type: object required: @@ -946,7 +920,7 @@ components: resource_group_id: type: string spec: - $ref: "llm-orchestration/src/spec/v2.yaml#/components/schemas/OrchestrationConfig" + $ref: '#/components/schemas/OrchestrationConfig' OrchestrationConfigListResponse: type: object required: @@ -958,8 +932,7 @@ components: resources: type: array items: - $ref: "#/components/schemas/OrchestrationConfigGetResponse" - # Orchestration Config Schemas - referencing v2.yaml + $ref: '#/components/schemas/OrchestrationConfigGetResponse' OrchestrationConfigPostRequest: type: object required: @@ -971,17 +944,17 @@ components: name: type: string maxLength: 120 - pattern: "^[a-zA-Z0-9_-]+$" + pattern: ^[a-zA-Z0-9_-]+$ version: type: string maxLength: 10 - pattern: "^[a-zA-Z0-9._-]+$" + pattern: ^[a-zA-Z0-9._-]+$ scenario: type: string maxLength: 120 - pattern: "^[a-zA-Z0-9_-]+$" + pattern: ^[a-zA-Z0-9_-]+$ spec: - $ref: "llm-orchestration/src/spec/v2.yaml#/components/schemas/OrchestrationConfig" + $ref: '#/components/schemas/OrchestrationConfig' OrchestrationConfigPostResponse: type: object required: @@ -1029,7 +1002,7 @@ components: resource_group_id: type: string spec: - $ref: "llm-orchestration/src/spec/v2.yaml#/components/schemas/OrchestrationConfig" + $ref: '#/components/schemas/OrchestrationConfig' OrchestrationConfigDeleteResponse: type: object required: @@ -1054,32 +1027,910 @@ components: scenario: type: string spec: - $ref: "llm-orchestration/src/spec/v2.yaml#/components/schemas/OrchestrationConfig" + $ref: '#/components/schemas/OrchestrationConfig' + ChatMessageContent: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/TextContent' + minItems: 1 + SystemChatMessage: + type: object + additionalProperties: false + properties: + role: + type: string + enum: + - system + content: + $ref: '#/components/schemas/ChatMessageContent' + required: + - role + - content + ImageContentUrl: + type: object + required: + - url + additionalProperties: false + properties: + url: + type: string + detail: + type: string + default: auto + UserChatMessageContentItem: + type: object + additionalProperties: false + properties: + type: + type: string + enum: + - text + - image_url + text: + type: string + image_url: + $ref: '#/components/schemas/ImageContentUrl' + required: + - type + UserChatMessageContent: + oneOf: + - type: string + - type: array + items: + $ref: '#/components/schemas/UserChatMessageContentItem' + minItems: 1 + UserChatMessage: + type: object + additionalProperties: false + properties: + content: + $ref: '#/components/schemas/UserChatMessageContent' + role: + type: string + enum: + - user + required: + - content + - role + MessageToolCall: + type: object + properties: + id: + type: string + description: The ID of the tool call. + type: + type: string + enum: + - function + description: The type of the tool. Currently, only `function` is supported. + function: + type: object + description: The function that the model called. + properties: + name: + type: string + description: The name of the function to call. + arguments: + type: string + description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + required: + - name + - arguments + required: + - id + - type + - function + MessageToolCalls: + type: array + description: The tool calls generated by the model, such as function calls. + items: + $ref: '#/components/schemas/MessageToolCall' + AssistantChatMessage: + type: object + additionalProperties: false + properties: + role: + type: string + enum: + - assistant + content: + $ref: '#/components/schemas/ChatMessageContent' + refusal: + type: string + tool_calls: + $ref: '#/components/schemas/MessageToolCalls' + required: + - role + ToolChatMessage: + type: object + additionalProperties: false + properties: + role: + type: string + enum: + - tool + example: tool + tool_call_id: + type: string + content: + $ref: '#/components/schemas/ChatMessageContent' + required: + - role + - content + - tool_call_id + DeveloperChatMessage: + type: object + additionalProperties: false + properties: + role: + type: string + enum: + - developer + content: + $ref: '#/components/schemas/ChatMessageContent' + required: + - role + - content + ChatMessage: + oneOf: + - $ref: '#/components/schemas/SystemChatMessage' + - $ref: '#/components/schemas/UserChatMessage' + - $ref: '#/components/schemas/AssistantChatMessage' + - $ref: '#/components/schemas/ToolChatMessage' + - $ref: '#/components/schemas/DeveloperChatMessage' + TemplatingChatMessage: + type: array + minItems: 1 + items: + $ref: '#/components/schemas/ChatMessage' + Template: + type: object + required: + - template + additionalProperties: false + properties: + template: + allOf: + - $ref: '#/components/schemas/TemplatingChatMessage' + description: A chat message array to be formatted with values from input_params. Both role and content can be templated. If messages_history is provided, the templated messages will be appended. + defaults: + description: Optional default values for the template. If a parameter has no default it is required. + type: object + additionalProperties: + type: string + response_format: + description: | + Response format that the model output should adhere to. This is the same as the OpenAI definition. + oneOf: + - $ref: '#/components/schemas/ResponseFormatText' + - $ref: '#/components/schemas/ResponseFormatJsonObject' + - $ref: '#/components/schemas/ResponseFormatJsonSchema' + tools: + type: array + description: | + A list of tools the model may call. Used to provide a list of functions the model may generate JSON inputs for. This is the same as the OpenAI definition. + items: + $ref: '#/components/schemas/ChatCompletionTool' + example: + template: + - role: user + content: How can the features of AI in SAP BTP specifically {{'{{?groundingOutput}}'}}, be applied to {{'{{?inputContext}}'}} + defaults: + inputContext: The default text that will be used in the template if inputContext is not set + TemplateRefByID: + type: object + required: + - id + additionalProperties: false + properties: + id: + type: string + description: ID of the template in prompt registry + example: template_id + TemplateRefByScenarioNameVersion: + type: object + required: + - scenario + - name + - version + additionalProperties: false + properties: + scenario: + type: string + description: Scenario name + example: some-scenario + name: + type: string + description: Name of the template + example: some-template-name + version: + type: string + description: Version of the template + example: some version, can be `latest` + TemplateRef: + type: object + required: + - template_ref + additionalProperties: false + properties: + template_ref: + description: Reference to a template in the prompt registry by ID or by scenario, name and version + oneOf: + - $ref: '#/components/schemas/TemplateRefByID' + - $ref: '#/components/schemas/TemplateRefByScenarioNameVersion' + LLMModelDetails: + type: object + description: | + The model and parameters to be used for the prompt templating. This is the model that will be used to generate the response. + required: + - name + additionalProperties: false + properties: + name: + type: string + description: Name of the model as in LLM Access configuration + example: gpt-4o-mini + version: + type: string + description: Version of the model to be used + default: latest + params: + type: object + description: Additional parameters for the model. Default values are used for mandatory parameters. + additionalProperties: true + example: + max_tokens: 300 + temperature: 0.1 + frequency_penalty: 0 + presence_penalty: 0 + 'n': 2 + stream_options: + include_usage: true + timeout: + description: Timeout for the LLM request in seconds. This parameter is currently ignored for Vertex AI models. + type: integer + default: 600 + minimum: 1 + maximum: 600 + max_retries: + description: Maximum number of retries for the LLM request. This parameter is currently ignored for Vertex AI models. + type: integer + default: 2 + minimum: 0 + maximum: 5 + PromptTemplatingModuleConfig: + type: object + required: + - prompt + - model + additionalProperties: false + properties: + prompt: + description: | + The prompt template to be used. Can be either a user defined template or a reference to a template in the prompt registry. + oneOf: + - $ref: '#/components/schemas/Template' + - $ref: '#/components/schemas/TemplateRef' + model: + $ref: '#/components/schemas/LLMModelDetails' + AzureThreshold: + type: integer + enum: + - 0 + - 2 + - 4 + - 6 + example: 0 + AzureContentSafetyInput: + description: Filter configuration for Azure Content Safety + type: object + additionalProperties: false + properties: + hate: + $ref: '#/components/schemas/AzureThreshold' + self_harm: + $ref: '#/components/schemas/AzureThreshold' + sexual: + $ref: '#/components/schemas/AzureThreshold' + violence: + $ref: '#/components/schemas/AzureThreshold' + prompt_shield: + type: boolean + description: A flag to use prompt shield + default: false + AzureContentSafetyInputFilterConfig: + type: object + required: + - type + additionalProperties: false + properties: + type: + description: Name of the filter provider type + type: string + enum: + - azure_content_safety + example: azure_content_safety + config: + $ref: '#/components/schemas/AzureContentSafetyInput' + LlamaGuard38b: + description: Filter configuration for Llama Guard 3 8B + type: object + additionalProperties: false + minProperties: 1 + properties: + violent_crimes: + type: boolean + non_violent_crimes: + type: boolean + sex_crimes: + type: boolean + child_exploitation: + type: boolean + defamation: + type: boolean + specialized_advice: + type: boolean + privacy: + type: boolean + intellectual_property: + type: boolean + indiscriminate_weapons: + type: boolean + hate: + type: boolean + self_harm: + type: boolean + sexual_content: + type: boolean + elections: + type: boolean + code_interpreter_abuse: + type: boolean + LlamaGuard38bFilterConfig: + type: object + required: + - type + - config + additionalProperties: false + properties: + type: + description: Name of the filter provider type + type: string + enum: + - llama_guard_3_8b + example: llama_guard_3_8b + config: + $ref: '#/components/schemas/LlamaGuard38b' + InputFilterConfig: + oneOf: + - $ref: '#/components/schemas/AzureContentSafetyInputFilterConfig' + - $ref: '#/components/schemas/LlamaGuard38bFilterConfig' + InputFilteringConfig: + type: object + required: + - filters + additionalProperties: false + properties: + filters: + description: Configuration for content filtering services that should be used for the given filtering step (input filtering). + type: array + minItems: 1 + items: + $ref: '#/components/schemas/InputFilterConfig' + AzureContentSafetyOutput: + description: Filter configuration for Azure Content Safety + type: object + additionalProperties: false + properties: + hate: + $ref: '#/components/schemas/AzureThreshold' + self_harm: + $ref: '#/components/schemas/AzureThreshold' + sexual: + $ref: '#/components/schemas/AzureThreshold' + violence: + $ref: '#/components/schemas/AzureThreshold' + AzureContentSafetyOutputFilterConfig: + type: object + required: + - type + additionalProperties: false + properties: + type: + description: Name of the filter provider type + type: string + enum: + - azure_content_safety + example: azure_content_safety + config: + $ref: '#/components/schemas/AzureContentSafetyOutput' + OutputFilterConfig: + oneOf: + - $ref: '#/components/schemas/AzureContentSafetyOutputFilterConfig' + - $ref: '#/components/schemas/LlamaGuard38bFilterConfig' + FilteringStreamOptions: + description: Stream options for output filtering. Will be ignored if stream is false. + type: object + additionalProperties: false + properties: + overlap: + type: integer + description: Number of characters that should be additionally sent to content filtering services from previous chunks as additional context. + default: 0 + minimum: 0 + maximum: 10000 + OutputFilteringConfig: + type: object + required: + - filters + additionalProperties: false + properties: + filters: + description: Configuration for content filtering services that should be used for the given filtering step (output filtering). + type: array + minItems: 1 + items: + $ref: '#/components/schemas/OutputFilterConfig' + stream_options: + $ref: '#/components/schemas/FilteringStreamOptions' + FilteringModuleConfig: + type: object + additionalProperties: false + properties: + input: + allOf: + - $ref: '#/components/schemas/InputFilteringConfig' + description: List of provider type and filters + output: + allOf: + - $ref: '#/components/schemas/OutputFilteringConfig' + description: List of provider type and filters + minProperties: 1 + DPIEntities: + description: Default entities supported by data privacy and integration service + type: string + enum: + - profile-person + - profile-org + - profile-university + - profile-location + - profile-email + - profile-phone + - profile-address + - profile-sapids-internal + - profile-sapids-public + - profile-url + - profile-username-password + - profile-nationalid + - profile-iban + - profile-ssn + - profile-credit-card-number + - profile-passport + - profile-driverlicense + - profile-nationality + - profile-religious-group + - profile-political-group + - profile-pronouns-gender + - profile-ethnicity + - profile-gender + - profile-sexual-orientation + - profile-trade-union + - profile-sensitive-data + DPIMethodConstant: + description: Replaces the entity with the specified value followed by an incrementing number + type: object + required: + - method + - value + additionalProperties: false + properties: + method: + type: string + enum: + - constant + value: + description: Value to be used for replacement + example: NAME_REDACTED + type: string + DPIMethodFabricatedData: + description: Replaces the entity with a randomly generated value appropriate to its type. + type: object + required: + - method + additionalProperties: false + properties: + method: + type: string + enum: + - fabricated_data + DPIStandardEntity: + type: object + required: + - type + additionalProperties: false + properties: + type: + $ref: '#/components/schemas/DPIEntities' + replacement_strategy: + description: Replacement strategy to be used for the entity + oneOf: + - $ref: '#/components/schemas/DPIMethodConstant' + - $ref: '#/components/schemas/DPIMethodFabricatedData' + DPICustomEntity: + type: object + required: + - regex + - replacement_strategy + additionalProperties: false + properties: + regex: + description: Regular expression to match the entity + type: string + replacement_strategy: + description: Replacement strategy to be used for the entity + oneOf: + - $ref: '#/components/schemas/DPIMethodConstant' + DPIEntityConfig: + oneOf: + - $ref: '#/components/schemas/DPIStandardEntity' + - $ref: '#/components/schemas/DPICustomEntity' + DPIConfig: + type: object + required: + - type + - method + - entities + additionalProperties: false + properties: + type: + description: Type of masking service provider + type: string + enum: + - sap_data_privacy_integration + method: + description: Type of masking method to be used + type: string + enum: + - anonymization + - pseudonymization + entities: + description: List of entities to be masked + type: array + minItems: 1 + items: + $ref: '#/components/schemas/DPIEntityConfig' + allowlist: + description: List of strings that should not be masked + type: array + example: + - SAP + - Joule + items: + type: string + mask_grounding_input: + type: object + additionalProperties: false + properties: + enabled: + type: boolean + default: false + description: controls whether the input to the grounding module will be masked with the configuration supplied in the masking module + MaskingProviderConfig: + oneOf: + - $ref: '#/components/schemas/DPIConfig' + MaskingModuleConfig: + oneOf: + - type: object + title: MaskingModuleConfigProviders + properties: + providers: + description: List of masking service providers + type: array + minItems: 1 + items: + $ref: '#/components/schemas/MaskingProviderConfig' + required: + - providers + additionalProperties: false + - type: object + title: MaskingModuleConfigMaskingProviders + properties: + masking_providers: + deprecated: true + description: This field is **DEPRECATED** and will be removed on August 05, 2026. Use `providers` property instead. List of masking service providers. + type: array + minItems: 1 + items: + $ref: '#/components/schemas/MaskingProviderConfig' + required: + - masking_providers + additionalProperties: false + GroundingFilterId: + title: Id + description: Identifier of this SearchFilter - unique per request. + type: string + GroundingFilterSearchConfiguration: + additionalProperties: false + properties: + max_chunk_count: + type: integer + minimum: 0 + exclusiveMinimum: true + title: Maxchunkcount + description: Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. + max_document_count: + type: integer + minimum: 0 + exclusiveMinimum: true + title: Maxdocumentcount + description: '[Only supports ''vector'' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with ''maxChunkCount''. If maxDocumentCount is given, then only one chunk per document is returned.' + title: SearchConfiguration + minProperties: 0 + maxProperties: 1 + DataRepositoryType: + type: string + description: Only include DataRepositories with the given type. + enum: + - vector + - help.sap.com + title: DataRepositoryType + KeyValueListPair: + additionalProperties: false + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + type: object + required: + - key + - value + title: KeyValueListPair + SearchSelectOptionEnum: + type: string + enum: + - ignoreIfKeyAbsent + title: SearchSelectOptionEnum + SearchDocumentKeyValueListPair: + additionalProperties: false + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + select_mode: + type: array + items: + $ref: '#/components/schemas/SearchSelectOptionEnum' + title: Selectmode + description: Select mode for search filters + type: object + required: + - key + - value + title: SearchDocumentKeyValueListPair + DocumentGroundingFilter: + type: object + required: + - data_repository_type + additionalProperties: false + properties: + id: + $ref: '#/components/schemas/GroundingFilterId' + search_config: + $ref: '#/components/schemas/GroundingFilterSearchConfiguration' + data_repositories: + type: array + items: + type: string + title: DataRepositories + description: Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids. + default: + - '*' + data_repository_type: + $ref: '#/components/schemas/DataRepositoryType' + data_repository_metadata: + type: array + items: + $ref: '#/components/schemas/KeyValueListPair' + title: Datarepositorymetadata + description: Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*'] + document_metadata: + type: array + items: + $ref: '#/components/schemas/SearchDocumentKeyValueListPair' + title: Documentmetadata + description: Restrict documents considered during search to those annotated with the given metadata. + chunk_metadata: + type: array + items: + $ref: '#/components/schemas/KeyValueListPair' + title: Chunkmetadata + description: Restrict chunks considered during search to those with the given metadata. + minProperties: 1 + GroundingModuleConfig: + type: object + required: + - type + - config + additionalProperties: false + properties: + type: + type: string + anyOf: + - enum: + - document_grounding_service + - {} + example: document_grounding_service + config: + type: object + required: + - placeholders + additionalProperties: false + properties: + filters: + type: array + items: + oneOf: + - $ref: '#/components/schemas/DocumentGroundingFilter' + description: Document grounding service filters to be used + placeholders: + type: object + additionalProperties: false + required: + - input + - output + properties: + input: + type: array + minItems: 1 + items: + type: string + example: groundingInput + description: Contains the input parameters used for grounding input questions + output: + type: string + description: Placeholder name for grounding output + example: groundingOutput + description: Placeholders to be used for grounding input questions and output + metadata_params: + type: array + items: + type: string + description: Parameter name used for specifying metadata parameters + SAPDocumentTranslation: + type: object + required: + - type + - config + additionalProperties: false + properties: + type: + description: Type of document translation provider + type: string + enum: + - sap_document_translation + example: sap_document_translation + config: + description: Configuration for `sap_document_translation` translation provider. + type: object + required: + - target_language + additionalProperties: false + properties: + source_language: + type: string + description: Language of the text to be translated. + example: de-DE + target_language: + type: string + description: Language to which the text should be translated. + example: en-US + TranslationModuleConfig: + type: object + description: Configuration for translation module + additionalProperties: false + properties: + input: + description: Configuration for input translation + oneOf: + - $ref: '#/components/schemas/SAPDocumentTranslation' + output: + description: Configuration for output translation + oneOf: + - $ref: '#/components/schemas/SAPDocumentTranslation' + ModuleConfigs: + type: object + required: + - prompt_templating + additionalProperties: false + properties: + prompt_templating: + $ref: '#/components/schemas/PromptTemplatingModuleConfig' + filtering: + $ref: '#/components/schemas/FilteringModuleConfig' + masking: + $ref: '#/components/schemas/MaskingModuleConfig' + grounding: + $ref: '#/components/schemas/GroundingModuleConfig' + translation: + $ref: '#/components/schemas/TranslationModuleConfig' + GlobalStreamOptions: + description: Options for streaming. Will be ignored if enabled is false. + type: object + additionalProperties: false + properties: + enabled: + type: boolean + description: If true, the response will be streamed back to the client + default: false + chunk_size: + type: integer + description: Minimum number of characters per chunk that post-LLM modules operate on. + default: 100 + minimum: 1 + maximum: 10000 + delimiters: + type: array + minItems: 1 + description: List of delimiters to split the input text into chunks.Please note, this is a required parameter when `input_translation_module_config` or `output_translation_module_config` are configured. + items: + type: string + example: + - |+ + + - . + - '?' + - '!' + OrchestrationConfig: + type: object + required: + - modules + additionalProperties: false + properties: + modules: + $ref: '#/components/schemas/ModuleConfigs' + stream: + $ref: '#/components/schemas/GlobalStreamOptions' responses: BadRequest: description: Bad Request content: application/json: schema: - $ref: "#/components/schemas/ErrorResponse" + $ref: '#/components/schemas/ErrorResponse' CommonError: description: Common Error content: application/json: schema: - $ref: "#/components/schemas/ErrorResponse" + $ref: '#/components/schemas/ErrorResponse' ForbiddenError: description: Forbidden Error content: application/json: schema: - $ref: "#/components/schemas/ErrorResponse" + $ref: '#/components/schemas/ErrorResponse' NotFound: description: Bad Request content: application/json: schema: - $ref: "#/components/schemas/ErrorResponse" + $ref: '#/components/schemas/ErrorResponse' parameters: ai-resource-group: name: AI-Resource-Group @@ -1088,3 +1939,15 @@ components: required: false schema: type: string + ai-resource-group-scope: + name: AI-Resource-Group-Scope + in: header + description: Specify whether the resource group scope is to be used + required: false + schema: + type: string + enum: + - 'true' + - 'True' + - 'false' + - 'False' diff --git a/core-services/prompt-registry/src/test/java/com/sap/ai/sdk/prompt/registry/spring/SpringAiConverterTest.java b/core-services/prompt-registry/src/test/java/com/sap/ai/sdk/prompt/registry/spring/SpringAiConverterTest.java index 07d117f34..de3053bf7 100644 --- a/core-services/prompt-registry/src/test/java/com/sap/ai/sdk/prompt/registry/spring/SpringAiConverterTest.java +++ b/core-services/prompt-registry/src/test/java/com/sap/ai/sdk/prompt/registry/spring/SpringAiConverterTest.java @@ -36,6 +36,7 @@ void testPromptRegistryToSpringAi() { "0.0.1", "java-e2e-test", "default", + null, false, PromptTemplateSubstitutionRequest.create() .inputParams(Map.of("inputExample", "I love football"))); @@ -58,6 +59,7 @@ void testInvalidRoleThrowsException() { "0.0.1", "error", "default", + null, false, PromptTemplateSubstitutionRequest.create() .inputParams(Map.of("inputExample", "I love football"))); diff --git a/docs/release_notes.md b/docs/release_notes.md index 60a92966b..11d727cd8 100644 --- a/docs/release_notes.md +++ b/docs/release_notes.md @@ -8,7 +8,11 @@ ### 🔧 Compatibility Notes -- [Prompt Registry] `Template` has been renamed to `PromptTemplate`. +- [Prompt Registry] breaking changes: + - `Template` has been renamed to `PromptTemplate`. + - Some endpoints have a new parameter `String aiResourceGroupScope` which can be set to `null`. + + For more details please refer to the [sample code](https://github.com/SAP/ai-sdk-java/blob/main/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/PromptRegistryController.java). ### ✨ New Functionality 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 52b4b391f..4018b94bd 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 @@ -82,7 +82,7 @@ PromptTemplateListResponse history() { @GetMapping("/importTemplate") PromptTemplatePostResponse importTemplate() throws IOException { final Resource template = new ClassPathResource("prompt-template.yaml"); - return client.importPromptTemplate("default", template.getFile()); + return client.importPromptTemplate("default", null, template.getFile()); } @GetMapping("/exportTemplate") @@ -97,6 +97,7 @@ PromptTemplateSubstitutionResponse useTemplate() { return client.parsePromptTemplateById( template.getId(), "default", + null, false, PromptTemplateSubstitutionRequest.create() .inputParams(Map.of("inputExample", "I love football"))); @@ -127,6 +128,7 @@ Generation promptRegistryToSpringAi() { "0.0.1", "java-e2e-test", "default", + null, false, PromptTemplateSubstitutionRequest.create() .inputParams(Map.of("inputExample", "I love football")));