From 0ea5f5dcad5fd3eaccb095f5fca96b1d95b2321f Mon Sep 17 00:00:00 2001 From: SAP Cloud SDK Bot Date: Sun, 25 Jan 2026 00:11:04 +0000 Subject: [PATCH] Update document-grounding based on main --- .../ai/sdk/grounding/client/RetrievalApi.java | 36 +- .../ai/sdk/grounding/client/VectorApi.java | 212 ++++ .../ai/sdk/grounding/model/BaseDocument.java | 45 +- .../grounding/model/BinaryBooleanFilter.java | 341 +++++++ .../BoostingScoreComputationStrategy.java | 64 ++ .../model/BoostingScoringConfiguration.java | 319 ++++++ ...tingScoringConfigurationMetadataInner.java | 424 ++++++++ .../model/CollectionPendingResponse.java | 93 +- .../grounding/model/CollectionRequest.java | 2 +- .../sdk/grounding/model/DataRepository.java | 88 +- .../model/DataRepositorySearchResults.java | 14 +- .../grounding/model/DataRepositoryType.java | 6 +- .../model/DataRepositoryWithDocuments.java | 83 +- .../DenseRetrievalScoringConfiguration.java | 217 ++++ .../ai/sdk/grounding/model/DocumentInput.java | 42 +- .../model/DocumentKeyValueListPair.java | 69 +- .../sdk/grounding/model/DocumentResponse.java | 28 +- .../model/DocumentsListResponse.java | 2 +- .../sap/ai/sdk/grounding/model/Filter.java | 570 +++++++++++ .../grounding/model/FilterMatchModeEnum.java | 64 ++ .../ai/sdk/grounding/model/FiltersInner.java | 635 ++++++++++++ .../KeyWordRetrievalScoringConfiguration.java | 262 +++++ .../com/sap/ai/sdk/grounding/model/Left.java | 565 +++++++++++ .../com/sap/ai/sdk/grounding/model/Left1.java | 570 +++++++++++ .../ai/sdk/grounding/model/LocationInner.java | 49 + .../model/MergeStrategyReranker.java | 369 +++++++ .../MergeStrategyRerankerBoostingInner.java | 344 +++++++ .../model/MergeStrategyScoreReuse.java | 176 ++++ .../grounding/model/MergeStrategyType.java | 68 ++ .../ai/sdk/grounding/model/MetadataItem.java | 239 +++++ .../grounding/model/MetadataKeyUpdate.java | 238 +++++ .../grounding/model/MetadataOperation.java | 238 +++++ .../model/MetadataOperationEnum.java | 68 ++ .../sdk/grounding/model/MetadataResponse.java | 187 ++++ .../grounding/model/MetadataUpdateItem.java | 293 ++++++ .../sdk/grounding/model/MetadataUpdates.java | 212 ++++ .../model/PerFilterSearchResultError.java | 4 +- .../model/PostProcessingObjectReference.java | 176 ++++ .../model/PostProcessingOperation.java | 345 +++++++ .../ai/sdk/grounding/model/ResultsInner1.java | 127 ++- .../ai/sdk/grounding/model/ResultsInner2.java | 19 +- .../ai/sdk/grounding/model/ResultsInner3.java | 275 ------ .../model/RetrievalBinaryBooleanFilter.java | 350 +++++++ .../sdk/grounding/model/RetrievalChunk.java | 82 +- .../RetrievalDocumentKeyValueListPair.java | 70 +- .../model/RetrievalPerFilterSearchResult.java | 50 +- .../RetrievalPerFilterSearchResultError.java | 4 +- .../RetrievalScopedKeyValueListPair.java | 367 +++++++ .../model/RetrievalSearchConfiguration.java | 12 +- ...trievalSearchDocumentKeyValueListPair.java | 4 +- .../model/RetrievalSearchFilter.java | 50 +- .../grounding/model/RetrievalSearchInput.java | 82 +- ...trievalSearchInputPostProcessingInner.java | 356 +++++++ ...chInputPostProcessingInnerInputsInner.java | 23 + ...earchInputPostProcessingInnerStrategy.java | 23 + .../model/RetrievalSearchResults.java | 14 +- .../RetrievalSearchSelectOptionEnum.java | 2 +- .../model/RetrievalVectorSearchFilter.java | 647 ++++++++++++ .../RetrievalVectorSearchFilterFilter.java | 585 +++++++++++ .../com/sap/ai/sdk/grounding/model/Right.java | 570 +++++++++++ .../sap/ai/sdk/grounding/model/Right1.java | 570 +++++++++++ .../model/ScopedKeyValueListPair.java | 360 +++++++ .../com/sap/ai/sdk/grounding/model/Score.java | 185 ++++ .../model/ScoresAggregationStrategy.java | 66 ++ .../ai/sdk/grounding/model/SearchScores.java | 241 +++++ .../model/SearchScoresAggregatedScore.java | 175 ++++ .../sap/ai/sdk/grounding/model/Strategy.java | 23 + .../grounding/model/TextOnlyBaseChunk.java | 67 +- .../model/TextOnlyBaseChunkCreate.java | 240 +++++ .../grounding/model/TextSearchRequest.java | 8 +- .../sdk/grounding/model/ValidationError.java | 14 +- .../model/VectorDocumentKeyValueListPair.java | 69 +- .../model/VectorKeyValueListPair.java | 2 +- .../model/VectorScoringConfiguration.java | 343 +++++++ .../model/VectorSearchConfiguration.java | 12 +- .../VectorSearchDocumentKeyValueListPair.java | 4 +- .../grounding/model/VectorSearchFilter.java | 44 +- .../grounding/model/VectorSearchResults.java | 15 +- .../model/VectorSearchSelectOptionEnum.java | 2 +- .../src/main/resources/spec/grounding.yaml | 926 ++++++++++++++++-- 80 files changed, 13952 insertions(+), 883 deletions(-) create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BinaryBooleanFilter.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BoostingScoreComputationStrategy.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BoostingScoringConfiguration.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BoostingScoringConfigurationMetadataInner.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DenseRetrievalScoringConfiguration.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Filter.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/FilterMatchModeEnum.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/FiltersInner.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/KeyWordRetrievalScoringConfiguration.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Left.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Left1.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/LocationInner.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyReranker.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyRerankerBoostingInner.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyScoreReuse.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyType.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataItem.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataKeyUpdate.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataOperation.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataOperationEnum.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataResponse.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataUpdateItem.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataUpdates.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/PostProcessingObjectReference.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/PostProcessingOperation.java delete mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner3.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalBinaryBooleanFilter.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalScopedKeyValueListPair.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInputPostProcessingInner.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInputPostProcessingInnerInputsInner.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInputPostProcessingInnerStrategy.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalVectorSearchFilter.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalVectorSearchFilterFilter.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Right.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Right1.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ScopedKeyValueListPair.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Score.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ScoresAggregationStrategy.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchScores.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchScoresAggregatedScore.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Strategy.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextOnlyBaseChunkCreate.java create mode 100644 core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorScoringConfiguration.java diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/client/RetrievalApi.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/client/RetrievalApi.java index 93ca69db2..6226acda6 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/client/RetrievalApi.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/client/RetrievalApi.java @@ -157,14 +157,17 @@ public DataRepositories getDataRepositories(@Nonnull final String aiResourceGrou * *

404 - The specification of the resource was incorrect * - * @param aiResourceGroup Resource Group ID - * @param repositoryId Repository ID + * @param aiResourceGroup (required) Resource Group ID + * @param repositoryId (required) Repository ID + * @param remoteName (optional) Remote name if DataRepository is from remote DG. * @return DataRepository * @throws OpenApiRequestException if an error occurs while attempting to invoke the API */ @Nonnull public DataRepository getDataRepositoryById( - @Nonnull final String aiResourceGroup, @Nonnull final UUID repositoryId) + @Nonnull final String aiResourceGroup, + @Nonnull final UUID repositoryId, + @Nullable final String remoteName) throws OpenApiRequestException { final Object localVarPostBody = null; @@ -194,6 +197,8 @@ public DataRepository getDataRepositoryById( final MultiValueMap localVarFormParams = new LinkedMultiValueMap(); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "remoteName", remoteName)); + if (aiResourceGroup != null) localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); @@ -219,6 +224,31 @@ public DataRepository getDataRepositoryById( localVarReturnType); } + /** + * List single DataRepository object. + * + *

List data repository by id + * + *

200 - Successful Response + * + *

400 - The specification of the resource was incorrect + * + *

422 - There are validation issues with the data. + * + *

404 - The specification of the resource was incorrect + * + * @param aiResourceGroup Resource Group ID + * @param repositoryId Repository ID + * @return DataRepository + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public DataRepository getDataRepositoryById( + @Nonnull final String aiResourceGroup, @Nonnull final UUID repositoryId) + throws OpenApiRequestException { + return getDataRepositoryById(aiResourceGroup, repositoryId, null); + } + /** * Retrieve relevant content * diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/client/VectorApi.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/client/VectorApi.java index 4647e2be3..7453ed569 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/client/VectorApi.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/client/VectorApi.java @@ -11,6 +11,8 @@ import com.sap.ai.sdk.grounding.model.DocumentUpdateRequest; import com.sap.ai.sdk.grounding.model.Documents; import com.sap.ai.sdk.grounding.model.DocumentsListResponse; +import com.sap.ai.sdk.grounding.model.MetadataResponse; +import com.sap.ai.sdk.grounding.model.MetadataUpdates; import com.sap.ai.sdk.grounding.model.TextSearchRequest; import com.sap.ai.sdk.grounding.model.VectorSearchResults; import com.sap.ai.sdk.grounding.model.VectorV1VectorEndpointsGetCollectionCreationStatus200Response; @@ -1042,6 +1044,146 @@ public VectorSearchResults search( localVarReturnType); } + /** + * Patch chunks metadata + * + *

Allows to add, remove and modify the chunks metadata. + * + *

200 - Successful Response + * + *

400 - The specification of the resource was incorrect + * + *

404 - The specification of the resource was incorrect + * + *

422 - There are validation issues with the data. + * + * @param aiResourceGroup Resource Group ID + * @param metadataUpdates The value for the parameter metadataUpdates + * @return MetadataResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public MetadataResponse updateChunksMetadata( + @Nonnull final String aiResourceGroup, @Nonnull final MetadataUpdates metadataUpdates) + throws OpenApiRequestException { + final Object localVarPostBody = metadataUpdates; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling updateChunksMetadata"); + } + + // verify the required parameter 'metadataUpdates' is set + if (metadataUpdates == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'metadataUpdates' when calling vectorV1VectorEndpointsUpdateChunksMetadata"); + } + + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/chunks/metadata").build().toUriString(); + + final MultiValueMap localVarQueryParams = + new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarFormParams = + new LinkedMultiValueMap(); + + if (aiResourceGroup != null) + localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {"application/json"}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.PATCH, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Patch collections metadata + * + *

Allows to add, remove and modify the collections metadata. + * + *

200 - Successful Response + * + *

400 - The specification of the resource was incorrect + * + *

404 - The specification of the resource was incorrect + * + *

422 - There are validation issues with the data. + * + * @param aiResourceGroup Resource Group ID + * @param metadataUpdates The value for the parameter metadataUpdates + * @return MetadataResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public MetadataResponse updateCollectionsMetadata( + @Nonnull final String aiResourceGroup, @Nonnull final MetadataUpdates metadataUpdates) + throws OpenApiRequestException { + final Object localVarPostBody = metadataUpdates; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling updateCollectionsMetadata"); + } + + // verify the required parameter 'metadataUpdates' is set + if (metadataUpdates == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'metadataUpdates' when calling vectorV1VectorEndpointsUpdateCollectionsMetadata"); + } + + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/collections/metadata").build().toUriString(); + + final MultiValueMap localVarQueryParams = + new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarFormParams = + new LinkedMultiValueMap(); + + if (aiResourceGroup != null) + localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {"application/json"}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.PATCH, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + /** * Upsert documents in collection * @@ -1125,4 +1267,74 @@ public DocumentsListResponse updateDocuments( localVarAuthNames, localVarReturnType); } + + /** + * Patch documents metadata + * + *

Allows to add, remove and modify the documents metadata. + * + *

200 - Successful Response + * + *

400 - The specification of the resource was incorrect + * + *

404 - The specification of the resource was incorrect + * + *

422 - There are validation issues with the data. + * + * @param aiResourceGroup Resource Group ID + * @param metadataUpdates The value for the parameter metadataUpdates + * @return MetadataResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public MetadataResponse updateDocumentsMetadata( + @Nonnull final String aiResourceGroup, @Nonnull final MetadataUpdates metadataUpdates) + throws OpenApiRequestException { + final Object localVarPostBody = metadataUpdates; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling updateDocumentsMetadata"); + } + + // verify the required parameter 'metadataUpdates' is set + if (metadataUpdates == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'metadataUpdates' when calling vectorV1VectorEndpointsUpdateDocumentsMetadata"); + } + + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/documents/metadata").build().toUriString(); + + final MultiValueMap localVarQueryParams = + new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarFormParams = + new LinkedMultiValueMap(); + + if (aiResourceGroup != null) + localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup)); + + final String[] localVarAccepts = {"application/json"}; + final List localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + final String[] localVarContentTypes = {"application/json"}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.PATCH, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BaseDocument.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BaseDocument.java index 2691195fe..d89ab92d1 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BaseDocument.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BaseDocument.java @@ -32,7 +32,7 @@ public class BaseDocument // CHECKSTYLE:ON { @JsonProperty("chunks") - private List chunks = new ArrayList<>(); + private List chunks = new ArrayList<>(); @JsonProperty("metadata") private List metadata = new ArrayList<>(); @@ -50,7 +50,7 @@ protected BaseDocument() {} * @return The same instance of this {@link BaseDocument} class */ @Nonnull - public BaseDocument chunks(@Nonnull final List chunks) { + public BaseDocument chunks(@Nonnull final List chunks) { this.chunks = chunks; return this; } @@ -62,7 +62,7 @@ public BaseDocument chunks(@Nonnull final List chunks) { * @return The same instance of type {@link BaseDocument} */ @Nonnull - public BaseDocument addChunksItem(@Nonnull final TextOnlyBaseChunk chunksItem) { + public BaseDocument addChunksItem(@Nonnull final TextOnlyBaseChunkCreate chunksItem) { if (this.chunks == null) { this.chunks = new ArrayList<>(); } @@ -76,7 +76,7 @@ public BaseDocument addChunksItem(@Nonnull final TextOnlyBaseChunk chunksItem) { * @return chunks The chunks of this {@link BaseDocument} instance. */ @Nonnull - public List getChunks() { + public List getChunks() { return chunks; } @@ -85,7 +85,7 @@ public List getChunks() { * * @param chunks The chunks of this {@link BaseDocument} */ - public void setChunks(@Nonnull final List chunks) { + public void setChunks(@Nonnull final List chunks) { this.chunks = chunks; } @@ -96,7 +96,7 @@ public void setChunks(@Nonnull final List chunks) { * @return The same instance of this {@link BaseDocument} class */ @Nonnull - public BaseDocument metadata(@Nonnull final List metadata) { + public BaseDocument metadata(@Nullable final List metadata) { this.metadata = metadata; return this; } @@ -131,7 +131,7 @@ public List getMetadata() { * * @param metadata The metadata of this {@link BaseDocument} */ - public void setMetadata(@Nonnull final List metadata) { + public void setMetadata(@Nullable final List metadata) { this.metadata = metadata; } @@ -238,7 +238,7 @@ private String toIndentedString(final java.lang.Object o) { * with all required arguments. */ public static Builder create() { - return (chunks) -> (metadata) -> new BaseDocument().chunks(chunks).metadata(metadata); + return (chunks) -> new BaseDocument().chunks(chunks); } /** Builder helper class. */ @@ -247,39 +247,18 @@ public interface Builder { * Set the chunks of this {@link BaseDocument} instance. * * @param chunks The chunks of this {@link BaseDocument} - * @return The BaseDocument builder. + * @return The BaseDocument instance. */ - Builder1 chunks(@Nonnull final List chunks); + BaseDocument chunks(@Nonnull final List chunks); /** * Set the chunks of this {@link BaseDocument} instance. * * @param chunks The chunks of this {@link BaseDocument} - * @return The BaseDocument builder. - */ - default Builder1 chunks(@Nonnull final TextOnlyBaseChunk... chunks) { - return chunks(Arrays.asList(chunks)); - } - } - - /** Builder helper class. */ - public interface Builder1 { - /** - * Set the metadata of this {@link BaseDocument} instance. - * - * @param metadata The metadata of this {@link BaseDocument} * @return The BaseDocument instance. */ - BaseDocument metadata(@Nonnull final List metadata); - - /** - * Set the metadata of this {@link BaseDocument} instance. - * - * @param metadata The metadata of this {@link BaseDocument} - * @return The BaseDocument instance. - */ - default BaseDocument metadata(@Nonnull final VectorDocumentKeyValueListPair... metadata) { - return metadata(Arrays.asList(metadata)); + default BaseDocument chunks(@Nonnull final TextOnlyBaseChunkCreate... chunks) { + return chunks(Arrays.asList(chunks)); } } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BinaryBooleanFilter.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BinaryBooleanFilter.java new file mode 100644 index 000000000..f1fa41df4 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BinaryBooleanFilter.java @@ -0,0 +1,341 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** BinaryBooleanFilter */ +// CHECKSTYLE:OFF +public class BinaryBooleanFilter +// CHECKSTYLE:ON +{ + /** Boolean operator for combining filter conditions */ + public enum OperatorEnum { + /** The AND option of this BinaryBooleanFilter */ + AND("and"), + + /** The OR option of this BinaryBooleanFilter */ + OR("or"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this BinaryBooleanFilter */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + OperatorEnum(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 BinaryBooleanFilter + */ + @JsonCreator + @Nonnull + public static OperatorEnum fromValue(@Nonnull final String value) { + for (OperatorEnum b : OperatorEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("operator") + private OperatorEnum operator; + + @JsonProperty("left") + private Left1 left; + + @JsonProperty("right") + private Right1 right; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BinaryBooleanFilter. */ + protected BinaryBooleanFilter() {} + + /** + * Set the operator of this {@link BinaryBooleanFilter} instance and return the same instance. + * + * @param operator Boolean operator for combining filter conditions + * @return The same instance of this {@link BinaryBooleanFilter} class + */ + @Nonnull + public BinaryBooleanFilter operator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + return this; + } + + /** + * Boolean operator for combining filter conditions + * + * @return operator The operator of this {@link BinaryBooleanFilter} instance. + */ + @Nonnull + public OperatorEnum getOperator() { + return operator; + } + + /** + * Set the operator of this {@link BinaryBooleanFilter} instance. + * + * @param operator Boolean operator for combining filter conditions + */ + public void setOperator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + } + + /** + * Set the left of this {@link BinaryBooleanFilter} instance and return the same instance. + * + * @param left The left of this {@link BinaryBooleanFilter} + * @return The same instance of this {@link BinaryBooleanFilter} class + */ + @Nonnull + public BinaryBooleanFilter left(@Nonnull final Left1 left) { + this.left = left; + return this; + } + + /** + * Get left + * + * @return left The left of this {@link BinaryBooleanFilter} instance. + */ + @Nonnull + public Left1 getLeft() { + return left; + } + + /** + * Set the left of this {@link BinaryBooleanFilter} instance. + * + * @param left The left of this {@link BinaryBooleanFilter} + */ + public void setLeft(@Nonnull final Left1 left) { + this.left = left; + } + + /** + * Set the right of this {@link BinaryBooleanFilter} instance and return the same instance. + * + * @param right The right of this {@link BinaryBooleanFilter} + * @return The same instance of this {@link BinaryBooleanFilter} class + */ + @Nonnull + public BinaryBooleanFilter right(@Nonnull final Right1 right) { + this.right = right; + return this; + } + + /** + * Get right + * + * @return right The right of this {@link BinaryBooleanFilter} instance. + */ + @Nonnull + public Right1 getRight() { + return right; + } + + /** + * Set the right of this {@link BinaryBooleanFilter} instance. + * + * @param right The right of this {@link BinaryBooleanFilter} + */ + public void setRight(@Nonnull final Right1 right) { + this.right = right; + } + + /** + * Get the names of the unrecognizable properties of the {@link BinaryBooleanFilter}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BinaryBooleanFilter} 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( + "BinaryBooleanFilter has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BinaryBooleanFilter} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (operator != null) declaredFields.put("operator", operator); + if (left != null) declaredFields.put("left", left); + if (right != null) declaredFields.put("right", right); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BinaryBooleanFilter} 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 BinaryBooleanFilter binaryBooleanFilter = (BinaryBooleanFilter) o; + return Objects.equals(this.cloudSdkCustomFields, binaryBooleanFilter.cloudSdkCustomFields) + && Objects.equals(this.operator, binaryBooleanFilter.operator) + && Objects.equals(this.left, binaryBooleanFilter.left) + && Objects.equals(this.right, binaryBooleanFilter.right); + } + + @Override + public int hashCode() { + return Objects.hash(operator, left, right, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BinaryBooleanFilter {\n"); + sb.append(" operator: ").append(toIndentedString(operator)).append("\n"); + sb.append(" left: ").append(toIndentedString(left)).append("\n"); + sb.append(" right: ").append(toIndentedString(right)).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 BinaryBooleanFilter} + * instance with all required arguments. + */ + public static Builder create() { + return (operator) -> + (left) -> (right) -> new BinaryBooleanFilter().operator(operator).left(left).right(right); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the operator of this {@link BinaryBooleanFilter} instance. + * + * @param operator Boolean operator for combining filter conditions + * @return The BinaryBooleanFilter builder. + */ + Builder1 operator(@Nonnull final OperatorEnum operator); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the left of this {@link BinaryBooleanFilter} instance. + * + * @param left The left of this {@link BinaryBooleanFilter} + * @return The BinaryBooleanFilter builder. + */ + Builder2 left(@Nonnull final Left1 left); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the right of this {@link BinaryBooleanFilter} instance. + * + * @param right The right of this {@link BinaryBooleanFilter} + * @return The BinaryBooleanFilter instance. + */ + BinaryBooleanFilter right(@Nonnull final Right1 right); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BoostingScoreComputationStrategy.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BoostingScoreComputationStrategy.java new file mode 100644 index 000000000..c9d66eec4 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BoostingScoreComputationStrategy.java @@ -0,0 +1,64 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.annotation.Nonnull; + +/** Gets or Sets BoostingScoreComputationStrategy */ +public enum BoostingScoreComputationStrategy { + MATCH_COUNT("match_count"), + + EMBEDDING("embedding"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + BoostingScoreComputationStrategy(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 BoostingScoreComputationStrategy fromValue(@Nonnull final String value) { + for (final BoostingScoreComputationStrategy b : BoostingScoreComputationStrategy.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BoostingScoringConfiguration.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BoostingScoringConfiguration.java new file mode 100644 index 000000000..df7a4c347 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BoostingScoringConfiguration.java @@ -0,0 +1,319 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** BoostingScoringConfiguration */ +// CHECKSTYLE:OFF +public class BoostingScoringConfiguration +// CHECKSTYLE:ON +{ + @JsonProperty("enabled") + private Boolean enabled = true; + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonProperty("weight") + private Integer weight = 1; + + @JsonProperty("scoreComputationStrategy") + private BoostingScoreComputationStrategy scoreComputationStrategy; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BoostingScoringConfiguration. */ + protected BoostingScoringConfiguration() {} + + /** + * Set the enabled of this {@link BoostingScoringConfiguration} instance and return the same + * instance. + * + * @param enabled Enable metadata-based boosting. + * @return The same instance of this {@link BoostingScoringConfiguration} class + */ + @Nonnull + public BoostingScoringConfiguration enabled(@Nullable final Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Enable metadata-based boosting. + * + * @return enabled The enabled of this {@link BoostingScoringConfiguration} instance. + */ + @Nullable + public Boolean isEnabled() { + return enabled; + } + + /** + * Set the enabled of this {@link BoostingScoringConfiguration} instance. + * + * @param enabled Enable metadata-based boosting. + */ + public void setEnabled(@Nullable final Boolean enabled) { + this.enabled = enabled; + } + + /** + * Set the metadata of this {@link BoostingScoringConfiguration} instance and return the same + * instance. + * + * @param metadata The metadata of this {@link BoostingScoringConfiguration} + * @return The same instance of this {@link BoostingScoringConfiguration} class + */ + @Nonnull + public BoostingScoringConfiguration metadata( + @Nullable final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link BoostingScoringConfiguration}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link BoostingScoringConfiguration} + */ + @Nonnull + public BoostingScoringConfiguration addMetadataItem( + @Nonnull final BoostingScoringConfigurationMetadataInner metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link BoostingScoringConfiguration} instance. + */ + @Nullable + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link BoostingScoringConfiguration} instance. + * + * @param metadata The metadata of this {@link BoostingScoringConfiguration} + */ + public void setMetadata( + @Nullable final List metadata) { + this.metadata = metadata; + } + + /** + * Set the weight of this {@link BoostingScoringConfiguration} instance and return the same + * instance. + * + * @param weight Contribution to final score. + * @return The same instance of this {@link BoostingScoringConfiguration} class + */ + @Nonnull + public BoostingScoringConfiguration weight(@Nullable final Integer weight) { + this.weight = weight; + return this; + } + + /** + * Contribution to final score. + * + * @return weight The weight of this {@link BoostingScoringConfiguration} instance. + */ + @Nullable + public Integer getWeight() { + return weight; + } + + /** + * Set the weight of this {@link BoostingScoringConfiguration} instance. + * + * @param weight Contribution to final score. + */ + public void setWeight(@Nullable final Integer weight) { + this.weight = weight; + } + + /** + * Set the scoreComputationStrategy of this {@link BoostingScoringConfiguration} instance and + * return the same instance. + * + * @param scoreComputationStrategy The scoreComputationStrategy of this {@link + * BoostingScoringConfiguration} + * @return The same instance of this {@link BoostingScoringConfiguration} class + */ + @Nonnull + public BoostingScoringConfiguration scoreComputationStrategy( + @Nullable final BoostingScoreComputationStrategy scoreComputationStrategy) { + this.scoreComputationStrategy = scoreComputationStrategy; + return this; + } + + /** + * Get scoreComputationStrategy + * + * @return scoreComputationStrategy The scoreComputationStrategy of this {@link + * BoostingScoringConfiguration} instance. + */ + @Nonnull + public BoostingScoreComputationStrategy getScoreComputationStrategy() { + return scoreComputationStrategy; + } + + /** + * Set the scoreComputationStrategy of this {@link BoostingScoringConfiguration} instance. + * + * @param scoreComputationStrategy The scoreComputationStrategy of this {@link + * BoostingScoringConfiguration} + */ + public void setScoreComputationStrategy( + @Nullable final BoostingScoreComputationStrategy scoreComputationStrategy) { + this.scoreComputationStrategy = scoreComputationStrategy; + } + + /** + * Get the names of the unrecognizable properties of the {@link BoostingScoringConfiguration}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BoostingScoringConfiguration} + * 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( + "BoostingScoringConfiguration has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BoostingScoringConfiguration} 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 (metadata != null) declaredFields.put("metadata", metadata); + if (weight != null) declaredFields.put("weight", weight); + if (scoreComputationStrategy != null) + declaredFields.put("scoreComputationStrategy", scoreComputationStrategy); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BoostingScoringConfiguration} 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 BoostingScoringConfiguration boostingScoringConfiguration = + (BoostingScoringConfiguration) o; + return Objects.equals( + this.cloudSdkCustomFields, boostingScoringConfiguration.cloudSdkCustomFields) + && Objects.equals(this.enabled, boostingScoringConfiguration.enabled) + && Objects.equals(this.metadata, boostingScoringConfiguration.metadata) + && Objects.equals(this.weight, boostingScoringConfiguration.weight) + && Objects.equals( + this.scoreComputationStrategy, boostingScoringConfiguration.scoreComputationStrategy); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, metadata, weight, scoreComputationStrategy, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BoostingScoringConfiguration {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append(" scoreComputationStrategy: ") + .append(toIndentedString(scoreComputationStrategy)) + .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 BoostingScoringConfiguration} instance. No arguments are required. */ + public static BoostingScoringConfiguration create() { + return new BoostingScoringConfiguration(); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BoostingScoringConfigurationMetadataInner.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BoostingScoringConfigurationMetadataInner.java new file mode 100644 index 000000000..68663f699 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/BoostingScoringConfigurationMetadataInner.java @@ -0,0 +1,424 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** BoostingScoringConfigurationMetadataInner */ +// CHECKSTYLE:OFF +public class BoostingScoringConfigurationMetadataInner +// CHECKSTYLE:ON +{ + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + /** Gets or Sets scope */ + public enum ScopeEnum { + /** The REPOSITORY option of this BoostingScoringConfigurationMetadataInner */ + REPOSITORY("repository"), + + /** The DOCUMENT option of this BoostingScoringConfigurationMetadataInner */ + DOCUMENT("document"), + + /** The CHUNK option of this BoostingScoringConfigurationMetadataInner */ + CHUNK("chunk"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this BoostingScoringConfigurationMetadataInner */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ScopeEnum(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 BoostingScoringConfigurationMetadataInner + */ + @JsonCreator + @Nonnull + public static ScopeEnum fromValue(@Nonnull final String value) { + for (ScopeEnum b : ScopeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("scope") + private ScopeEnum scope = ScopeEnum.DOCUMENT; + + @JsonProperty("weight") + private Integer weight; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BoostingScoringConfigurationMetadataInner. */ + protected BoostingScoringConfigurationMetadataInner() {} + + /** + * Set the key of this {@link BoostingScoringConfigurationMetadataInner} instance and return the + * same instance. + * + * @param key The key of this {@link BoostingScoringConfigurationMetadataInner} + * @return The same instance of this {@link BoostingScoringConfigurationMetadataInner} class + */ + @Nonnull + public BoostingScoringConfigurationMetadataInner key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link BoostingScoringConfigurationMetadataInner} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link BoostingScoringConfigurationMetadataInner} instance. + * + * @param key The key of this {@link BoostingScoringConfigurationMetadataInner} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link BoostingScoringConfigurationMetadataInner} instance and return the + * same instance. + * + * @param value The value of this {@link BoostingScoringConfigurationMetadataInner} + * @return The same instance of this {@link BoostingScoringConfigurationMetadataInner} class + */ + @Nonnull + public BoostingScoringConfigurationMetadataInner value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link BoostingScoringConfigurationMetadataInner}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link BoostingScoringConfigurationMetadataInner} + */ + @Nonnull + public BoostingScoringConfigurationMetadataInner 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 BoostingScoringConfigurationMetadataInner} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link BoostingScoringConfigurationMetadataInner} instance. + * + * @param value The value of this {@link BoostingScoringConfigurationMetadataInner} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Set the scope of this {@link BoostingScoringConfigurationMetadataInner} instance and return the + * same instance. + * + * @param scope The scope of this {@link BoostingScoringConfigurationMetadataInner} + * @return The same instance of this {@link BoostingScoringConfigurationMetadataInner} class + */ + @Nonnull + public BoostingScoringConfigurationMetadataInner scope(@Nullable final ScopeEnum scope) { + this.scope = scope; + return this; + } + + /** + * Get scope + * + * @return scope The scope of this {@link BoostingScoringConfigurationMetadataInner} instance. + */ + @Nonnull + public ScopeEnum getScope() { + return scope; + } + + /** + * Set the scope of this {@link BoostingScoringConfigurationMetadataInner} instance. + * + * @param scope The scope of this {@link BoostingScoringConfigurationMetadataInner} + */ + public void setScope(@Nullable final ScopeEnum scope) { + this.scope = scope; + } + + /** + * Set the weight of this {@link BoostingScoringConfigurationMetadataInner} instance and return + * the same instance. + * + * @param weight The weight of this {@link BoostingScoringConfigurationMetadataInner} + * @return The same instance of this {@link BoostingScoringConfigurationMetadataInner} class + */ + @Nonnull + public BoostingScoringConfigurationMetadataInner weight(@Nonnull final Integer weight) { + this.weight = weight; + return this; + } + + /** + * Get weight + * + * @return weight The weight of this {@link BoostingScoringConfigurationMetadataInner} instance. + */ + @Nonnull + public Integer getWeight() { + return weight; + } + + /** + * Set the weight of this {@link BoostingScoringConfigurationMetadataInner} instance. + * + * @param weight The weight of this {@link BoostingScoringConfigurationMetadataInner} + */ + public void setWeight(@Nonnull final Integer weight) { + this.weight = weight; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * BoostingScoringConfigurationMetadataInner}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link + * BoostingScoringConfigurationMetadataInner} 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( + "BoostingScoringConfigurationMetadataInner has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BoostingScoringConfigurationMetadataInner} + * 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 (scope != null) declaredFields.put("scope", scope); + if (weight != null) declaredFields.put("weight", weight); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BoostingScoringConfigurationMetadataInner} + * 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 BoostingScoringConfigurationMetadataInner boostingScoringConfigurationMetadataInner = + (BoostingScoringConfigurationMetadataInner) o; + return Objects.equals( + this.cloudSdkCustomFields, + boostingScoringConfigurationMetadataInner.cloudSdkCustomFields) + && Objects.equals(this.key, boostingScoringConfigurationMetadataInner.key) + && Objects.equals(this.value, boostingScoringConfigurationMetadataInner.value) + && Objects.equals(this.scope, boostingScoringConfigurationMetadataInner.scope) + && Objects.equals(this.weight, boostingScoringConfigurationMetadataInner.weight); + } + + @Override + public int hashCode() { + return Objects.hash(key, value, scope, weight, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BoostingScoringConfigurationMetadataInner {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).append("\n"); + sb.append(" weight: ").append(toIndentedString(weight)).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 + * BoostingScoringConfigurationMetadataInner} instance with all required arguments. + */ + public static Builder create() { + return (key) -> + (value) -> + (weight) -> + new BoostingScoringConfigurationMetadataInner() + .key(key) + .value(value) + .weight(weight); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the key of this {@link BoostingScoringConfigurationMetadataInner} instance. + * + * @param key The key of this {@link BoostingScoringConfigurationMetadataInner} + * @return The BoostingScoringConfigurationMetadataInner builder. + */ + Builder1 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the value of this {@link BoostingScoringConfigurationMetadataInner} instance. + * + * @param value The value of this {@link BoostingScoringConfigurationMetadataInner} + * @return The BoostingScoringConfigurationMetadataInner builder. + */ + Builder2 value(@Nonnull final List value); + + /** + * Set the value of this {@link BoostingScoringConfigurationMetadataInner} instance. + * + * @param value The value of this {@link BoostingScoringConfigurationMetadataInner} + * @return The BoostingScoringConfigurationMetadataInner builder. + */ + default Builder2 value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the weight of this {@link BoostingScoringConfigurationMetadataInner} instance. + * + * @param weight The weight of this {@link BoostingScoringConfigurationMetadataInner} + * @return The BoostingScoringConfigurationMetadataInner instance. + */ + BoostingScoringConfigurationMetadataInner weight(@Nonnull final Integer weight); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionPendingResponse.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionPendingResponse.java index ed5259502..62aab46b3 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionPendingResponse.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionPendingResponse.java @@ -30,11 +30,8 @@ public class CollectionPendingResponse VectorV1VectorEndpointsGetCollectionDeletionStatus200Response // CHECKSTYLE:ON { - @JsonProperty("Location") - private String location; - - @JsonProperty("status") - private String status; + @JsonProperty("monitorURL") + private String monitorURL; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -43,66 +40,35 @@ public class CollectionPendingResponse protected CollectionPendingResponse() {} /** - * Set the location of this {@link CollectionPendingResponse} instance and return the same + * Set the monitorURL of this {@link CollectionPendingResponse} instance and return the same * instance. * - * @param location The location of this {@link CollectionPendingResponse} - * @return The same instance of this {@link CollectionPendingResponse} class - */ - @Nonnull - public CollectionPendingResponse location(@Nonnull final String location) { - this.location = location; - return this; - } - - /** - * Get location - * - * @return location The location of this {@link CollectionPendingResponse} instance. - */ - @Nonnull - public String getLocation() { - return location; - } - - /** - * Set the location of this {@link CollectionPendingResponse} instance. - * - * @param location The location of this {@link CollectionPendingResponse} - */ - public void setLocation(@Nonnull final String location) { - this.location = location; - } - - /** - * Set the status of this {@link CollectionPendingResponse} instance and return the same instance. - * - * @param status The status of this {@link CollectionPendingResponse} + * @param monitorURL The monitorURL of this {@link CollectionPendingResponse} * @return The same instance of this {@link CollectionPendingResponse} class */ @Nonnull - public CollectionPendingResponse status(@Nonnull final String status) { - this.status = status; + public CollectionPendingResponse monitorURL(@Nonnull final String monitorURL) { + this.monitorURL = monitorURL; return this; } /** - * Get status + * Get monitorURL * - * @return status The status of this {@link CollectionPendingResponse} instance. + * @return monitorURL The monitorURL of this {@link CollectionPendingResponse} instance. */ @Nonnull - public String getStatus() { - return status; + public String getMonitorURL() { + return monitorURL; } /** - * Set the status of this {@link CollectionPendingResponse} instance. + * Set the monitorURL of this {@link CollectionPendingResponse} instance. * - * @param status The status of this {@link CollectionPendingResponse} + * @param monitorURL The monitorURL of this {@link CollectionPendingResponse} */ - public void setStatus(@Nonnull final String status) { - this.status = status; + public void setMonitorURL(@Nonnull final String monitorURL) { + this.monitorURL = monitorURL; } /** @@ -144,8 +110,7 @@ public Object getCustomField(@Nonnull final String name) throws NoSuchElementExc @Nonnull public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (location != null) declaredFields.put("location", location); - if (status != null) declaredFields.put("status", status); + if (monitorURL != null) declaredFields.put("monitorURL", monitorURL); return declaredFields; } @@ -171,13 +136,12 @@ public boolean equals(@Nullable final java.lang.Object o) { } final CollectionPendingResponse collectionPendingResponse = (CollectionPendingResponse) o; return Objects.equals(this.cloudSdkCustomFields, collectionPendingResponse.cloudSdkCustomFields) - && Objects.equals(this.location, collectionPendingResponse.location) - && Objects.equals(this.status, collectionPendingResponse.status); + && Objects.equals(this.monitorURL, collectionPendingResponse.monitorURL); } @Override public int hashCode() { - return Objects.hash(location, status, cloudSdkCustomFields); + return Objects.hash(monitorURL, cloudSdkCustomFields); } @Override @@ -185,8 +149,7 @@ public int hashCode() { public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("class CollectionPendingResponse {\n"); - sb.append(" location: ").append(toIndentedString(location)).append("\n"); - sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" monitorURL: ").append(toIndentedString(monitorURL)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); @@ -209,29 +172,17 @@ private String toIndentedString(final java.lang.Object o) { * CollectionPendingResponse} instance with all required arguments. */ public static Builder create() { - return (location) -> - (status) -> new CollectionPendingResponse().location(location).status(status); + return (monitorURL) -> new CollectionPendingResponse().monitorURL(monitorURL); } /** Builder helper class. */ public interface Builder { /** - * Set the location of this {@link CollectionPendingResponse} instance. - * - * @param location The location of this {@link CollectionPendingResponse} - * @return The CollectionPendingResponse builder. - */ - Builder1 location(@Nonnull final String location); - } - - /** Builder helper class. */ - public interface Builder1 { - /** - * Set the status of this {@link CollectionPendingResponse} instance. + * Set the monitorURL of this {@link CollectionPendingResponse} instance. * - * @param status The status of this {@link CollectionPendingResponse} + * @param monitorURL The monitorURL of this {@link CollectionPendingResponse} * @return The CollectionPendingResponse instance. */ - CollectionPendingResponse status(@Nonnull final String status); + CollectionPendingResponse monitorURL(@Nonnull final String monitorURL); } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionRequest.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionRequest.java index b514ab2d4..592a846ac 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionRequest.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionRequest.java @@ -177,7 +177,7 @@ public CollectionRequest id(@Nullable final UUID id) { * * @return id The id of this {@link CollectionRequest} instance. */ - @Nonnull + @Nullable public UUID getId() { return id; } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepository.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepository.java index c1c195443..73ad708e8 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepository.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepository.java @@ -40,6 +40,12 @@ public class DataRepository @JsonProperty("metadata") private List metadata = new ArrayList<>(); + @JsonProperty("remoteGroundingName") + private String remoteGroundingName; + + @JsonProperty("message") + private String message; + @JsonProperty("type") private DataRepositoryType type; @@ -160,6 +166,69 @@ public void setMetadata(@Nullable final List metadata this.metadata = metadata; } + /** + * Set the remoteGroundingName of this {@link DataRepository} instance and return the same + * instance. + * + * @param remoteGroundingName The remoteGroundingName of this {@link DataRepository} + * @return The same instance of this {@link DataRepository} class + */ + @Nonnull + public DataRepository remoteGroundingName(@Nullable final String remoteGroundingName) { + this.remoteGroundingName = remoteGroundingName; + return this; + } + + /** + * Get remoteGroundingName + * + * @return remoteGroundingName The remoteGroundingName of this {@link DataRepository} instance. + */ + @Nullable + public String getRemoteGroundingName() { + return remoteGroundingName; + } + + /** + * Set the remoteGroundingName of this {@link DataRepository} instance. + * + * @param remoteGroundingName The remoteGroundingName of this {@link DataRepository} + */ + public void setRemoteGroundingName(@Nullable final String remoteGroundingName) { + this.remoteGroundingName = remoteGroundingName; + } + + /** + * Set the message of this {@link DataRepository} instance and return the same instance. + * + * @param message The message of this {@link DataRepository} + * @return The same instance of this {@link DataRepository} class + */ + @Nonnull + public DataRepository message(@Nullable final String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link DataRepository} instance. + */ + @Nullable + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link DataRepository} instance. + * + * @param message The message of this {@link DataRepository} + */ + public void setMessage(@Nullable final String message) { + this.message = message; + } + /** * Set the type of this {@link DataRepository} instance and return the same instance. * @@ -167,7 +236,7 @@ public void setMetadata(@Nullable final List metadata * @return The same instance of this {@link DataRepository} class */ @Nonnull - public DataRepository type(@Nullable final DataRepositoryType type) { + public DataRepository type(@Nonnull final DataRepositoryType type) { this.type = type; return this; } @@ -177,7 +246,7 @@ public DataRepository type(@Nullable final DataRepositoryType type) { * * @return type The type of this {@link DataRepository} instance. */ - @Nullable + @Nonnull public DataRepositoryType getType() { return type; } @@ -187,7 +256,7 @@ public DataRepositoryType getType() { * * @param type The type of this {@link DataRepository} */ - public void setType(@Nullable final DataRepositoryType type) { + public void setType(@Nonnull final DataRepositoryType type) { this.type = type; } @@ -232,6 +301,8 @@ public Map toMap() { if (id != null) declaredFields.put("id", id); if (title != null) declaredFields.put("title", title); if (metadata != null) declaredFields.put("metadata", metadata); + if (remoteGroundingName != null) declaredFields.put("remoteGroundingName", remoteGroundingName); + if (message != null) declaredFields.put("message", message); if (type != null) declaredFields.put("type", type); return declaredFields; } @@ -261,12 +332,15 @@ public boolean equals(@Nullable final java.lang.Object o) { && Objects.equals(this.id, dataRepository.id) && Objects.equals(this.title, dataRepository.title) && Objects.equals(this.metadata, dataRepository.metadata) + && Objects.equals(this.remoteGroundingName, dataRepository.remoteGroundingName) + && Objects.equals(this.message, dataRepository.message) && Objects.equals(this.type, dataRepository.type); } @Override public int hashCode() { - return Objects.hash(id, title, metadata, type, cloudSdkCustomFields); + return Objects.hash( + id, title, metadata, remoteGroundingName, message, type, cloudSdkCustomFields); } @Override @@ -277,6 +351,10 @@ public String toString() { sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" remoteGroundingName: ") + .append(toIndentedString(remoteGroundingName)) + .append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); sb.append(" type: ").append(toIndentedString(type)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> @@ -333,6 +411,6 @@ public interface Builder2 { * @param type The type of this {@link DataRepository} * @return The DataRepository instance. */ - DataRepository type(@Nullable final DataRepositoryType type); + DataRepository type(@Nonnull final DataRepositoryType type); } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositorySearchResults.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositorySearchResults.java index 60e8049c7..a305466e8 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositorySearchResults.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositorySearchResults.java @@ -32,7 +32,7 @@ public class DataRepositorySearchResults // CHECKSTYLE:ON { @JsonProperty("results") - private List results = new ArrayList<>(); + private List results = new ArrayList<>(); @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -48,7 +48,7 @@ protected DataRepositorySearchResults() {} * @return The same instance of this {@link DataRepositorySearchResults} class */ @Nonnull - public DataRepositorySearchResults results(@Nonnull final List results) { + public DataRepositorySearchResults results(@Nonnull final List results) { this.results = results; return this; } @@ -60,7 +60,7 @@ public DataRepositorySearchResults results(@Nonnull final List re * @return The same instance of type {@link DataRepositorySearchResults} */ @Nonnull - public DataRepositorySearchResults addResultsItem(@Nonnull final ResultsInner3 resultsItem) { + public DataRepositorySearchResults addResultsItem(@Nonnull final ResultsInner2 resultsItem) { if (this.results == null) { this.results = new ArrayList<>(); } @@ -74,7 +74,7 @@ public DataRepositorySearchResults addResultsItem(@Nonnull final ResultsInner3 r * @return results The results of this {@link DataRepositorySearchResults} instance. */ @Nonnull - public List getResults() { + public List getResults() { return results; } @@ -83,7 +83,7 @@ public List getResults() { * * @param results List of returned results. */ - public void setResults(@Nonnull final List results) { + public void setResults(@Nonnull final List results) { this.results = results; } @@ -201,7 +201,7 @@ public interface Builder { * @param results List of returned results. * @return The DataRepositorySearchResults instance. */ - DataRepositorySearchResults results(@Nonnull final List results); + DataRepositorySearchResults results(@Nonnull final List results); /** * Set the results of this {@link DataRepositorySearchResults} instance. @@ -209,7 +209,7 @@ public interface Builder { * @param results List of returned results. * @return The DataRepositorySearchResults instance. */ - default DataRepositorySearchResults results(@Nonnull final ResultsInner3... results) { + default DataRepositorySearchResults results(@Nonnull final ResultsInner2... results) { return results(Arrays.asList(results)); } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryType.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryType.java index b3cc53040..a8d18c7cf 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryType.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryType.java @@ -15,12 +15,14 @@ import com.fasterxml.jackson.annotation.JsonValue; import javax.annotation.Nonnull; -/** Gets or Sets DataRepositoryType */ +/** Only include DataRepositories with the given type. */ public enum DataRepositoryType { VECTOR("vector"), HELP_SAP_COM("help.sap.com"), + REMOTE_DG("remote:dg"), + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); private final String value; @@ -59,6 +61,6 @@ public static DataRepositoryType fromValue(@Nonnull final String value) { return b; } } - return null; + return UNKNOWN_DEFAULT_OPEN_API; } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryWithDocuments.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryWithDocuments.java index df951886e..871def445 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryWithDocuments.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryWithDocuments.java @@ -41,6 +41,12 @@ public class DataRepositoryWithDocuments @JsonProperty("metadata") private List metadata = new ArrayList<>(); + @JsonProperty("remoteGroundingName") + private String remoteGroundingName; + + @JsonProperty("message") + private String message; + @JsonProperty("documents") private List documents = new ArrayList<>(); @@ -165,6 +171,72 @@ public void setMetadata(@Nullable final List metadata this.metadata = metadata; } + /** + * Set the remoteGroundingName of this {@link DataRepositoryWithDocuments} instance and return the + * same instance. + * + * @param remoteGroundingName Friendly destination Name (grounding.name) of remote instance. + * @return The same instance of this {@link DataRepositoryWithDocuments} class + */ + @Nonnull + public DataRepositoryWithDocuments remoteGroundingName( + @Nullable final String remoteGroundingName) { + this.remoteGroundingName = remoteGroundingName; + return this; + } + + /** + * Friendly destination Name (grounding.name) of remote instance. + * + * @return remoteGroundingName The remoteGroundingName of this {@link DataRepositoryWithDocuments} + * instance. + */ + @Nullable + public String getRemoteGroundingName() { + return remoteGroundingName; + } + + /** + * Set the remoteGroundingName of this {@link DataRepositoryWithDocuments} instance. + * + * @param remoteGroundingName Friendly destination Name (grounding.name) of remote instance. + */ + public void setRemoteGroundingName(@Nullable final String remoteGroundingName) { + this.remoteGroundingName = remoteGroundingName; + } + + /** + * Set the message of this {@link DataRepositoryWithDocuments} instance and return the same + * instance. + * + * @param message Optional message. + * @return The same instance of this {@link DataRepositoryWithDocuments} class + */ + @Nonnull + public DataRepositoryWithDocuments message(@Nullable final String message) { + this.message = message; + return this; + } + + /** + * Optional message. + * + * @return message The message of this {@link DataRepositoryWithDocuments} instance. + */ + @Nullable + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link DataRepositoryWithDocuments} instance. + * + * @param message Optional message. + */ + public void setMessage(@Nullable final String message) { + this.message = message; + } + /** * Set the documents of this {@link DataRepositoryWithDocuments} instance and return the same * instance. @@ -255,6 +327,8 @@ public Map toMap() { if (id != null) declaredFields.put("id", id); if (title != null) declaredFields.put("title", title); if (metadata != null) declaredFields.put("metadata", metadata); + if (remoteGroundingName != null) declaredFields.put("remoteGroundingName", remoteGroundingName); + if (message != null) declaredFields.put("message", message); if (documents != null) declaredFields.put("documents", documents); return declaredFields; } @@ -285,12 +359,15 @@ public boolean equals(@Nullable final java.lang.Object o) { && Objects.equals(this.id, dataRepositoryWithDocuments.id) && Objects.equals(this.title, dataRepositoryWithDocuments.title) && Objects.equals(this.metadata, dataRepositoryWithDocuments.metadata) + && Objects.equals(this.remoteGroundingName, dataRepositoryWithDocuments.remoteGroundingName) + && Objects.equals(this.message, dataRepositoryWithDocuments.message) && Objects.equals(this.documents, dataRepositoryWithDocuments.documents); } @Override public int hashCode() { - return Objects.hash(id, title, metadata, documents, cloudSdkCustomFields); + return Objects.hash( + id, title, metadata, remoteGroundingName, message, documents, cloudSdkCustomFields); } @Override @@ -301,6 +378,10 @@ public String toString() { sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" title: ").append(toIndentedString(title)).append("\n"); sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" remoteGroundingName: ") + .append(toIndentedString(remoteGroundingName)) + .append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); sb.append(" documents: ").append(toIndentedString(documents)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DenseRetrievalScoringConfiguration.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DenseRetrievalScoringConfiguration.java new file mode 100644 index 000000000..7a186c261 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DenseRetrievalScoringConfiguration.java @@ -0,0 +1,217 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** DenseRetrievalScoringConfiguration */ +// CHECKSTYLE:OFF +public class DenseRetrievalScoringConfiguration +// CHECKSTYLE:ON +{ + @JsonProperty("enabled") + private Boolean enabled = true; + + @JsonProperty("weight") + private Integer weight = 1; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DenseRetrievalScoringConfiguration. */ + protected DenseRetrievalScoringConfiguration() {} + + /** + * Set the enabled of this {@link DenseRetrievalScoringConfiguration} instance and return the same + * instance. + * + * @param enabled Enable dense retrieval. + * @return The same instance of this {@link DenseRetrievalScoringConfiguration} class + */ + @Nonnull + public DenseRetrievalScoringConfiguration enabled(@Nullable final Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Enable dense retrieval. + * + * @return enabled The enabled of this {@link DenseRetrievalScoringConfiguration} instance. + */ + @Nullable + public Boolean isEnabled() { + return enabled; + } + + /** + * Set the enabled of this {@link DenseRetrievalScoringConfiguration} instance. + * + * @param enabled Enable dense retrieval. + */ + public void setEnabled(@Nullable final Boolean enabled) { + this.enabled = enabled; + } + + /** + * Set the weight of this {@link DenseRetrievalScoringConfiguration} instance and return the same + * instance. + * + * @param weight Contribution to final score. + * @return The same instance of this {@link DenseRetrievalScoringConfiguration} class + */ + @Nonnull + public DenseRetrievalScoringConfiguration weight(@Nullable final Integer weight) { + this.weight = weight; + return this; + } + + /** + * Contribution to final score. + * + * @return weight The weight of this {@link DenseRetrievalScoringConfiguration} instance. + */ + @Nullable + public Integer getWeight() { + return weight; + } + + /** + * Set the weight of this {@link DenseRetrievalScoringConfiguration} instance. + * + * @param weight Contribution to final score. + */ + public void setWeight(@Nullable final Integer weight) { + this.weight = weight; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * DenseRetrievalScoringConfiguration}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DenseRetrievalScoringConfiguration} + * 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( + "DenseRetrievalScoringConfiguration has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DenseRetrievalScoringConfiguration} 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 (weight != null) declaredFields.put("weight", weight); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DenseRetrievalScoringConfiguration} 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 DenseRetrievalScoringConfiguration denseRetrievalScoringConfiguration = + (DenseRetrievalScoringConfiguration) o; + return Objects.equals( + this.cloudSdkCustomFields, denseRetrievalScoringConfiguration.cloudSdkCustomFields) + && Objects.equals(this.enabled, denseRetrievalScoringConfiguration.enabled) + && Objects.equals(this.weight, denseRetrievalScoringConfiguration.weight); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, weight, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DenseRetrievalScoringConfiguration {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" weight: ").append(toIndentedString(weight)).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 DenseRetrievalScoringConfiguration} instance. No arguments are required. + */ + public static DenseRetrievalScoringConfiguration create() { + return new DenseRetrievalScoringConfiguration(); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentInput.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentInput.java index e8d8937e6..2a07fe952 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentInput.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentInput.java @@ -33,7 +33,7 @@ public class DocumentInput // CHECKSTYLE:ON { @JsonProperty("chunks") - private List chunks = new ArrayList<>(); + private List chunks = new ArrayList<>(); @JsonProperty("metadata") private List metadata = new ArrayList<>(); @@ -54,7 +54,7 @@ protected DocumentInput() {} * @return The same instance of this {@link DocumentInput} class */ @Nonnull - public DocumentInput chunks(@Nonnull final List chunks) { + public DocumentInput chunks(@Nonnull final List chunks) { this.chunks = chunks; return this; } @@ -66,7 +66,7 @@ public DocumentInput chunks(@Nonnull final List chunks) { * @return The same instance of type {@link DocumentInput} */ @Nonnull - public DocumentInput addChunksItem(@Nonnull final TextOnlyBaseChunk chunksItem) { + public DocumentInput addChunksItem(@Nonnull final TextOnlyBaseChunkCreate chunksItem) { if (this.chunks == null) { this.chunks = new ArrayList<>(); } @@ -80,7 +80,7 @@ public DocumentInput addChunksItem(@Nonnull final TextOnlyBaseChunk chunksItem) * @return chunks The chunks of this {@link DocumentInput} instance. */ @Nonnull - public List getChunks() { + public List getChunks() { return chunks; } @@ -89,7 +89,7 @@ public List getChunks() { * * @param chunks The chunks of this {@link DocumentInput} */ - public void setChunks(@Nonnull final List chunks) { + public void setChunks(@Nonnull final List chunks) { this.chunks = chunks; } @@ -100,7 +100,7 @@ public void setChunks(@Nonnull final List chunks) { * @return The same instance of this {@link DocumentInput} class */ @Nonnull - public DocumentInput metadata(@Nonnull final List metadata) { + public DocumentInput metadata(@Nullable final List metadata) { this.metadata = metadata; return this; } @@ -135,7 +135,7 @@ public List getMetadata() { * * @param metadata The metadata of this {@link DocumentInput} */ - public void setMetadata(@Nonnull final List metadata) { + public void setMetadata(@Nullable final List metadata) { this.metadata = metadata; } @@ -276,8 +276,7 @@ private String toIndentedString(final java.lang.Object o) { * with all required arguments. */ public static Builder create() { - return (chunks) -> - (metadata) -> (id) -> new DocumentInput().chunks(chunks).metadata(metadata).id(id); + return (chunks) -> (id) -> new DocumentInput().chunks(chunks).id(id); } /** Builder helper class. */ @@ -288,7 +287,7 @@ public interface Builder { * @param chunks The chunks of this {@link DocumentInput} * @return The DocumentInput builder. */ - Builder1 chunks(@Nonnull final List chunks); + Builder1 chunks(@Nonnull final List chunks); /** * Set the chunks of this {@link DocumentInput} instance. @@ -296,34 +295,13 @@ public interface Builder { * @param chunks The chunks of this {@link DocumentInput} * @return The DocumentInput builder. */ - default Builder1 chunks(@Nonnull final TextOnlyBaseChunk... chunks) { + default Builder1 chunks(@Nonnull final TextOnlyBaseChunkCreate... chunks) { return chunks(Arrays.asList(chunks)); } } /** Builder helper class. */ public interface Builder1 { - /** - * Set the metadata of this {@link DocumentInput} instance. - * - * @param metadata The metadata of this {@link DocumentInput} - * @return The DocumentInput builder. - */ - Builder2 metadata(@Nonnull final List metadata); - - /** - * Set the metadata of this {@link DocumentInput} instance. - * - * @param metadata The metadata of this {@link DocumentInput} - * @return The DocumentInput builder. - */ - default Builder2 metadata(@Nonnull final VectorDocumentKeyValueListPair... metadata) { - return metadata(Arrays.asList(metadata)); - } - } - - /** Builder helper class. */ - public interface Builder2 { /** * Set the id of this {@link DocumentInput} instance. * diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentKeyValueListPair.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentKeyValueListPair.java index 38a9c5cb7..a96618ba3 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentKeyValueListPair.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentKeyValueListPair.java @@ -13,10 +13,8 @@ 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; @@ -39,65 +37,8 @@ public class DocumentKeyValueListPair @JsonProperty("value") private List value = new ArrayList<>(); - /** Gets or Sets matchMode */ - public enum MatchModeEnum { - /** The ANY option of this DocumentKeyValueListPair */ - ANY("ANY"), - - /** The ALL option of this DocumentKeyValueListPair */ - ALL("ALL"), - - /** The UNKNOWN_DEFAULT_OPEN_API option of this DocumentKeyValueListPair */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - MatchModeEnum(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 DocumentKeyValueListPair - */ - @JsonCreator - @Nullable - public static MatchModeEnum fromValue(@Nonnull final String value) { - for (MatchModeEnum b : MatchModeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return null; - } - } - @JsonProperty("matchMode") - private MatchModeEnum matchMode; + private FilterMatchModeEnum matchMode; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -190,7 +131,7 @@ public void setValue(@Nonnull final List value) { * @return The same instance of this {@link DocumentKeyValueListPair} class */ @Nonnull - public DocumentKeyValueListPair matchMode(@Nullable final MatchModeEnum matchMode) { + public DocumentKeyValueListPair matchMode(@Nullable final FilterMatchModeEnum matchMode) { this.matchMode = matchMode; return this; } @@ -200,8 +141,8 @@ public DocumentKeyValueListPair matchMode(@Nullable final MatchModeEnum matchMod * * @return matchMode The matchMode of this {@link DocumentKeyValueListPair} instance. */ - @Nullable - public MatchModeEnum getMatchMode() { + @Nonnull + public FilterMatchModeEnum getMatchMode() { return matchMode; } @@ -210,7 +151,7 @@ public MatchModeEnum getMatchMode() { * * @param matchMode The matchMode of this {@link DocumentKeyValueListPair} */ - public void setMatchMode(@Nullable final MatchModeEnum matchMode) { + public void setMatchMode(@Nullable final FilterMatchModeEnum matchMode) { this.matchMode = matchMode; } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentResponse.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentResponse.java index 6cad13430..01aae16bf 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentResponse.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentResponse.java @@ -100,7 +100,7 @@ public void setChunks(@Nonnull final List chunks) { * @return The same instance of this {@link DocumentResponse} class */ @Nonnull - public DocumentResponse metadata(@Nonnull final List metadata) { + public DocumentResponse metadata(@Nullable final List metadata) { this.metadata = metadata; return this; } @@ -136,7 +136,7 @@ public List getMetadata() { * * @param metadata The metadata of this {@link DocumentResponse} */ - public void setMetadata(@Nonnull final List metadata) { + public void setMetadata(@Nullable final List metadata) { this.metadata = metadata; } @@ -277,8 +277,7 @@ private String toIndentedString(final java.lang.Object o) { * instance with all required arguments. */ public static Builder create() { - return (chunks) -> - (metadata) -> (id) -> new DocumentResponse().chunks(chunks).metadata(metadata).id(id); + return (chunks) -> (id) -> new DocumentResponse().chunks(chunks).id(id); } /** Builder helper class. */ @@ -304,27 +303,6 @@ default Builder1 chunks(@Nonnull final TextOnlyBaseChunk... chunks) { /** Builder helper class. */ public interface Builder1 { - /** - * Set the metadata of this {@link DocumentResponse} instance. - * - * @param metadata The metadata of this {@link DocumentResponse} - * @return The DocumentResponse builder. - */ - Builder2 metadata(@Nonnull final List metadata); - - /** - * Set the metadata of this {@link DocumentResponse} instance. - * - * @param metadata The metadata of this {@link DocumentResponse} - * @return The DocumentResponse builder. - */ - default Builder2 metadata(@Nonnull final VectorDocumentKeyValueListPair... metadata) { - return metadata(Arrays.asList(metadata)); - } - } - - /** Builder helper class. */ - public interface Builder2 { /** * Set the id of this {@link DocumentResponse} instance. * diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentsListResponse.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentsListResponse.java index 5531d854b..07459b6b1 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentsListResponse.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentsListResponse.java @@ -26,7 +26,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** A response containing documents created or updated, retrieved from the server. */ +/** A response containing documents retrieved from the server. */ // CHECKSTYLE:OFF public class DocumentsListResponse // CHECKSTYLE:ON diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Filter.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Filter.java new file mode 100644 index 000000000..f14167f6e --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Filter.java @@ -0,0 +1,570 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** Advanced filter expression for combining metadata filters with boolean logic */ +// CHECKSTYLE:OFF +public class Filter +// CHECKSTYLE:ON +{ + /** Boolean operator for combining filter conditions */ + public enum OperatorEnum { + /** The AND option of this Filter */ + AND("and"), + + /** The OR option of this Filter */ + OR("or"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this Filter */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + OperatorEnum(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 Filter + */ + @JsonCreator + @Nonnull + public static OperatorEnum fromValue(@Nonnull final String value) { + for (OperatorEnum b : OperatorEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("operator") + private OperatorEnum operator; + + @JsonProperty("left") + private Left1 left; + + @JsonProperty("right") + private Right1 right; + + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + /** Scope of the metadata filter (e.g., collection, document, chunk) */ + public enum ScopeEnum { + /** The COLLECTION option of this Filter */ + COLLECTION("collection"), + + /** The DOCUMENT option of this Filter */ + DOCUMENT("document"), + + /** The CHUNK option of this Filter */ + CHUNK("chunk"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this Filter */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ScopeEnum(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 Filter + */ + @JsonCreator + @Nonnull + public static ScopeEnum fromValue(@Nonnull final String value) { + for (ScopeEnum b : ScopeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("scope") + private ScopeEnum scope = ScopeEnum.DOCUMENT; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for Filter. */ + protected Filter() {} + + /** + * Set the operator of this {@link Filter} instance and return the same instance. + * + * @param operator Boolean operator for combining filter conditions + * @return The same instance of this {@link Filter} class + */ + @Nonnull + public Filter operator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + return this; + } + + /** + * Boolean operator for combining filter conditions + * + * @return operator The operator of this {@link Filter} instance. + */ + @Nonnull + public OperatorEnum getOperator() { + return operator; + } + + /** + * Set the operator of this {@link Filter} instance. + * + * @param operator Boolean operator for combining filter conditions + */ + public void setOperator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + } + + /** + * Set the left of this {@link Filter} instance and return the same instance. + * + * @param left The left of this {@link Filter} + * @return The same instance of this {@link Filter} class + */ + @Nonnull + public Filter left(@Nonnull final Left1 left) { + this.left = left; + return this; + } + + /** + * Get left + * + * @return left The left of this {@link Filter} instance. + */ + @Nonnull + public Left1 getLeft() { + return left; + } + + /** + * Set the left of this {@link Filter} instance. + * + * @param left The left of this {@link Filter} + */ + public void setLeft(@Nonnull final Left1 left) { + this.left = left; + } + + /** + * Set the right of this {@link Filter} instance and return the same instance. + * + * @param right The right of this {@link Filter} + * @return The same instance of this {@link Filter} class + */ + @Nonnull + public Filter right(@Nonnull final Right1 right) { + this.right = right; + return this; + } + + /** + * Get right + * + * @return right The right of this {@link Filter} instance. + */ + @Nonnull + public Right1 getRight() { + return right; + } + + /** + * Set the right of this {@link Filter} instance. + * + * @param right The right of this {@link Filter} + */ + public void setRight(@Nonnull final Right1 right) { + this.right = right; + } + + /** + * Set the key of this {@link Filter} instance and return the same instance. + * + * @param key The key of this {@link Filter} + * @return The same instance of this {@link Filter} class + */ + @Nonnull + public Filter key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link Filter} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link Filter} instance. + * + * @param key The key of this {@link Filter} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link Filter} instance and return the same instance. + * + * @param value The value of this {@link Filter} + * @return The same instance of this {@link Filter} class + */ + @Nonnull + public Filter value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link Filter}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link Filter} + */ + @Nonnull + public Filter 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 Filter} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link Filter} instance. + * + * @param value The value of this {@link Filter} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Set the scope of this {@link Filter} instance and return the same instance. + * + * @param scope Scope of the metadata filter (e.g., collection, document, chunk) + * @return The same instance of this {@link Filter} class + */ + @Nonnull + public Filter scope(@Nullable final ScopeEnum scope) { + this.scope = scope; + return this; + } + + /** + * Scope of the metadata filter (e.g., collection, document, chunk) + * + * @return scope The scope of this {@link Filter} instance. + */ + @Nonnull + public ScopeEnum getScope() { + return scope; + } + + /** + * Set the scope of this {@link Filter} instance. + * + * @param scope Scope of the metadata filter (e.g., collection, document, chunk) + */ + public void setScope(@Nullable final ScopeEnum scope) { + this.scope = scope; + } + + /** + * Get the names of the unrecognizable properties of the {@link Filter}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Filter} 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("Filter has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Filter} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (operator != null) declaredFields.put("operator", operator); + if (left != null) declaredFields.put("left", left); + if (right != null) declaredFields.put("right", right); + if (key != null) declaredFields.put("key", key); + if (value != null) declaredFields.put("value", value); + if (scope != null) declaredFields.put("scope", scope); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Filter} 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 Filter filter = (Filter) o; + return Objects.equals(this.cloudSdkCustomFields, filter.cloudSdkCustomFields) + && Objects.equals(this.operator, filter.operator) + && Objects.equals(this.left, filter.left) + && Objects.equals(this.right, filter.right) + && Objects.equals(this.key, filter.key) + && Objects.equals(this.value, filter.value) + && Objects.equals(this.scope, filter.scope); + } + + @Override + public int hashCode() { + return Objects.hash(operator, left, right, key, value, scope, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Filter {\n"); + sb.append(" operator: ").append(toIndentedString(operator)).append("\n"); + sb.append(" left: ").append(toIndentedString(left)).append("\n"); + sb.append(" right: ").append(toIndentedString(right)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).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 Filter} instance with + * all required arguments. + */ + public static Builder create() { + return (operator) -> + (left) -> + (right) -> + (key) -> + (value) -> + new Filter() + .operator(operator) + .left(left) + .right(right) + .key(key) + .value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the operator of this {@link Filter} instance. + * + * @param operator Boolean operator for combining filter conditions + * @return The Filter builder. + */ + Builder1 operator(@Nonnull final OperatorEnum operator); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the left of this {@link Filter} instance. + * + * @param left The left of this {@link Filter} + * @return The Filter builder. + */ + Builder2 left(@Nonnull final Left1 left); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the right of this {@link Filter} instance. + * + * @param right The right of this {@link Filter} + * @return The Filter builder. + */ + Builder3 right(@Nonnull final Right1 right); + } + + /** Builder helper class. */ + public interface Builder3 { + /** + * Set the key of this {@link Filter} instance. + * + * @param key The key of this {@link Filter} + * @return The Filter builder. + */ + Builder4 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder4 { + /** + * Set the value of this {@link Filter} instance. + * + * @param value The value of this {@link Filter} + * @return The Filter instance. + */ + Filter value(@Nonnull final List value); + + /** + * Set the value of this {@link Filter} instance. + * + * @param value The value of this {@link Filter} + * @return The Filter instance. + */ + default Filter value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/FilterMatchModeEnum.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/FilterMatchModeEnum.java new file mode 100644 index 000000000..74216976f --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/FilterMatchModeEnum.java @@ -0,0 +1,64 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.annotation.Nonnull; + +/** Gets or Sets FilterMatchModeEnum */ +public enum FilterMatchModeEnum { + ANY("ANY"), + + ALL("ALL"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + FilterMatchModeEnum(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 FilterMatchModeEnum fromValue(@Nonnull final String value) { + for (final FilterMatchModeEnum b : FilterMatchModeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/FiltersInner.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/FiltersInner.java new file mode 100644 index 000000000..6d8e31c7d --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/FiltersInner.java @@ -0,0 +1,635 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** FiltersInner */ +// CHECKSTYLE:OFF +public class FiltersInner +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + @JsonProperty("searchConfiguration") + private RetrievalSearchConfiguration searchConfiguration = new RetrievalSearchConfiguration(); + + @JsonProperty("dataRepositories") + private List dataRepositories = new ArrayList<>(Arrays.asList("*")); + + @JsonProperty("dataRepositoryType") + private DataRepositoryType dataRepositoryType; + + @JsonProperty("remoteName") + private String remoteName; + + @JsonProperty("dataRepositoryMetadata") + private List dataRepositoryMetadata = new ArrayList<>(); + + @JsonProperty("documentMetadata") + private List documentMetadata = new ArrayList<>(); + + @JsonProperty("chunkMetadata") + private List chunkMetadata = new ArrayList<>(); + + @JsonProperty("filter") + private RetrievalVectorSearchFilterFilter filter; + + @JsonProperty("scoringConfiguration") + private VectorScoringConfiguration scoringConfiguration; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for FiltersInner. */ + protected FiltersInner() {} + + /** + * Set the id of this {@link FiltersInner} instance and return the same instance. + * + * @param id Identifier of this RetrievalSearchFilter - unique per request. + * @return The same instance of this {@link FiltersInner} class + */ + @Nonnull + public FiltersInner id(@Nonnull final String id) { + this.id = id; + return this; + } + + /** + * Identifier of this RetrievalSearchFilter - unique per request. + * + * @return id The id of this {@link FiltersInner} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link FiltersInner} instance. + * + * @param id Identifier of this RetrievalSearchFilter - unique per request. + */ + public void setId(@Nonnull final String id) { + this.id = id; + } + + /** + * Set the searchConfiguration of this {@link FiltersInner} instance and return the same instance. + * + * @param searchConfiguration The searchConfiguration of this {@link FiltersInner} + * @return The same instance of this {@link FiltersInner} class + */ + @Nonnull + public FiltersInner searchConfiguration( + @Nullable final RetrievalSearchConfiguration searchConfiguration) { + this.searchConfiguration = searchConfiguration; + return this; + } + + /** + * Get searchConfiguration + * + * @return searchConfiguration The searchConfiguration of this {@link FiltersInner} instance. + */ + @Nullable + public RetrievalSearchConfiguration getSearchConfiguration() { + return searchConfiguration; + } + + /** + * Set the searchConfiguration of this {@link FiltersInner} instance. + * + * @param searchConfiguration The searchConfiguration of this {@link FiltersInner} + */ + public void setSearchConfiguration( + @Nullable final RetrievalSearchConfiguration searchConfiguration) { + this.searchConfiguration = searchConfiguration; + } + + /** + * Set the dataRepositories of this {@link FiltersInner} 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 FiltersInner} class + */ + @Nonnull + public FiltersInner dataRepositories(@Nullable final List dataRepositories) { + this.dataRepositories = dataRepositories; + return this; + } + + /** + * Add one dataRepositories instance to this {@link FiltersInner}. + * + * @param dataRepositoriesItem The dataRepositories that should be added + * @return The same instance of type {@link FiltersInner} + */ + @Nonnull + public FiltersInner 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 FiltersInner} instance. + */ + @Nonnull + public List getDataRepositories() { + return dataRepositories; + } + + /** + * Set the dataRepositories of this {@link FiltersInner} 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 FiltersInner} instance and return the same instance. + * + * @param dataRepositoryType The dataRepositoryType of this {@link FiltersInner} + * @return The same instance of this {@link FiltersInner} class + */ + @Nonnull + public FiltersInner dataRepositoryType(@Nonnull final DataRepositoryType dataRepositoryType) { + this.dataRepositoryType = dataRepositoryType; + return this; + } + + /** + * Get dataRepositoryType + * + * @return dataRepositoryType The dataRepositoryType of this {@link FiltersInner} instance. + */ + @Nonnull + public DataRepositoryType getDataRepositoryType() { + return dataRepositoryType; + } + + /** + * Set the dataRepositoryType of this {@link FiltersInner} instance. + * + * @param dataRepositoryType The dataRepositoryType of this {@link FiltersInner} + */ + public void setDataRepositoryType(@Nonnull final DataRepositoryType dataRepositoryType) { + this.dataRepositoryType = dataRepositoryType; + } + + /** + * Set the remoteName of this {@link FiltersInner} instance and return the same instance. + * + * @param remoteName Destination Name of remote instance. + * @return The same instance of this {@link FiltersInner} class + */ + @Nonnull + public FiltersInner remoteName(@Nullable final String remoteName) { + this.remoteName = remoteName; + return this; + } + + /** + * Destination Name of remote instance. + * + * @return remoteName The remoteName of this {@link FiltersInner} instance. + */ + @Nullable + public String getRemoteName() { + return remoteName; + } + + /** + * Set the remoteName of this {@link FiltersInner} instance. + * + * @param remoteName Destination Name of remote instance. + */ + public void setRemoteName(@Nullable final String remoteName) { + this.remoteName = remoteName; + } + + /** + * Set the dataRepositoryMetadata of this {@link FiltersInner} 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 FiltersInner} class + */ + @Nonnull + public FiltersInner dataRepositoryMetadata( + @Nullable final List dataRepositoryMetadata) { + this.dataRepositoryMetadata = dataRepositoryMetadata; + return this; + } + + /** + * Add one dataRepositoryMetadata instance to this {@link FiltersInner}. + * + * @param dataRepositoryMetadataItem The dataRepositoryMetadata that should be added + * @return The same instance of type {@link FiltersInner} + */ + @Nonnull + public FiltersInner addDataRepositoryMetadataItem( + @Nonnull final RetrievalKeyValueListPair 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 FiltersInner} + * instance. + */ + @Nonnull + public List getDataRepositoryMetadata() { + return dataRepositoryMetadata; + } + + /** + * Set the dataRepositoryMetadata of this {@link FiltersInner} 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 FiltersInner} 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 FiltersInner} class + */ + @Nonnull + public FiltersInner documentMetadata( + @Nullable final List documentMetadata) { + this.documentMetadata = documentMetadata; + return this; + } + + /** + * Add one documentMetadata instance to this {@link FiltersInner}. + * + * @param documentMetadataItem The documentMetadata that should be added + * @return The same instance of type {@link FiltersInner} + */ + @Nonnull + public FiltersInner addDocumentMetadataItem( + @Nonnull final RetrievalSearchDocumentKeyValueListPair 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 FiltersInner} instance. + */ + @Nonnull + public List getDocumentMetadata() { + return documentMetadata; + } + + /** + * Set the documentMetadata of this {@link FiltersInner} 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 FiltersInner} 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 FiltersInner} class + */ + @Nonnull + public FiltersInner chunkMetadata(@Nullable final List chunkMetadata) { + this.chunkMetadata = chunkMetadata; + return this; + } + + /** + * Add one chunkMetadata instance to this {@link FiltersInner}. + * + * @param chunkMetadataItem The chunkMetadata that should be added + * @return The same instance of type {@link FiltersInner} + */ + @Nonnull + public FiltersInner addChunkMetadataItem( + @Nonnull final RetrievalKeyValueListPair 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 FiltersInner} instance. + */ + @Nonnull + public List getChunkMetadata() { + return chunkMetadata; + } + + /** + * Set the chunkMetadata of this {@link FiltersInner} instance. + * + * @param chunkMetadata Restrict chunks considered during search to those with the given metadata. + */ + public void setChunkMetadata(@Nullable final List chunkMetadata) { + this.chunkMetadata = chunkMetadata; + } + + /** + * Set the filter of this {@link FiltersInner} instance and return the same instance. + * + * @param filter The filter of this {@link FiltersInner} + * @return The same instance of this {@link FiltersInner} class + */ + @Nonnull + public FiltersInner filter(@Nullable final RetrievalVectorSearchFilterFilter filter) { + this.filter = filter; + return this; + } + + /** + * Get filter + * + * @return filter The filter of this {@link FiltersInner} instance. + */ + @Nullable + public RetrievalVectorSearchFilterFilter getFilter() { + return filter; + } + + /** + * Set the filter of this {@link FiltersInner} instance. + * + * @param filter The filter of this {@link FiltersInner} + */ + public void setFilter(@Nullable final RetrievalVectorSearchFilterFilter filter) { + this.filter = filter; + } + + /** + * Set the scoringConfiguration of this {@link FiltersInner} instance and return the same + * instance. + * + * @param scoringConfiguration The scoringConfiguration of this {@link FiltersInner} + * @return The same instance of this {@link FiltersInner} class + */ + @Nonnull + public FiltersInner scoringConfiguration( + @Nullable final VectorScoringConfiguration scoringConfiguration) { + this.scoringConfiguration = scoringConfiguration; + return this; + } + + /** + * Get scoringConfiguration + * + * @return scoringConfiguration The scoringConfiguration of this {@link FiltersInner} instance. + */ + @Nonnull + public VectorScoringConfiguration getScoringConfiguration() { + return scoringConfiguration; + } + + /** + * Set the scoringConfiguration of this {@link FiltersInner} instance. + * + * @param scoringConfiguration The scoringConfiguration of this {@link FiltersInner} + */ + public void setScoringConfiguration( + @Nullable final VectorScoringConfiguration scoringConfiguration) { + this.scoringConfiguration = scoringConfiguration; + } + + /** + * Get the names of the unrecognizable properties of the {@link FiltersInner}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link FiltersInner} 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("FiltersInner has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link FiltersInner} 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 (searchConfiguration != null) declaredFields.put("searchConfiguration", searchConfiguration); + if (dataRepositories != null) declaredFields.put("dataRepositories", dataRepositories); + if (dataRepositoryType != null) declaredFields.put("dataRepositoryType", dataRepositoryType); + if (remoteName != null) declaredFields.put("remoteName", remoteName); + if (dataRepositoryMetadata != null) + declaredFields.put("dataRepositoryMetadata", dataRepositoryMetadata); + if (documentMetadata != null) declaredFields.put("documentMetadata", documentMetadata); + if (chunkMetadata != null) declaredFields.put("chunkMetadata", chunkMetadata); + if (filter != null) declaredFields.put("filter", filter); + if (scoringConfiguration != null) + declaredFields.put("scoringConfiguration", scoringConfiguration); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link FiltersInner} 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 FiltersInner filtersInner = (FiltersInner) o; + return Objects.equals(this.cloudSdkCustomFields, filtersInner.cloudSdkCustomFields) + && Objects.equals(this.id, filtersInner.id) + && Objects.equals(this.searchConfiguration, filtersInner.searchConfiguration) + && Objects.equals(this.dataRepositories, filtersInner.dataRepositories) + && Objects.equals(this.dataRepositoryType, filtersInner.dataRepositoryType) + && Objects.equals(this.remoteName, filtersInner.remoteName) + && Objects.equals(this.dataRepositoryMetadata, filtersInner.dataRepositoryMetadata) + && Objects.equals(this.documentMetadata, filtersInner.documentMetadata) + && Objects.equals(this.chunkMetadata, filtersInner.chunkMetadata) + && Objects.equals(this.filter, filtersInner.filter) + && Objects.equals(this.scoringConfiguration, filtersInner.scoringConfiguration); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + searchConfiguration, + dataRepositories, + dataRepositoryType, + remoteName, + dataRepositoryMetadata, + documentMetadata, + chunkMetadata, + filter, + scoringConfiguration, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class FiltersInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" searchConfiguration: ") + .append(toIndentedString(searchConfiguration)) + .append("\n"); + sb.append(" dataRepositories: ").append(toIndentedString(dataRepositories)).append("\n"); + sb.append(" dataRepositoryType: ").append(toIndentedString(dataRepositoryType)).append("\n"); + sb.append(" remoteName: ").append(toIndentedString(remoteName)).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"); + sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); + sb.append(" scoringConfiguration: ") + .append(toIndentedString(scoringConfiguration)) + .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 FiltersInner} instance + * with all required arguments. + */ + public static Builder create() { + return (id) -> + (dataRepositoryType) -> new FiltersInner().id(id).dataRepositoryType(dataRepositoryType); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link FiltersInner} instance. + * + * @param id Identifier of this RetrievalSearchFilter - unique per request. + * @return The FiltersInner builder. + */ + Builder1 id(@Nonnull final String id); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the dataRepositoryType of this {@link FiltersInner} instance. + * + * @param dataRepositoryType The dataRepositoryType of this {@link FiltersInner} + * @return The FiltersInner instance. + */ + FiltersInner dataRepositoryType(@Nonnull final DataRepositoryType dataRepositoryType); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/KeyWordRetrievalScoringConfiguration.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/KeyWordRetrievalScoringConfiguration.java new file mode 100644 index 000000000..b4d8edc88 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/KeyWordRetrievalScoringConfiguration.java @@ -0,0 +1,262 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** KeyWordRetrievalScoringConfiguration */ +// CHECKSTYLE:OFF +public class KeyWordRetrievalScoringConfiguration +// CHECKSTYLE:ON +{ + @JsonProperty("enabled") + private Boolean enabled = true; + + @JsonProperty("weight") + private Integer weight = 1; + + @JsonProperty("extractKeyWordsFromQuery") + private Boolean extractKeyWordsFromQuery = false; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for KeyWordRetrievalScoringConfiguration. */ + protected KeyWordRetrievalScoringConfiguration() {} + + /** + * Set the enabled of this {@link KeyWordRetrievalScoringConfiguration} instance and return the + * same instance. + * + * @param enabled Enable dense retrieval. + * @return The same instance of this {@link KeyWordRetrievalScoringConfiguration} class + */ + @Nonnull + public KeyWordRetrievalScoringConfiguration enabled(@Nullable final Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Enable dense retrieval. + * + * @return enabled The enabled of this {@link KeyWordRetrievalScoringConfiguration} instance. + */ + @Nullable + public Boolean isEnabled() { + return enabled; + } + + /** + * Set the enabled of this {@link KeyWordRetrievalScoringConfiguration} instance. + * + * @param enabled Enable dense retrieval. + */ + public void setEnabled(@Nullable final Boolean enabled) { + this.enabled = enabled; + } + + /** + * Set the weight of this {@link KeyWordRetrievalScoringConfiguration} instance and return the + * same instance. + * + * @param weight Contribution to final score. + * @return The same instance of this {@link KeyWordRetrievalScoringConfiguration} class + */ + @Nonnull + public KeyWordRetrievalScoringConfiguration weight(@Nullable final Integer weight) { + this.weight = weight; + return this; + } + + /** + * Contribution to final score. + * + * @return weight The weight of this {@link KeyWordRetrievalScoringConfiguration} instance. + */ + @Nullable + public Integer getWeight() { + return weight; + } + + /** + * Set the weight of this {@link KeyWordRetrievalScoringConfiguration} instance. + * + * @param weight Contribution to final score. + */ + public void setWeight(@Nullable final Integer weight) { + this.weight = weight; + } + + /** + * Set the extractKeyWordsFromQuery of this {@link KeyWordRetrievalScoringConfiguration} instance + * and return the same instance. + * + * @param extractKeyWordsFromQuery Extract Keywords from Query. + * @return The same instance of this {@link KeyWordRetrievalScoringConfiguration} class + */ + @Nonnull + public KeyWordRetrievalScoringConfiguration extractKeyWordsFromQuery( + @Nullable final Boolean extractKeyWordsFromQuery) { + this.extractKeyWordsFromQuery = extractKeyWordsFromQuery; + return this; + } + + /** + * Extract Keywords from Query. + * + * @return extractKeyWordsFromQuery The extractKeyWordsFromQuery of this {@link + * KeyWordRetrievalScoringConfiguration} instance. + */ + @Nullable + public Boolean isExtractKeyWordsFromQuery() { + return extractKeyWordsFromQuery; + } + + /** + * Set the extractKeyWordsFromQuery of this {@link KeyWordRetrievalScoringConfiguration} instance. + * + * @param extractKeyWordsFromQuery Extract Keywords from Query. + */ + public void setExtractKeyWordsFromQuery(@Nullable final Boolean extractKeyWordsFromQuery) { + this.extractKeyWordsFromQuery = extractKeyWordsFromQuery; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * KeyWordRetrievalScoringConfiguration}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link + * KeyWordRetrievalScoringConfiguration} 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( + "KeyWordRetrievalScoringConfiguration has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link KeyWordRetrievalScoringConfiguration} 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 (weight != null) declaredFields.put("weight", weight); + if (extractKeyWordsFromQuery != null) + declaredFields.put("extractKeyWordsFromQuery", extractKeyWordsFromQuery); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link KeyWordRetrievalScoringConfiguration} 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 KeyWordRetrievalScoringConfiguration keyWordRetrievalScoringConfiguration = + (KeyWordRetrievalScoringConfiguration) o; + return Objects.equals( + this.cloudSdkCustomFields, keyWordRetrievalScoringConfiguration.cloudSdkCustomFields) + && Objects.equals(this.enabled, keyWordRetrievalScoringConfiguration.enabled) + && Objects.equals(this.weight, keyWordRetrievalScoringConfiguration.weight) + && Objects.equals( + this.extractKeyWordsFromQuery, + keyWordRetrievalScoringConfiguration.extractKeyWordsFromQuery); + } + + @Override + public int hashCode() { + return Objects.hash(enabled, weight, extractKeyWordsFromQuery, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class KeyWordRetrievalScoringConfiguration {\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" weight: ").append(toIndentedString(weight)).append("\n"); + sb.append(" extractKeyWordsFromQuery: ") + .append(toIndentedString(extractKeyWordsFromQuery)) + .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 KeyWordRetrievalScoringConfiguration} instance. No arguments are required. + */ + public static KeyWordRetrievalScoringConfiguration create() { + return new KeyWordRetrievalScoringConfiguration(); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Left.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Left.java new file mode 100644 index 000000000..99c43cbcb --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Left.java @@ -0,0 +1,565 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** Left */ +// CHECKSTYLE:OFF +public class Left +// CHECKSTYLE:ON +{ + /** Gets or Sets operator */ + public enum OperatorEnum { + /** The AND option of this Left */ + AND("and"), + + /** The OR option of this Left */ + OR("or"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this Left */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + OperatorEnum(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 Left + */ + @JsonCreator + @Nonnull + public static OperatorEnum fromValue(@Nonnull final String value) { + for (OperatorEnum b : OperatorEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("operator") + private OperatorEnum operator; + + @JsonProperty("left") + private Left left; + + @JsonProperty("right") + private Right right; + + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + /** Gets or Sets scope */ + public enum ScopeEnum { + /** The REPOSITORY option of this Left */ + REPOSITORY("repository"), + + /** The DOCUMENT option of this Left */ + DOCUMENT("document"), + + /** The CHUNK option of this Left */ + CHUNK("chunk"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this Left */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ScopeEnum(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 Left + */ + @JsonCreator + @Nonnull + public static ScopeEnum fromValue(@Nonnull final String value) { + for (ScopeEnum b : ScopeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("scope") + private ScopeEnum scope = ScopeEnum.DOCUMENT; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for Left. */ + protected Left() {} + + /** + * Set the operator of this {@link Left} instance and return the same instance. + * + * @param operator The operator of this {@link Left} + * @return The same instance of this {@link Left} class + */ + @Nonnull + public Left operator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + return this; + } + + /** + * Get operator + * + * @return operator The operator of this {@link Left} instance. + */ + @Nonnull + public OperatorEnum getOperator() { + return operator; + } + + /** + * Set the operator of this {@link Left} instance. + * + * @param operator The operator of this {@link Left} + */ + public void setOperator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + } + + /** + * Set the left of this {@link Left} instance and return the same instance. + * + * @param left The left of this {@link Left} + * @return The same instance of this {@link Left} class + */ + @Nonnull + public Left left(@Nonnull final Left left) { + this.left = left; + return this; + } + + /** + * Get left + * + * @return left The left of this {@link Left} instance. + */ + @Nonnull + public Left getLeft() { + return left; + } + + /** + * Set the left of this {@link Left} instance. + * + * @param left The left of this {@link Left} + */ + public void setLeft(@Nonnull final Left left) { + this.left = left; + } + + /** + * Set the right of this {@link Left} instance and return the same instance. + * + * @param right The right of this {@link Left} + * @return The same instance of this {@link Left} class + */ + @Nonnull + public Left right(@Nonnull final Right right) { + this.right = right; + return this; + } + + /** + * Get right + * + * @return right The right of this {@link Left} instance. + */ + @Nonnull + public Right getRight() { + return right; + } + + /** + * Set the right of this {@link Left} instance. + * + * @param right The right of this {@link Left} + */ + public void setRight(@Nonnull final Right right) { + this.right = right; + } + + /** + * Set the key of this {@link Left} instance and return the same instance. + * + * @param key The key of this {@link Left} + * @return The same instance of this {@link Left} class + */ + @Nonnull + public Left key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link Left} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link Left} instance. + * + * @param key The key of this {@link Left} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link Left} instance and return the same instance. + * + * @param value The value of this {@link Left} + * @return The same instance of this {@link Left} class + */ + @Nonnull + public Left value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link Left}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link Left} + */ + @Nonnull + public Left 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 Left} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link Left} instance. + * + * @param value The value of this {@link Left} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Set the scope of this {@link Left} instance and return the same instance. + * + * @param scope The scope of this {@link Left} + * @return The same instance of this {@link Left} class + */ + @Nonnull + public Left scope(@Nullable final ScopeEnum scope) { + this.scope = scope; + return this; + } + + /** + * Get scope + * + * @return scope The scope of this {@link Left} instance. + */ + @Nonnull + public ScopeEnum getScope() { + return scope; + } + + /** + * Set the scope of this {@link Left} instance. + * + * @param scope The scope of this {@link Left} + */ + public void setScope(@Nullable final ScopeEnum scope) { + this.scope = scope; + } + + /** + * Get the names of the unrecognizable properties of the {@link Left}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Left} 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("Left has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Left} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (operator != null) declaredFields.put("operator", operator); + if (left != null) declaredFields.put("left", left); + if (right != null) declaredFields.put("right", right); + if (key != null) declaredFields.put("key", key); + if (value != null) declaredFields.put("value", value); + if (scope != null) declaredFields.put("scope", scope); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Left} 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 Left left = (Left) o; + return Objects.equals(this.cloudSdkCustomFields, left.cloudSdkCustomFields) + && Objects.equals(this.operator, left.operator) + && Objects.equals(this.left, left.left) + && Objects.equals(this.right, left.right) + && Objects.equals(this.key, left.key) + && Objects.equals(this.value, left.value) + && Objects.equals(this.scope, left.scope); + } + + @Override + public int hashCode() { + return Objects.hash(operator, left, right, key, value, scope, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Left {\n"); + sb.append(" operator: ").append(toIndentedString(operator)).append("\n"); + sb.append(" left: ").append(toIndentedString(left)).append("\n"); + sb.append(" right: ").append(toIndentedString(right)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).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 Left} instance with all + * required arguments. + */ + public static Builder create() { + return (operator) -> + (left) -> + (right) -> + (key) -> + (value) -> + new Left().operator(operator).left(left).right(right).key(key).value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the operator of this {@link Left} instance. + * + * @param operator The operator of this {@link Left} + * @return The Left builder. + */ + Builder1 operator(@Nonnull final OperatorEnum operator); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the left of this {@link Left} instance. + * + * @param left The left of this {@link Left} + * @return The Left builder. + */ + Builder2 left(@Nonnull final Left left); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the right of this {@link Left} instance. + * + * @param right The right of this {@link Left} + * @return The Left builder. + */ + Builder3 right(@Nonnull final Right right); + } + + /** Builder helper class. */ + public interface Builder3 { + /** + * Set the key of this {@link Left} instance. + * + * @param key The key of this {@link Left} + * @return The Left builder. + */ + Builder4 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder4 { + /** + * Set the value of this {@link Left} instance. + * + * @param value The value of this {@link Left} + * @return The Left instance. + */ + Left value(@Nonnull final List value); + + /** + * Set the value of this {@link Left} instance. + * + * @param value The value of this {@link Left} + * @return The Left instance. + */ + default Left value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Left1.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Left1.java new file mode 100644 index 000000000..568fc2dc7 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Left1.java @@ -0,0 +1,570 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** Left operand of the boolean expression */ +// CHECKSTYLE:OFF +public class Left1 +// CHECKSTYLE:ON +{ + /** Boolean operator for combining filter conditions */ + public enum OperatorEnum { + /** The AND option of this Left1 */ + AND("and"), + + /** The OR option of this Left1 */ + OR("or"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this Left1 */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + OperatorEnum(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 Left1 + */ + @JsonCreator + @Nonnull + public static OperatorEnum fromValue(@Nonnull final String value) { + for (OperatorEnum b : OperatorEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("operator") + private OperatorEnum operator; + + @JsonProperty("left") + private Left1 left; + + @JsonProperty("right") + private Right1 right; + + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + /** Scope of the metadata filter (e.g., collection, document, chunk) */ + public enum ScopeEnum { + /** The COLLECTION option of this Left1 */ + COLLECTION("collection"), + + /** The DOCUMENT option of this Left1 */ + DOCUMENT("document"), + + /** The CHUNK option of this Left1 */ + CHUNK("chunk"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this Left1 */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ScopeEnum(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 Left1 + */ + @JsonCreator + @Nonnull + public static ScopeEnum fromValue(@Nonnull final String value) { + for (ScopeEnum b : ScopeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("scope") + private ScopeEnum scope = ScopeEnum.DOCUMENT; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for Left1. */ + protected Left1() {} + + /** + * Set the operator of this {@link Left1} instance and return the same instance. + * + * @param operator Boolean operator for combining filter conditions + * @return The same instance of this {@link Left1} class + */ + @Nonnull + public Left1 operator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + return this; + } + + /** + * Boolean operator for combining filter conditions + * + * @return operator The operator of this {@link Left1} instance. + */ + @Nonnull + public OperatorEnum getOperator() { + return operator; + } + + /** + * Set the operator of this {@link Left1} instance. + * + * @param operator Boolean operator for combining filter conditions + */ + public void setOperator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + } + + /** + * Set the left of this {@link Left1} instance and return the same instance. + * + * @param left The left of this {@link Left1} + * @return The same instance of this {@link Left1} class + */ + @Nonnull + public Left1 left(@Nonnull final Left1 left) { + this.left = left; + return this; + } + + /** + * Get left + * + * @return left The left of this {@link Left1} instance. + */ + @Nonnull + public Left1 getLeft() { + return left; + } + + /** + * Set the left of this {@link Left1} instance. + * + * @param left The left of this {@link Left1} + */ + public void setLeft(@Nonnull final Left1 left) { + this.left = left; + } + + /** + * Set the right of this {@link Left1} instance and return the same instance. + * + * @param right The right of this {@link Left1} + * @return The same instance of this {@link Left1} class + */ + @Nonnull + public Left1 right(@Nonnull final Right1 right) { + this.right = right; + return this; + } + + /** + * Get right + * + * @return right The right of this {@link Left1} instance. + */ + @Nonnull + public Right1 getRight() { + return right; + } + + /** + * Set the right of this {@link Left1} instance. + * + * @param right The right of this {@link Left1} + */ + public void setRight(@Nonnull final Right1 right) { + this.right = right; + } + + /** + * Set the key of this {@link Left1} instance and return the same instance. + * + * @param key The key of this {@link Left1} + * @return The same instance of this {@link Left1} class + */ + @Nonnull + public Left1 key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link Left1} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link Left1} instance. + * + * @param key The key of this {@link Left1} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link Left1} instance and return the same instance. + * + * @param value The value of this {@link Left1} + * @return The same instance of this {@link Left1} class + */ + @Nonnull + public Left1 value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link Left1}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link Left1} + */ + @Nonnull + public Left1 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 Left1} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link Left1} instance. + * + * @param value The value of this {@link Left1} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Set the scope of this {@link Left1} instance and return the same instance. + * + * @param scope Scope of the metadata filter (e.g., collection, document, chunk) + * @return The same instance of this {@link Left1} class + */ + @Nonnull + public Left1 scope(@Nullable final ScopeEnum scope) { + this.scope = scope; + return this; + } + + /** + * Scope of the metadata filter (e.g., collection, document, chunk) + * + * @return scope The scope of this {@link Left1} instance. + */ + @Nonnull + public ScopeEnum getScope() { + return scope; + } + + /** + * Set the scope of this {@link Left1} instance. + * + * @param scope Scope of the metadata filter (e.g., collection, document, chunk) + */ + public void setScope(@Nullable final ScopeEnum scope) { + this.scope = scope; + } + + /** + * Get the names of the unrecognizable properties of the {@link Left1}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Left1} 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("Left1 has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Left1} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (operator != null) declaredFields.put("operator", operator); + if (left != null) declaredFields.put("left", left); + if (right != null) declaredFields.put("right", right); + if (key != null) declaredFields.put("key", key); + if (value != null) declaredFields.put("value", value); + if (scope != null) declaredFields.put("scope", scope); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Left1} 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 Left1 left1 = (Left1) o; + return Objects.equals(this.cloudSdkCustomFields, left1.cloudSdkCustomFields) + && Objects.equals(this.operator, left1.operator) + && Objects.equals(this.left, left1.left) + && Objects.equals(this.right, left1.right) + && Objects.equals(this.key, left1.key) + && Objects.equals(this.value, left1.value) + && Objects.equals(this.scope, left1.scope); + } + + @Override + public int hashCode() { + return Objects.hash(operator, left, right, key, value, scope, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Left1 {\n"); + sb.append(" operator: ").append(toIndentedString(operator)).append("\n"); + sb.append(" left: ").append(toIndentedString(left)).append("\n"); + sb.append(" right: ").append(toIndentedString(right)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).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 Left1} instance with + * all required arguments. + */ + public static Builder create() { + return (operator) -> + (left) -> + (right) -> + (key) -> + (value) -> + new Left1() + .operator(operator) + .left(left) + .right(right) + .key(key) + .value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the operator of this {@link Left1} instance. + * + * @param operator Boolean operator for combining filter conditions + * @return The Left1 builder. + */ + Builder1 operator(@Nonnull final OperatorEnum operator); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the left of this {@link Left1} instance. + * + * @param left The left of this {@link Left1} + * @return The Left1 builder. + */ + Builder2 left(@Nonnull final Left1 left); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the right of this {@link Left1} instance. + * + * @param right The right of this {@link Left1} + * @return The Left1 builder. + */ + Builder3 right(@Nonnull final Right1 right); + } + + /** Builder helper class. */ + public interface Builder3 { + /** + * Set the key of this {@link Left1} instance. + * + * @param key The key of this {@link Left1} + * @return The Left1 builder. + */ + Builder4 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder4 { + /** + * Set the value of this {@link Left1} instance. + * + * @param value The value of this {@link Left1} + * @return The Left1 instance. + */ + Left1 value(@Nonnull final List value); + + /** + * Set the value of this {@link Left1} instance. + * + * @param value The value of this {@link Left1} + * @return The Left1 instance. + */ + default Left1 value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/LocationInner.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/LocationInner.java new file mode 100644 index 000000000..1f72e5aa3 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/LocationInner.java @@ -0,0 +1,49 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.model; + +import javax.annotation.Nonnull; + +/** LocationInner */ +public interface LocationInner { + /** Helper class to create {@code String } that implements {@link LocationInner}. */ + record InnerString(@com.fasterxml.jackson.annotation.JsonValue @Nonnull String value) + implements LocationInner {} + + /** + * Creator to enable deserialization of {@code 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 {@code Integer } that implements {@link LocationInner}. */ + record InnerInteger(@com.fasterxml.jackson.annotation.JsonValue @Nonnull Integer value) + implements LocationInner {} + + /** + * Creator to enable deserialization of {@code Integer }. + * + * @param val the value to use + * @return a new instance of {@link InnerInteger}. + */ + @com.fasterxml.jackson.annotation.JsonCreator + @Nonnull + static InnerInteger create(@Nonnull final Integer val) { + return new InnerInteger(val); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyReranker.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyReranker.java new file mode 100644 index 000000000..960d24c33 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyReranker.java @@ -0,0 +1,369 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** + * The MergeStrategyReranker will call a reranker LLM to merge the given PerFilterSearchResult + * instances. This strategy adds latency, but yields good results. + */ +// CHECKSTYLE:OFF +public class MergeStrategyReranker + implements RetrievalSearchInputPostProcessingInnerStrategy, Strategy +// CHECKSTYLE:ON +{ + @JsonProperty("type") + private MergeStrategyType type; + + /** The RerankerModel to use. */ + public enum ModelEnum { + /** The COHERE_3_5 option of this MergeStrategyReranker */ + COHERE_3_5("cohere-3.5"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this MergeStrategyReranker */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ModelEnum(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 MergeStrategyReranker + */ + @JsonCreator + @Nullable + public static ModelEnum fromValue(@Nonnull final String value) { + for (ModelEnum b : ModelEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } + } + + @JsonProperty("model") + private ModelEnum model = ModelEnum.COHERE_3_5; + + @JsonProperty("boosting") + private List boosting; + + @JsonProperty("includeAllMetaData") + private Boolean includeAllMetaData = false; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MergeStrategyReranker. */ + protected MergeStrategyReranker() {} + + /** + * Set the type of this {@link MergeStrategyReranker} instance and return the same instance. + * + * @param type The type of this {@link MergeStrategyReranker} + * @return The same instance of this {@link MergeStrategyReranker} class + */ + @Nonnull + public MergeStrategyReranker type(@Nullable final MergeStrategyType type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link MergeStrategyReranker} instance. + */ + @Nonnull + public MergeStrategyType getType() { + return type; + } + + /** + * Set the type of this {@link MergeStrategyReranker} instance. + * + * @param type The type of this {@link MergeStrategyReranker} + */ + public void setType(@Nullable final MergeStrategyType type) { + this.type = type; + } + + /** + * Set the model of this {@link MergeStrategyReranker} instance and return the same instance. + * + * @param model The RerankerModel to use. + * @return The same instance of this {@link MergeStrategyReranker} class + */ + @Nonnull + public MergeStrategyReranker model(@Nullable final ModelEnum model) { + this.model = model; + return this; + } + + /** + * The RerankerModel to use. + * + * @return model The model of this {@link MergeStrategyReranker} instance. + */ + @Nullable + public ModelEnum getModel() { + return model; + } + + /** + * Set the model of this {@link MergeStrategyReranker} instance. + * + * @param model The RerankerModel to use. + */ + public void setModel(@Nullable final ModelEnum model) { + this.model = model; + } + + /** + * Set the boosting of this {@link MergeStrategyReranker} instance and return the same instance. + * + * @param boosting Key-value pairs to be included in the ranking process, to boost related chunks + * according to chunk content and metadata, if includeMetaData is true. + * @return The same instance of this {@link MergeStrategyReranker} class + */ + @Nonnull + public MergeStrategyReranker boosting( + @Nullable final List boosting) { + this.boosting = boosting; + return this; + } + + /** + * Add one boosting instance to this {@link MergeStrategyReranker}. + * + * @param boostingItem The boosting that should be added + * @return The same instance of type {@link MergeStrategyReranker} + */ + @Nonnull + public MergeStrategyReranker addBoostingItem( + @Nonnull final MergeStrategyRerankerBoostingInner boostingItem) { + if (this.boosting == null) { + this.boosting = new ArrayList<>(); + } + this.boosting.add(boostingItem); + return this; + } + + /** + * Key-value pairs to be included in the ranking process, to boost related chunks according to + * chunk content and metadata, if includeMetaData is true. + * + * @return boosting The boosting of this {@link MergeStrategyReranker} instance. + */ + @Nullable + public List getBoosting() { + return boosting; + } + + /** + * Set the boosting of this {@link MergeStrategyReranker} instance. + * + * @param boosting Key-value pairs to be included in the ranking process, to boost related chunks + * according to chunk content and metadata, if includeMetaData is true. + */ + public void setBoosting(@Nullable final List boosting) { + this.boosting = boosting; + } + + /** + * Set the includeAllMetaData of this {@link MergeStrategyReranker} instance and return the same + * instance. + * + * @param includeAllMetaData If true, document and chunk metadata are sent to the reranker LLM + * along with the text content of the chunk. + * @return The same instance of this {@link MergeStrategyReranker} class + */ + @Nonnull + public MergeStrategyReranker includeAllMetaData(@Nullable final Boolean includeAllMetaData) { + this.includeAllMetaData = includeAllMetaData; + return this; + } + + /** + * If true, document and chunk metadata are sent to the reranker LLM along with the text content + * of the chunk. + * + * @return includeAllMetaData The includeAllMetaData of this {@link MergeStrategyReranker} + * instance. + */ + @Nullable + public Boolean isIncludeAllMetaData() { + return includeAllMetaData; + } + + /** + * Set the includeAllMetaData of this {@link MergeStrategyReranker} instance. + * + * @param includeAllMetaData If true, document and chunk metadata are sent to the reranker LLM + * along with the text content of the chunk. + */ + public void setIncludeAllMetaData(@Nullable final Boolean includeAllMetaData) { + this.includeAllMetaData = includeAllMetaData; + } + + /** + * Get the names of the unrecognizable properties of the {@link MergeStrategyReranker}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MergeStrategyReranker} 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( + "MergeStrategyReranker has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MergeStrategyReranker} 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 (model != null) declaredFields.put("model", model); + if (boosting != null) declaredFields.put("boosting", boosting); + if (includeAllMetaData != null) declaredFields.put("includeAllMetaData", includeAllMetaData); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MergeStrategyReranker} 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 MergeStrategyReranker mergeStrategyReranker = (MergeStrategyReranker) o; + return Objects.equals(this.cloudSdkCustomFields, mergeStrategyReranker.cloudSdkCustomFields) + && Objects.equals(this.type, mergeStrategyReranker.type) + && Objects.equals(this.model, mergeStrategyReranker.model) + && Objects.equals(this.boosting, mergeStrategyReranker.boosting) + && Objects.equals(this.includeAllMetaData, mergeStrategyReranker.includeAllMetaData); + } + + @Override + public int hashCode() { + return Objects.hash(type, model, boosting, includeAllMetaData, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MergeStrategyReranker {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + sb.append(" boosting: ").append(toIndentedString(boosting)).append("\n"); + sb.append(" includeAllMetaData: ").append(toIndentedString(includeAllMetaData)).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 MergeStrategyReranker} instance. No arguments are required. */ + public static MergeStrategyReranker create() { + return new MergeStrategyReranker(); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyRerankerBoostingInner.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyRerankerBoostingInner.java new file mode 100644 index 000000000..43f5815cb --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyRerankerBoostingInner.java @@ -0,0 +1,344 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** MergeStrategyRerankerBoostingInner */ +// CHECKSTYLE:OFF +public class MergeStrategyRerankerBoostingInner +// CHECKSTYLE:ON +{ + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + @JsonProperty("scope") + private List scope = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MergeStrategyRerankerBoostingInner. */ + protected MergeStrategyRerankerBoostingInner() {} + + /** + * Set the key of this {@link MergeStrategyRerankerBoostingInner} instance and return the same + * instance. + * + * @param key The key of this {@link MergeStrategyRerankerBoostingInner} + * @return The same instance of this {@link MergeStrategyRerankerBoostingInner} class + */ + @Nonnull + public MergeStrategyRerankerBoostingInner key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link MergeStrategyRerankerBoostingInner} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link MergeStrategyRerankerBoostingInner} instance. + * + * @param key The key of this {@link MergeStrategyRerankerBoostingInner} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link MergeStrategyRerankerBoostingInner} instance and return the same + * instance. + * + * @param value The value of this {@link MergeStrategyRerankerBoostingInner} + * @return The same instance of this {@link MergeStrategyRerankerBoostingInner} class + */ + @Nonnull + public MergeStrategyRerankerBoostingInner value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link MergeStrategyRerankerBoostingInner}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link MergeStrategyRerankerBoostingInner} + */ + @Nonnull + public MergeStrategyRerankerBoostingInner 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 MergeStrategyRerankerBoostingInner} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link MergeStrategyRerankerBoostingInner} instance. + * + * @param value The value of this {@link MergeStrategyRerankerBoostingInner} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Set the scope of this {@link MergeStrategyRerankerBoostingInner} instance and return the same + * instance. + * + * @param scope PerFilterSearchResult ID or a new ID for each PostProcessingOperation. + * @return The same instance of this {@link MergeStrategyRerankerBoostingInner} class + */ + @Nonnull + public MergeStrategyRerankerBoostingInner scope(@Nonnull final List scope) { + this.scope = scope; + return this; + } + + /** + * Add one scope instance to this {@link MergeStrategyRerankerBoostingInner}. + * + * @param scopeItem The scope that should be added + * @return The same instance of type {@link MergeStrategyRerankerBoostingInner} + */ + @Nonnull + public MergeStrategyRerankerBoostingInner addScopeItem(@Nonnull final String scopeItem) { + if (this.scope == null) { + this.scope = new ArrayList<>(); + } + this.scope.add(scopeItem); + return this; + } + + /** + * PerFilterSearchResult ID or a new ID for each PostProcessingOperation. + * + * @return scope The scope of this {@link MergeStrategyRerankerBoostingInner} instance. + */ + @Nonnull + public List getScope() { + return scope; + } + + /** + * Set the scope of this {@link MergeStrategyRerankerBoostingInner} instance. + * + * @param scope PerFilterSearchResult ID or a new ID for each PostProcessingOperation. + */ + public void setScope(@Nonnull final List scope) { + this.scope = scope; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * MergeStrategyRerankerBoostingInner}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MergeStrategyRerankerBoostingInner} + * 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( + "MergeStrategyRerankerBoostingInner has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MergeStrategyRerankerBoostingInner} 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 (scope != null) declaredFields.put("scope", scope); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MergeStrategyRerankerBoostingInner} 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 MergeStrategyRerankerBoostingInner mergeStrategyRerankerBoostingInner = + (MergeStrategyRerankerBoostingInner) o; + return Objects.equals( + this.cloudSdkCustomFields, mergeStrategyRerankerBoostingInner.cloudSdkCustomFields) + && Objects.equals(this.key, mergeStrategyRerankerBoostingInner.key) + && Objects.equals(this.value, mergeStrategyRerankerBoostingInner.value) + && Objects.equals(this.scope, mergeStrategyRerankerBoostingInner.scope); + } + + @Override + public int hashCode() { + return Objects.hash(key, value, scope, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MergeStrategyRerankerBoostingInner {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).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 + * MergeStrategyRerankerBoostingInner} instance with all required arguments. + */ + public static Builder create() { + return (key) -> + (value) -> + (scope) -> new MergeStrategyRerankerBoostingInner().key(key).value(value).scope(scope); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the key of this {@link MergeStrategyRerankerBoostingInner} instance. + * + * @param key The key of this {@link MergeStrategyRerankerBoostingInner} + * @return The MergeStrategyRerankerBoostingInner builder. + */ + Builder1 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the value of this {@link MergeStrategyRerankerBoostingInner} instance. + * + * @param value The value of this {@link MergeStrategyRerankerBoostingInner} + * @return The MergeStrategyRerankerBoostingInner builder. + */ + Builder2 value(@Nonnull final List value); + + /** + * Set the value of this {@link MergeStrategyRerankerBoostingInner} instance. + * + * @param value The value of this {@link MergeStrategyRerankerBoostingInner} + * @return The MergeStrategyRerankerBoostingInner builder. + */ + default Builder2 value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the scope of this {@link MergeStrategyRerankerBoostingInner} instance. + * + * @param scope PerFilterSearchResult ID or a new ID for each PostProcessingOperation. + * @return The MergeStrategyRerankerBoostingInner instance. + */ + MergeStrategyRerankerBoostingInner scope(@Nonnull final List scope); + + /** + * Set the scope of this {@link MergeStrategyRerankerBoostingInner} instance. + * + * @param scope PerFilterSearchResult ID or a new ID for each PostProcessingOperation. + * @return The MergeStrategyRerankerBoostingInner instance. + */ + default MergeStrategyRerankerBoostingInner scope(@Nonnull final String... scope) { + return scope(Arrays.asList(scope)); + } + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyScoreReuse.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyScoreReuse.java new file mode 100644 index 000000000..415b53969 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyScoreReuse.java @@ -0,0 +1,176 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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 MergeStrategyScoreReuse merges the given PerFilterSearchResult instances according to the + * scores returned by the downstream retrieval process. It is important that the scores are + * comparable, meaning they should come from the same embedding model or reranker model. + */ +// CHECKSTYLE:OFF +public class MergeStrategyScoreReuse + implements RetrievalSearchInputPostProcessingInnerStrategy, Strategy +// CHECKSTYLE:ON +{ + @JsonProperty("type") + private MergeStrategyType type; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MergeStrategyScoreReuse. */ + protected MergeStrategyScoreReuse() {} + + /** + * Set the type of this {@link MergeStrategyScoreReuse} instance and return the same instance. + * + * @param type The type of this {@link MergeStrategyScoreReuse} + * @return The same instance of this {@link MergeStrategyScoreReuse} class + */ + @Nonnull + public MergeStrategyScoreReuse type(@Nullable final MergeStrategyType type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link MergeStrategyScoreReuse} instance. + */ + @Nonnull + public MergeStrategyType getType() { + return type; + } + + /** + * Set the type of this {@link MergeStrategyScoreReuse} instance. + * + * @param type The type of this {@link MergeStrategyScoreReuse} + */ + public void setType(@Nullable final MergeStrategyType type) { + this.type = type; + } + + /** + * Get the names of the unrecognizable properties of the {@link MergeStrategyScoreReuse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MergeStrategyScoreReuse} 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( + "MergeStrategyScoreReuse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MergeStrategyScoreReuse} 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); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MergeStrategyScoreReuse} 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 MergeStrategyScoreReuse mergeStrategyScoreReuse = (MergeStrategyScoreReuse) o; + return Objects.equals(this.cloudSdkCustomFields, mergeStrategyScoreReuse.cloudSdkCustomFields) + && Objects.equals(this.type, mergeStrategyScoreReuse.type); + } + + @Override + public int hashCode() { + return Objects.hash(type, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MergeStrategyScoreReuse {\n"); + sb.append(" type: ").append(toIndentedString(type)).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 MergeStrategyScoreReuse} instance. No arguments are required. */ + public static MergeStrategyScoreReuse create() { + return new MergeStrategyScoreReuse(); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyType.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyType.java new file mode 100644 index 000000000..07139de76 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MergeStrategyType.java @@ -0,0 +1,68 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.annotation.Nonnull; + +/** Gets or Sets MergeStrategyType */ +public enum MergeStrategyType { + RERANKER("reranker"), + + SCORE_REUSE("scoreReuse"), + + RECIPROCAL_RANK_FUSION("reciprocalRankFusion"), + + RANDOM("random"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + MergeStrategyType(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 MergeStrategyType fromValue(@Nonnull final String value) { + for (final MergeStrategyType b : MergeStrategyType.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataItem.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataItem.java new file mode 100644 index 000000000..6d11d6dc5 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataItem.java @@ -0,0 +1,239 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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 java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** MetadataItem */ +// CHECKSTYLE:OFF +public class MetadataItem +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private UUID id; + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MetadataItem. */ + protected MetadataItem() {} + + /** + * Set the id of this {@link MetadataItem} instance and return the same instance. + * + * @param id ID of collection + * @return The same instance of this {@link MetadataItem} class + */ + @Nonnull + public MetadataItem id(@Nonnull final UUID id) { + this.id = id; + return this; + } + + /** + * ID of collection + * + * @return id The id of this {@link MetadataItem} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link MetadataItem} instance. + * + * @param id ID of collection + */ + public void setId(@Nonnull final UUID id) { + this.id = id; + } + + /** + * Set the metadata of this {@link MetadataItem} instance and return the same instance. + * + * @param metadata List of metadata of the collections or documents or chunks + * @return The same instance of this {@link MetadataItem} class + */ + @Nonnull + public MetadataItem metadata(@Nullable final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link MetadataItem}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link MetadataItem} + */ + @Nonnull + public MetadataItem addMetadataItem(@Nonnull final VectorKeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * List of metadata of the collections or documents or chunks + * + * @return metadata The metadata of this {@link MetadataItem} instance. + */ + @Nullable + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link MetadataItem} instance. + * + * @param metadata List of metadata of the collections or documents or chunks + */ + public void setMetadata(@Nullable final List metadata) { + this.metadata = metadata; + } + + /** + * Get the names of the unrecognizable properties of the {@link MetadataItem}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MetadataItem} 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("MetadataItem has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MetadataItem} 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 (metadata != null) declaredFields.put("metadata", metadata); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MetadataItem} 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 MetadataItem metadataItem = (MetadataItem) o; + return Objects.equals(this.cloudSdkCustomFields, metadataItem.cloudSdkCustomFields) + && Objects.equals(this.id, metadataItem.id) + && Objects.equals(this.metadata, metadataItem.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(id, metadata, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MetadataItem {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).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 MetadataItem} instance + * with all required arguments. + */ + public static Builder create() { + return (id) -> new MetadataItem().id(id); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link MetadataItem} instance. + * + * @param id ID of collection + * @return The MetadataItem instance. + */ + MetadataItem id(@Nonnull final UUID id); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataKeyUpdate.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataKeyUpdate.java new file mode 100644 index 000000000..3298bb0ce --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataKeyUpdate.java @@ -0,0 +1,238 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** MetadataKeyUpdate */ +// CHECKSTYLE:OFF +public class MetadataKeyUpdate +// CHECKSTYLE:ON +{ + @JsonProperty("key") + private String key; + + @JsonProperty("operations") + private List operations; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MetadataKeyUpdate. */ + protected MetadataKeyUpdate() {} + + /** + * Set the key of this {@link MetadataKeyUpdate} instance and return the same instance. + * + * @param key Key to update + * @return The same instance of this {@link MetadataKeyUpdate} class + */ + @Nonnull + public MetadataKeyUpdate key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Key to update + * + * @return key The key of this {@link MetadataKeyUpdate} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link MetadataKeyUpdate} instance. + * + * @param key Key to update + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the operations of this {@link MetadataKeyUpdate} instance and return the same instance. + * + * @param operations Update operation executed for the key + * @return The same instance of this {@link MetadataKeyUpdate} class + */ + @Nonnull + public MetadataKeyUpdate operations(@Nullable final List operations) { + this.operations = operations; + return this; + } + + /** + * Add one operations instance to this {@link MetadataKeyUpdate}. + * + * @param operationsItem The operations that should be added + * @return The same instance of type {@link MetadataKeyUpdate} + */ + @Nonnull + public MetadataKeyUpdate addOperationsItem(@Nonnull final MetadataOperation operationsItem) { + if (this.operations == null) { + this.operations = new ArrayList<>(); + } + this.operations.add(operationsItem); + return this; + } + + /** + * Update operation executed for the key + * + * @return operations The operations of this {@link MetadataKeyUpdate} instance. + */ + @Nullable + public List getOperations() { + return operations; + } + + /** + * Set the operations of this {@link MetadataKeyUpdate} instance. + * + * @param operations Update operation executed for the key + */ + public void setOperations(@Nullable final List operations) { + this.operations = operations; + } + + /** + * Get the names of the unrecognizable properties of the {@link MetadataKeyUpdate}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MetadataKeyUpdate} 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("MetadataKeyUpdate has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MetadataKeyUpdate} 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 (operations != null) declaredFields.put("operations", operations); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MetadataKeyUpdate} 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 MetadataKeyUpdate metadataKeyUpdate = (MetadataKeyUpdate) o; + return Objects.equals(this.cloudSdkCustomFields, metadataKeyUpdate.cloudSdkCustomFields) + && Objects.equals(this.key, metadataKeyUpdate.key) + && Objects.equals(this.operations, metadataKeyUpdate.operations); + } + + @Override + public int hashCode() { + return Objects.hash(key, operations, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MetadataKeyUpdate {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" operations: ").append(toIndentedString(operations)).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 MetadataKeyUpdate} + * instance with all required arguments. + */ + public static Builder create() { + return (key) -> new MetadataKeyUpdate().key(key); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the key of this {@link MetadataKeyUpdate} instance. + * + * @param key Key to update + * @return The MetadataKeyUpdate instance. + */ + MetadataKeyUpdate key(@Nonnull final String key); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataOperation.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataOperation.java new file mode 100644 index 000000000..1fc9fa1a7 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataOperation.java @@ -0,0 +1,238 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** MetadataOperation */ +// CHECKSTYLE:OFF +public class MetadataOperation +// CHECKSTYLE:ON +{ + @JsonProperty("op") + private MetadataOperationEnum op; + + @JsonProperty("values") + private List values; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MetadataOperation. */ + protected MetadataOperation() {} + + /** + * Set the op of this {@link MetadataOperation} instance and return the same instance. + * + * @param op The op of this {@link MetadataOperation} + * @return The same instance of this {@link MetadataOperation} class + */ + @Nonnull + public MetadataOperation op(@Nonnull final MetadataOperationEnum op) { + this.op = op; + return this; + } + + /** + * Get op + * + * @return op The op of this {@link MetadataOperation} instance. + */ + @Nonnull + public MetadataOperationEnum getOp() { + return op; + } + + /** + * Set the op of this {@link MetadataOperation} instance. + * + * @param op The op of this {@link MetadataOperation} + */ + public void setOp(@Nonnull final MetadataOperationEnum op) { + this.op = op; + } + + /** + * Set the values of this {@link MetadataOperation} instance and return the same instance. + * + * @param values List of values to update. + * @return The same instance of this {@link MetadataOperation} class + */ + @Nonnull + public MetadataOperation values(@Nullable final List values) { + this.values = values; + return this; + } + + /** + * Add one values instance to this {@link MetadataOperation}. + * + * @param valuesItem The values that should be added + * @return The same instance of type {@link MetadataOperation} + */ + @Nonnull + public MetadataOperation addValuesItem(@Nonnull final String valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * List of values to update. + * + * @return values The values of this {@link MetadataOperation} instance. + */ + @Nullable + public List getValues() { + return values; + } + + /** + * Set the values of this {@link MetadataOperation} instance. + * + * @param values List of values to update. + */ + public void setValues(@Nullable final List values) { + this.values = values; + } + + /** + * Get the names of the unrecognizable properties of the {@link MetadataOperation}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MetadataOperation} 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("MetadataOperation has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MetadataOperation} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (op != null) declaredFields.put("op", op); + if (values != null) declaredFields.put("values", values); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MetadataOperation} 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 MetadataOperation metadataOperation = (MetadataOperation) o; + return Objects.equals(this.cloudSdkCustomFields, metadataOperation.cloudSdkCustomFields) + && Objects.equals(this.op, metadataOperation.op) + && Objects.equals(this.values, metadataOperation.values); + } + + @Override + public int hashCode() { + return Objects.hash(op, values, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MetadataOperation {\n"); + sb.append(" op: ").append(toIndentedString(op)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).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 MetadataOperation} + * instance with all required arguments. + */ + public static Builder create() { + return (op) -> new MetadataOperation().op(op); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the op of this {@link MetadataOperation} instance. + * + * @param op The op of this {@link MetadataOperation} + * @return The MetadataOperation instance. + */ + MetadataOperation op(@Nonnull final MetadataOperationEnum op); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataOperationEnum.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataOperationEnum.java new file mode 100644 index 000000000..81e0a6478 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataOperationEnum.java @@ -0,0 +1,68 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.annotation.Nonnull; + +/** Gets or Sets MetadataOperationEnum */ +public enum MetadataOperationEnum { + ADD("add"), + + REMOVE("remove"), + + REPLACE("replace"), + + DELETE_KEY("delete_key"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + MetadataOperationEnum(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 MetadataOperationEnum fromValue(@Nonnull final String value) { + for (final MetadataOperationEnum b : MetadataOperationEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataResponse.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataResponse.java new file mode 100644 index 000000000..6b1efcb32 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataResponse.java @@ -0,0 +1,187 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** MetadataResponse */ +// CHECKSTYLE:OFF +public class MetadataResponse +// CHECKSTYLE:ON +{ + @JsonProperty("current_metadata") + private List currentMetadata = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MetadataResponse. */ + protected MetadataResponse() {} + + /** + * Set the currentMetadata of this {@link MetadataResponse} instance and return the same instance. + * + * @param currentMetadata List of metadata after updates. + * @return The same instance of this {@link MetadataResponse} class + */ + @Nonnull + public MetadataResponse currentMetadata(@Nullable final List currentMetadata) { + this.currentMetadata = currentMetadata; + return this; + } + + /** + * Add one currentMetadata instance to this {@link MetadataResponse}. + * + * @param currentMetadataItem The currentMetadata that should be added + * @return The same instance of type {@link MetadataResponse} + */ + @Nonnull + public MetadataResponse addCurrentMetadataItem(@Nonnull final MetadataItem currentMetadataItem) { + if (this.currentMetadata == null) { + this.currentMetadata = new ArrayList<>(); + } + this.currentMetadata.add(currentMetadataItem); + return this; + } + + /** + * List of metadata after updates. + * + * @return currentMetadata The currentMetadata of this {@link MetadataResponse} instance. + */ + @Nullable + public List getCurrentMetadata() { + return currentMetadata; + } + + /** + * Set the currentMetadata of this {@link MetadataResponse} instance. + * + * @param currentMetadata List of metadata after updates. + */ + public void setCurrentMetadata(@Nullable final List currentMetadata) { + this.currentMetadata = currentMetadata; + } + + /** + * Get the names of the unrecognizable properties of the {@link MetadataResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MetadataResponse} 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("MetadataResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MetadataResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (currentMetadata != null) declaredFields.put("currentMetadata", currentMetadata); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MetadataResponse} 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 MetadataResponse metadataResponse = (MetadataResponse) o; + return Objects.equals(this.cloudSdkCustomFields, metadataResponse.cloudSdkCustomFields) + && Objects.equals(this.currentMetadata, metadataResponse.currentMetadata); + } + + @Override + public int hashCode() { + return Objects.hash(currentMetadata, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MetadataResponse {\n"); + sb.append(" currentMetadata: ").append(toIndentedString(currentMetadata)).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 MetadataResponse} instance. No arguments are required. */ + public static MetadataResponse create() { + return new MetadataResponse(); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataUpdateItem.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataUpdateItem.java new file mode 100644 index 000000000..f2142d55a --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataUpdateItem.java @@ -0,0 +1,293 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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 java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** MetadataUpdateItem */ +// CHECKSTYLE:OFF +public class MetadataUpdateItem +// CHECKSTYLE:ON +{ + @JsonProperty("ids") + private List ids = new ArrayList<>(); + + @JsonProperty("metadataUpdates") + private List metadataUpdates = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MetadataUpdateItem. */ + protected MetadataUpdateItem() {} + + /** + * Set the ids of this {@link MetadataUpdateItem} instance and return the same instance. + * + * @param ids List of collection or document or chunk ids for which the metadata should be updated + * @return The same instance of this {@link MetadataUpdateItem} class + */ + @Nonnull + public MetadataUpdateItem ids(@Nonnull final List ids) { + this.ids = ids; + return this; + } + + /** + * Add one ids instance to this {@link MetadataUpdateItem}. + * + * @param idsItem The ids that should be added + * @return The same instance of type {@link MetadataUpdateItem} + */ + @Nonnull + public MetadataUpdateItem addIdsItem(@Nonnull final UUID idsItem) { + if (this.ids == null) { + this.ids = new ArrayList<>(); + } + this.ids.add(idsItem); + return this; + } + + /** + * List of collection or document or chunk ids for which the metadata should be updated + * + * @return ids The ids of this {@link MetadataUpdateItem} instance. + */ + @Nonnull + public List getIds() { + return ids; + } + + /** + * Set the ids of this {@link MetadataUpdateItem} instance. + * + * @param ids List of collection or document or chunk ids for which the metadata should be updated + */ + public void setIds(@Nonnull final List ids) { + this.ids = ids; + } + + /** + * Set the metadataUpdates of this {@link MetadataUpdateItem} instance and return the same + * instance. + * + * @param metadataUpdates List of metadata updates for the given resource ids + * @return The same instance of this {@link MetadataUpdateItem} class + */ + @Nonnull + public MetadataUpdateItem metadataUpdates( + @Nonnull final List metadataUpdates) { + this.metadataUpdates = metadataUpdates; + return this; + } + + /** + * Add one metadataUpdates instance to this {@link MetadataUpdateItem}. + * + * @param metadataUpdatesItem The metadataUpdates that should be added + * @return The same instance of type {@link MetadataUpdateItem} + */ + @Nonnull + public MetadataUpdateItem addMetadataUpdatesItem( + @Nonnull final MetadataKeyUpdate metadataUpdatesItem) { + if (this.metadataUpdates == null) { + this.metadataUpdates = new ArrayList<>(); + } + this.metadataUpdates.add(metadataUpdatesItem); + return this; + } + + /** + * List of metadata updates for the given resource ids + * + * @return metadataUpdates The metadataUpdates of this {@link MetadataUpdateItem} instance. + */ + @Nonnull + public List getMetadataUpdates() { + return metadataUpdates; + } + + /** + * Set the metadataUpdates of this {@link MetadataUpdateItem} instance. + * + * @param metadataUpdates List of metadata updates for the given resource ids + */ + public void setMetadataUpdates(@Nonnull final List metadataUpdates) { + this.metadataUpdates = metadataUpdates; + } + + /** + * Get the names of the unrecognizable properties of the {@link MetadataUpdateItem}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MetadataUpdateItem} 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("MetadataUpdateItem has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MetadataUpdateItem} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (ids != null) declaredFields.put("ids", ids); + if (metadataUpdates != null) declaredFields.put("metadataUpdates", metadataUpdates); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MetadataUpdateItem} 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 MetadataUpdateItem metadataUpdateItem = (MetadataUpdateItem) o; + return Objects.equals(this.cloudSdkCustomFields, metadataUpdateItem.cloudSdkCustomFields) + && Objects.equals(this.ids, metadataUpdateItem.ids) + && Objects.equals(this.metadataUpdates, metadataUpdateItem.metadataUpdates); + } + + @Override + public int hashCode() { + return Objects.hash(ids, metadataUpdates, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MetadataUpdateItem {\n"); + sb.append(" ids: ").append(toIndentedString(ids)).append("\n"); + sb.append(" metadataUpdates: ").append(toIndentedString(metadataUpdates)).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 MetadataUpdateItem} + * instance with all required arguments. + */ + public static Builder create() { + return (ids) -> + (metadataUpdates) -> new MetadataUpdateItem().ids(ids).metadataUpdates(metadataUpdates); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the ids of this {@link MetadataUpdateItem} instance. + * + * @param ids List of collection or document or chunk ids for which the metadata should be + * updated + * @return The MetadataUpdateItem builder. + */ + Builder1 ids(@Nonnull final List ids); + + /** + * Set the ids of this {@link MetadataUpdateItem} instance. + * + * @param ids List of collection or document or chunk ids for which the metadata should be + * updated + * @return The MetadataUpdateItem builder. + */ + default Builder1 ids(@Nonnull final UUID... ids) { + return ids(Arrays.asList(ids)); + } + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the metadataUpdates of this {@link MetadataUpdateItem} instance. + * + * @param metadataUpdates List of metadata updates for the given resource ids + * @return The MetadataUpdateItem instance. + */ + MetadataUpdateItem metadataUpdates(@Nonnull final List metadataUpdates); + + /** + * Set the metadataUpdates of this {@link MetadataUpdateItem} instance. + * + * @param metadataUpdates List of metadata updates for the given resource ids + * @return The MetadataUpdateItem instance. + */ + default MetadataUpdateItem metadataUpdates( + @Nonnull final MetadataKeyUpdate... metadataUpdates) { + return metadataUpdates(Arrays.asList(metadataUpdates)); + } + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataUpdates.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataUpdates.java new file mode 100644 index 000000000..a8a0d89c1 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/MetadataUpdates.java @@ -0,0 +1,212 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** MetadataUpdates */ +// CHECKSTYLE:OFF +public class MetadataUpdates +// CHECKSTYLE:ON +{ + @JsonProperty("updates") + private List updates = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for MetadataUpdates. */ + protected MetadataUpdates() {} + + /** + * Set the updates of this {@link MetadataUpdates} instance and return the same instance. + * + * @param updates List of metadata updates. + * @return The same instance of this {@link MetadataUpdates} class + */ + @Nonnull + public MetadataUpdates updates(@Nonnull final List updates) { + this.updates = updates; + return this; + } + + /** + * Add one updates instance to this {@link MetadataUpdates}. + * + * @param updatesItem The updates that should be added + * @return The same instance of type {@link MetadataUpdates} + */ + @Nonnull + public MetadataUpdates addUpdatesItem(@Nonnull final MetadataUpdateItem updatesItem) { + if (this.updates == null) { + this.updates = new ArrayList<>(); + } + this.updates.add(updatesItem); + return this; + } + + /** + * List of metadata updates. + * + * @return updates The updates of this {@link MetadataUpdates} instance. + */ + @Nonnull + public List getUpdates() { + return updates; + } + + /** + * Set the updates of this {@link MetadataUpdates} instance. + * + * @param updates List of metadata updates. + */ + public void setUpdates(@Nonnull final List updates) { + this.updates = updates; + } + + /** + * Get the names of the unrecognizable properties of the {@link MetadataUpdates}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link MetadataUpdates} 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("MetadataUpdates has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link MetadataUpdates} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (updates != null) declaredFields.put("updates", updates); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link MetadataUpdates} 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 MetadataUpdates metadataUpdates = (MetadataUpdates) o; + return Objects.equals(this.cloudSdkCustomFields, metadataUpdates.cloudSdkCustomFields) + && Objects.equals(this.updates, metadataUpdates.updates); + } + + @Override + public int hashCode() { + return Objects.hash(updates, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class MetadataUpdates {\n"); + sb.append(" updates: ").append(toIndentedString(updates)).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 MetadataUpdates} + * instance with all required arguments. + */ + public static Builder create() { + return (updates) -> new MetadataUpdates().updates(updates); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the updates of this {@link MetadataUpdates} instance. + * + * @param updates List of metadata updates. + * @return The MetadataUpdates instance. + */ + MetadataUpdates updates(@Nonnull final List updates); + + /** + * Set the updates of this {@link MetadataUpdates} instance. + * + * @param updates List of metadata updates. + * @return The MetadataUpdates instance. + */ + default MetadataUpdates updates(@Nonnull final MetadataUpdateItem... updates) { + return updates(Arrays.asList(updates)); + } + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/PerFilterSearchResultError.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/PerFilterSearchResultError.java index d359214c0..78ce59509 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/PerFilterSearchResultError.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/PerFilterSearchResultError.java @@ -23,13 +23,13 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** PerFilterSearchResultError */ +/** Error message if any. */ // CHECKSTYLE:OFF public class PerFilterSearchResultError // CHECKSTYLE:ON { @JsonProperty("message") - private String message; + private String message = "Unknown Error Occurred"; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/PostProcessingObjectReference.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/PostProcessingObjectReference.java new file mode 100644 index 000000000..b8c68a47f --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/PostProcessingObjectReference.java @@ -0,0 +1,176 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** PostProcessingObjectReference */ +// CHECKSTYLE:OFF +public class PostProcessingObjectReference + implements RetrievalSearchInputPostProcessingInnerInputsInner +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id = "6d3eeafd-f3db-4e8e-949a-0e40e50eab64"; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PostProcessingObjectReference. */ + protected PostProcessingObjectReference() {} + + /** + * Set the id of this {@link PostProcessingObjectReference} instance and return the same instance. + * + * @param id PerFilterSearchResult ID or PostProcessingOperation ID. + * @return The same instance of this {@link PostProcessingObjectReference} class + */ + @Nonnull + public PostProcessingObjectReference id(@Nullable final String id) { + this.id = id; + return this; + } + + /** + * PerFilterSearchResult ID or PostProcessingOperation ID. + * + * @return id The id of this {@link PostProcessingObjectReference} instance. + */ + @Nullable + public String getId() { + return id; + } + + /** + * Set the id of this {@link PostProcessingObjectReference} instance. + * + * @param id PerFilterSearchResult ID or PostProcessingOperation ID. + */ + public void setId(@Nullable final String id) { + this.id = id; + } + + /** + * Get the names of the unrecognizable properties of the {@link PostProcessingObjectReference}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PostProcessingObjectReference} + * 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( + "PostProcessingObjectReference has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PostProcessingObjectReference} 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 PostProcessingObjectReference} 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 PostProcessingObjectReference postProcessingObjectReference = + (PostProcessingObjectReference) o; + return Objects.equals( + this.cloudSdkCustomFields, postProcessingObjectReference.cloudSdkCustomFields) + && Objects.equals(this.id, postProcessingObjectReference.id); + } + + @Override + public int hashCode() { + return Objects.hash(id, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PostProcessingObjectReference {\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 new {@link PostProcessingObjectReference} instance. No arguments are required. */ + public static PostProcessingObjectReference create() { + return new PostProcessingObjectReference(); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/PostProcessingOperation.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/PostProcessingOperation.java new file mode 100644 index 000000000..7712328e7 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/PostProcessingOperation.java @@ -0,0 +1,345 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** PostProcessingOperation */ +// CHECKSTYLE:OFF +public class PostProcessingOperation implements RetrievalSearchInputPostProcessingInnerInputsInner +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id = "ae9eee48-4671-4321-a3e5-640adaaf26ae"; + + @JsonProperty("maxChunkCount") + private Integer maxChunkCount = 5; + + @JsonProperty("strategy") + private Strategy strategy; + + @JsonProperty("inputs") + private List inputs = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PostProcessingOperation. */ + protected PostProcessingOperation() {} + + /** + * Set the id of this {@link PostProcessingOperation} instance and return the same instance. + * + * @param id New ID for each PostProcessingOperation. + * @return The same instance of this {@link PostProcessingOperation} class + */ + @Nonnull + public PostProcessingOperation id(@Nullable final String id) { + this.id = id; + return this; + } + + /** + * New ID for each PostProcessingOperation. + * + * @return id The id of this {@link PostProcessingOperation} instance. + */ + @Nullable + public String getId() { + return id; + } + + /** + * Set the id of this {@link PostProcessingOperation} instance. + * + * @param id New ID for each PostProcessingOperation. + */ + public void setId(@Nullable final String id) { + this.id = id; + } + + /** + * Set the maxChunkCount of this {@link PostProcessingOperation} instance and return the same + * instance. + * + * @param maxChunkCount Maximum number of chunks to be retained in final PerSearchFilterResult. + * Minimum: 0 Maximum: 10000000 + * @return The same instance of this {@link PostProcessingOperation} class + */ + @Nonnull + public PostProcessingOperation maxChunkCount(@Nullable final Integer maxChunkCount) { + this.maxChunkCount = maxChunkCount; + return this; + } + + /** + * Maximum number of chunks to be retained in final PerSearchFilterResult. minimum: 0 maximum: + * 10000000 + * + * @return maxChunkCount The maxChunkCount of this {@link PostProcessingOperation} instance. + */ + @Nullable + public Integer getMaxChunkCount() { + return maxChunkCount; + } + + /** + * Set the maxChunkCount of this {@link PostProcessingOperation} instance. + * + * @param maxChunkCount Maximum number of chunks to be retained in final PerSearchFilterResult. + * Minimum: 0 Maximum: 10000000 + */ + public void setMaxChunkCount(@Nullable final Integer maxChunkCount) { + this.maxChunkCount = maxChunkCount; + } + + /** + * Set the strategy of this {@link PostProcessingOperation} instance and return the same instance. + * + * @param strategy The strategy of this {@link PostProcessingOperation} + * @return The same instance of this {@link PostProcessingOperation} class + */ + @Nonnull + public PostProcessingOperation strategy(@Nonnull final Strategy strategy) { + this.strategy = strategy; + return this; + } + + /** + * Get strategy + * + * @return strategy The strategy of this {@link PostProcessingOperation} instance. + */ + @Nonnull + public Strategy getStrategy() { + return strategy; + } + + /** + * Set the strategy of this {@link PostProcessingOperation} instance. + * + * @param strategy The strategy of this {@link PostProcessingOperation} + */ + public void setStrategy(@Nonnull final Strategy strategy) { + this.strategy = strategy; + } + + /** + * Set the inputs of this {@link PostProcessingOperation} instance and return the same instance. + * + * @param inputs The inputs of this {@link PostProcessingOperation} + * @return The same instance of this {@link PostProcessingOperation} class + */ + @Nonnull + public PostProcessingOperation inputs( + @Nonnull final List inputs) { + this.inputs = inputs; + return this; + } + + /** + * Add one inputs instance to this {@link PostProcessingOperation}. + * + * @param inputsItem The inputs that should be added + * @return The same instance of type {@link PostProcessingOperation} + */ + @Nonnull + public PostProcessingOperation addInputsItem( + @Nonnull final RetrievalSearchInputPostProcessingInnerInputsInner inputsItem) { + if (this.inputs == null) { + this.inputs = new ArrayList<>(); + } + this.inputs.add(inputsItem); + return this; + } + + /** + * Get inputs + * + * @return inputs The inputs of this {@link PostProcessingOperation} instance. + */ + @Nonnull + public List getInputs() { + return inputs; + } + + /** + * Set the inputs of this {@link PostProcessingOperation} instance. + * + * @param inputs The inputs of this {@link PostProcessingOperation} + */ + public void setInputs( + @Nonnull final List inputs) { + this.inputs = inputs; + } + + /** + * Get the names of the unrecognizable properties of the {@link PostProcessingOperation}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PostProcessingOperation} 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( + "PostProcessingOperation has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PostProcessingOperation} 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 (maxChunkCount != null) declaredFields.put("maxChunkCount", maxChunkCount); + if (strategy != null) declaredFields.put("strategy", strategy); + if (inputs != null) declaredFields.put("inputs", inputs); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PostProcessingOperation} 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 PostProcessingOperation postProcessingOperation = (PostProcessingOperation) o; + return Objects.equals(this.cloudSdkCustomFields, postProcessingOperation.cloudSdkCustomFields) + && Objects.equals(this.id, postProcessingOperation.id) + && Objects.equals(this.maxChunkCount, postProcessingOperation.maxChunkCount) + && Objects.equals(this.strategy, postProcessingOperation.strategy) + && Objects.equals(this.inputs, postProcessingOperation.inputs); + } + + @Override + public int hashCode() { + return Objects.hash(id, maxChunkCount, strategy, inputs, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PostProcessingOperation {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" maxChunkCount: ").append(toIndentedString(maxChunkCount)).append("\n"); + sb.append(" strategy: ").append(toIndentedString(strategy)).append("\n"); + sb.append(" inputs: ").append(toIndentedString(inputs)).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 + * PostProcessingOperation} instance with all required arguments. + */ + public static Builder create() { + return (strategy) -> + (inputs) -> new PostProcessingOperation().strategy(strategy).inputs(inputs); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the strategy of this {@link PostProcessingOperation} instance. + * + * @param strategy The strategy of this {@link PostProcessingOperation} + * @return The PostProcessingOperation builder. + */ + Builder1 strategy(@Nonnull final Strategy strategy); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the inputs of this {@link PostProcessingOperation} instance. + * + * @param inputs The inputs of this {@link PostProcessingOperation} + * @return The PostProcessingOperation instance. + */ + PostProcessingOperation inputs( + @Nonnull final List inputs); + + /** + * Set the inputs of this {@link PostProcessingOperation} instance. + * + * @param inputs The inputs of this {@link PostProcessingOperation} + * @return The PostProcessingOperation instance. + */ + default PostProcessingOperation inputs( + @Nonnull final RetrievalSearchInputPostProcessingInnerInputsInner... inputs) { + return inputs(Arrays.asList(inputs)); + } + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner1.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner1.java index 530a118f4..35866499a 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner1.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner1.java @@ -16,7 +16,6 @@ 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; @@ -35,7 +34,13 @@ public class ResultsInner1 private String filterId; @JsonProperty("results") - private List results = new ArrayList<>(); + private List results = new ArrayList<>(); + + @JsonProperty("remoteGroundingName") + private String remoteGroundingName; + + @JsonProperty("error") + private RetrievalPerFilterSearchResultError error; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -77,11 +82,11 @@ public void setFilterId(@Nonnull final String filterId) { /** * Set the results of this {@link ResultsInner1} instance and return the same instance. * - * @param results The results of this {@link ResultsInner1} + * @param results List of returned results. * @return The same instance of this {@link ResultsInner1} class */ @Nonnull - public ResultsInner1 results(@Nonnull final List results) { + public ResultsInner1 results(@Nullable final List results) { this.results = results; return this; } @@ -93,7 +98,8 @@ public ResultsInner1 results(@Nonnull final List results) { * @return The same instance of type {@link ResultsInner1} */ @Nonnull - public ResultsInner1 addResultsItem(@Nonnull final DocumentsChunk resultsItem) { + public ResultsInner1 addResultsItem( + @Nonnull final RetrievalDataRepositorySearchResult resultsItem) { if (this.results == null) { this.results = new ArrayList<>(); } @@ -102,24 +108,90 @@ public ResultsInner1 addResultsItem(@Nonnull final DocumentsChunk resultsItem) { } /** - * Get results + * List of returned results. * * @return results The results of this {@link ResultsInner1} instance. */ @Nonnull - public List getResults() { + public List getResults() { return results; } /** * Set the results of this {@link ResultsInner1} instance. * - * @param results The results of this {@link ResultsInner1} + * @param results List of returned results. */ - public void setResults(@Nonnull final List results) { + public void setResults(@Nullable final List results) { this.results = results; } + /** + * Set the remoteGroundingName of this {@link ResultsInner1} instance and return the same + * instance. + * + * @param remoteGroundingName Friendly Destination Name of remote instance (grounding.name). Only + * present if dataRepositoryType = remote:dg. + * @return The same instance of this {@link ResultsInner1} class + */ + @Nonnull + public ResultsInner1 remoteGroundingName(@Nullable final String remoteGroundingName) { + this.remoteGroundingName = remoteGroundingName; + return this; + } + + /** + * Friendly Destination Name of remote instance (grounding.name). Only present if + * dataRepositoryType = remote:dg. + * + * @return remoteGroundingName The remoteGroundingName of this {@link ResultsInner1} instance. + */ + @Nullable + public String getRemoteGroundingName() { + return remoteGroundingName; + } + + /** + * Set the remoteGroundingName of this {@link ResultsInner1} instance. + * + * @param remoteGroundingName Friendly Destination Name of remote instance (grounding.name). Only + * present if dataRepositoryType = remote:dg. + */ + public void setRemoteGroundingName(@Nullable final String remoteGroundingName) { + this.remoteGroundingName = remoteGroundingName; + } + + /** + * Set the error of this {@link ResultsInner1} instance and return the same instance. + * + * @param error The error of this {@link ResultsInner1} + * @return The same instance of this {@link ResultsInner1} class + */ + @Nonnull + public ResultsInner1 error(@Nullable final RetrievalPerFilterSearchResultError error) { + this.error = error; + return this; + } + + /** + * Get error + * + * @return error The error of this {@link ResultsInner1} instance. + */ + @Nonnull + public RetrievalPerFilterSearchResultError getError() { + return error; + } + + /** + * Set the error of this {@link ResultsInner1} instance. + * + * @param error The error of this {@link ResultsInner1} + */ + public void setError(@Nullable final RetrievalPerFilterSearchResultError error) { + this.error = error; + } + /** * Get the names of the unrecognizable properties of the {@link ResultsInner1}. * @@ -160,6 +232,8 @@ public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); if (filterId != null) declaredFields.put("filterId", filterId); if (results != null) declaredFields.put("results", results); + if (remoteGroundingName != null) declaredFields.put("remoteGroundingName", remoteGroundingName); + if (error != null) declaredFields.put("error", error); return declaredFields; } @@ -186,12 +260,14 @@ public boolean equals(@Nullable final java.lang.Object o) { final ResultsInner1 resultsInner1 = (ResultsInner1) o; return Objects.equals(this.cloudSdkCustomFields, resultsInner1.cloudSdkCustomFields) && Objects.equals(this.filterId, resultsInner1.filterId) - && Objects.equals(this.results, resultsInner1.results); + && Objects.equals(this.results, resultsInner1.results) + && Objects.equals(this.remoteGroundingName, resultsInner1.remoteGroundingName) + && Objects.equals(this.error, resultsInner1.error); } @Override public int hashCode() { - return Objects.hash(filterId, results, cloudSdkCustomFields); + return Objects.hash(filterId, results, remoteGroundingName, error, cloudSdkCustomFields); } @Override @@ -201,6 +277,10 @@ public String toString() { sb.append("class ResultsInner1 {\n"); sb.append(" filterId: ").append(toIndentedString(filterId)).append("\n"); sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append(" remoteGroundingName: ") + .append(toIndentedString(remoteGroundingName)) + .append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); @@ -223,7 +303,7 @@ private String toIndentedString(final java.lang.Object o) { * with all required arguments. */ public static Builder create() { - return (filterId) -> (results) -> new ResultsInner1().filterId(filterId).results(results); + return (filterId) -> new ResultsInner1().filterId(filterId); } /** Builder helper class. */ @@ -232,29 +312,8 @@ public interface Builder { * Set the filterId of this {@link ResultsInner1} instance. * * @param filterId The filterId of this {@link ResultsInner1} - * @return The ResultsInner1 builder. - */ - Builder1 filterId(@Nonnull final String filterId); - } - - /** Builder helper class. */ - public interface Builder1 { - /** - * Set the results of this {@link ResultsInner1} instance. - * - * @param results The results of this {@link ResultsInner1} * @return The ResultsInner1 instance. */ - ResultsInner1 results(@Nonnull final List results); - - /** - * Set the results of this {@link ResultsInner1} instance. - * - * @param results The results of this {@link ResultsInner1} - * @return The ResultsInner1 instance. - */ - default ResultsInner1 results(@Nonnull final DocumentsChunk... results) { - return results(Arrays.asList(results)); - } + ResultsInner1 filterId(@Nonnull final String filterId); } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner2.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner2.java index 57d91deec..10e655a61 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner2.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner2.java @@ -34,10 +34,10 @@ public class ResultsInner2 private String filterId; @JsonProperty("results") - private List results = new ArrayList<>(); + private List results = new ArrayList<>(); @JsonProperty("error") - private RetrievalPerFilterSearchResultError error; + private PerFilterSearchResultError error; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -83,7 +83,7 @@ public void setFilterId(@Nonnull final String filterId) { * @return The same instance of this {@link ResultsInner2} class */ @Nonnull - public ResultsInner2 results(@Nullable final List results) { + public ResultsInner2 results(@Nullable final List results) { this.results = results; return this; } @@ -95,8 +95,7 @@ public ResultsInner2 results(@Nullable final List(); } @@ -110,7 +109,7 @@ public ResultsInner2 addResultsItem( * @return results The results of this {@link ResultsInner2} instance. */ @Nonnull - public List getResults() { + public List getResults() { return results; } @@ -119,7 +118,7 @@ public List getResults() { * * @param results List of returned results. */ - public void setResults(@Nullable final List results) { + public void setResults(@Nullable final List results) { this.results = results; } @@ -130,7 +129,7 @@ public void setResults(@Nullable final List * @return The same instance of this {@link ResultsInner2} class */ @Nonnull - public ResultsInner2 error(@Nullable final RetrievalPerFilterSearchResultError error) { + public ResultsInner2 error(@Nullable final PerFilterSearchResultError error) { this.error = error; return this; } @@ -141,7 +140,7 @@ public ResultsInner2 error(@Nullable final RetrievalPerFilterSearchResultError e * @return error The error of this {@link ResultsInner2} instance. */ @Nonnull - public RetrievalPerFilterSearchResultError getError() { + public PerFilterSearchResultError getError() { return error; } @@ -150,7 +149,7 @@ public RetrievalPerFilterSearchResultError getError() { * * @param error The error of this {@link ResultsInner2} */ - public void setError(@Nullable final RetrievalPerFilterSearchResultError error) { + public void setError(@Nullable final PerFilterSearchResultError error) { this.error = error; } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner3.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner3.java deleted file mode 100644 index d6c0cf558..000000000 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner3.java +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Grounding - * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. - * - * - * - * 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.grounding.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; - -/** ResultsInner3 */ -// CHECKSTYLE:OFF -public class ResultsInner3 -// CHECKSTYLE:ON -{ - @JsonProperty("filterId") - private String filterId; - - @JsonProperty("results") - private List results = new ArrayList<>(); - - @JsonProperty("error") - private PerFilterSearchResultError error; - - @JsonAnySetter @JsonAnyGetter - private final Map cloudSdkCustomFields = new LinkedHashMap<>(); - - /** Default constructor for ResultsInner3. */ - protected ResultsInner3() {} - - /** - * Set the filterId of this {@link ResultsInner3} instance and return the same instance. - * - * @param filterId The filterId of this {@link ResultsInner3} - * @return The same instance of this {@link ResultsInner3} class - */ - @Nonnull - public ResultsInner3 filterId(@Nonnull final String filterId) { - this.filterId = filterId; - return this; - } - - /** - * Get filterId - * - * @return filterId The filterId of this {@link ResultsInner3} instance. - */ - @Nonnull - public String getFilterId() { - return filterId; - } - - /** - * Set the filterId of this {@link ResultsInner3} instance. - * - * @param filterId The filterId of this {@link ResultsInner3} - */ - public void setFilterId(@Nonnull final String filterId) { - this.filterId = filterId; - } - - /** - * Set the results of this {@link ResultsInner3} instance and return the same instance. - * - * @param results List of returned results. - * @return The same instance of this {@link ResultsInner3} class - */ - @Nonnull - public ResultsInner3 results(@Nullable final List results) { - this.results = results; - return this; - } - - /** - * Add one results instance to this {@link ResultsInner3}. - * - * @param resultsItem The results that should be added - * @return The same instance of type {@link ResultsInner3} - */ - @Nonnull - public ResultsInner3 addResultsItem(@Nonnull final DataRepositorySearchResult resultsItem) { - if (this.results == null) { - this.results = new ArrayList<>(); - } - this.results.add(resultsItem); - return this; - } - - /** - * List of returned results. - * - * @return results The results of this {@link ResultsInner3} instance. - */ - @Nonnull - public List getResults() { - return results; - } - - /** - * Set the results of this {@link ResultsInner3} instance. - * - * @param results List of returned results. - */ - public void setResults(@Nullable final List results) { - this.results = results; - } - - /** - * Set the error of this {@link ResultsInner3} instance and return the same instance. - * - * @param error The error of this {@link ResultsInner3} - * @return The same instance of this {@link ResultsInner3} class - */ - @Nonnull - public ResultsInner3 error(@Nullable final PerFilterSearchResultError error) { - this.error = error; - return this; - } - - /** - * Get error - * - * @return error The error of this {@link ResultsInner3} instance. - */ - @Nonnull - public PerFilterSearchResultError getError() { - return error; - } - - /** - * Set the error of this {@link ResultsInner3} instance. - * - * @param error The error of this {@link ResultsInner3} - */ - public void setError(@Nullable final PerFilterSearchResultError error) { - this.error = error; - } - - /** - * Get the names of the unrecognizable properties of the {@link ResultsInner3}. - * - * @return The set of properties names - */ - @JsonIgnore - @Nonnull - public Set getCustomFieldNames() { - return cloudSdkCustomFields.keySet(); - } - - /** - * Get the value of an unrecognizable property of this {@link ResultsInner3} 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("ResultsInner3 has no field with name '" + name + "'."); - } - return cloudSdkCustomFields.get(name); - } - - /** - * Get the value of all properties of this {@link ResultsInner3} instance including unrecognized - * properties. - * - * @return The map of all properties - */ - @JsonIgnore - @Nonnull - public Map toMap() { - final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); - if (filterId != null) declaredFields.put("filterId", filterId); - if (results != null) declaredFields.put("results", results); - if (error != null) declaredFields.put("error", error); - return declaredFields; - } - - /** - * Set an unrecognizable property of this {@link ResultsInner3} 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 ResultsInner3 resultsInner3 = (ResultsInner3) o; - return Objects.equals(this.cloudSdkCustomFields, resultsInner3.cloudSdkCustomFields) - && Objects.equals(this.filterId, resultsInner3.filterId) - && Objects.equals(this.results, resultsInner3.results) - && Objects.equals(this.error, resultsInner3.error); - } - - @Override - public int hashCode() { - return Objects.hash(filterId, results, error, cloudSdkCustomFields); - } - - @Override - @Nonnull - public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("class ResultsInner3 {\n"); - sb.append(" filterId: ").append(toIndentedString(filterId)).append("\n"); - sb.append(" results: ").append(toIndentedString(results)).append("\n"); - sb.append(" error: ").append(toIndentedString(error)).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 ResultsInner3} instance - * with all required arguments. - */ - public static Builder create() { - return (filterId) -> new ResultsInner3().filterId(filterId); - } - - /** Builder helper class. */ - public interface Builder { - /** - * Set the filterId of this {@link ResultsInner3} instance. - * - * @param filterId The filterId of this {@link ResultsInner3} - * @return The ResultsInner3 instance. - */ - ResultsInner3 filterId(@Nonnull final String filterId); - } -} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalBinaryBooleanFilter.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalBinaryBooleanFilter.java new file mode 100644 index 000000000..2d59a32ee --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalBinaryBooleanFilter.java @@ -0,0 +1,350 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** RetrievalBinaryBooleanFilter */ +// CHECKSTYLE:OFF +public class RetrievalBinaryBooleanFilter +// CHECKSTYLE:ON +{ + /** Gets or Sets operator */ + public enum OperatorEnum { + /** The AND option of this RetrievalBinaryBooleanFilter */ + AND("and"), + + /** The OR option of this RetrievalBinaryBooleanFilter */ + OR("or"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this RetrievalBinaryBooleanFilter */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + OperatorEnum(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 RetrievalBinaryBooleanFilter + */ + @JsonCreator + @Nonnull + public static OperatorEnum fromValue(@Nonnull final String value) { + for (OperatorEnum b : OperatorEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("operator") + private OperatorEnum operator; + + @JsonProperty("left") + private Left left; + + @JsonProperty("right") + private Right right; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for RetrievalBinaryBooleanFilter. */ + protected RetrievalBinaryBooleanFilter() {} + + /** + * Set the operator of this {@link RetrievalBinaryBooleanFilter} instance and return the same + * instance. + * + * @param operator The operator of this {@link RetrievalBinaryBooleanFilter} + * @return The same instance of this {@link RetrievalBinaryBooleanFilter} class + */ + @Nonnull + public RetrievalBinaryBooleanFilter operator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + return this; + } + + /** + * Get operator + * + * @return operator The operator of this {@link RetrievalBinaryBooleanFilter} instance. + */ + @Nonnull + public OperatorEnum getOperator() { + return operator; + } + + /** + * Set the operator of this {@link RetrievalBinaryBooleanFilter} instance. + * + * @param operator The operator of this {@link RetrievalBinaryBooleanFilter} + */ + public void setOperator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + } + + /** + * Set the left of this {@link RetrievalBinaryBooleanFilter} instance and return the same + * instance. + * + * @param left The left of this {@link RetrievalBinaryBooleanFilter} + * @return The same instance of this {@link RetrievalBinaryBooleanFilter} class + */ + @Nonnull + public RetrievalBinaryBooleanFilter left(@Nonnull final Left left) { + this.left = left; + return this; + } + + /** + * Get left + * + * @return left The left of this {@link RetrievalBinaryBooleanFilter} instance. + */ + @Nonnull + public Left getLeft() { + return left; + } + + /** + * Set the left of this {@link RetrievalBinaryBooleanFilter} instance. + * + * @param left The left of this {@link RetrievalBinaryBooleanFilter} + */ + public void setLeft(@Nonnull final Left left) { + this.left = left; + } + + /** + * Set the right of this {@link RetrievalBinaryBooleanFilter} instance and return the same + * instance. + * + * @param right The right of this {@link RetrievalBinaryBooleanFilter} + * @return The same instance of this {@link RetrievalBinaryBooleanFilter} class + */ + @Nonnull + public RetrievalBinaryBooleanFilter right(@Nonnull final Right right) { + this.right = right; + return this; + } + + /** + * Get right + * + * @return right The right of this {@link RetrievalBinaryBooleanFilter} instance. + */ + @Nonnull + public Right getRight() { + return right; + } + + /** + * Set the right of this {@link RetrievalBinaryBooleanFilter} instance. + * + * @param right The right of this {@link RetrievalBinaryBooleanFilter} + */ + public void setRight(@Nonnull final Right right) { + this.right = right; + } + + /** + * Get the names of the unrecognizable properties of the {@link RetrievalBinaryBooleanFilter}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link RetrievalBinaryBooleanFilter} + * 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( + "RetrievalBinaryBooleanFilter has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RetrievalBinaryBooleanFilter} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (operator != null) declaredFields.put("operator", operator); + if (left != null) declaredFields.put("left", left); + if (right != null) declaredFields.put("right", right); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RetrievalBinaryBooleanFilter} 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 RetrievalBinaryBooleanFilter retrievalBinaryBooleanFilter = + (RetrievalBinaryBooleanFilter) o; + return Objects.equals( + this.cloudSdkCustomFields, retrievalBinaryBooleanFilter.cloudSdkCustomFields) + && Objects.equals(this.operator, retrievalBinaryBooleanFilter.operator) + && Objects.equals(this.left, retrievalBinaryBooleanFilter.left) + && Objects.equals(this.right, retrievalBinaryBooleanFilter.right); + } + + @Override + public int hashCode() { + return Objects.hash(operator, left, right, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class RetrievalBinaryBooleanFilter {\n"); + sb.append(" operator: ").append(toIndentedString(operator)).append("\n"); + sb.append(" left: ").append(toIndentedString(left)).append("\n"); + sb.append(" right: ").append(toIndentedString(right)).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 + * RetrievalBinaryBooleanFilter} instance with all required arguments. + */ + public static Builder create() { + return (operator) -> + (left) -> + (right) -> + new RetrievalBinaryBooleanFilter().operator(operator).left(left).right(right); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the operator of this {@link RetrievalBinaryBooleanFilter} instance. + * + * @param operator The operator of this {@link RetrievalBinaryBooleanFilter} + * @return The RetrievalBinaryBooleanFilter builder. + */ + Builder1 operator(@Nonnull final OperatorEnum operator); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the left of this {@link RetrievalBinaryBooleanFilter} instance. + * + * @param left The left of this {@link RetrievalBinaryBooleanFilter} + * @return The RetrievalBinaryBooleanFilter builder. + */ + Builder2 left(@Nonnull final Left left); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the right of this {@link RetrievalBinaryBooleanFilter} instance. + * + * @param right The right of this {@link RetrievalBinaryBooleanFilter} + * @return The RetrievalBinaryBooleanFilter instance. + */ + RetrievalBinaryBooleanFilter right(@Nonnull final Right right); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalChunk.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalChunk.java index 96f6093f7..09ff24120 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalChunk.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalChunk.java @@ -39,6 +39,12 @@ public class RetrievalChunk @JsonProperty("metadata") private List metadata = new ArrayList<>(); + @JsonProperty("searchScores") + private SearchScores searchScores; + + @JsonProperty("postProcessingScore") + private Score postProcessingScore; + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -153,6 +159,69 @@ public void setMetadata(@Nullable final List metadata this.metadata = metadata; } + /** + * Set the searchScores of this {@link RetrievalChunk} instance and return the same instance. + * + * @param searchScores The searchScores of this {@link RetrievalChunk} + * @return The same instance of this {@link RetrievalChunk} class + */ + @Nonnull + public RetrievalChunk searchScores(@Nullable final SearchScores searchScores) { + this.searchScores = searchScores; + return this; + } + + /** + * Get searchScores + * + * @return searchScores The searchScores of this {@link RetrievalChunk} instance. + */ + @Nonnull + public SearchScores getSearchScores() { + return searchScores; + } + + /** + * Set the searchScores of this {@link RetrievalChunk} instance. + * + * @param searchScores The searchScores of this {@link RetrievalChunk} + */ + public void setSearchScores(@Nullable final SearchScores searchScores) { + this.searchScores = searchScores; + } + + /** + * Set the postProcessingScore of this {@link RetrievalChunk} instance and return the same + * instance. + * + * @param postProcessingScore The postProcessingScore of this {@link RetrievalChunk} + * @return The same instance of this {@link RetrievalChunk} class + */ + @Nonnull + public RetrievalChunk postProcessingScore(@Nullable final Score postProcessingScore) { + this.postProcessingScore = postProcessingScore; + return this; + } + + /** + * Get postProcessingScore + * + * @return postProcessingScore The postProcessingScore of this {@link RetrievalChunk} instance. + */ + @Nonnull + public Score getPostProcessingScore() { + return postProcessingScore; + } + + /** + * Set the postProcessingScore of this {@link RetrievalChunk} instance. + * + * @param postProcessingScore The postProcessingScore of this {@link RetrievalChunk} + */ + public void setPostProcessingScore(@Nullable final Score postProcessingScore) { + this.postProcessingScore = postProcessingScore; + } + /** * Get the names of the unrecognizable properties of the {@link RetrievalChunk}. * @@ -194,6 +263,8 @@ public Map toMap() { if (id != null) declaredFields.put("id", id); if (content != null) declaredFields.put("content", content); if (metadata != null) declaredFields.put("metadata", metadata); + if (searchScores != null) declaredFields.put("searchScores", searchScores); + if (postProcessingScore != null) declaredFields.put("postProcessingScore", postProcessingScore); return declaredFields; } @@ -221,12 +292,15 @@ public boolean equals(@Nullable final java.lang.Object o) { return Objects.equals(this.cloudSdkCustomFields, retrievalChunk.cloudSdkCustomFields) && Objects.equals(this.id, retrievalChunk.id) && Objects.equals(this.content, retrievalChunk.content) - && Objects.equals(this.metadata, retrievalChunk.metadata); + && Objects.equals(this.metadata, retrievalChunk.metadata) + && Objects.equals(this.searchScores, retrievalChunk.searchScores) + && Objects.equals(this.postProcessingScore, retrievalChunk.postProcessingScore); } @Override public int hashCode() { - return Objects.hash(id, content, metadata, cloudSdkCustomFields); + return Objects.hash( + id, content, metadata, searchScores, postProcessingScore, cloudSdkCustomFields); } @Override @@ -237,6 +311,10 @@ public String toString() { sb.append(" id: ").append(toIndentedString(id)).append("\n"); sb.append(" content: ").append(toIndentedString(content)).append("\n"); sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" searchScores: ").append(toIndentedString(searchScores)).append("\n"); + sb.append(" postProcessingScore: ") + .append(toIndentedString(postProcessingScore)) + .append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalDocumentKeyValueListPair.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalDocumentKeyValueListPair.java index 958f23b02..6d4b36ec9 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalDocumentKeyValueListPair.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalDocumentKeyValueListPair.java @@ -13,10 +13,8 @@ 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; @@ -39,65 +37,8 @@ public class RetrievalDocumentKeyValueListPair @JsonProperty("value") private List value = new ArrayList<>(); - /** Gets or Sets matchMode */ - public enum MatchModeEnum { - /** The ANY option of this RetrievalDocumentKeyValueListPair */ - ANY("ANY"), - - /** The ALL option of this RetrievalDocumentKeyValueListPair */ - ALL("ALL"), - - /** The UNKNOWN_DEFAULT_OPEN_API option of this RetrievalDocumentKeyValueListPair */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - MatchModeEnum(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 RetrievalDocumentKeyValueListPair - */ - @JsonCreator - @Nullable - public static MatchModeEnum fromValue(@Nonnull final String value) { - for (MatchModeEnum b : MatchModeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return null; - } - } - @JsonProperty("matchMode") - private MatchModeEnum matchMode; + private FilterMatchModeEnum matchMode; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -192,7 +133,8 @@ public void setValue(@Nonnull final List value) { * @return The same instance of this {@link RetrievalDocumentKeyValueListPair} class */ @Nonnull - public RetrievalDocumentKeyValueListPair matchMode(@Nullable final MatchModeEnum matchMode) { + public RetrievalDocumentKeyValueListPair matchMode( + @Nullable final FilterMatchModeEnum matchMode) { this.matchMode = matchMode; return this; } @@ -202,8 +144,8 @@ public RetrievalDocumentKeyValueListPair matchMode(@Nullable final MatchModeEnum * * @return matchMode The matchMode of this {@link RetrievalDocumentKeyValueListPair} instance. */ - @Nullable - public MatchModeEnum getMatchMode() { + @Nonnull + public FilterMatchModeEnum getMatchMode() { return matchMode; } @@ -212,7 +154,7 @@ public MatchModeEnum getMatchMode() { * * @param matchMode The matchMode of this {@link RetrievalDocumentKeyValueListPair} */ - public void setMatchMode(@Nullable final MatchModeEnum matchMode) { + public void setMatchMode(@Nullable final FilterMatchModeEnum matchMode) { this.matchMode = matchMode; } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalPerFilterSearchResult.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalPerFilterSearchResult.java index 58baa7981..7064900e4 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalPerFilterSearchResult.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalPerFilterSearchResult.java @@ -36,6 +36,9 @@ public class RetrievalPerFilterSearchResult @JsonProperty("results") private List results = new ArrayList<>(); + @JsonProperty("remoteGroundingName") + private String remoteGroundingName; + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -123,6 +126,43 @@ public void setResults(@Nullable final List this.results = results; } + /** + * Set the remoteGroundingName of this {@link RetrievalPerFilterSearchResult} instance and return + * the same instance. + * + * @param remoteGroundingName Friendly Destination Name of remote instance (grounding.name). Only + * present if dataRepositoryType = remote:dg. + * @return The same instance of this {@link RetrievalPerFilterSearchResult} class + */ + @Nonnull + public RetrievalPerFilterSearchResult remoteGroundingName( + @Nullable final String remoteGroundingName) { + this.remoteGroundingName = remoteGroundingName; + return this; + } + + /** + * Friendly Destination Name of remote instance (grounding.name). Only present if + * dataRepositoryType = remote:dg. + * + * @return remoteGroundingName The remoteGroundingName of this {@link + * RetrievalPerFilterSearchResult} instance. + */ + @Nullable + public String getRemoteGroundingName() { + return remoteGroundingName; + } + + /** + * Set the remoteGroundingName of this {@link RetrievalPerFilterSearchResult} instance. + * + * @param remoteGroundingName Friendly Destination Name of remote instance (grounding.name). Only + * present if dataRepositoryType = remote:dg. + */ + public void setRemoteGroundingName(@Nullable final String remoteGroundingName) { + this.remoteGroundingName = remoteGroundingName; + } + /** * Get the names of the unrecognizable properties of the {@link RetrievalPerFilterSearchResult}. * @@ -165,6 +205,7 @@ public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); if (filterId != null) declaredFields.put("filterId", filterId); if (results != null) declaredFields.put("results", results); + if (remoteGroundingName != null) declaredFields.put("remoteGroundingName", remoteGroundingName); return declaredFields; } @@ -194,12 +235,14 @@ public boolean equals(@Nullable final java.lang.Object o) { return Objects.equals( this.cloudSdkCustomFields, retrievalPerFilterSearchResult.cloudSdkCustomFields) && Objects.equals(this.filterId, retrievalPerFilterSearchResult.filterId) - && Objects.equals(this.results, retrievalPerFilterSearchResult.results); + && Objects.equals(this.results, retrievalPerFilterSearchResult.results) + && Objects.equals( + this.remoteGroundingName, retrievalPerFilterSearchResult.remoteGroundingName); } @Override public int hashCode() { - return Objects.hash(filterId, results, cloudSdkCustomFields); + return Objects.hash(filterId, results, remoteGroundingName, cloudSdkCustomFields); } @Override @@ -209,6 +252,9 @@ public String toString() { sb.append("class RetrievalPerFilterSearchResult {\n"); sb.append(" filterId: ").append(toIndentedString(filterId)).append("\n"); sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append(" remoteGroundingName: ") + .append(toIndentedString(remoteGroundingName)) + .append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalPerFilterSearchResultError.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalPerFilterSearchResultError.java index 233c90487..b12c4567e 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalPerFilterSearchResultError.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalPerFilterSearchResultError.java @@ -23,13 +23,13 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** RetrievalPerFilterSearchResultError */ +/** Error message if any. */ // CHECKSTYLE:OFF public class RetrievalPerFilterSearchResultError // CHECKSTYLE:ON { @JsonProperty("message") - private String message; + private String message = "Unknown Error Occurred"; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalScopedKeyValueListPair.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalScopedKeyValueListPair.java new file mode 100644 index 000000000..43478fc67 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalScopedKeyValueListPair.java @@ -0,0 +1,367 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** RetrievalScopedKeyValueListPair */ +// CHECKSTYLE:OFF +public class RetrievalScopedKeyValueListPair +// CHECKSTYLE:ON +{ + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + /** Gets or Sets scope */ + public enum ScopeEnum { + /** The REPOSITORY option of this RetrievalScopedKeyValueListPair */ + REPOSITORY("repository"), + + /** The DOCUMENT option of this RetrievalScopedKeyValueListPair */ + DOCUMENT("document"), + + /** The CHUNK option of this RetrievalScopedKeyValueListPair */ + CHUNK("chunk"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this RetrievalScopedKeyValueListPair */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ScopeEnum(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 RetrievalScopedKeyValueListPair + */ + @JsonCreator + @Nonnull + public static ScopeEnum fromValue(@Nonnull final String value) { + for (ScopeEnum b : ScopeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("scope") + private ScopeEnum scope = ScopeEnum.DOCUMENT; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for RetrievalScopedKeyValueListPair. */ + protected RetrievalScopedKeyValueListPair() {} + + /** + * Set the key of this {@link RetrievalScopedKeyValueListPair} instance and return the same + * instance. + * + * @param key The key of this {@link RetrievalScopedKeyValueListPair} + * @return The same instance of this {@link RetrievalScopedKeyValueListPair} class + */ + @Nonnull + public RetrievalScopedKeyValueListPair key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link RetrievalScopedKeyValueListPair} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link RetrievalScopedKeyValueListPair} instance. + * + * @param key The key of this {@link RetrievalScopedKeyValueListPair} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link RetrievalScopedKeyValueListPair} instance and return the same + * instance. + * + * @param value The value of this {@link RetrievalScopedKeyValueListPair} + * @return The same instance of this {@link RetrievalScopedKeyValueListPair} class + */ + @Nonnull + public RetrievalScopedKeyValueListPair value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link RetrievalScopedKeyValueListPair}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link RetrievalScopedKeyValueListPair} + */ + @Nonnull + public RetrievalScopedKeyValueListPair 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 RetrievalScopedKeyValueListPair} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link RetrievalScopedKeyValueListPair} instance. + * + * @param value The value of this {@link RetrievalScopedKeyValueListPair} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Set the scope of this {@link RetrievalScopedKeyValueListPair} instance and return the same + * instance. + * + * @param scope The scope of this {@link RetrievalScopedKeyValueListPair} + * @return The same instance of this {@link RetrievalScopedKeyValueListPair} class + */ + @Nonnull + public RetrievalScopedKeyValueListPair scope(@Nullable final ScopeEnum scope) { + this.scope = scope; + return this; + } + + /** + * Get scope + * + * @return scope The scope of this {@link RetrievalScopedKeyValueListPair} instance. + */ + @Nonnull + public ScopeEnum getScope() { + return scope; + } + + /** + * Set the scope of this {@link RetrievalScopedKeyValueListPair} instance. + * + * @param scope The scope of this {@link RetrievalScopedKeyValueListPair} + */ + public void setScope(@Nullable final ScopeEnum scope) { + this.scope = scope; + } + + /** + * Get the names of the unrecognizable properties of the {@link RetrievalScopedKeyValueListPair}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link RetrievalScopedKeyValueListPair} + * 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( + "RetrievalScopedKeyValueListPair has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RetrievalScopedKeyValueListPair} 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 (scope != null) declaredFields.put("scope", scope); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RetrievalScopedKeyValueListPair} 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 RetrievalScopedKeyValueListPair retrievalScopedKeyValueListPair = + (RetrievalScopedKeyValueListPair) o; + return Objects.equals( + this.cloudSdkCustomFields, retrievalScopedKeyValueListPair.cloudSdkCustomFields) + && Objects.equals(this.key, retrievalScopedKeyValueListPair.key) + && Objects.equals(this.value, retrievalScopedKeyValueListPair.value) + && Objects.equals(this.scope, retrievalScopedKeyValueListPair.scope); + } + + @Override + public int hashCode() { + return Objects.hash(key, value, scope, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class RetrievalScopedKeyValueListPair {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).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 + * RetrievalScopedKeyValueListPair} instance with all required arguments. + */ + public static Builder create() { + return (key) -> (value) -> new RetrievalScopedKeyValueListPair().key(key).value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the key of this {@link RetrievalScopedKeyValueListPair} instance. + * + * @param key The key of this {@link RetrievalScopedKeyValueListPair} + * @return The RetrievalScopedKeyValueListPair builder. + */ + Builder1 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the value of this {@link RetrievalScopedKeyValueListPair} instance. + * + * @param value The value of this {@link RetrievalScopedKeyValueListPair} + * @return The RetrievalScopedKeyValueListPair instance. + */ + RetrievalScopedKeyValueListPair value(@Nonnull final List value); + + /** + * Set the value of this {@link RetrievalScopedKeyValueListPair} instance. + * + * @param value The value of this {@link RetrievalScopedKeyValueListPair} + * @return The RetrievalScopedKeyValueListPair instance. + */ + default RetrievalScopedKeyValueListPair value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchConfiguration.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchConfiguration.java index 9c7658971..49ee910f0 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchConfiguration.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchConfiguration.java @@ -45,7 +45,7 @@ protected RetrievalSearchConfiguration() {} * instance. * * @param maxChunkCount Maximum number of chunks to be returned. Cannot be used with - * 'maxDocumentCount'. Minimum: 0 + * 'maxDocumentCount'. Minimum: 0 Maximum: 10000000 * @return The same instance of this {@link RetrievalSearchConfiguration} class */ @Nonnull @@ -56,7 +56,7 @@ public RetrievalSearchConfiguration maxChunkCount(@Nullable final Integer maxChu /** * Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. - * minimum: 0 + * minimum: 0 maximum: 10000000 * * @return maxChunkCount The maxChunkCount of this {@link RetrievalSearchConfiguration} instance. */ @@ -69,7 +69,7 @@ public Integer getMaxChunkCount() { * Set the maxChunkCount of this {@link RetrievalSearchConfiguration} instance. * * @param maxChunkCount Maximum number of chunks to be returned. Cannot be used with - * 'maxDocumentCount'. Minimum: 0 + * 'maxDocumentCount'. Minimum: 0 Maximum: 10000000 */ public void setMaxChunkCount(@Nullable final Integer maxChunkCount) { this.maxChunkCount = maxChunkCount; @@ -81,7 +81,7 @@ public void setMaxChunkCount(@Nullable final Integer maxChunkCount) { * * @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 + * is given, then only one chunk per document is returned. Minimum: 0 Maximum: 10000000 * @return The same instance of this {@link RetrievalSearchConfiguration} class */ @Nonnull @@ -93,7 +93,7 @@ public RetrievalSearchConfiguration maxDocumentCount(@Nullable final Integer max /** * [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 + * one chunk per document is returned. minimum: 0 maximum: 10000000 * * @return maxDocumentCount The maxDocumentCount of this {@link RetrievalSearchConfiguration} * instance. @@ -108,7 +108,7 @@ public Integer getMaxDocumentCount() { * * @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 + * is given, then only one chunk per document is returned. Minimum: 0 Maximum: 10000000 */ public void setMaxDocumentCount(@Nullable final Integer maxDocumentCount) { this.maxDocumentCount = maxDocumentCount; diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchDocumentKeyValueListPair.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchDocumentKeyValueListPair.java index 9df948a7f..5a4349301 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchDocumentKeyValueListPair.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchDocumentKeyValueListPair.java @@ -38,7 +38,7 @@ public class RetrievalSearchDocumentKeyValueListPair private List value = new ArrayList<>(); @JsonProperty("selectMode") - private List selectMode = new ArrayList<>(); + private List selectMode; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -161,7 +161,7 @@ public RetrievalSearchDocumentKeyValueListPair addSelectModeItem( * @return selectMode The selectMode of this {@link RetrievalSearchDocumentKeyValueListPair} * instance. */ - @Nonnull + @Nullable public List getSelectMode() { return selectMode; } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchFilter.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchFilter.java index f32b33aee..23138d14a 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchFilter.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchFilter.java @@ -35,7 +35,7 @@ public class RetrievalSearchFilter private String id; @JsonProperty("searchConfiguration") - private RetrievalSearchConfiguration searchConfiguration; + private RetrievalSearchConfiguration searchConfiguration = new RetrievalSearchConfiguration(); @JsonProperty("dataRepositories") private List dataRepositories = new ArrayList<>(Arrays.asList("*")); @@ -43,6 +43,9 @@ public class RetrievalSearchFilter @JsonProperty("dataRepositoryType") private DataRepositoryType dataRepositoryType; + @JsonProperty("remoteName") + private String remoteName; + @JsonProperty("dataRepositoryMetadata") private List dataRepositoryMetadata = new ArrayList<>(); @@ -109,7 +112,7 @@ public RetrievalSearchFilter searchConfiguration( * @return searchConfiguration The searchConfiguration of this {@link RetrievalSearchFilter} * instance. */ - @Nonnull + @Nullable public RetrievalSearchConfiguration getSearchConfiguration() { return searchConfiguration; } @@ -183,7 +186,7 @@ public void setDataRepositories(@Nullable final List dataRepositories) { */ @Nonnull public RetrievalSearchFilter dataRepositoryType( - @Nullable final DataRepositoryType dataRepositoryType) { + @Nonnull final DataRepositoryType dataRepositoryType) { this.dataRepositoryType = dataRepositoryType; return this; } @@ -194,7 +197,7 @@ public RetrievalSearchFilter dataRepositoryType( * @return dataRepositoryType The dataRepositoryType of this {@link RetrievalSearchFilter} * instance. */ - @Nullable + @Nonnull public DataRepositoryType getDataRepositoryType() { return dataRepositoryType; } @@ -204,10 +207,41 @@ public DataRepositoryType getDataRepositoryType() { * * @param dataRepositoryType The dataRepositoryType of this {@link RetrievalSearchFilter} */ - public void setDataRepositoryType(@Nullable final DataRepositoryType dataRepositoryType) { + public void setDataRepositoryType(@Nonnull final DataRepositoryType dataRepositoryType) { this.dataRepositoryType = dataRepositoryType; } + /** + * Set the remoteName of this {@link RetrievalSearchFilter} instance and return the same instance. + * + * @param remoteName Destination Name of remote instance. + * @return The same instance of this {@link RetrievalSearchFilter} class + */ + @Nonnull + public RetrievalSearchFilter remoteName(@Nullable final String remoteName) { + this.remoteName = remoteName; + return this; + } + + /** + * Destination Name of remote instance. + * + * @return remoteName The remoteName of this {@link RetrievalSearchFilter} instance. + */ + @Nullable + public String getRemoteName() { + return remoteName; + } + + /** + * Set the remoteName of this {@link RetrievalSearchFilter} instance. + * + * @param remoteName Destination Name of remote instance. + */ + public void setRemoteName(@Nullable final String remoteName) { + this.remoteName = remoteName; + } + /** * Set the dataRepositoryMetadata of this {@link RetrievalSearchFilter} instance and return the * same instance. @@ -408,6 +442,7 @@ public Map toMap() { if (searchConfiguration != null) declaredFields.put("searchConfiguration", searchConfiguration); if (dataRepositories != null) declaredFields.put("dataRepositories", dataRepositories); if (dataRepositoryType != null) declaredFields.put("dataRepositoryType", dataRepositoryType); + if (remoteName != null) declaredFields.put("remoteName", remoteName); if (dataRepositoryMetadata != null) declaredFields.put("dataRepositoryMetadata", dataRepositoryMetadata); if (documentMetadata != null) declaredFields.put("documentMetadata", documentMetadata); @@ -441,6 +476,7 @@ public boolean equals(@Nullable final java.lang.Object o) { && Objects.equals(this.searchConfiguration, retrievalSearchFilter.searchConfiguration) && Objects.equals(this.dataRepositories, retrievalSearchFilter.dataRepositories) && Objects.equals(this.dataRepositoryType, retrievalSearchFilter.dataRepositoryType) + && Objects.equals(this.remoteName, retrievalSearchFilter.remoteName) && Objects.equals(this.dataRepositoryMetadata, retrievalSearchFilter.dataRepositoryMetadata) && Objects.equals(this.documentMetadata, retrievalSearchFilter.documentMetadata) && Objects.equals(this.chunkMetadata, retrievalSearchFilter.chunkMetadata); @@ -453,6 +489,7 @@ public int hashCode() { searchConfiguration, dataRepositories, dataRepositoryType, + remoteName, dataRepositoryMetadata, documentMetadata, chunkMetadata, @@ -470,6 +507,7 @@ public String toString() { .append("\n"); sb.append(" dataRepositories: ").append(toIndentedString(dataRepositories)).append("\n"); sb.append(" dataRepositoryType: ").append(toIndentedString(dataRepositoryType)).append("\n"); + sb.append(" remoteName: ").append(toIndentedString(remoteName)).append("\n"); sb.append(" dataRepositoryMetadata: ") .append(toIndentedString(dataRepositoryMetadata)) .append("\n"); @@ -521,6 +559,6 @@ public interface Builder1 { * @param dataRepositoryType The dataRepositoryType of this {@link RetrievalSearchFilter} * @return The RetrievalSearchFilter instance. */ - RetrievalSearchFilter dataRepositoryType(@Nullable final DataRepositoryType dataRepositoryType); + RetrievalSearchFilter dataRepositoryType(@Nonnull final DataRepositoryType dataRepositoryType); } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInput.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInput.java index 018ba627f..36424f314 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInput.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInput.java @@ -35,7 +35,10 @@ public class RetrievalSearchInput private String query; @JsonProperty("filters") - private List filters = new ArrayList<>(); + private List filters = new ArrayList<>(); + + @JsonProperty("postProcessing") + private List postProcessing = new ArrayList<>(); @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -50,7 +53,7 @@ protected RetrievalSearchInput() {} * @return The same instance of this {@link RetrievalSearchInput} class */ @Nonnull - public RetrievalSearchInput query(@Nonnull final String query) { + public RetrievalSearchInput query(@Nullable final String query) { this.query = query; return this; } @@ -60,7 +63,7 @@ public RetrievalSearchInput query(@Nonnull final String query) { * * @return query The query of this {@link RetrievalSearchInput} instance. */ - @Nonnull + @Nullable public String getQuery() { return query; } @@ -70,7 +73,7 @@ public String getQuery() { * * @param query Query string */ - public void setQuery(@Nonnull final String query) { + public void setQuery(@Nullable final String query) { this.query = query; } @@ -81,7 +84,7 @@ public void setQuery(@Nonnull final String query) { * @return The same instance of this {@link RetrievalSearchInput} class */ @Nonnull - public RetrievalSearchInput filters(@Nonnull final List filters) { + public RetrievalSearchInput filters(@Nonnull final List filters) { this.filters = filters; return this; } @@ -93,7 +96,7 @@ public RetrievalSearchInput filters(@Nonnull final List f * @return The same instance of type {@link RetrievalSearchInput} */ @Nonnull - public RetrievalSearchInput addFiltersItem(@Nonnull final RetrievalSearchFilter filtersItem) { + public RetrievalSearchInput addFiltersItem(@Nonnull final FiltersInner filtersItem) { if (this.filters == null) { this.filters = new ArrayList<>(); } @@ -107,7 +110,7 @@ public RetrievalSearchInput addFiltersItem(@Nonnull final RetrievalSearchFilter * @return filters The filters of this {@link RetrievalSearchInput} instance. */ @Nonnull - public List getFilters() { + public List getFilters() { return filters; } @@ -116,10 +119,60 @@ public List getFilters() { * * @param filters The filters of this {@link RetrievalSearchInput} */ - public void setFilters(@Nonnull final List filters) { + public void setFilters(@Nonnull final List filters) { this.filters = filters; } + /** + * Set the postProcessing of this {@link RetrievalSearchInput} instance and return the same + * instance. + * + * @param postProcessing List of operations to be performed across PerFilterSearchResults. + * @return The same instance of this {@link RetrievalSearchInput} class + */ + @Nonnull + public RetrievalSearchInput postProcessing( + @Nullable final List postProcessing) { + this.postProcessing = postProcessing; + return this; + } + + /** + * Add one postProcessing instance to this {@link RetrievalSearchInput}. + * + * @param postProcessingItem The postProcessing that should be added + * @return The same instance of type {@link RetrievalSearchInput} + */ + @Nonnull + public RetrievalSearchInput addPostProcessingItem( + @Nonnull final RetrievalSearchInputPostProcessingInner postProcessingItem) { + if (this.postProcessing == null) { + this.postProcessing = new ArrayList<>(); + } + this.postProcessing.add(postProcessingItem); + return this; + } + + /** + * List of operations to be performed across PerFilterSearchResults. + * + * @return postProcessing The postProcessing of this {@link RetrievalSearchInput} instance. + */ + @Nonnull + public List getPostProcessing() { + return postProcessing; + } + + /** + * Set the postProcessing of this {@link RetrievalSearchInput} instance. + * + * @param postProcessing List of operations to be performed across PerFilterSearchResults. + */ + public void setPostProcessing( + @Nullable final List postProcessing) { + this.postProcessing = postProcessing; + } + /** * Get the names of the unrecognizable properties of the {@link RetrievalSearchInput}. * @@ -161,6 +214,7 @@ public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); if (query != null) declaredFields.put("query", query); if (filters != null) declaredFields.put("filters", filters); + if (postProcessing != null) declaredFields.put("postProcessing", postProcessing); return declaredFields; } @@ -187,12 +241,13 @@ public boolean equals(@Nullable final java.lang.Object o) { final RetrievalSearchInput retrievalSearchInput = (RetrievalSearchInput) o; return Objects.equals(this.cloudSdkCustomFields, retrievalSearchInput.cloudSdkCustomFields) && Objects.equals(this.query, retrievalSearchInput.query) - && Objects.equals(this.filters, retrievalSearchInput.filters); + && Objects.equals(this.filters, retrievalSearchInput.filters) + && Objects.equals(this.postProcessing, retrievalSearchInput.postProcessing); } @Override public int hashCode() { - return Objects.hash(query, filters, cloudSdkCustomFields); + return Objects.hash(query, filters, postProcessing, cloudSdkCustomFields); } @Override @@ -202,6 +257,7 @@ public String toString() { sb.append("class RetrievalSearchInput {\n"); sb.append(" query: ").append(toIndentedString(query)).append("\n"); sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" postProcessing: ").append(toIndentedString(postProcessing)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); @@ -235,7 +291,7 @@ public interface Builder { * @param query Query string * @return The RetrievalSearchInput builder. */ - Builder1 query(@Nonnull final String query); + Builder1 query(@Nullable final String query); } /** Builder helper class. */ @@ -246,7 +302,7 @@ public interface Builder1 { * @param filters The filters of this {@link RetrievalSearchInput} * @return The RetrievalSearchInput instance. */ - RetrievalSearchInput filters(@Nonnull final List filters); + RetrievalSearchInput filters(@Nonnull final List filters); /** * Set the filters of this {@link RetrievalSearchInput} instance. @@ -254,7 +310,7 @@ public interface Builder1 { * @param filters The filters of this {@link RetrievalSearchInput} * @return The RetrievalSearchInput instance. */ - default RetrievalSearchInput filters(@Nonnull final RetrievalSearchFilter... filters) { + default RetrievalSearchInput filters(@Nonnull final FiltersInner... filters) { return filters(Arrays.asList(filters)); } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInputPostProcessingInner.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInputPostProcessingInner.java new file mode 100644 index 000000000..244d8b4e8 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInputPostProcessingInner.java @@ -0,0 +1,356 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** RetrievalSearchInputPostProcessingInner */ +// CHECKSTYLE:OFF +public class RetrievalSearchInputPostProcessingInner +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id = "ae9eee48-4671-4321-a3e5-640adaaf26ae"; + + @JsonProperty("maxChunkCount") + private Integer maxChunkCount = 5; + + @JsonProperty("strategy") + private RetrievalSearchInputPostProcessingInnerStrategy strategy; + + @JsonProperty("inputs") + private List inputs = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for RetrievalSearchInputPostProcessingInner. */ + protected RetrievalSearchInputPostProcessingInner() {} + + /** + * Set the id of this {@link RetrievalSearchInputPostProcessingInner} instance and return the same + * instance. + * + * @param id New ID for each PostProcessingOperation. + * @return The same instance of this {@link RetrievalSearchInputPostProcessingInner} class + */ + @Nonnull + public RetrievalSearchInputPostProcessingInner id(@Nullable final String id) { + this.id = id; + return this; + } + + /** + * New ID for each PostProcessingOperation. + * + * @return id The id of this {@link RetrievalSearchInputPostProcessingInner} instance. + */ + @Nullable + public String getId() { + return id; + } + + /** + * Set the id of this {@link RetrievalSearchInputPostProcessingInner} instance. + * + * @param id New ID for each PostProcessingOperation. + */ + public void setId(@Nullable final String id) { + this.id = id; + } + + /** + * Set the maxChunkCount of this {@link RetrievalSearchInputPostProcessingInner} instance and + * return the same instance. + * + * @param maxChunkCount Maximum number of chunks to be retained in final PerSearchFilterResult. + * Minimum: 0 Maximum: 10000000 + * @return The same instance of this {@link RetrievalSearchInputPostProcessingInner} class + */ + @Nonnull + public RetrievalSearchInputPostProcessingInner maxChunkCount( + @Nullable final Integer maxChunkCount) { + this.maxChunkCount = maxChunkCount; + return this; + } + + /** + * Maximum number of chunks to be retained in final PerSearchFilterResult. minimum: 0 maximum: + * 10000000 + * + * @return maxChunkCount The maxChunkCount of this {@link RetrievalSearchInputPostProcessingInner} + * instance. + */ + @Nullable + public Integer getMaxChunkCount() { + return maxChunkCount; + } + + /** + * Set the maxChunkCount of this {@link RetrievalSearchInputPostProcessingInner} instance. + * + * @param maxChunkCount Maximum number of chunks to be retained in final PerSearchFilterResult. + * Minimum: 0 Maximum: 10000000 + */ + public void setMaxChunkCount(@Nullable final Integer maxChunkCount) { + this.maxChunkCount = maxChunkCount; + } + + /** + * Set the strategy of this {@link RetrievalSearchInputPostProcessingInner} instance and return + * the same instance. + * + * @param strategy The strategy of this {@link RetrievalSearchInputPostProcessingInner} + * @return The same instance of this {@link RetrievalSearchInputPostProcessingInner} class + */ + @Nonnull + public RetrievalSearchInputPostProcessingInner strategy( + @Nonnull final RetrievalSearchInputPostProcessingInnerStrategy strategy) { + this.strategy = strategy; + return this; + } + + /** + * Get strategy + * + * @return strategy The strategy of this {@link RetrievalSearchInputPostProcessingInner} instance. + */ + @Nonnull + public RetrievalSearchInputPostProcessingInnerStrategy getStrategy() { + return strategy; + } + + /** + * Set the strategy of this {@link RetrievalSearchInputPostProcessingInner} instance. + * + * @param strategy The strategy of this {@link RetrievalSearchInputPostProcessingInner} + */ + public void setStrategy(@Nonnull final RetrievalSearchInputPostProcessingInnerStrategy strategy) { + this.strategy = strategy; + } + + /** + * Set the inputs of this {@link RetrievalSearchInputPostProcessingInner} instance and return the + * same instance. + * + * @param inputs The inputs of this {@link RetrievalSearchInputPostProcessingInner} + * @return The same instance of this {@link RetrievalSearchInputPostProcessingInner} class + */ + @Nonnull + public RetrievalSearchInputPostProcessingInner inputs( + @Nonnull final List inputs) { + this.inputs = inputs; + return this; + } + + /** + * Add one inputs instance to this {@link RetrievalSearchInputPostProcessingInner}. + * + * @param inputsItem The inputs that should be added + * @return The same instance of type {@link RetrievalSearchInputPostProcessingInner} + */ + @Nonnull + public RetrievalSearchInputPostProcessingInner addInputsItem( + @Nonnull final RetrievalSearchInputPostProcessingInnerInputsInner inputsItem) { + if (this.inputs == null) { + this.inputs = new ArrayList<>(); + } + this.inputs.add(inputsItem); + return this; + } + + /** + * Get inputs + * + * @return inputs The inputs of this {@link RetrievalSearchInputPostProcessingInner} instance. + */ + @Nonnull + public List getInputs() { + return inputs; + } + + /** + * Set the inputs of this {@link RetrievalSearchInputPostProcessingInner} instance. + * + * @param inputs The inputs of this {@link RetrievalSearchInputPostProcessingInner} + */ + public void setInputs( + @Nonnull final List inputs) { + this.inputs = inputs; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * RetrievalSearchInputPostProcessingInner}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link + * RetrievalSearchInputPostProcessingInner} 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( + "RetrievalSearchInputPostProcessingInner has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RetrievalSearchInputPostProcessingInner} + * 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 (maxChunkCount != null) declaredFields.put("maxChunkCount", maxChunkCount); + if (strategy != null) declaredFields.put("strategy", strategy); + if (inputs != null) declaredFields.put("inputs", inputs); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RetrievalSearchInputPostProcessingInner} + * 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 RetrievalSearchInputPostProcessingInner retrievalSearchInputPostProcessingInner = + (RetrievalSearchInputPostProcessingInner) o; + return Objects.equals( + this.cloudSdkCustomFields, retrievalSearchInputPostProcessingInner.cloudSdkCustomFields) + && Objects.equals(this.id, retrievalSearchInputPostProcessingInner.id) + && Objects.equals(this.maxChunkCount, retrievalSearchInputPostProcessingInner.maxChunkCount) + && Objects.equals(this.strategy, retrievalSearchInputPostProcessingInner.strategy) + && Objects.equals(this.inputs, retrievalSearchInputPostProcessingInner.inputs); + } + + @Override + public int hashCode() { + return Objects.hash(id, maxChunkCount, strategy, inputs, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class RetrievalSearchInputPostProcessingInner {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" maxChunkCount: ").append(toIndentedString(maxChunkCount)).append("\n"); + sb.append(" strategy: ").append(toIndentedString(strategy)).append("\n"); + sb.append(" inputs: ").append(toIndentedString(inputs)).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 + * RetrievalSearchInputPostProcessingInner} instance with all required arguments. + */ + public static Builder create() { + return (strategy) -> + (inputs) -> new RetrievalSearchInputPostProcessingInner().strategy(strategy).inputs(inputs); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the strategy of this {@link RetrievalSearchInputPostProcessingInner} instance. + * + * @param strategy The strategy of this {@link RetrievalSearchInputPostProcessingInner} + * @return The RetrievalSearchInputPostProcessingInner builder. + */ + Builder1 strategy(@Nonnull final RetrievalSearchInputPostProcessingInnerStrategy strategy); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the inputs of this {@link RetrievalSearchInputPostProcessingInner} instance. + * + * @param inputs The inputs of this {@link RetrievalSearchInputPostProcessingInner} + * @return The RetrievalSearchInputPostProcessingInner instance. + */ + RetrievalSearchInputPostProcessingInner inputs( + @Nonnull final List inputs); + + /** + * Set the inputs of this {@link RetrievalSearchInputPostProcessingInner} instance. + * + * @param inputs The inputs of this {@link RetrievalSearchInputPostProcessingInner} + * @return The RetrievalSearchInputPostProcessingInner instance. + */ + default RetrievalSearchInputPostProcessingInner inputs( + @Nonnull final RetrievalSearchInputPostProcessingInnerInputsInner... inputs) { + return inputs(Arrays.asList(inputs)); + } + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInputPostProcessingInnerInputsInner.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInputPostProcessingInnerInputsInner.java new file mode 100644 index 000000000..fc1d030a0 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInputPostProcessingInnerInputsInner.java @@ -0,0 +1,23 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** RetrievalSearchInputPostProcessingInnerInputsInner */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = PostProcessingObjectReference.class), + @JsonSubTypes.Type(value = PostProcessingOperation.class), +}) +public interface RetrievalSearchInputPostProcessingInnerInputsInner {} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInputPostProcessingInnerStrategy.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInputPostProcessingInnerStrategy.java new file mode 100644 index 000000000..af8217935 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInputPostProcessingInnerStrategy.java @@ -0,0 +1,23 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** Merging and scoring strategy to derive final PerSearchFilterResult. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = MergeStrategyReranker.class), + @JsonSubTypes.Type(value = MergeStrategyScoreReuse.class), +}) +public interface RetrievalSearchInputPostProcessingInnerStrategy {} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchResults.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchResults.java index dcbf507cf..e29f60da4 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchResults.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchResults.java @@ -32,7 +32,7 @@ public class RetrievalSearchResults // CHECKSTYLE:ON { @JsonProperty("results") - private List results = new ArrayList<>(); + private List results = new ArrayList<>(); @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -47,7 +47,7 @@ protected RetrievalSearchResults() {} * @return The same instance of this {@link RetrievalSearchResults} class */ @Nonnull - public RetrievalSearchResults results(@Nonnull final List results) { + public RetrievalSearchResults results(@Nonnull final List results) { this.results = results; return this; } @@ -59,7 +59,7 @@ public RetrievalSearchResults results(@Nonnull final List results * @return The same instance of type {@link RetrievalSearchResults} */ @Nonnull - public RetrievalSearchResults addResultsItem(@Nonnull final ResultsInner2 resultsItem) { + public RetrievalSearchResults addResultsItem(@Nonnull final ResultsInner1 resultsItem) { if (this.results == null) { this.results = new ArrayList<>(); } @@ -73,7 +73,7 @@ public RetrievalSearchResults addResultsItem(@Nonnull final ResultsInner2 result * @return results The results of this {@link RetrievalSearchResults} instance. */ @Nonnull - public List getResults() { + public List getResults() { return results; } @@ -82,7 +82,7 @@ public List getResults() { * * @param results List of returned results. */ - public void setResults(@Nonnull final List results) { + public void setResults(@Nonnull final List results) { this.results = results; } @@ -198,7 +198,7 @@ public interface Builder { * @param results List of returned results. * @return The RetrievalSearchResults instance. */ - RetrievalSearchResults results(@Nonnull final List results); + RetrievalSearchResults results(@Nonnull final List results); /** * Set the results of this {@link RetrievalSearchResults} instance. @@ -206,7 +206,7 @@ public interface Builder { * @param results List of returned results. * @return The RetrievalSearchResults instance. */ - default RetrievalSearchResults results(@Nonnull final ResultsInner2... results) { + default RetrievalSearchResults results(@Nonnull final ResultsInner1... results) { return results(Arrays.asList(results)); } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchSelectOptionEnum.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchSelectOptionEnum.java index 6794adcc4..d09480780 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchSelectOptionEnum.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchSelectOptionEnum.java @@ -57,6 +57,6 @@ public static RetrievalSearchSelectOptionEnum fromValue(@Nonnull final String va return b; } } - return null; + return UNKNOWN_DEFAULT_OPEN_API; } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalVectorSearchFilter.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalVectorSearchFilter.java new file mode 100644 index 000000000..f3a09a7c1 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalVectorSearchFilter.java @@ -0,0 +1,647 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** RetrievalVectorSearchFilter */ +// CHECKSTYLE:OFF +public class RetrievalVectorSearchFilter +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + @JsonProperty("searchConfiguration") + private RetrievalSearchConfiguration searchConfiguration = new RetrievalSearchConfiguration(); + + @JsonProperty("dataRepositories") + private List dataRepositories = new ArrayList<>(Arrays.asList("*")); + + @JsonProperty("dataRepositoryType") + private DataRepositoryType dataRepositoryType; + + @JsonProperty("remoteName") + private String remoteName; + + @JsonProperty("dataRepositoryMetadata") + private List dataRepositoryMetadata = new ArrayList<>(); + + @JsonProperty("documentMetadata") + private List documentMetadata = new ArrayList<>(); + + @JsonProperty("chunkMetadata") + private List chunkMetadata = new ArrayList<>(); + + @JsonProperty("filter") + private RetrievalVectorSearchFilterFilter filter; + + @JsonProperty("scoringConfiguration") + private VectorScoringConfiguration scoringConfiguration; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for RetrievalVectorSearchFilter. */ + protected RetrievalVectorSearchFilter() {} + + /** + * Set the id of this {@link RetrievalVectorSearchFilter} instance and return the same instance. + * + * @param id Identifier of this RetrievalSearchFilter - unique per request. + * @return The same instance of this {@link RetrievalVectorSearchFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilter id(@Nonnull final String id) { + this.id = id; + return this; + } + + /** + * Identifier of this RetrievalSearchFilter - unique per request. + * + * @return id The id of this {@link RetrievalVectorSearchFilter} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link RetrievalVectorSearchFilter} instance. + * + * @param id Identifier of this RetrievalSearchFilter - unique per request. + */ + public void setId(@Nonnull final String id) { + this.id = id; + } + + /** + * Set the searchConfiguration of this {@link RetrievalVectorSearchFilter} instance and return the + * same instance. + * + * @param searchConfiguration The searchConfiguration of this {@link RetrievalVectorSearchFilter} + * @return The same instance of this {@link RetrievalVectorSearchFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilter searchConfiguration( + @Nullable final RetrievalSearchConfiguration searchConfiguration) { + this.searchConfiguration = searchConfiguration; + return this; + } + + /** + * Get searchConfiguration + * + * @return searchConfiguration The searchConfiguration of this {@link RetrievalVectorSearchFilter} + * instance. + */ + @Nullable + public RetrievalSearchConfiguration getSearchConfiguration() { + return searchConfiguration; + } + + /** + * Set the searchConfiguration of this {@link RetrievalVectorSearchFilter} instance. + * + * @param searchConfiguration The searchConfiguration of this {@link RetrievalVectorSearchFilter} + */ + public void setSearchConfiguration( + @Nullable final RetrievalSearchConfiguration searchConfiguration) { + this.searchConfiguration = searchConfiguration; + } + + /** + * Set the dataRepositories of this {@link RetrievalVectorSearchFilter} 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 RetrievalVectorSearchFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilter dataRepositories( + @Nullable final List dataRepositories) { + this.dataRepositories = dataRepositories; + return this; + } + + /** + * Add one dataRepositories instance to this {@link RetrievalVectorSearchFilter}. + * + * @param dataRepositoriesItem The dataRepositories that should be added + * @return The same instance of type {@link RetrievalVectorSearchFilter} + */ + @Nonnull + public RetrievalVectorSearchFilter 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 RetrievalVectorSearchFilter} + * instance. + */ + @Nonnull + public List getDataRepositories() { + return dataRepositories; + } + + /** + * Set the dataRepositories of this {@link RetrievalVectorSearchFilter} 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 RetrievalVectorSearchFilter} instance and return the + * same instance. + * + * @param dataRepositoryType The dataRepositoryType of this {@link RetrievalVectorSearchFilter} + * @return The same instance of this {@link RetrievalVectorSearchFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilter dataRepositoryType( + @Nullable final DataRepositoryType dataRepositoryType) { + this.dataRepositoryType = dataRepositoryType; + return this; + } + + /** + * Get dataRepositoryType + * + * @return dataRepositoryType The dataRepositoryType of this {@link RetrievalVectorSearchFilter} + * instance. + */ + @Nonnull + public DataRepositoryType getDataRepositoryType() { + return dataRepositoryType; + } + + /** + * Set the dataRepositoryType of this {@link RetrievalVectorSearchFilter} instance. + * + * @param dataRepositoryType The dataRepositoryType of this {@link RetrievalVectorSearchFilter} + */ + public void setDataRepositoryType(@Nullable final DataRepositoryType dataRepositoryType) { + this.dataRepositoryType = dataRepositoryType; + } + + /** + * Set the remoteName of this {@link RetrievalVectorSearchFilter} instance and return the same + * instance. + * + * @param remoteName Destination Name of remote instance. + * @return The same instance of this {@link RetrievalVectorSearchFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilter remoteName(@Nullable final String remoteName) { + this.remoteName = remoteName; + return this; + } + + /** + * Destination Name of remote instance. + * + * @return remoteName The remoteName of this {@link RetrievalVectorSearchFilter} instance. + */ + @Nullable + public String getRemoteName() { + return remoteName; + } + + /** + * Set the remoteName of this {@link RetrievalVectorSearchFilter} instance. + * + * @param remoteName Destination Name of remote instance. + */ + public void setRemoteName(@Nullable final String remoteName) { + this.remoteName = remoteName; + } + + /** + * Set the dataRepositoryMetadata of this {@link RetrievalVectorSearchFilter} 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 RetrievalVectorSearchFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilter dataRepositoryMetadata( + @Nullable final List dataRepositoryMetadata) { + this.dataRepositoryMetadata = dataRepositoryMetadata; + return this; + } + + /** + * Add one dataRepositoryMetadata instance to this {@link RetrievalVectorSearchFilter}. + * + * @param dataRepositoryMetadataItem The dataRepositoryMetadata that should be added + * @return The same instance of type {@link RetrievalVectorSearchFilter} + */ + @Nonnull + public RetrievalVectorSearchFilter addDataRepositoryMetadataItem( + @Nonnull final RetrievalKeyValueListPair 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 + * RetrievalVectorSearchFilter} instance. + */ + @Nonnull + public List getDataRepositoryMetadata() { + return dataRepositoryMetadata; + } + + /** + * Set the dataRepositoryMetadata of this {@link RetrievalVectorSearchFilter} 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 RetrievalVectorSearchFilter} 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 RetrievalVectorSearchFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilter documentMetadata( + @Nullable final List documentMetadata) { + this.documentMetadata = documentMetadata; + return this; + } + + /** + * Add one documentMetadata instance to this {@link RetrievalVectorSearchFilter}. + * + * @param documentMetadataItem The documentMetadata that should be added + * @return The same instance of type {@link RetrievalVectorSearchFilter} + */ + @Nonnull + public RetrievalVectorSearchFilter addDocumentMetadataItem( + @Nonnull final RetrievalSearchDocumentKeyValueListPair 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 RetrievalVectorSearchFilter} + * instance. + */ + @Nonnull + public List getDocumentMetadata() { + return documentMetadata; + } + + /** + * Set the documentMetadata of this {@link RetrievalVectorSearchFilter} 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 RetrievalVectorSearchFilter} 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 RetrievalVectorSearchFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilter chunkMetadata( + @Nullable final List chunkMetadata) { + this.chunkMetadata = chunkMetadata; + return this; + } + + /** + * Add one chunkMetadata instance to this {@link RetrievalVectorSearchFilter}. + * + * @param chunkMetadataItem The chunkMetadata that should be added + * @return The same instance of type {@link RetrievalVectorSearchFilter} + */ + @Nonnull + public RetrievalVectorSearchFilter addChunkMetadataItem( + @Nonnull final RetrievalKeyValueListPair 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 RetrievalVectorSearchFilter} instance. + */ + @Nonnull + public List getChunkMetadata() { + return chunkMetadata; + } + + /** + * Set the chunkMetadata of this {@link RetrievalVectorSearchFilter} instance. + * + * @param chunkMetadata Restrict chunks considered during search to those with the given metadata. + */ + public void setChunkMetadata(@Nullable final List chunkMetadata) { + this.chunkMetadata = chunkMetadata; + } + + /** + * Set the filter of this {@link RetrievalVectorSearchFilter} instance and return the same + * instance. + * + * @param filter The filter of this {@link RetrievalVectorSearchFilter} + * @return The same instance of this {@link RetrievalVectorSearchFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilter filter( + @Nullable final RetrievalVectorSearchFilterFilter filter) { + this.filter = filter; + return this; + } + + /** + * Get filter + * + * @return filter The filter of this {@link RetrievalVectorSearchFilter} instance. + */ + @Nullable + public RetrievalVectorSearchFilterFilter getFilter() { + return filter; + } + + /** + * Set the filter of this {@link RetrievalVectorSearchFilter} instance. + * + * @param filter The filter of this {@link RetrievalVectorSearchFilter} + */ + public void setFilter(@Nullable final RetrievalVectorSearchFilterFilter filter) { + this.filter = filter; + } + + /** + * Set the scoringConfiguration of this {@link RetrievalVectorSearchFilter} instance and return + * the same instance. + * + * @param scoringConfiguration The scoringConfiguration of this {@link + * RetrievalVectorSearchFilter} + * @return The same instance of this {@link RetrievalVectorSearchFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilter scoringConfiguration( + @Nullable final VectorScoringConfiguration scoringConfiguration) { + this.scoringConfiguration = scoringConfiguration; + return this; + } + + /** + * Get scoringConfiguration + * + * @return scoringConfiguration The scoringConfiguration of this {@link + * RetrievalVectorSearchFilter} instance. + */ + @Nonnull + public VectorScoringConfiguration getScoringConfiguration() { + return scoringConfiguration; + } + + /** + * Set the scoringConfiguration of this {@link RetrievalVectorSearchFilter} instance. + * + * @param scoringConfiguration The scoringConfiguration of this {@link + * RetrievalVectorSearchFilter} + */ + public void setScoringConfiguration( + @Nullable final VectorScoringConfiguration scoringConfiguration) { + this.scoringConfiguration = scoringConfiguration; + } + + /** + * Get the names of the unrecognizable properties of the {@link RetrievalVectorSearchFilter}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link RetrievalVectorSearchFilter} + * 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( + "RetrievalVectorSearchFilter has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RetrievalVectorSearchFilter} 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 (searchConfiguration != null) declaredFields.put("searchConfiguration", searchConfiguration); + if (dataRepositories != null) declaredFields.put("dataRepositories", dataRepositories); + if (dataRepositoryType != null) declaredFields.put("dataRepositoryType", dataRepositoryType); + if (remoteName != null) declaredFields.put("remoteName", remoteName); + if (dataRepositoryMetadata != null) + declaredFields.put("dataRepositoryMetadata", dataRepositoryMetadata); + if (documentMetadata != null) declaredFields.put("documentMetadata", documentMetadata); + if (chunkMetadata != null) declaredFields.put("chunkMetadata", chunkMetadata); + if (filter != null) declaredFields.put("filter", filter); + if (scoringConfiguration != null) + declaredFields.put("scoringConfiguration", scoringConfiguration); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RetrievalVectorSearchFilter} 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 RetrievalVectorSearchFilter retrievalVectorSearchFilter = (RetrievalVectorSearchFilter) o; + return Objects.equals( + this.cloudSdkCustomFields, retrievalVectorSearchFilter.cloudSdkCustomFields) + && Objects.equals(this.id, retrievalVectorSearchFilter.id) + && Objects.equals(this.searchConfiguration, retrievalVectorSearchFilter.searchConfiguration) + && Objects.equals(this.dataRepositories, retrievalVectorSearchFilter.dataRepositories) + && Objects.equals(this.dataRepositoryType, retrievalVectorSearchFilter.dataRepositoryType) + && Objects.equals(this.remoteName, retrievalVectorSearchFilter.remoteName) + && Objects.equals( + this.dataRepositoryMetadata, retrievalVectorSearchFilter.dataRepositoryMetadata) + && Objects.equals(this.documentMetadata, retrievalVectorSearchFilter.documentMetadata) + && Objects.equals(this.chunkMetadata, retrievalVectorSearchFilter.chunkMetadata) + && Objects.equals(this.filter, retrievalVectorSearchFilter.filter) + && Objects.equals( + this.scoringConfiguration, retrievalVectorSearchFilter.scoringConfiguration); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + searchConfiguration, + dataRepositories, + dataRepositoryType, + remoteName, + dataRepositoryMetadata, + documentMetadata, + chunkMetadata, + filter, + scoringConfiguration, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class RetrievalVectorSearchFilter {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" searchConfiguration: ") + .append(toIndentedString(searchConfiguration)) + .append("\n"); + sb.append(" dataRepositories: ").append(toIndentedString(dataRepositories)).append("\n"); + sb.append(" dataRepositoryType: ").append(toIndentedString(dataRepositoryType)).append("\n"); + sb.append(" remoteName: ").append(toIndentedString(remoteName)).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"); + sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); + sb.append(" scoringConfiguration: ") + .append(toIndentedString(scoringConfiguration)) + .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 + * RetrievalVectorSearchFilter} instance with all required arguments. + */ + public static Builder create() { + return (id) -> new RetrievalVectorSearchFilter().id(id); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link RetrievalVectorSearchFilter} instance. + * + * @param id Identifier of this RetrievalSearchFilter - unique per request. + * @return The RetrievalVectorSearchFilter instance. + */ + RetrievalVectorSearchFilter id(@Nonnull final String id); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalVectorSearchFilterFilter.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalVectorSearchFilterFilter.java new file mode 100644 index 000000000..cde2b6b4f --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalVectorSearchFilterFilter.java @@ -0,0 +1,585 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** + * Filter to apply on the search results. This cannot be used together with + * 'documentMetadata'. The depth of the filter must not exceed 5 levels. + */ +// CHECKSTYLE:OFF +public class RetrievalVectorSearchFilterFilter +// CHECKSTYLE:ON +{ + /** Gets or Sets operator */ + public enum OperatorEnum { + /** The AND option of this RetrievalVectorSearchFilterFilter */ + AND("and"), + + /** The OR option of this RetrievalVectorSearchFilterFilter */ + OR("or"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this RetrievalVectorSearchFilterFilter */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + OperatorEnum(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 RetrievalVectorSearchFilterFilter + */ + @JsonCreator + @Nonnull + public static OperatorEnum fromValue(@Nonnull final String value) { + for (OperatorEnum b : OperatorEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("operator") + private OperatorEnum operator; + + @JsonProperty("left") + private Left left; + + @JsonProperty("right") + private Right right; + + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + /** Gets or Sets scope */ + public enum ScopeEnum { + /** The REPOSITORY option of this RetrievalVectorSearchFilterFilter */ + REPOSITORY("repository"), + + /** The DOCUMENT option of this RetrievalVectorSearchFilterFilter */ + DOCUMENT("document"), + + /** The CHUNK option of this RetrievalVectorSearchFilterFilter */ + CHUNK("chunk"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this RetrievalVectorSearchFilterFilter */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ScopeEnum(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 RetrievalVectorSearchFilterFilter + */ + @JsonCreator + @Nonnull + public static ScopeEnum fromValue(@Nonnull final String value) { + for (ScopeEnum b : ScopeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("scope") + private ScopeEnum scope = ScopeEnum.DOCUMENT; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for RetrievalVectorSearchFilterFilter. */ + protected RetrievalVectorSearchFilterFilter() {} + + /** + * Set the operator of this {@link RetrievalVectorSearchFilterFilter} instance and return the same + * instance. + * + * @param operator The operator of this {@link RetrievalVectorSearchFilterFilter} + * @return The same instance of this {@link RetrievalVectorSearchFilterFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilterFilter operator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + return this; + } + + /** + * Get operator + * + * @return operator The operator of this {@link RetrievalVectorSearchFilterFilter} instance. + */ + @Nonnull + public OperatorEnum getOperator() { + return operator; + } + + /** + * Set the operator of this {@link RetrievalVectorSearchFilterFilter} instance. + * + * @param operator The operator of this {@link RetrievalVectorSearchFilterFilter} + */ + public void setOperator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + } + + /** + * Set the left of this {@link RetrievalVectorSearchFilterFilter} instance and return the same + * instance. + * + * @param left The left of this {@link RetrievalVectorSearchFilterFilter} + * @return The same instance of this {@link RetrievalVectorSearchFilterFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilterFilter left(@Nonnull final Left left) { + this.left = left; + return this; + } + + /** + * Get left + * + * @return left The left of this {@link RetrievalVectorSearchFilterFilter} instance. + */ + @Nonnull + public Left getLeft() { + return left; + } + + /** + * Set the left of this {@link RetrievalVectorSearchFilterFilter} instance. + * + * @param left The left of this {@link RetrievalVectorSearchFilterFilter} + */ + public void setLeft(@Nonnull final Left left) { + this.left = left; + } + + /** + * Set the right of this {@link RetrievalVectorSearchFilterFilter} instance and return the same + * instance. + * + * @param right The right of this {@link RetrievalVectorSearchFilterFilter} + * @return The same instance of this {@link RetrievalVectorSearchFilterFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilterFilter right(@Nonnull final Right right) { + this.right = right; + return this; + } + + /** + * Get right + * + * @return right The right of this {@link RetrievalVectorSearchFilterFilter} instance. + */ + @Nonnull + public Right getRight() { + return right; + } + + /** + * Set the right of this {@link RetrievalVectorSearchFilterFilter} instance. + * + * @param right The right of this {@link RetrievalVectorSearchFilterFilter} + */ + public void setRight(@Nonnull final Right right) { + this.right = right; + } + + /** + * Set the key of this {@link RetrievalVectorSearchFilterFilter} instance and return the same + * instance. + * + * @param key The key of this {@link RetrievalVectorSearchFilterFilter} + * @return The same instance of this {@link RetrievalVectorSearchFilterFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilterFilter key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link RetrievalVectorSearchFilterFilter} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link RetrievalVectorSearchFilterFilter} instance. + * + * @param key The key of this {@link RetrievalVectorSearchFilterFilter} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link RetrievalVectorSearchFilterFilter} instance and return the same + * instance. + * + * @param value The value of this {@link RetrievalVectorSearchFilterFilter} + * @return The same instance of this {@link RetrievalVectorSearchFilterFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilterFilter value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link RetrievalVectorSearchFilterFilter}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link RetrievalVectorSearchFilterFilter} + */ + @Nonnull + public RetrievalVectorSearchFilterFilter 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 RetrievalVectorSearchFilterFilter} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link RetrievalVectorSearchFilterFilter} instance. + * + * @param value The value of this {@link RetrievalVectorSearchFilterFilter} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Set the scope of this {@link RetrievalVectorSearchFilterFilter} instance and return the same + * instance. + * + * @param scope The scope of this {@link RetrievalVectorSearchFilterFilter} + * @return The same instance of this {@link RetrievalVectorSearchFilterFilter} class + */ + @Nonnull + public RetrievalVectorSearchFilterFilter scope(@Nullable final ScopeEnum scope) { + this.scope = scope; + return this; + } + + /** + * Get scope + * + * @return scope The scope of this {@link RetrievalVectorSearchFilterFilter} instance. + */ + @Nonnull + public ScopeEnum getScope() { + return scope; + } + + /** + * Set the scope of this {@link RetrievalVectorSearchFilterFilter} instance. + * + * @param scope The scope of this {@link RetrievalVectorSearchFilterFilter} + */ + public void setScope(@Nullable final ScopeEnum scope) { + this.scope = scope; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * RetrievalVectorSearchFilterFilter}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link RetrievalVectorSearchFilterFilter} + * 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( + "RetrievalVectorSearchFilterFilter has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RetrievalVectorSearchFilterFilter} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (operator != null) declaredFields.put("operator", operator); + if (left != null) declaredFields.put("left", left); + if (right != null) declaredFields.put("right", right); + if (key != null) declaredFields.put("key", key); + if (value != null) declaredFields.put("value", value); + if (scope != null) declaredFields.put("scope", scope); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RetrievalVectorSearchFilterFilter} 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 RetrievalVectorSearchFilterFilter retrievalVectorSearchFilterFilter = + (RetrievalVectorSearchFilterFilter) o; + return Objects.equals( + this.cloudSdkCustomFields, retrievalVectorSearchFilterFilter.cloudSdkCustomFields) + && Objects.equals(this.operator, retrievalVectorSearchFilterFilter.operator) + && Objects.equals(this.left, retrievalVectorSearchFilterFilter.left) + && Objects.equals(this.right, retrievalVectorSearchFilterFilter.right) + && Objects.equals(this.key, retrievalVectorSearchFilterFilter.key) + && Objects.equals(this.value, retrievalVectorSearchFilterFilter.value) + && Objects.equals(this.scope, retrievalVectorSearchFilterFilter.scope); + } + + @Override + public int hashCode() { + return Objects.hash(operator, left, right, key, value, scope, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class RetrievalVectorSearchFilterFilter {\n"); + sb.append(" operator: ").append(toIndentedString(operator)).append("\n"); + sb.append(" left: ").append(toIndentedString(left)).append("\n"); + sb.append(" right: ").append(toIndentedString(right)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).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 + * RetrievalVectorSearchFilterFilter} instance with all required arguments. + */ + public static Builder create() { + return (operator) -> + (left) -> + (right) -> + (key) -> + (value) -> + new RetrievalVectorSearchFilterFilter() + .operator(operator) + .left(left) + .right(right) + .key(key) + .value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the operator of this {@link RetrievalVectorSearchFilterFilter} instance. + * + * @param operator The operator of this {@link RetrievalVectorSearchFilterFilter} + * @return The RetrievalVectorSearchFilterFilter builder. + */ + Builder1 operator(@Nonnull final OperatorEnum operator); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the left of this {@link RetrievalVectorSearchFilterFilter} instance. + * + * @param left The left of this {@link RetrievalVectorSearchFilterFilter} + * @return The RetrievalVectorSearchFilterFilter builder. + */ + Builder2 left(@Nonnull final Left left); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the right of this {@link RetrievalVectorSearchFilterFilter} instance. + * + * @param right The right of this {@link RetrievalVectorSearchFilterFilter} + * @return The RetrievalVectorSearchFilterFilter builder. + */ + Builder3 right(@Nonnull final Right right); + } + + /** Builder helper class. */ + public interface Builder3 { + /** + * Set the key of this {@link RetrievalVectorSearchFilterFilter} instance. + * + * @param key The key of this {@link RetrievalVectorSearchFilterFilter} + * @return The RetrievalVectorSearchFilterFilter builder. + */ + Builder4 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder4 { + /** + * Set the value of this {@link RetrievalVectorSearchFilterFilter} instance. + * + * @param value The value of this {@link RetrievalVectorSearchFilterFilter} + * @return The RetrievalVectorSearchFilterFilter instance. + */ + RetrievalVectorSearchFilterFilter value(@Nonnull final List value); + + /** + * Set the value of this {@link RetrievalVectorSearchFilterFilter} instance. + * + * @param value The value of this {@link RetrievalVectorSearchFilterFilter} + * @return The RetrievalVectorSearchFilterFilter instance. + */ + default RetrievalVectorSearchFilterFilter value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Right.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Right.java new file mode 100644 index 000000000..a827f1d93 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Right.java @@ -0,0 +1,570 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** Right */ +// CHECKSTYLE:OFF +public class Right +// CHECKSTYLE:ON +{ + /** Gets or Sets operator */ + public enum OperatorEnum { + /** The AND option of this Right */ + AND("and"), + + /** The OR option of this Right */ + OR("or"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this Right */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + OperatorEnum(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 Right + */ + @JsonCreator + @Nonnull + public static OperatorEnum fromValue(@Nonnull final String value) { + for (OperatorEnum b : OperatorEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("operator") + private OperatorEnum operator; + + @JsonProperty("left") + private Left left; + + @JsonProperty("right") + private Right right; + + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + /** Gets or Sets scope */ + public enum ScopeEnum { + /** The REPOSITORY option of this Right */ + REPOSITORY("repository"), + + /** The DOCUMENT option of this Right */ + DOCUMENT("document"), + + /** The CHUNK option of this Right */ + CHUNK("chunk"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this Right */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ScopeEnum(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 Right + */ + @JsonCreator + @Nonnull + public static ScopeEnum fromValue(@Nonnull final String value) { + for (ScopeEnum b : ScopeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("scope") + private ScopeEnum scope = ScopeEnum.DOCUMENT; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for Right. */ + protected Right() {} + + /** + * Set the operator of this {@link Right} instance and return the same instance. + * + * @param operator The operator of this {@link Right} + * @return The same instance of this {@link Right} class + */ + @Nonnull + public Right operator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + return this; + } + + /** + * Get operator + * + * @return operator The operator of this {@link Right} instance. + */ + @Nonnull + public OperatorEnum getOperator() { + return operator; + } + + /** + * Set the operator of this {@link Right} instance. + * + * @param operator The operator of this {@link Right} + */ + public void setOperator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + } + + /** + * Set the left of this {@link Right} instance and return the same instance. + * + * @param left The left of this {@link Right} + * @return The same instance of this {@link Right} class + */ + @Nonnull + public Right left(@Nonnull final Left left) { + this.left = left; + return this; + } + + /** + * Get left + * + * @return left The left of this {@link Right} instance. + */ + @Nonnull + public Left getLeft() { + return left; + } + + /** + * Set the left of this {@link Right} instance. + * + * @param left The left of this {@link Right} + */ + public void setLeft(@Nonnull final Left left) { + this.left = left; + } + + /** + * Set the right of this {@link Right} instance and return the same instance. + * + * @param right The right of this {@link Right} + * @return The same instance of this {@link Right} class + */ + @Nonnull + public Right right(@Nonnull final Right right) { + this.right = right; + return this; + } + + /** + * Get right + * + * @return right The right of this {@link Right} instance. + */ + @Nonnull + public Right getRight() { + return right; + } + + /** + * Set the right of this {@link Right} instance. + * + * @param right The right of this {@link Right} + */ + public void setRight(@Nonnull final Right right) { + this.right = right; + } + + /** + * Set the key of this {@link Right} instance and return the same instance. + * + * @param key The key of this {@link Right} + * @return The same instance of this {@link Right} class + */ + @Nonnull + public Right key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link Right} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link Right} instance. + * + * @param key The key of this {@link Right} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link Right} instance and return the same instance. + * + * @param value The value of this {@link Right} + * @return The same instance of this {@link Right} class + */ + @Nonnull + public Right value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link Right}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link Right} + */ + @Nonnull + public Right 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 Right} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link Right} instance. + * + * @param value The value of this {@link Right} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Set the scope of this {@link Right} instance and return the same instance. + * + * @param scope The scope of this {@link Right} + * @return The same instance of this {@link Right} class + */ + @Nonnull + public Right scope(@Nullable final ScopeEnum scope) { + this.scope = scope; + return this; + } + + /** + * Get scope + * + * @return scope The scope of this {@link Right} instance. + */ + @Nonnull + public ScopeEnum getScope() { + return scope; + } + + /** + * Set the scope of this {@link Right} instance. + * + * @param scope The scope of this {@link Right} + */ + public void setScope(@Nullable final ScopeEnum scope) { + this.scope = scope; + } + + /** + * Get the names of the unrecognizable properties of the {@link Right}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Right} 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("Right has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Right} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (operator != null) declaredFields.put("operator", operator); + if (left != null) declaredFields.put("left", left); + if (right != null) declaredFields.put("right", right); + if (key != null) declaredFields.put("key", key); + if (value != null) declaredFields.put("value", value); + if (scope != null) declaredFields.put("scope", scope); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Right} 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 Right right = (Right) o; + return Objects.equals(this.cloudSdkCustomFields, right.cloudSdkCustomFields) + && Objects.equals(this.operator, right.operator) + && Objects.equals(this.left, right.left) + && Objects.equals(this.right, right.right) + && Objects.equals(this.key, right.key) + && Objects.equals(this.value, right.value) + && Objects.equals(this.scope, right.scope); + } + + @Override + public int hashCode() { + return Objects.hash(operator, left, right, key, value, scope, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Right {\n"); + sb.append(" operator: ").append(toIndentedString(operator)).append("\n"); + sb.append(" left: ").append(toIndentedString(left)).append("\n"); + sb.append(" right: ").append(toIndentedString(right)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).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 Right} instance with + * all required arguments. + */ + public static Builder create() { + return (operator) -> + (left) -> + (right) -> + (key) -> + (value) -> + new Right() + .operator(operator) + .left(left) + .right(right) + .key(key) + .value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the operator of this {@link Right} instance. + * + * @param operator The operator of this {@link Right} + * @return The Right builder. + */ + Builder1 operator(@Nonnull final OperatorEnum operator); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the left of this {@link Right} instance. + * + * @param left The left of this {@link Right} + * @return The Right builder. + */ + Builder2 left(@Nonnull final Left left); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the right of this {@link Right} instance. + * + * @param right The right of this {@link Right} + * @return The Right builder. + */ + Builder3 right(@Nonnull final Right right); + } + + /** Builder helper class. */ + public interface Builder3 { + /** + * Set the key of this {@link Right} instance. + * + * @param key The key of this {@link Right} + * @return The Right builder. + */ + Builder4 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder4 { + /** + * Set the value of this {@link Right} instance. + * + * @param value The value of this {@link Right} + * @return The Right instance. + */ + Right value(@Nonnull final List value); + + /** + * Set the value of this {@link Right} instance. + * + * @param value The value of this {@link Right} + * @return The Right instance. + */ + default Right value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Right1.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Right1.java new file mode 100644 index 000000000..b239d2f7a --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Right1.java @@ -0,0 +1,570 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** Right operand of the boolean expression */ +// CHECKSTYLE:OFF +public class Right1 +// CHECKSTYLE:ON +{ + /** Boolean operator for combining filter conditions */ + public enum OperatorEnum { + /** The AND option of this Right1 */ + AND("and"), + + /** The OR option of this Right1 */ + OR("or"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this Right1 */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + OperatorEnum(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 Right1 + */ + @JsonCreator + @Nonnull + public static OperatorEnum fromValue(@Nonnull final String value) { + for (OperatorEnum b : OperatorEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("operator") + private OperatorEnum operator; + + @JsonProperty("left") + private Left1 left; + + @JsonProperty("right") + private Right1 right; + + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + /** Scope of the metadata filter (e.g., collection, document, chunk) */ + public enum ScopeEnum { + /** The COLLECTION option of this Right1 */ + COLLECTION("collection"), + + /** The DOCUMENT option of this Right1 */ + DOCUMENT("document"), + + /** The CHUNK option of this Right1 */ + CHUNK("chunk"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this Right1 */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ScopeEnum(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 Right1 + */ + @JsonCreator + @Nonnull + public static ScopeEnum fromValue(@Nonnull final String value) { + for (ScopeEnum b : ScopeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("scope") + private ScopeEnum scope = ScopeEnum.DOCUMENT; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for Right1. */ + protected Right1() {} + + /** + * Set the operator of this {@link Right1} instance and return the same instance. + * + * @param operator Boolean operator for combining filter conditions + * @return The same instance of this {@link Right1} class + */ + @Nonnull + public Right1 operator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + return this; + } + + /** + * Boolean operator for combining filter conditions + * + * @return operator The operator of this {@link Right1} instance. + */ + @Nonnull + public OperatorEnum getOperator() { + return operator; + } + + /** + * Set the operator of this {@link Right1} instance. + * + * @param operator Boolean operator for combining filter conditions + */ + public void setOperator(@Nonnull final OperatorEnum operator) { + this.operator = operator; + } + + /** + * Set the left of this {@link Right1} instance and return the same instance. + * + * @param left The left of this {@link Right1} + * @return The same instance of this {@link Right1} class + */ + @Nonnull + public Right1 left(@Nonnull final Left1 left) { + this.left = left; + return this; + } + + /** + * Get left + * + * @return left The left of this {@link Right1} instance. + */ + @Nonnull + public Left1 getLeft() { + return left; + } + + /** + * Set the left of this {@link Right1} instance. + * + * @param left The left of this {@link Right1} + */ + public void setLeft(@Nonnull final Left1 left) { + this.left = left; + } + + /** + * Set the right of this {@link Right1} instance and return the same instance. + * + * @param right The right of this {@link Right1} + * @return The same instance of this {@link Right1} class + */ + @Nonnull + public Right1 right(@Nonnull final Right1 right) { + this.right = right; + return this; + } + + /** + * Get right + * + * @return right The right of this {@link Right1} instance. + */ + @Nonnull + public Right1 getRight() { + return right; + } + + /** + * Set the right of this {@link Right1} instance. + * + * @param right The right of this {@link Right1} + */ + public void setRight(@Nonnull final Right1 right) { + this.right = right; + } + + /** + * Set the key of this {@link Right1} instance and return the same instance. + * + * @param key The key of this {@link Right1} + * @return The same instance of this {@link Right1} class + */ + @Nonnull + public Right1 key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link Right1} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link Right1} instance. + * + * @param key The key of this {@link Right1} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link Right1} instance and return the same instance. + * + * @param value The value of this {@link Right1} + * @return The same instance of this {@link Right1} class + */ + @Nonnull + public Right1 value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link Right1}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link Right1} + */ + @Nonnull + public Right1 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 Right1} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link Right1} instance. + * + * @param value The value of this {@link Right1} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Set the scope of this {@link Right1} instance and return the same instance. + * + * @param scope Scope of the metadata filter (e.g., collection, document, chunk) + * @return The same instance of this {@link Right1} class + */ + @Nonnull + public Right1 scope(@Nullable final ScopeEnum scope) { + this.scope = scope; + return this; + } + + /** + * Scope of the metadata filter (e.g., collection, document, chunk) + * + * @return scope The scope of this {@link Right1} instance. + */ + @Nonnull + public ScopeEnum getScope() { + return scope; + } + + /** + * Set the scope of this {@link Right1} instance. + * + * @param scope Scope of the metadata filter (e.g., collection, document, chunk) + */ + public void setScope(@Nullable final ScopeEnum scope) { + this.scope = scope; + } + + /** + * Get the names of the unrecognizable properties of the {@link Right1}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Right1} 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("Right1 has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Right1} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (operator != null) declaredFields.put("operator", operator); + if (left != null) declaredFields.put("left", left); + if (right != null) declaredFields.put("right", right); + if (key != null) declaredFields.put("key", key); + if (value != null) declaredFields.put("value", value); + if (scope != null) declaredFields.put("scope", scope); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Right1} 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 Right1 right1 = (Right1) o; + return Objects.equals(this.cloudSdkCustomFields, right1.cloudSdkCustomFields) + && Objects.equals(this.operator, right1.operator) + && Objects.equals(this.left, right1.left) + && Objects.equals(this.right, right1.right) + && Objects.equals(this.key, right1.key) + && Objects.equals(this.value, right1.value) + && Objects.equals(this.scope, right1.scope); + } + + @Override + public int hashCode() { + return Objects.hash(operator, left, right, key, value, scope, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Right1 {\n"); + sb.append(" operator: ").append(toIndentedString(operator)).append("\n"); + sb.append(" left: ").append(toIndentedString(left)).append("\n"); + sb.append(" right: ").append(toIndentedString(right)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).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 Right1} instance with + * all required arguments. + */ + public static Builder create() { + return (operator) -> + (left) -> + (right) -> + (key) -> + (value) -> + new Right1() + .operator(operator) + .left(left) + .right(right) + .key(key) + .value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the operator of this {@link Right1} instance. + * + * @param operator Boolean operator for combining filter conditions + * @return The Right1 builder. + */ + Builder1 operator(@Nonnull final OperatorEnum operator); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the left of this {@link Right1} instance. + * + * @param left The left of this {@link Right1} + * @return The Right1 builder. + */ + Builder2 left(@Nonnull final Left1 left); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the right of this {@link Right1} instance. + * + * @param right The right of this {@link Right1} + * @return The Right1 builder. + */ + Builder3 right(@Nonnull final Right1 right); + } + + /** Builder helper class. */ + public interface Builder3 { + /** + * Set the key of this {@link Right1} instance. + * + * @param key The key of this {@link Right1} + * @return The Right1 builder. + */ + Builder4 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder4 { + /** + * Set the value of this {@link Right1} instance. + * + * @param value The value of this {@link Right1} + * @return The Right1 instance. + */ + Right1 value(@Nonnull final List value); + + /** + * Set the value of this {@link Right1} instance. + * + * @param value The value of this {@link Right1} + * @return The Right1 instance. + */ + default Right1 value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ScopedKeyValueListPair.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ScopedKeyValueListPair.java new file mode 100644 index 000000000..b043f9dbf --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ScopedKeyValueListPair.java @@ -0,0 +1,360 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** ScopedKeyValueListPair */ +// CHECKSTYLE:OFF +public class ScopedKeyValueListPair +// CHECKSTYLE:ON +{ + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + /** Scope of the metadata filter (e.g., collection, document, chunk) */ + public enum ScopeEnum { + /** The COLLECTION option of this ScopedKeyValueListPair */ + COLLECTION("collection"), + + /** The DOCUMENT option of this ScopedKeyValueListPair */ + DOCUMENT("document"), + + /** The CHUNK option of this ScopedKeyValueListPair */ + CHUNK("chunk"), + + /** The UNKNOWN_DEFAULT_OPEN_API option of this ScopedKeyValueListPair */ + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private String value; + + ScopeEnum(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 ScopedKeyValueListPair + */ + @JsonCreator + @Nonnull + public static ScopeEnum fromValue(@Nonnull final String value) { + for (ScopeEnum b : ScopeEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } + } + + @JsonProperty("scope") + private ScopeEnum scope = ScopeEnum.DOCUMENT; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ScopedKeyValueListPair. */ + protected ScopedKeyValueListPair() {} + + /** + * Set the key of this {@link ScopedKeyValueListPair} instance and return the same instance. + * + * @param key The key of this {@link ScopedKeyValueListPair} + * @return The same instance of this {@link ScopedKeyValueListPair} class + */ + @Nonnull + public ScopedKeyValueListPair key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link ScopedKeyValueListPair} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link ScopedKeyValueListPair} instance. + * + * @param key The key of this {@link ScopedKeyValueListPair} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link ScopedKeyValueListPair} instance and return the same instance. + * + * @param value The value of this {@link ScopedKeyValueListPair} + * @return The same instance of this {@link ScopedKeyValueListPair} class + */ + @Nonnull + public ScopedKeyValueListPair value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link ScopedKeyValueListPair}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link ScopedKeyValueListPair} + */ + @Nonnull + public ScopedKeyValueListPair 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 ScopedKeyValueListPair} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link ScopedKeyValueListPair} instance. + * + * @param value The value of this {@link ScopedKeyValueListPair} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Set the scope of this {@link ScopedKeyValueListPair} instance and return the same instance. + * + * @param scope Scope of the metadata filter (e.g., collection, document, chunk) + * @return The same instance of this {@link ScopedKeyValueListPair} class + */ + @Nonnull + public ScopedKeyValueListPair scope(@Nullable final ScopeEnum scope) { + this.scope = scope; + return this; + } + + /** + * Scope of the metadata filter (e.g., collection, document, chunk) + * + * @return scope The scope of this {@link ScopedKeyValueListPair} instance. + */ + @Nonnull + public ScopeEnum getScope() { + return scope; + } + + /** + * Set the scope of this {@link ScopedKeyValueListPair} instance. + * + * @param scope Scope of the metadata filter (e.g., collection, document, chunk) + */ + public void setScope(@Nullable final ScopeEnum scope) { + this.scope = scope; + } + + /** + * Get the names of the unrecognizable properties of the {@link ScopedKeyValueListPair}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ScopedKeyValueListPair} 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( + "ScopedKeyValueListPair has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ScopedKeyValueListPair} 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 (scope != null) declaredFields.put("scope", scope); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ScopedKeyValueListPair} 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 ScopedKeyValueListPair scopedKeyValueListPair = (ScopedKeyValueListPair) o; + return Objects.equals(this.cloudSdkCustomFields, scopedKeyValueListPair.cloudSdkCustomFields) + && Objects.equals(this.key, scopedKeyValueListPair.key) + && Objects.equals(this.value, scopedKeyValueListPair.value) + && Objects.equals(this.scope, scopedKeyValueListPair.scope); + } + + @Override + public int hashCode() { + return Objects.hash(key, value, scope, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ScopedKeyValueListPair {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" scope: ").append(toIndentedString(scope)).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 ScopedKeyValueListPair} + * instance with all required arguments. + */ + public static Builder create() { + return (key) -> (value) -> new ScopedKeyValueListPair().key(key).value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the key of this {@link ScopedKeyValueListPair} instance. + * + * @param key The key of this {@link ScopedKeyValueListPair} + * @return The ScopedKeyValueListPair builder. + */ + Builder1 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the value of this {@link ScopedKeyValueListPair} instance. + * + * @param value The value of this {@link ScopedKeyValueListPair} + * @return The ScopedKeyValueListPair instance. + */ + ScopedKeyValueListPair value(@Nonnull final List value); + + /** + * Set the value of this {@link ScopedKeyValueListPair} instance. + * + * @param value The value of this {@link ScopedKeyValueListPair} + * @return The ScopedKeyValueListPair instance. + */ + default ScopedKeyValueListPair value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Score.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Score.java new file mode 100644 index 000000000..576d74b5f --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Score.java @@ -0,0 +1,185 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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.math.BigDecimal; +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; + +/** Score */ +// CHECKSTYLE:OFF +public class Score +// CHECKSTYLE:ON +{ + @JsonProperty("value") + private BigDecimal value; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for Score. */ + protected Score() {} + + /** + * Set the value of this {@link Score} instance and return the same instance. + * + * @param value The value of this {@link Score} + * @return The same instance of this {@link Score} class + */ + @Nonnull + public Score value(@Nonnull final BigDecimal value) { + this.value = value; + return this; + } + + /** + * Get value + * + * @return value The value of this {@link Score} instance. + */ + @Nonnull + public BigDecimal getValue() { + return value; + } + + /** + * Set the value of this {@link Score} instance. + * + * @param value The value of this {@link Score} + */ + public void setValue(@Nonnull final BigDecimal value) { + this.value = value; + } + + /** + * Get the names of the unrecognizable properties of the {@link Score}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Score} 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("Score has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Score} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (value != null) declaredFields.put("value", value); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Score} 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 Score score = (Score) o; + return Objects.equals(this.cloudSdkCustomFields, score.cloudSdkCustomFields) + && Objects.equals(this.value, score.value); + } + + @Override + public int hashCode() { + return Objects.hash(value, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Score {\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 Score} instance with + * all required arguments. + */ + public static Builder create() { + return (value) -> new Score().value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the value of this {@link Score} instance. + * + * @param value The value of this {@link Score} + * @return The Score instance. + */ + Score value(@Nonnull final BigDecimal value); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ScoresAggregationStrategy.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ScoresAggregationStrategy.java new file mode 100644 index 000000000..d2ec1dd7e --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ScoresAggregationStrategy.java @@ -0,0 +1,66 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.annotation.Nonnull; + +/** Gets or Sets ScoresAggregationStrategy */ +public enum ScoresAggregationStrategy { + WEIGHTED_AVERAGE("weighted_average"), + + RRF("rrf"), + + WEIGHTED_RRF("weighted_rrf"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + ScoresAggregationStrategy(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 ScoresAggregationStrategy fromValue(@Nonnull final String value) { + for (final ScoresAggregationStrategy b : ScoresAggregationStrategy.values()) { + if (b.value.equals(value)) { + return b; + } + } + return UNKNOWN_DEFAULT_OPEN_API; + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchScores.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchScores.java new file mode 100644 index 000000000..d2eed3f77 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchScores.java @@ -0,0 +1,241 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** SearchScores */ +// CHECKSTYLE:OFF +public class SearchScores +// CHECKSTYLE:ON +{ + @JsonProperty("aggregatedScore") + private SearchScoresAggregatedScore aggregatedScore; + + @JsonProperty("denseRetrievalScore") + private SearchScoresAggregatedScore denseRetrievalScore; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for SearchScores. */ + protected SearchScores() {} + + /** + * Set the aggregatedScore of this {@link SearchScores} instance and return the same instance. + * + * @param aggregatedScore The aggregatedScore of this {@link SearchScores} + * @return The same instance of this {@link SearchScores} class + */ + @Nonnull + public SearchScores aggregatedScore(@Nonnull final SearchScoresAggregatedScore aggregatedScore) { + this.aggregatedScore = aggregatedScore; + return this; + } + + /** + * Get aggregatedScore + * + * @return aggregatedScore The aggregatedScore of this {@link SearchScores} instance. + */ + @Nonnull + public SearchScoresAggregatedScore getAggregatedScore() { + return aggregatedScore; + } + + /** + * Set the aggregatedScore of this {@link SearchScores} instance. + * + * @param aggregatedScore The aggregatedScore of this {@link SearchScores} + */ + public void setAggregatedScore(@Nonnull final SearchScoresAggregatedScore aggregatedScore) { + this.aggregatedScore = aggregatedScore; + } + + /** + * Set the denseRetrievalScore of this {@link SearchScores} instance and return the same instance. + * + * @param denseRetrievalScore The denseRetrievalScore of this {@link SearchScores} + * @return The same instance of this {@link SearchScores} class + */ + @Nonnull + public SearchScores denseRetrievalScore( + @Nonnull final SearchScoresAggregatedScore denseRetrievalScore) { + this.denseRetrievalScore = denseRetrievalScore; + return this; + } + + /** + * Get denseRetrievalScore + * + * @return denseRetrievalScore The denseRetrievalScore of this {@link SearchScores} instance. + */ + @Nonnull + public SearchScoresAggregatedScore getDenseRetrievalScore() { + return denseRetrievalScore; + } + + /** + * Set the denseRetrievalScore of this {@link SearchScores} instance. + * + * @param denseRetrievalScore The denseRetrievalScore of this {@link SearchScores} + */ + public void setDenseRetrievalScore( + @Nonnull final SearchScoresAggregatedScore denseRetrievalScore) { + this.denseRetrievalScore = denseRetrievalScore; + } + + /** + * Get the names of the unrecognizable properties of the {@link SearchScores}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SearchScores} 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("SearchScores has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SearchScores} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (aggregatedScore != null) declaredFields.put("aggregatedScore", aggregatedScore); + if (denseRetrievalScore != null) declaredFields.put("denseRetrievalScore", denseRetrievalScore); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SearchScores} 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 SearchScores searchScores = (SearchScores) o; + return Objects.equals(this.cloudSdkCustomFields, searchScores.cloudSdkCustomFields) + && Objects.equals(this.aggregatedScore, searchScores.aggregatedScore) + && Objects.equals(this.denseRetrievalScore, searchScores.denseRetrievalScore); + } + + @Override + public int hashCode() { + return Objects.hash(aggregatedScore, denseRetrievalScore, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SearchScores {\n"); + sb.append(" aggregatedScore: ").append(toIndentedString(aggregatedScore)).append("\n"); + sb.append(" denseRetrievalScore: ") + .append(toIndentedString(denseRetrievalScore)) + .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 SearchScores} instance + * with all required arguments. + */ + public static Builder create() { + return (aggregatedScore) -> + (denseRetrievalScore) -> + new SearchScores() + .aggregatedScore(aggregatedScore) + .denseRetrievalScore(denseRetrievalScore); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the aggregatedScore of this {@link SearchScores} instance. + * + * @param aggregatedScore The aggregatedScore of this {@link SearchScores} + * @return The SearchScores builder. + */ + Builder1 aggregatedScore(@Nonnull final SearchScoresAggregatedScore aggregatedScore); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the denseRetrievalScore of this {@link SearchScores} instance. + * + * @param denseRetrievalScore The denseRetrievalScore of this {@link SearchScores} + * @return The SearchScores instance. + */ + SearchScores denseRetrievalScore( + @Nonnull final SearchScoresAggregatedScore denseRetrievalScore); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchScoresAggregatedScore.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchScoresAggregatedScore.java new file mode 100644 index 000000000..c7120ae83 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchScoresAggregatedScore.java @@ -0,0 +1,175 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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.math.BigDecimal; +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; + +/** SearchScoresAggregatedScore */ +// CHECKSTYLE:OFF +public class SearchScoresAggregatedScore +// CHECKSTYLE:ON +{ + @JsonProperty("value") + private BigDecimal value; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for SearchScoresAggregatedScore. */ + protected SearchScoresAggregatedScore() {} + + /** + * Set the value of this {@link SearchScoresAggregatedScore} instance and return the same + * instance. + * + * @param value The value of this {@link SearchScoresAggregatedScore} + * @return The same instance of this {@link SearchScoresAggregatedScore} class + */ + @Nonnull + public SearchScoresAggregatedScore value(@Nullable final BigDecimal value) { + this.value = value; + return this; + } + + /** + * Get value + * + * @return value The value of this {@link SearchScoresAggregatedScore} instance. + */ + @Nonnull + public BigDecimal getValue() { + return value; + } + + /** + * Set the value of this {@link SearchScoresAggregatedScore} instance. + * + * @param value The value of this {@link SearchScoresAggregatedScore} + */ + public void setValue(@Nullable final BigDecimal value) { + this.value = value; + } + + /** + * Get the names of the unrecognizable properties of the {@link SearchScoresAggregatedScore}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SearchScoresAggregatedScore} + * 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( + "SearchScoresAggregatedScore has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SearchScoresAggregatedScore} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (value != null) declaredFields.put("value", value); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SearchScoresAggregatedScore} 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 SearchScoresAggregatedScore searchScoresAggregatedScore = (SearchScoresAggregatedScore) o; + return Objects.equals( + this.cloudSdkCustomFields, searchScoresAggregatedScore.cloudSdkCustomFields) + && Objects.equals(this.value, searchScoresAggregatedScore.value); + } + + @Override + public int hashCode() { + return Objects.hash(value, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SearchScoresAggregatedScore {\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 new {@link SearchScoresAggregatedScore} instance. No arguments are required. */ + public static SearchScoresAggregatedScore create() { + return new SearchScoresAggregatedScore(); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Strategy.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Strategy.java new file mode 100644 index 000000000..c55f9ce3a --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/Strategy.java @@ -0,0 +1,23 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.model; + +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + +/** Merging and scoring strategy to derive final PerSearchFilterResult. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = MergeStrategyReranker.class), + @JsonSubTypes.Type(value = MergeStrategyScoreReuse.class), +}) +public interface Strategy {} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextOnlyBaseChunk.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextOnlyBaseChunk.java index 98c9775ce..2a6a09710 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextOnlyBaseChunk.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextOnlyBaseChunk.java @@ -16,17 +16,17 @@ 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 java.util.UUID; import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** TextOnlyBaseChunk */ +/** Schema for a text-only chunk. */ // CHECKSTYLE:OFF public class TextOnlyBaseChunk // CHECKSTYLE:ON @@ -37,6 +37,9 @@ public class TextOnlyBaseChunk @JsonProperty("metadata") private List metadata = new ArrayList<>(); + @JsonProperty("id") + private UUID id; + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -81,7 +84,7 @@ public void setContent(@Nonnull final String content) { * @return The same instance of this {@link TextOnlyBaseChunk} class */ @Nonnull - public TextOnlyBaseChunk metadata(@Nonnull final List metadata) { + public TextOnlyBaseChunk metadata(@Nullable final List metadata) { this.metadata = metadata; return this; } @@ -116,10 +119,41 @@ public List getMetadata() { * * @param metadata The metadata of this {@link TextOnlyBaseChunk} */ - public void setMetadata(@Nonnull final List metadata) { + public void setMetadata(@Nullable final List metadata) { this.metadata = metadata; } + /** + * Set the id of this {@link TextOnlyBaseChunk} instance and return the same instance. + * + * @param id Unique identifier of a chuk. + * @return The same instance of this {@link TextOnlyBaseChunk} class + */ + @Nonnull + public TextOnlyBaseChunk id(@Nonnull final UUID id) { + this.id = id; + return this; + } + + /** + * Unique identifier of a chuk. + * + * @return id The id of this {@link TextOnlyBaseChunk} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link TextOnlyBaseChunk} instance. + * + * @param id Unique identifier of a chuk. + */ + public void setId(@Nonnull final UUID id) { + this.id = id; + } + /** * Get the names of the unrecognizable properties of the {@link TextOnlyBaseChunk}. * @@ -160,6 +194,7 @@ public Map toMap() { final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); if (content != null) declaredFields.put("content", content); if (metadata != null) declaredFields.put("metadata", metadata); + if (id != null) declaredFields.put("id", id); return declaredFields; } @@ -186,12 +221,13 @@ public boolean equals(@Nullable final java.lang.Object o) { final TextOnlyBaseChunk textOnlyBaseChunk = (TextOnlyBaseChunk) o; return Objects.equals(this.cloudSdkCustomFields, textOnlyBaseChunk.cloudSdkCustomFields) && Objects.equals(this.content, textOnlyBaseChunk.content) - && Objects.equals(this.metadata, textOnlyBaseChunk.metadata); + && Objects.equals(this.metadata, textOnlyBaseChunk.metadata) + && Objects.equals(this.id, textOnlyBaseChunk.id); } @Override public int hashCode() { - return Objects.hash(content, metadata, cloudSdkCustomFields); + return Objects.hash(content, metadata, id, cloudSdkCustomFields); } @Override @@ -201,6 +237,7 @@ public String toString() { sb.append("class TextOnlyBaseChunk {\n"); sb.append(" content: ").append(toIndentedString(content)).append("\n"); sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); @@ -223,7 +260,7 @@ private String toIndentedString(final java.lang.Object o) { * instance with all required arguments. */ public static Builder create() { - return (content) -> (metadata) -> new TextOnlyBaseChunk().content(content).metadata(metadata); + return (content) -> (id) -> new TextOnlyBaseChunk().content(content).id(id); } /** Builder helper class. */ @@ -240,21 +277,11 @@ public interface Builder { /** Builder helper class. */ public interface Builder1 { /** - * Set the metadata of this {@link TextOnlyBaseChunk} instance. + * Set the id of this {@link TextOnlyBaseChunk} instance. * - * @param metadata The metadata of this {@link TextOnlyBaseChunk} + * @param id Unique identifier of a chuk. * @return The TextOnlyBaseChunk instance. */ - TextOnlyBaseChunk metadata(@Nonnull final List metadata); - - /** - * Set the metadata of this {@link TextOnlyBaseChunk} instance. - * - * @param metadata The metadata of this {@link TextOnlyBaseChunk} - * @return The TextOnlyBaseChunk instance. - */ - default TextOnlyBaseChunk metadata(@Nonnull final VectorKeyValueListPair... metadata) { - return metadata(Arrays.asList(metadata)); - } + TextOnlyBaseChunk id(@Nonnull final UUID id); } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextOnlyBaseChunkCreate.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextOnlyBaseChunkCreate.java new file mode 100644 index 000000000..b35ced312 --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextOnlyBaseChunkCreate.java @@ -0,0 +1,240 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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; + +/** Schema for a text-only chunk. */ +// CHECKSTYLE:OFF +public class TextOnlyBaseChunkCreate +// CHECKSTYLE:ON +{ + @JsonProperty("content") + private String content; + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for TextOnlyBaseChunkCreate. */ + protected TextOnlyBaseChunkCreate() {} + + /** + * Set the content of this {@link TextOnlyBaseChunkCreate} instance and return the same instance. + * + * @param content The content of this {@link TextOnlyBaseChunkCreate} + * @return The same instance of this {@link TextOnlyBaseChunkCreate} class + */ + @Nonnull + public TextOnlyBaseChunkCreate content(@Nonnull final String content) { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link TextOnlyBaseChunkCreate} instance. + */ + @Nonnull + public String getContent() { + return content; + } + + /** + * Set the content of this {@link TextOnlyBaseChunkCreate} instance. + * + * @param content The content of this {@link TextOnlyBaseChunkCreate} + */ + public void setContent(@Nonnull final String content) { + this.content = content; + } + + /** + * Set the metadata of this {@link TextOnlyBaseChunkCreate} instance and return the same instance. + * + * @param metadata The metadata of this {@link TextOnlyBaseChunkCreate} + * @return The same instance of this {@link TextOnlyBaseChunkCreate} class + */ + @Nonnull + public TextOnlyBaseChunkCreate metadata(@Nullable final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link TextOnlyBaseChunkCreate}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link TextOnlyBaseChunkCreate} + */ + @Nonnull + public TextOnlyBaseChunkCreate addMetadataItem( + @Nonnull final VectorKeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link TextOnlyBaseChunkCreate} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link TextOnlyBaseChunkCreate} instance. + * + * @param metadata The metadata of this {@link TextOnlyBaseChunkCreate} + */ + public void setMetadata(@Nullable final List metadata) { + this.metadata = metadata; + } + + /** + * Get the names of the unrecognizable properties of the {@link TextOnlyBaseChunkCreate}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TextOnlyBaseChunkCreate} 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( + "TextOnlyBaseChunkCreate has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TextOnlyBaseChunkCreate} 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 (metadata != null) declaredFields.put("metadata", metadata); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TextOnlyBaseChunkCreate} 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 TextOnlyBaseChunkCreate textOnlyBaseChunkCreate = (TextOnlyBaseChunkCreate) o; + return Objects.equals(this.cloudSdkCustomFields, textOnlyBaseChunkCreate.cloudSdkCustomFields) + && Objects.equals(this.content, textOnlyBaseChunkCreate.content) + && Objects.equals(this.metadata, textOnlyBaseChunkCreate.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(content, metadata, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class TextOnlyBaseChunkCreate {\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).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 + * TextOnlyBaseChunkCreate} instance with all required arguments. + */ + public static Builder create() { + return (content) -> new TextOnlyBaseChunkCreate().content(content); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the content of this {@link TextOnlyBaseChunkCreate} instance. + * + * @param content The content of this {@link TextOnlyBaseChunkCreate} + * @return The TextOnlyBaseChunkCreate instance. + */ + TextOnlyBaseChunkCreate content(@Nonnull final String content); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextSearchRequest.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextSearchRequest.java index d4b6781db..28b6a9703 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextSearchRequest.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextSearchRequest.java @@ -50,7 +50,7 @@ protected TextSearchRequest() {} * @return The same instance of this {@link TextSearchRequest} class */ @Nonnull - public TextSearchRequest query(@Nonnull final String query) { + public TextSearchRequest query(@Nullable final String query) { this.query = query; return this; } @@ -60,7 +60,7 @@ public TextSearchRequest query(@Nonnull final String query) { * * @return query The query of this {@link TextSearchRequest} instance. */ - @Nonnull + @Nullable public String getQuery() { return query; } @@ -70,7 +70,7 @@ public String getQuery() { * * @param query Query string */ - public void setQuery(@Nonnull final String query) { + public void setQuery(@Nullable final String query) { this.query = query; } @@ -234,7 +234,7 @@ public interface Builder { * @param query Query string * @return The TextSearchRequest builder. */ - Builder1 query(@Nonnull final String query); + Builder1 query(@Nullable final String query); } /** Builder helper class. */ diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ValidationError.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ValidationError.java index a4c7471ff..21fe906d0 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ValidationError.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/ValidationError.java @@ -32,7 +32,7 @@ public class ValidationError // CHECKSTYLE:ON { @JsonProperty("loc") - private List loc = new ArrayList<>(); + private List loc = new ArrayList<>(); @JsonProperty("msg") private String msg; @@ -53,7 +53,7 @@ protected ValidationError() {} * @return The same instance of this {@link ValidationError} class */ @Nonnull - public ValidationError loc(@Nonnull final List loc) { + public ValidationError loc(@Nonnull final List loc) { this.loc = loc; return this; } @@ -65,7 +65,7 @@ public ValidationError loc(@Nonnull final List loc) { * @return The same instance of type {@link ValidationError} */ @Nonnull - public ValidationError addLocItem(@Nonnull final String locItem) { + public ValidationError addLocItem(@Nonnull final LocationInner locItem) { if (this.loc == null) { this.loc = new ArrayList<>(); } @@ -79,7 +79,7 @@ public ValidationError addLocItem(@Nonnull final String locItem) { * @return loc The loc of this {@link ValidationError} instance. */ @Nonnull - public List getLoc() { + public List getLoc() { return loc; } @@ -88,7 +88,7 @@ public List getLoc() { * * @param loc The loc of this {@link ValidationError} */ - public void setLoc(@Nonnull final List loc) { + public void setLoc(@Nonnull final List loc) { this.loc = loc; } @@ -271,7 +271,7 @@ public interface Builder { * @param loc The loc of this {@link ValidationError} * @return The ValidationError builder. */ - Builder1 loc(@Nonnull final List loc); + Builder1 loc(@Nonnull final List loc); /** * Set the loc of this {@link ValidationError} instance. @@ -279,7 +279,7 @@ public interface Builder { * @param loc The loc of this {@link ValidationError} * @return The ValidationError builder. */ - default Builder1 loc(@Nonnull final String... loc) { + default Builder1 loc(@Nonnull final LocationInner... loc) { return loc(Arrays.asList(loc)); } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorDocumentKeyValueListPair.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorDocumentKeyValueListPair.java index 933540a5b..88bfd0de8 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorDocumentKeyValueListPair.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorDocumentKeyValueListPair.java @@ -13,10 +13,8 @@ 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; @@ -39,65 +37,8 @@ public class VectorDocumentKeyValueListPair @JsonProperty("value") private List value = new ArrayList<>(); - /** Gets or Sets matchMode */ - public enum MatchModeEnum { - /** The ANY option of this VectorDocumentKeyValueListPair */ - ANY("ANY"), - - /** The ALL option of this VectorDocumentKeyValueListPair */ - ALL("ALL"), - - /** The UNKNOWN_DEFAULT_OPEN_API option of this VectorDocumentKeyValueListPair */ - UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); - - private String value; - - MatchModeEnum(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 VectorDocumentKeyValueListPair - */ - @JsonCreator - @Nullable - public static MatchModeEnum fromValue(@Nonnull final String value) { - for (MatchModeEnum b : MatchModeEnum.values()) { - if (b.value.equals(value)) { - return b; - } - } - return null; - } - } - @JsonProperty("matchMode") - private MatchModeEnum matchMode; + private FilterMatchModeEnum matchMode; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -192,7 +133,7 @@ public void setValue(@Nonnull final List value) { * @return The same instance of this {@link VectorDocumentKeyValueListPair} class */ @Nonnull - public VectorDocumentKeyValueListPair matchMode(@Nullable final MatchModeEnum matchMode) { + public VectorDocumentKeyValueListPair matchMode(@Nullable final FilterMatchModeEnum matchMode) { this.matchMode = matchMode; return this; } @@ -202,8 +143,8 @@ public VectorDocumentKeyValueListPair matchMode(@Nullable final MatchModeEnum ma * * @return matchMode The matchMode of this {@link VectorDocumentKeyValueListPair} instance. */ - @Nullable - public MatchModeEnum getMatchMode() { + @Nonnull + public FilterMatchModeEnum getMatchMode() { return matchMode; } @@ -212,7 +153,7 @@ public MatchModeEnum getMatchMode() { * * @param matchMode The matchMode of this {@link VectorDocumentKeyValueListPair} */ - public void setMatchMode(@Nullable final MatchModeEnum matchMode) { + public void setMatchMode(@Nullable final FilterMatchModeEnum matchMode) { this.matchMode = matchMode; } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorKeyValueListPair.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorKeyValueListPair.java index 2cbd0b162..20d08282b 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorKeyValueListPair.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorKeyValueListPair.java @@ -26,7 +26,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; -/** VectorKeyValueListPair */ +/** Collection metadata during ingestion */ // CHECKSTYLE:OFF public class VectorKeyValueListPair // CHECKSTYLE:ON diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorScoringConfiguration.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorScoringConfiguration.java new file mode 100644 index 000000000..5883e49df --- /dev/null +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorScoringConfiguration.java @@ -0,0 +1,343 @@ +/* + * Grounding + * Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions. + * + * + * + * 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.grounding.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.math.BigDecimal; +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; + +/** VectorScoringConfiguration */ +// CHECKSTYLE:OFF +public class VectorScoringConfiguration +// CHECKSTYLE:ON +{ + @JsonProperty("denseRetrieval") + private DenseRetrievalScoringConfiguration denseRetrieval; + + @JsonProperty("keywordRetrieval") + private KeyWordRetrievalScoringConfiguration keywordRetrieval; + + @JsonProperty("boosting") + private BoostingScoringConfiguration boosting; + + @JsonProperty("scoreThreshold") + private BigDecimal scoreThreshold; + + @JsonProperty("aggregationStrategy") + private ScoresAggregationStrategy aggregationStrategy; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for VectorScoringConfiguration. */ + protected VectorScoringConfiguration() {} + + /** + * Set the denseRetrieval of this {@link VectorScoringConfiguration} instance and return the same + * instance. + * + * @param denseRetrieval The denseRetrieval of this {@link VectorScoringConfiguration} + * @return The same instance of this {@link VectorScoringConfiguration} class + */ + @Nonnull + public VectorScoringConfiguration denseRetrieval( + @Nullable final DenseRetrievalScoringConfiguration denseRetrieval) { + this.denseRetrieval = denseRetrieval; + return this; + } + + /** + * Get denseRetrieval + * + * @return denseRetrieval The denseRetrieval of this {@link VectorScoringConfiguration} instance. + */ + @Nonnull + public DenseRetrievalScoringConfiguration getDenseRetrieval() { + return denseRetrieval; + } + + /** + * Set the denseRetrieval of this {@link VectorScoringConfiguration} instance. + * + * @param denseRetrieval The denseRetrieval of this {@link VectorScoringConfiguration} + */ + public void setDenseRetrieval(@Nullable final DenseRetrievalScoringConfiguration denseRetrieval) { + this.denseRetrieval = denseRetrieval; + } + + /** + * Set the keywordRetrieval of this {@link VectorScoringConfiguration} instance and return the + * same instance. + * + * @param keywordRetrieval The keywordRetrieval of this {@link VectorScoringConfiguration} + * @return The same instance of this {@link VectorScoringConfiguration} class + */ + @Nonnull + public VectorScoringConfiguration keywordRetrieval( + @Nullable final KeyWordRetrievalScoringConfiguration keywordRetrieval) { + this.keywordRetrieval = keywordRetrieval; + return this; + } + + /** + * Get keywordRetrieval + * + * @return keywordRetrieval The keywordRetrieval of this {@link VectorScoringConfiguration} + * instance. + */ + @Nonnull + public KeyWordRetrievalScoringConfiguration getKeywordRetrieval() { + return keywordRetrieval; + } + + /** + * Set the keywordRetrieval of this {@link VectorScoringConfiguration} instance. + * + * @param keywordRetrieval The keywordRetrieval of this {@link VectorScoringConfiguration} + */ + public void setKeywordRetrieval( + @Nullable final KeyWordRetrievalScoringConfiguration keywordRetrieval) { + this.keywordRetrieval = keywordRetrieval; + } + + /** + * Set the boosting of this {@link VectorScoringConfiguration} instance and return the same + * instance. + * + * @param boosting The boosting of this {@link VectorScoringConfiguration} + * @return The same instance of this {@link VectorScoringConfiguration} class + */ + @Nonnull + public VectorScoringConfiguration boosting( + @Nullable final BoostingScoringConfiguration boosting) { + this.boosting = boosting; + return this; + } + + /** + * Get boosting + * + * @return boosting The boosting of this {@link VectorScoringConfiguration} instance. + */ + @Nonnull + public BoostingScoringConfiguration getBoosting() { + return boosting; + } + + /** + * Set the boosting of this {@link VectorScoringConfiguration} instance. + * + * @param boosting The boosting of this {@link VectorScoringConfiguration} + */ + public void setBoosting(@Nullable final BoostingScoringConfiguration boosting) { + this.boosting = boosting; + } + + /** + * Set the scoreThreshold of this {@link VectorScoringConfiguration} instance and return the same + * instance. + * + * @param scoreThreshold Minimum chunk score threshold. + * @return The same instance of this {@link VectorScoringConfiguration} class + */ + @Nonnull + public VectorScoringConfiguration scoreThreshold(@Nullable final BigDecimal scoreThreshold) { + this.scoreThreshold = scoreThreshold; + return this; + } + + /** + * Minimum chunk score threshold. + * + * @return scoreThreshold The scoreThreshold of this {@link VectorScoringConfiguration} instance. + */ + @Nullable + public BigDecimal getScoreThreshold() { + return scoreThreshold; + } + + /** + * Set the scoreThreshold of this {@link VectorScoringConfiguration} instance. + * + * @param scoreThreshold Minimum chunk score threshold. + */ + public void setScoreThreshold(@Nullable final BigDecimal scoreThreshold) { + this.scoreThreshold = scoreThreshold; + } + + /** + * Set the aggregationStrategy of this {@link VectorScoringConfiguration} instance and return the + * same instance. + * + * @param aggregationStrategy The aggregationStrategy of this {@link VectorScoringConfiguration} + * @return The same instance of this {@link VectorScoringConfiguration} class + */ + @Nonnull + public VectorScoringConfiguration aggregationStrategy( + @Nullable final ScoresAggregationStrategy aggregationStrategy) { + this.aggregationStrategy = aggregationStrategy; + return this; + } + + /** + * Get aggregationStrategy + * + * @return aggregationStrategy The aggregationStrategy of this {@link VectorScoringConfiguration} + * instance. + */ + @Nonnull + public ScoresAggregationStrategy getAggregationStrategy() { + return aggregationStrategy; + } + + /** + * Set the aggregationStrategy of this {@link VectorScoringConfiguration} instance. + * + * @param aggregationStrategy The aggregationStrategy of this {@link VectorScoringConfiguration} + */ + public void setAggregationStrategy( + @Nullable final ScoresAggregationStrategy aggregationStrategy) { + this.aggregationStrategy = aggregationStrategy; + } + + /** + * Get the names of the unrecognizable properties of the {@link VectorScoringConfiguration}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link VectorScoringConfiguration} + * 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( + "VectorScoringConfiguration has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link VectorScoringConfiguration} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (denseRetrieval != null) declaredFields.put("denseRetrieval", denseRetrieval); + if (keywordRetrieval != null) declaredFields.put("keywordRetrieval", keywordRetrieval); + if (boosting != null) declaredFields.put("boosting", boosting); + if (scoreThreshold != null) declaredFields.put("scoreThreshold", scoreThreshold); + if (aggregationStrategy != null) declaredFields.put("aggregationStrategy", aggregationStrategy); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link VectorScoringConfiguration} 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 VectorScoringConfiguration vectorScoringConfiguration = (VectorScoringConfiguration) o; + return Objects.equals( + this.cloudSdkCustomFields, vectorScoringConfiguration.cloudSdkCustomFields) + && Objects.equals(this.denseRetrieval, vectorScoringConfiguration.denseRetrieval) + && Objects.equals(this.keywordRetrieval, vectorScoringConfiguration.keywordRetrieval) + && Objects.equals(this.boosting, vectorScoringConfiguration.boosting) + && Objects.equals(this.scoreThreshold, vectorScoringConfiguration.scoreThreshold) + && Objects.equals(this.aggregationStrategy, vectorScoringConfiguration.aggregationStrategy); + } + + @Override + public int hashCode() { + return Objects.hash( + denseRetrieval, + keywordRetrieval, + boosting, + scoreThreshold, + aggregationStrategy, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class VectorScoringConfiguration {\n"); + sb.append(" denseRetrieval: ").append(toIndentedString(denseRetrieval)).append("\n"); + sb.append(" keywordRetrieval: ").append(toIndentedString(keywordRetrieval)).append("\n"); + sb.append(" boosting: ").append(toIndentedString(boosting)).append("\n"); + sb.append(" scoreThreshold: ").append(toIndentedString(scoreThreshold)).append("\n"); + sb.append(" aggregationStrategy: ") + .append(toIndentedString(aggregationStrategy)) + .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 VectorScoringConfiguration} instance. No arguments are required. */ + public static VectorScoringConfiguration create() { + return new VectorScoringConfiguration(); + } +} diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchConfiguration.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchConfiguration.java index ceb7c20f0..24e1a5bce 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchConfiguration.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchConfiguration.java @@ -45,7 +45,7 @@ protected VectorSearchConfiguration() {} * instance. * * @param maxChunkCount Maximum number of chunks to be returned. Cannot be used with - * 'maxDocumentCount'. Minimum: 0 + * 'maxDocumentCount'. Minimum: 0 Maximum: 10000000 * @return The same instance of this {@link VectorSearchConfiguration} class */ @Nonnull @@ -56,7 +56,7 @@ public VectorSearchConfiguration maxChunkCount(@Nullable final Integer maxChunkC /** * Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. - * minimum: 0 + * minimum: 0 maximum: 10000000 * * @return maxChunkCount The maxChunkCount of this {@link VectorSearchConfiguration} instance. */ @@ -69,7 +69,7 @@ public Integer getMaxChunkCount() { * Set the maxChunkCount of this {@link VectorSearchConfiguration} instance. * * @param maxChunkCount Maximum number of chunks to be returned. Cannot be used with - * 'maxDocumentCount'. Minimum: 0 + * 'maxDocumentCount'. Minimum: 0 Maximum: 10000000 */ public void setMaxChunkCount(@Nullable final Integer maxChunkCount) { this.maxChunkCount = maxChunkCount; @@ -81,7 +81,7 @@ public void setMaxChunkCount(@Nullable final Integer maxChunkCount) { * * @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 + * is given, then only one chunk per document is returned. Minimum: 0 Maximum: 10000000 * @return The same instance of this {@link VectorSearchConfiguration} class */ @Nonnull @@ -93,7 +93,7 @@ public VectorSearchConfiguration maxDocumentCount(@Nullable final Integer maxDoc /** * [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 + * one chunk per document is returned. minimum: 0 maximum: 10000000 * * @return maxDocumentCount The maxDocumentCount of this {@link VectorSearchConfiguration} * instance. @@ -108,7 +108,7 @@ public Integer getMaxDocumentCount() { * * @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 + * is given, then only one chunk per document is returned. Minimum: 0 Maximum: 10000000 */ public void setMaxDocumentCount(@Nullable final Integer maxDocumentCount) { this.maxDocumentCount = maxDocumentCount; diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchDocumentKeyValueListPair.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchDocumentKeyValueListPair.java index af9601f91..5d21431ba 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchDocumentKeyValueListPair.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchDocumentKeyValueListPair.java @@ -38,7 +38,7 @@ public class VectorSearchDocumentKeyValueListPair private List value = new ArrayList<>(); @JsonProperty("selectMode") - private List selectMode = new ArrayList<>(); + private List selectMode; @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -161,7 +161,7 @@ public VectorSearchDocumentKeyValueListPair addSelectModeItem( * @return selectMode The selectMode of this {@link VectorSearchDocumentKeyValueListPair} * instance. */ - @Nonnull + @Nullable public List getSelectMode() { return selectMode; } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchFilter.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchFilter.java index 28a10a70a..8cbe02d78 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchFilter.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchFilter.java @@ -49,6 +49,9 @@ public class VectorSearchFilter @JsonProperty("chunkMetadata") private List chunkMetadata = new ArrayList<>(); + @JsonProperty("filter") + private Filter filter; + @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -202,7 +205,7 @@ public VectorSearchFilter addCollectionMetadataItem( * * @return collectionMetadata The collectionMetadata of this {@link VectorSearchFilter} instance. */ - @Nonnull + @Nullable public List getCollectionMetadata() { return collectionMetadata; } @@ -254,7 +257,7 @@ public VectorSearchFilter addDocumentMetadataItem( * * @return documentMetadata The documentMetadata of this {@link VectorSearchFilter} instance. */ - @Nonnull + @Nullable public List getDocumentMetadata() { return documentMetadata; } @@ -318,6 +321,37 @@ public void setChunkMetadata(@Nullable final List chunkM this.chunkMetadata = chunkMetadata; } + /** + * Set the filter of this {@link VectorSearchFilter} instance and return the same instance. + * + * @param filter The filter of this {@link VectorSearchFilter} + * @return The same instance of this {@link VectorSearchFilter} class + */ + @Nonnull + public VectorSearchFilter filter(@Nullable final Filter filter) { + this.filter = filter; + return this; + } + + /** + * Get filter + * + * @return filter The filter of this {@link VectorSearchFilter} instance. + */ + @Nullable + public Filter getFilter() { + return filter; + } + + /** + * Set the filter of this {@link VectorSearchFilter} instance. + * + * @param filter The filter of this {@link VectorSearchFilter} + */ + public void setFilter(@Nullable final Filter filter) { + this.filter = filter; + } + /** * Get the names of the unrecognizable properties of the {@link VectorSearchFilter}. * @@ -362,6 +396,7 @@ public Map toMap() { if (collectionMetadata != null) declaredFields.put("collectionMetadata", collectionMetadata); if (documentMetadata != null) declaredFields.put("documentMetadata", documentMetadata); if (chunkMetadata != null) declaredFields.put("chunkMetadata", chunkMetadata); + if (filter != null) declaredFields.put("filter", filter); return declaredFields; } @@ -392,7 +427,8 @@ public boolean equals(@Nullable final java.lang.Object o) { && Objects.equals(this._configuration, vectorSearchFilter._configuration) && Objects.equals(this.collectionMetadata, vectorSearchFilter.collectionMetadata) && Objects.equals(this.documentMetadata, vectorSearchFilter.documentMetadata) - && Objects.equals(this.chunkMetadata, vectorSearchFilter.chunkMetadata); + && Objects.equals(this.chunkMetadata, vectorSearchFilter.chunkMetadata) + && Objects.equals(this.filter, vectorSearchFilter.filter); } @Override @@ -404,6 +440,7 @@ public int hashCode() { collectionMetadata, documentMetadata, chunkMetadata, + filter, cloudSdkCustomFields); } @@ -418,6 +455,7 @@ public String toString() { sb.append(" collectionMetadata: ").append(toIndentedString(collectionMetadata)).append("\n"); sb.append(" documentMetadata: ").append(toIndentedString(documentMetadata)).append("\n"); sb.append(" chunkMetadata: ").append(toIndentedString(chunkMetadata)).append("\n"); + sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); cloudSdkCustomFields.forEach( (k, v) -> sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchResults.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchResults.java index bee3e3f2c..f3487587c 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchResults.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchResults.java @@ -32,7 +32,7 @@ public class VectorSearchResults // CHECKSTYLE:ON { @JsonProperty("results") - private List results = new ArrayList<>(); + private List results = new ArrayList<>(); @JsonAnySetter @JsonAnyGetter private final Map cloudSdkCustomFields = new LinkedHashMap<>(); @@ -47,7 +47,7 @@ protected VectorSearchResults() {} * @return The same instance of this {@link VectorSearchResults} class */ @Nonnull - public VectorSearchResults results(@Nonnull final List results) { + public VectorSearchResults results(@Nonnull final List results) { this.results = results; return this; } @@ -59,7 +59,8 @@ public VectorSearchResults results(@Nonnull final List results) { * @return The same instance of type {@link VectorSearchResults} */ @Nonnull - public VectorSearchResults addResultsItem(@Nonnull final ResultsInner1 resultsItem) { + public VectorSearchResults addResultsItem( + @Nonnull final VectorPerFilterSearchResult resultsItem) { if (this.results == null) { this.results = new ArrayList<>(); } @@ -73,7 +74,7 @@ public VectorSearchResults addResultsItem(@Nonnull final ResultsInner1 resultsIt * @return results The results of this {@link VectorSearchResults} instance. */ @Nonnull - public List getResults() { + public List getResults() { return results; } @@ -82,7 +83,7 @@ public List getResults() { * * @param results List of returned results. */ - public void setResults(@Nonnull final List results) { + public void setResults(@Nonnull final List results) { this.results = results; } @@ -198,7 +199,7 @@ public interface Builder { * @param results List of returned results. * @return The VectorSearchResults instance. */ - VectorSearchResults results(@Nonnull final List results); + VectorSearchResults results(@Nonnull final List results); /** * Set the results of this {@link VectorSearchResults} instance. @@ -206,7 +207,7 @@ public interface Builder { * @param results List of returned results. * @return The VectorSearchResults instance. */ - default VectorSearchResults results(@Nonnull final ResultsInner1... results) { + default VectorSearchResults results(@Nonnull final VectorPerFilterSearchResult... results) { return results(Arrays.asList(results)); } } diff --git a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchSelectOptionEnum.java b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchSelectOptionEnum.java index af86e6a27..c50f4afd1 100644 --- a/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchSelectOptionEnum.java +++ b/core-services/document-grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorSearchSelectOptionEnum.java @@ -57,6 +57,6 @@ public static VectorSearchSelectOptionEnum fromValue(@Nonnull final String value return b; } } - return null; + return UNKNOWN_DEFAULT_OPEN_API; } } diff --git a/core-services/document-grounding/src/main/resources/spec/grounding.yaml b/core-services/document-grounding/src/main/resources/spec/grounding.yaml index 0b2ff6bc9..bf4f0c2fb 100644 --- a/core-services/document-grounding/src/main/resources/spec/grounding.yaml +++ b/core-services/document-grounding/src/main/resources/spec/grounding.yaml @@ -506,7 +506,7 @@ paths: schema: type: string description: Resource Group ID - - $ref: "#/components/parameters/top" + - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' - $ref: '#/components/parameters/count' tags: @@ -553,7 +553,6 @@ paths: schema: type: string format: uri - '400': $ref: '#/components/responses/BadRequest' '422': @@ -736,7 +735,7 @@ paths: format: uuid title: Collectionid description: Collection ID - - $ref: "#/components/parameters/top" + - $ref: '#/components/parameters/top' - $ref: '#/components/parameters/skip' - $ref: '#/components/parameters/count' responses: @@ -978,6 +977,108 @@ paths: $ref: '#/components/responses/NotFound' '422': $ref: '#/components/responses/UnprocessableEntity' + "/vector/collections/metadata": + patch: + tags: + - Vector + summary: Patch collections metadata + description: Allows to add, remove and modify the collections metadata. + operationId: vector.v1.vector_endpoints.update_collections_metadata + x-sap-cloud-sdk-operation-name: updateCollectionsMetadata + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataUpdates' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + "/vector/documents/metadata": + patch: + tags: + - Vector + summary: Patch documents metadata + description: Allows to add, remove and modify the documents metadata. + operationId: vector.v1.vector_endpoints.update_documents_metadata + x-sap-cloud-sdk-operation-name: updateDocumentsMetadata + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataUpdates' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + "/vector/chunks/metadata": + patch: + tags: + - Vector + summary: Patch chunks metadata + description: Allows to add, remove and modify the chunks metadata. + operationId: vector.v1.vector_endpoints.update_chunks_metadata + x-sap-cloud-sdk-operation-name: updateChunksMetadata + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + description: Resource Group ID + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataUpdates' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/MetadataResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' "/retrieval/dataRepositories": get: parameters: @@ -1028,6 +1129,15 @@ paths: format: uuid title: Repositoryid description: Repository ID + - name: remoteName + in: query + required: false + schema: + type: string + minLength: 1 + nullable: true + title: Remotename + description: Remote name if DataRepository is from remote DG. responses: '200': description: Successful Response @@ -1884,7 +1994,7 @@ components: metadata: type: array items: - $ref: "#/components/schemas/VectorKeyValueListPair" + $ref: '#/components/schemas/VectorKeyValueListPair' title: Metadata default: [] type: object @@ -1906,6 +2016,12 @@ components: $ref: "#/components/schemas/RetrievalKeyValueListPair" title: Metadata default: [] + searchScores: + $ref: "#/components/schemas/SearchScores" + nullable: true + postProcessingScore: + $ref: "#/components/schemas/Score" + nullable: true type: object required: - id @@ -1924,16 +2040,11 @@ components: maxLength: 1024 title: Value matchMode: - type: string - nullable: true title: MatchMode description: Default match mode for search filters + $ref: '#/components/schemas/FilterMatchModeEnum' + nullable: true default: ANY - anyOf: - - enum: - - ANY - - ALL - - {} type: object required: - key @@ -1952,16 +2063,11 @@ components: maxLength: 1024 title: Value matchMode: - type: string - nullable: true title: MatchMode description: Default match mode for search filters + $ref: '#/components/schemas/FilterMatchModeEnum' + nullable: true default: ANY - anyOf: - - enum: - - ANY - - ALL - - {} type: object required: - key @@ -1980,28 +2086,22 @@ components: maxLength: 1024 title: Value matchMode: - type: string - nullable: true title: MatchMode + nullable: true description: Default match mode for search filters + $ref: '#/components/schemas/FilterMatchModeEnum' default: ANY - anyOf: - - enum: - - ANY - - ALL - - {} - type: object + type: object required: - key - value - title: DocumentKeyValueListPair - + title: RetrievalDocumentKeyValueListPair HTTPValidationError: properties: detail: type: array items: - $ref: "#/components/schemas/ValidationError" + $ref: '#/components/schemas/ValidationError' title: Detail type: object title: HTTPValidationError @@ -2038,6 +2138,7 @@ components: required: - key - value + description: Collection metadata during ingestion title: VectorKeyValueListPair RetrievalKeyValueListPair: properties: @@ -2157,28 +2258,35 @@ components: VectorSearchConfiguration: properties: maxChunkCount: - nullable: true type: integer - minimum: 0 exclusiveMinimum: true + minimum: 0 + maximum: 10000000 + nullable: true title: Maxchunkcount description: Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. maxDocumentCount: - nullable: true type: integer - minimum: 0 exclusiveMinimum: true + minimum: 0 + maximum: 10000000 + nullable: 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." type: object title: VectorSearchConfiguration RetrievalSearchConfiguration: + nullable: true + default: {} + minProperties: 0 + maxProperties: 2 properties: maxChunkCount: nullable: true type: integer minimum: 0 exclusiveMinimum: true + maximum: 10000000 title: Maxchunkcount description: Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. maxDocumentCount: @@ -2186,6 +2294,7 @@ components: type: integer minimum: 0 exclusiveMinimum: true + maximum: 10000000 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." type: object @@ -2228,7 +2337,8 @@ components: selectMode: type: array items: - $ref: "#/components/schemas/VectorSearchSelectOptionEnum" + $ref: '#/components/schemas/VectorSearchSelectOptionEnum' + nullable: true title: Selectmode description: Select mode for search filters type: object @@ -2252,6 +2362,7 @@ components: type: array items: $ref: "#/components/schemas/RetrievalSearchSelectOptionEnum" + nullable: true title: Selectmode description: Select mode for search filters type: object @@ -2277,8 +2388,7 @@ components: results: type: array items: - anyOf: - - $ref: "#/components/schemas/VectorPerFilterSearchResult" + $ref: '#/components/schemas/VectorPerFilterSearchResult' title: Results description: List of returned results. type: object @@ -2320,6 +2430,7 @@ components: id: type: string format: uuid + nullable: true title: Id description: Unique identifier of a collection. type: object @@ -2342,16 +2453,12 @@ components: title: CollectionCreatedResponse CollectionPendingResponse: properties: - Location: + monitorURL: type: string - title: Location - status: - type: string - title: Status + title: MonitorURL type: object required: - - Location - - status + - monitorURL title: CollectionPendingResponse CollectionDeletedResponse: properties: @@ -2370,7 +2477,7 @@ components: properties: chunks: items: - $ref: '#/components/schemas/TextOnlyBaseChunk' + $ref: '#/components/schemas/TextOnlyBaseChunkCreate' type: array title: Chunks metadata: @@ -2378,10 +2485,10 @@ components: $ref: '#/components/schemas/VectorDocumentKeyValueListPair' type: array title: Metadata + default: [] type: object required: - chunks - - metadata title: BaseDocument description: Base class for documents, document requests and responses. DocumentCreateRequest: @@ -2402,7 +2509,7 @@ components: properties: chunks: items: - $ref: '#/components/schemas/TextOnlyBaseChunk' + $ref: '#/components/schemas/TextOnlyBaseChunkCreate' type: array title: Chunks metadata: @@ -2410,6 +2517,7 @@ components: $ref: '#/components/schemas/VectorDocumentKeyValueListPair' type: array title: Metadata + default: [] id: type: string format: uuid @@ -2418,7 +2526,6 @@ components: type: object required: - chunks - - metadata - id title: Document description: A single document stored in a collection by ID. @@ -2433,8 +2540,7 @@ components: required: - documents title: DocumentUpdateRequest - description: >- - An update request containing one or more documents to update existing + description: An update request containing one or more documents to update existing documents in a collection by ID. DocumentWithoutChunks: properties: @@ -2453,9 +2559,8 @@ components: - metadata - id title: DocumentWithoutChunks - description: >- - A single document stored in a collection by ID without exposing its - chunks. + description: A single document stored in a collection by ID without exposing + its chunks. DocumentsListResponse: properties: documents: @@ -2466,8 +2571,8 @@ components: type: object required: - documents - title: Documents - description: A response containing documents created or updated, retrieved from the server. + title: DocumentsListResponse + description: A response containing documents retrieved from the server. Documents: properties: count: @@ -2492,11 +2597,34 @@ components: $ref: '#/components/schemas/VectorKeyValueListPair' type: array title: Metadata + default: [] + id: + type: string + format: uuid + title: Id + description: Unique identifier of a chuk. + type: object + required: + - content + - id + title: TextOnlyBaseChunk + description: Schema for a text-only chunk. + TextOnlyBaseChunkCreate: + properties: + content: + type: string + title: Content + metadata: + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + type: array + title: Metadata + default: [] type: object required: - content - - metadata title: TextOnlyBaseChunk + description: Schema for a text-only chunk. DocumentResponse: properties: chunks: @@ -2509,6 +2637,7 @@ components: $ref: '#/components/schemas/VectorDocumentKeyValueListPair' type: array title: Metadata + default: [] id: type: string format: uuid @@ -2517,7 +2646,6 @@ components: type: object required: - chunks - - metadata - id title: DocumentResponse description: >- @@ -2533,18 +2661,13 @@ components: title: SearchSelectOptionEnum VectorSearchSelectOptionEnum: type: string - anyOf: - - enum: - - ignoreIfKeyAbsent - - {} - default: ignoreIfKeyAbsent + enum: + - ignoreIfKeyAbsent title: VectorSearchSelectOptionEnum RetrievalSearchSelectOptionEnum: type: string - anyOf: - - enum: - - ignoreIfKeyAbsent - - {} + enum: + - ignoreIfKeyAbsent title: RetrievalSearchSelectOptionEnum SearchFilter: properties: @@ -2609,20 +2732,20 @@ components: configuration: $ref: '#/components/schemas/VectorSearchConfiguration' collectionMetadata: + type: array items: $ref: '#/components/schemas/VectorKeyValueListPair' - type: array - maxItems: 2000 + nullable: true title: Collectionmetadata description: >- Restrict collections considered during search to those annotated with the given metadata. Useful when combined with collections=['*'] default: [] documentMetadata: + type: array items: $ref: '#/components/schemas/VectorSearchDocumentKeyValueListPair' - type: array - maxItems: 2000 + nullable: true title: Documentmetadata description: >- Restrict documents considered during search to those annotated with @@ -2632,12 +2755,19 @@ components: items: $ref: '#/components/schemas/VectorKeyValueListPair' type: array - maxItems: 2000 title: Chunkmetadata description: >- Restrict chunks considered during search to those with the given metadata. default: [] + filter: + title: Filter + description: Advanced filter expression for combining metadata filters with + boolean logic + anyOf: + - $ref: '#/components/schemas/BinaryBooleanFilter' + - $ref: '#/components/schemas/ScopedKeyValueListPair' + nullable: true type: object required: - id @@ -2650,6 +2780,7 @@ components: type: string maxLength: 2000 minLength: 1 + nullable: true title: Query description: Query string filters: @@ -2729,6 +2860,12 @@ components: title: Metadata description: Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories. default: [] + remoteGroundingName: + type: string + nullable: true + message: + type: string + nullable: true type: $ref: "#/components/schemas/DataRepositoryType" type: object @@ -2747,12 +2884,12 @@ components: - dataRepository title: DataRepositorySearchResult DataRepositoryType: + description: Only include DataRepositories with the given type. type: string - anyOf: - - enum: - - vector - - help.sap.com - - {} + enum: + - vector + - help.sap.com + - remote:dg title: DataRepositoryType DataRepositoryWithDocuments: properties: @@ -2770,6 +2907,15 @@ components: $ref: "#/components/schemas/RetrievalKeyValueListPair" title: Metadata description: Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories. + default: [] + remoteGroundingName: + type: string + nullable: true + description: Friendly destination Name (grounding.name) of remote instance. + message: + type: string + nullable: true + description: Optional message. documents: type: array items: @@ -2820,19 +2966,23 @@ components: - filterId title: PerFilterSearchResult PerFilterSearchResultError: + description: Error message if any. properties: message: type: string title: Message + default: Unknown Error Occurred type: object required: - message title: PerFilterSearchResultError RetrievalPerFilterSearchResultError: + description: Error message if any. properties: message: type: string title: Message + default: Unknown Error Occurred type: object required: - message @@ -2844,9 +2994,6 @@ components: title: Filterid error: $ref: "#/components/schemas/PerFilterSearchResultError" - description: Error message if any. - default: - message: Unknown Error Occurred type: object required: - filterId @@ -2858,24 +3005,23 @@ components: title: Id description: Identifier of this RetrievalSearchFilter - unique per request. searchConfiguration: - type: object nullable: true $ref: "#/components/schemas/RetrievalSearchConfiguration" default: {} - minProperties: 0 - maxProperties: 2 dataRepositories: type: array items: type: string title: Datarepositories description: Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids. - default: - - "*" + default: ["*"] dataRepositoryType: - type: string $ref: "#/components/schemas/DataRepositoryType" description: Only include DataRepositories with the given type. + remoteName: + description: Destination Name of remote instance. + type: string + nullable: true dataRepositoryMetadata: type: array items: @@ -2908,18 +3054,437 @@ components: query: type: string minLength: 1 + nullable: true title: Query description: Query string filters: type: array items: - $ref: "#/components/schemas/RetrievalSearchFilter" + anyOf: + - $ref: "#/components/schemas/RetrievalSearchFilter" + - $ref: "#/components/schemas/RetrievalVectorSearchFilter" title: Filters + postProcessing: + type: array + items: + type: object + required: + - strategy + - inputs + properties: + id: + description: New ID for each PostProcessingOperation. + default: ae9eee48-4671-4321-a3e5-640adaaf26ae + type: string + nullable: true + maxChunkCount: + description: "Maximum number of chunks to be retained in final PerSearchFilterResult." + type: integer + exclusiveMinimum: true + minimum: 0 + maximum: 10000000 + nullable: true + default: 5 + strategy: + description: "Merging and scoring strategy to derive final PerSearchFilterResult." + oneOf: + - $ref: '#/components/schemas/MergeStrategyScoreReuse' + - $ref: '#/components/schemas/MergeStrategyReranker' + inputs: + type: array + items: + oneOf: + - $ref: '#/components/schemas/PostProcessingObjectReference' + - $ref: '#/components/schemas/PostProcessingOperation' + description: List of operations to be performed across PerFilterSearchResults. + default: [] type: object required: - query - filters title: RetrievalSearchInput + Score: + type: object + properties: + value: + type: number + required: + - value + title: Score + SearchScores: + properties: + aggregatedScore: + type: object + properties: + value: + type: number + denseRetrievalScore: + type: object + properties: + value: + type: number + required: + - aggregatedScore + - denseRetrievalScore + title: SearchScores + RetrievalVectorSearchFilter: + properties: + id: + type: string + title: Id + description: Identifier of this RetrievalSearchFilter - unique per request. + searchConfiguration: + $ref: "#/components/schemas/RetrievalSearchConfiguration" + nullable: true + default: {} + dataRepositories: + type: array + items: + type: string + title: Datarepositories + description: Specify ['*'] to search across all DataRepositories or give a specific list of DataRepository ids. + default: + - "*" + dataRepositoryType: + $ref: "#/components/schemas/DataRepositoryType" + nullable: true + default: vector + remoteName: + description: Destination Name of remote instance. + type: string + nullable: true + dataRepositoryMetadata: + type: array + items: + $ref: "#/components/schemas/RetrievalKeyValueListPair" + title: Datarepositorymetadata + description: Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*'] + default: [] + documentMetadata: + type: array + items: + $ref: "#/components/schemas/RetrievalSearchDocumentKeyValueListPair" + title: Documentmetadata + description: Restrict documents considered during search to those annotated with the given metadata. + default: [] + chunkMetadata: + type: array + items: + $ref: "#/components/schemas/RetrievalKeyValueListPair" + title: Chunkmetadata + description: Restrict chunks considered during search to those with the given metadata. + default: [] + filter: + anyOf: + - $ref: '#/components/schemas/RetrievalBinaryBooleanFilter' + - $ref: '#/components/schemas/RetrievalScopedKeyValueListPair' + nullable: true + description: Filter to apply on the search results. This cannot be used together with 'documentMetadata'. The depth of the filter must not exceed 5 levels. + scoringConfiguration: + $ref: '#/components/schemas/VectorScoringConfiguration' + nullable: true + description: Scoring configuration for retrieval and ranking. + default: + denseRetrieval: + enabled: true + weight: 1 + keywordRetrieval: + enabled: true + extractKeyWordsFromQuery: false + weight: 1 + boosting: + enabled: true + metadata: [] + scoreComputationStrategy: match_count + weight: 1 + aggregationStrategy: weighted_average + type: object + required: + - id + title: RetrievalVectorSearchFilter + RetrievalBinaryBooleanFilter: + properties: + operator: + type: string + title: Operator + enum: + - and + - or + left: + title: Left + anyOf: + - $ref: '#/components/schemas/RetrievalBinaryBooleanFilter' + - $ref: '#/components/schemas/RetrievalScopedKeyValueListPair' + right: + title: Right + anyOf: + - $ref: '#/components/schemas/RetrievalBinaryBooleanFilter' + - $ref: '#/components/schemas/RetrievalScopedKeyValueListPair' + type: object + required: + - operator + - left + - right + title: RetrievalBinaryBooleanFilter + RetrievalScopedKeyValueListPair: + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + scope: + type: string + title: Scope + enum: + - repository + - document + - chunk + default: document + type: object + required: + - key + - value + title: RetrievalScopedKeyValueListPair + MergeStrategyScoreReuse: + properties: + type: + description: "The type of merge strategy." + $ref: '#/components/schemas/MergeStrategyType' + nullable: true + default: scoreReuse + type: object + title: MergeStrategyScoreReuse + description: The MergeStrategyScoreReuse merges the given PerFilterSearchResult instances according to the scores returned by the downstream retrieval process. It is important that the scores are comparable, meaning they should come from the same embedding model or reranker model. + MergeStrategyReranker: + properties: + type: + $ref: '#/components/schemas/MergeStrategyType' + nullable: true + default: reranker + model: + description: The RerankerModel to use. + type: string + enum: + - cohere-3.5 + nullable: true + title: RerankerModel + default: cohere-3.5 + boosting: + description: Key-value pairs to be included in the ranking process, to boost related chunks according to chunk content and metadata, if includeMetaData is true. + type: array + items: + type: object + required: + - key + - value + - scope + properties: + key: + type: string + maxLength: 1024 + value: + type: array + items: + type: string + maxLength: 1024 + scope: + type: array + description: PerFilterSearchResult ID or a new ID for each PostProcessingOperation. + items: + type: string + nullable: true + includeAllMetaData: + description: If true, document and chunk metadata are sent to the reranker LLM along with the text content of the chunk. + type: boolean + nullable: true + default: false + type: object + title: MergeStrategyReranker + description: The MergeStrategyReranker will call a reranker LLM to merge the given PerFilterSearchResult instances. This strategy adds latency, but yields good results. + MergeStrategyType: + enum: + - reranker + - scoreReuse + - reciprocalRankFusion + - random + type: string + title: MergeStrategyType + PostProcessingObjectReference: + properties: + id: + description: PerFilterSearchResult ID or PostProcessingOperation ID. + type: string + nullable: true + default: "6d3eeafd-f3db-4e8e-949a-0e40e50eab64" + type: object + title: PostProcessingObjectReference + PostProcessingOperation: + properties: + id: + type: string + nullable: true + description: New ID for each PostProcessingOperation. + default: ae9eee48-4671-4321-a3e5-640adaaf26ae + title: Id + maxChunkCount: + title: Maxchunkcount + description: Maximum number of chunks to be retained in final PerSearchFilterResult. + default: 5 + type: integer + exclusiveMinimum: true + minimum: 0 + maximum: 10000000 + nullable: true + strategy: + title: Strategy + description: Merging and scoring strategy to derive final PerSearchFilterResult. + oneOf: + - $ref: '#/components/schemas/MergeStrategyScoreReuse' + - $ref: '#/components/schemas/MergeStrategyReranker' + inputs: + title: Inputs + type: array + items: + oneOf: + - $ref: '#/components/schemas/PostProcessingObjectReference' + - $ref: '#/components/schemas/PostProcessingOperation' + type: object + required: + - strategy + - inputs + title: PostProcessingOperation + VectorScoringConfiguration: + properties: + denseRetrieval: + $ref: '#/components/schemas/DenseRetrievalScoringConfiguration' + nullable: true + default: + enabled: true + weight: 1 + keywordRetrieval: + $ref: '#/components/schemas/KeyWordRetrievalScoringConfiguration' + nullable: true + default: + enabled: true + weight: 1 + extractKeyWordsFromQuery: false + boosting: + $ref: '#/components/schemas/BoostingScoringConfiguration' + nullable: true + default: + enabled: true + metadata: [] + weight: 1 + scoreComputationStrategy: match_count + scoreThreshold: + title: Scorethreshold + description: Minimum chunk score threshold. + type: number + nullable: true + aggregationStrategy: + description: Methodology to calculate the final aggregate score. + $ref: '#/components/schemas/ScoresAggregationStrategy' + nullable: true + default: weighted_average + type: object + title: VectorScoringConfiguration + DenseRetrievalScoringConfiguration: + properties: + enabled: + type: boolean + nullable: true + description: Enable dense retrieval. + default: true + weight: + type: integer + nullable: true + description: Contribution to final score. + default: 1 + type: object + title: DenseRetrievalScoringConfiguration + KeyWordRetrievalScoringConfiguration: + properties: + enabled: + type: boolean + nullable: true + default: true + description: Enable dense retrieval. + weight: + type: integer + nullable: true + default: 1 + description: Contribution to final score. + extractKeyWordsFromQuery: + type: boolean + nullable: true + default: false + description: Extract Keywords from Query. + type: object + title: KeyWordRetrievalScoringConfiguration + BoostingScoringConfiguration: + properties: + enabled: + type: boolean + nullable: true + default: true + description: Enable metadata-based boosting. + metadata: + type: array + items: + type: object + required: + - key + - value + - weight + properties: + key: + type: string + maxLength: 1024 + value: + type: array + items: + type: string + maxLength: 1024 + scope: + type: string + enum: [repository, document, chunk] + default: document + weight: + type: integer + nullable: true + default: [] + weight: + type: integer + nullable: true + default: 1 + description: Contribution to final score. + scoreComputationStrategy: + description: How the similarity between document metadata and boosted key-value pairs is computed. + $ref: '#/components/schemas/BoostingScoreComputationStrategy' + nullable: true + default: match_count + type: object + title: BoostingScoringConfiguration + BoostingScoreComputationStrategy: + enum: + - match_count + - embedding + type: string + title: BoostingScoreComputationStrategy + ScoresAggregationStrategy: + enum: + - weighted_average + - rrf + - weighted_rrf + type: string + title: ScoresAggregationStrategy + RetrievalDataRepositorySearchResult: properties: dataRepository: @@ -2940,9 +3505,14 @@ components: title: Results description: List of returned results. default: [] + remoteGroundingName: + type: string + nullable: true + description: Friendly Destination Name of remote instance (grounding.name). + Only present if dataRepositoryType = remote:dg. type: object required: - - filterId + - filterId title: RetrievalPerFilterSearchResult RetrievalPerFilterSearchResultWithError: properties: @@ -2951,9 +3521,6 @@ components: title: Filterid error: $ref: "#/components/schemas/RetrievalPerFilterSearchResultError" - description: Error message if any. - default: - message: Unknown Error Occurred type: object required: - filterId @@ -2989,9 +3556,11 @@ components: ValidationError: properties: loc: - type: array items: - type: string + anyOf: + - type: string + - type: integer + type: array title: Location msg: type: string @@ -3001,19 +3570,19 @@ components: title: Error Type type: object required: - - loc - - msg - - type + - loc + - msg + - type title: ValidationError DocumentBulkDeleteRequest: properties: ids: - type: array items: type: string format: uuid - minItems: 1 + type: array maxItems: 100 + minItems: 1 title: Ids description: List of document IDs to delete type: object @@ -3043,6 +3612,169 @@ components: - notFound title: DocumentBulkDeleteResponse description: Response after deleting documents in bulk. + BinaryBooleanFilter: + type: object + required: + - operator + - left + - right + properties: + operator: + type: string + title: Operator + description: Boolean operator for combining filter conditions + enum: + - and + - or + left: + title: Left + description: Left operand of the boolean expression + anyOf: + - $ref: '#/components/schemas/BinaryBooleanFilter' + - $ref: '#/components/schemas/ScopedKeyValueListPair' + right: + title: Right + description: Right operand of the boolean expression + anyOf: + - $ref: '#/components/schemas/BinaryBooleanFilter' + - $ref: '#/components/schemas/ScopedKeyValueListPair' + title: BinaryBooleanFilter + ScopedKeyValueListPair: + type: object + required: + - key + - value + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + scope: + type: string + title: Scope + description: Scope of the metadata filter (e.g., collection, document, chunk) + enum: + - collection + - document + - chunk + default: document + title: ScopedKeyValueListPair + MetadataUpdates: + properties: + updates: + type: array + items: + $ref: '#/components/schemas/MetadataUpdateItem' + title: Updates + description: List of metadata updates. + type: object + required: + - updates + title: MetadataUpdates + MetadataUpdateItem: + properties: + ids: + type: array + items: + type: string + format: uuid + title: Ids + description: List of collection or document or chunk ids for which the metadata should be updated + metadataUpdates: + type: array + items: + $ref: '#/components/schemas/MetadataKeyUpdate' + title: MetadataUpdates + description: List of metadata updates for the given resource ids + type: object + required: + - ids + - metadataUpdates + title: MetadataUpdateItem + MetadataKeyUpdate: + properties: + key: + type: string + minLength: 1 + title: Key + description: Key to update + operations: + type: array + items: + $ref: '#/components/schemas/MetadataOperation' + nullable: true + title: Operations + description: Update operation executed for the key + type: object + required: + - key + title: MetadataKeyUpdate + MetadataOperation: + type: object + required: + - op + properties: + op: + $ref: '#/components/schemas/MetadataOperationEnum' + values: + type: array + items: + type: string + nullable: true + title: Values + description: List of values to update. + title: MetadataOperation + MetadataOperationEnum: + type: string + enum: + - add + - remove + - replace + - delete_key + title: MetadataOperationEnum + MetadataResponse: + type: object + properties: + current_metadata: + type: array + items: + $ref: '#/components/schemas/MetadataItem' + nullable: true + title: CurrentMetadata + description: List of metadata after updates. + default: [] + title: MetadataResponse + MetadataItem: + type: object + required: + - id + properties: + id: + type: string + format: uuid + title: Id + description: ID of collection + metadata: + type: array + items: + $ref: '#/components/schemas/VectorKeyValueListPair' + nullable: true + title: Metadata + description: List of metadata of the collections or documents or chunks + default: [] + title: MetadataItem + FilterMatchModeEnum: + type: string + enum: + - ANY + - ALL + title: FilterMatchModeEnum ### ### ######################## ### ### ### ### ### Error ### ### ### @@ -3146,4 +3878,4 @@ components: required: false schema: type: boolean - example: true \ No newline at end of file + example: true