diff --git a/.pipeline/checkstyle-suppressions.xml b/.pipeline/checkstyle-suppressions.xml index 8dcc891fc..ca22dcf50 100644 --- a/.pipeline/checkstyle-suppressions.xml +++ b/.pipeline/checkstyle-suppressions.xml @@ -10,6 +10,8 @@ + + diff --git a/.pipeline/spotbugs-exclusions.xml b/.pipeline/spotbugs-exclusions.xml index 3e709994f..ded4e5eca 100644 --- a/.pipeline/spotbugs-exclusions.xml +++ b/.pipeline/spotbugs-exclusions.xml @@ -5,6 +5,8 @@ + + diff --git a/README.md b/README.md index ae63c3e05..55a8085b0 100644 --- a/README.md +++ b/README.md @@ -136,6 +136,7 @@ For more detailed information and advanced usage, please refer to the following: - [ OpenAI Chat Completion](docs/guides/OPENAI_CHAT_COMPLETION.md) - [ Spring AI Integration](docs/guides/SPRING_AI_INTEGRATION.md) - [🧰 AI Core Deployment](docs/guides/AI_CORE_DEPLOYMENT.md) +- [ AI Core Grounding](docs/guides/GROUNDING.md) For updating versions, please refer to the [**Release Notes**](docs/release-notes/release-notes-0-to-14.md). diff --git a/docs/guides/GROUNDING.md b/docs/guides/GROUNDING.md new file mode 100644 index 000000000..f550b1362 --- /dev/null +++ b/docs/guides/GROUNDING.md @@ -0,0 +1,155 @@ +# Grounding Services + +## Table of Contents + +- [Introduction](#introduction) + - [Prerequisites](#prerequisites) + - [Maven Dependencies](#maven-dependencies) +- [Usage](#usage) + - [Data Ingestion](#data-ingestion) + - [Pipeline API](#pipeline-api) + - [Vector API](#vector-api) + - [Data Retrieval](#retrieval-api) + - [Retrieval API](#create-a-deployment) + - [Grounding via Orchestration](#grounding-via-orchestration) + +## Introduction + +This guide provides examples on how to manage data in SAP Document Grounding. +It's divided into two main sections: Data Ingestion and Data Retrieval. + +> [!WARNING] +> The below examples rely on generated model classes. +> Please be aware of the [implications described here](/README.md#general-requirements). + +## Prerequisites + +Before using the Grounding module, ensure that you have met all the general requirements outlined in the [README.md](../../README.md#general-requirements). +Additionally, include the necessary Maven dependency in your project. + +### Maven Dependencies + +Add the following dependency to your `pom.xml` file: + +```xml + + com.sap.ai.sdk + grounding + ${ai-sdk.version} + +``` + +See [an example pom in our Spring Boot application](../../sample-code/spring-app/pom.xml) + +## Usage + +In addition to the prerequisites above, we assume you have already set up the following to carry out the examples in this guide: + +- A running instance of SAP AI Core with correctly setup credentials, including a resource group id. + +## Data Ingestion + +The following APIs are available for data ingestion: Pipeline and Vector. + +### Pipeline API + +Consider the following code sample to read pipelines, create a new one and get its status: + +```java +var api = new GroundingClient().pipelines(); +var resourceGroupId = "default"; + +// get all pipelines +Pipelines pipelines = api.getAllPipelines(resourceGroupId); + +// create new pipeline +var type = "MSSharePoint"; // or "S3" or "SFTP" +var pipelineSecret = "my-secret-name"; +var config = PipelinePostRequstConfiguration.create().destination(pipelineSecret); +var request = PipelinePostRequst.create().type(type)._configuration(config); +PipelineId pipeline = api.createPipeline(resourceGroupId, request); + +// get pipeline status +PipelineStatus status = api.getPipelineStatus(resourceGroupId, pipeline.getPipelineId()); +``` + +### Vector API + +```java +var api = new GroundingClient().vector(); +var resourceGroupId = "default"; + +// resolve collection id +var collectionId = UUID.fromString("12345-123-123-123-0123456abcdef"); + +var request = DocumentCreateRequest.create() + .documents(BaseDocument.create() + .chunks(TextOnlyBaseChunk.create() + .content("The dog makes _woof_") + .metadata(KeyValueListPair.create() + .key("animal").value("dog"))) + .metadata(DocumentKeyValueListPair.create() + .key("topic").value("sound"))); +DocumentsListResponse response = api.createDocuments(resourceGroupId, collectionId, request); +``` + +Refer to the [DeploymentController.java](../../sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/DeploymentController.java) in our Spring Boot application for a complete example. + +## Data Retrieval + +The following APIs are available for data retrieval: Retrieval and Orchestration. + + +### Retrieval API + +Consider the following code sample to search for relevant grounding data based on a query: + +```java +var api = new GroundingClient().retrieval(); +var resourceGroupId = "default"; + +var filter = + RetrievalSearchFilter.create() + .id("question") + .dataRepositoryType(DataRepositoryType.VECTOR) + .dataRepositories(List.of("*")) + .searchConfiguration(SearchConfiguration.create().maxChunkCount(10)); +var search = RetrievalSearchInput.create().query("What is SAP Cloud SDK for AI?").filters(filter); +RetievalSearchResults results = api.search(resourceGroupId, search); +``` + +### Grounding via Orchestration + +You can use the grounding service via orchestration. +Please find the [documentation on Orchestration client in the dedicated document](ORCHESTRATION_CHAT_COMPLETION.md). + +```java +OrchestrationClient client; + +var databaseFilter = + DocumentGroundingFilter.create() + .dataRepositoryType(DataRepositoryType.VECTOR) + .searchConfig(GroundingFilterSearchConfiguration.create().maxChunkCount(3)); +var groundingConfigConfig = + GroundingModuleConfigConfig.create() + .inputParams(List.of("query")) + .outputParam("results") + .addFiltersItem(databaseFilter); +var groundingConfig = + GroundingModuleConfig.create() + .type(GroundingModuleConfig.TypeEnum.DOCUMENT_GROUNDING_SERVICE) + .config(groundingConfigConfig); +var configWithGrounding = + new OrchestrationModuleConfig() + .withLlmConfig(GPT_4O) + .withGroundingConfig(groundingConfig); + +var inputParams = Map.of("query", "What is SAP Cloud SDK for AI?"); + +var prompt = + new OrchestrationPrompt( + inputParams, + Message.system("Context message with embedded grounding results. {{?results}}")); + +OrchestrationChatResponse response = client.chatCompletion(prompt, configWithGrounding); +``` \ No newline at end of file diff --git a/grounding/pom.xml b/grounding/pom.xml new file mode 100644 index 000000000..659f1c7f4 --- /dev/null +++ b/grounding/pom.xml @@ -0,0 +1,152 @@ + + + 4.0.0 + + com.sap.ai.sdk + sdk-parent + 1.4.0-SNAPSHOT + + grounding + Grounding client + SAP Cloud SDK for AI is the official Software Development Kit (SDK) for SAP AI Core, SAP Generative AI Hub, and Orchestration Service. This is the client for the Grounding Service. + + https://github.com/SAP/ai-sdk-java?tab=readme-ov-file#documentation + + SAP SE + https://www.sap.com + + + + The Apache Software License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + SAP + cloudsdk@sap.com + SAP SE + https://www.sap.com + + + + ${project.basedir}/../ + 80% + 71% + 85% + 100% + 80% + 100% + + + + + + org.springframework + spring-core + + + org.springframework + spring-web + + + + com.sap.ai.sdk + core + + + com.sap.cloud.sdk.cloudplatform + cloudplatform-connectivity + + + com.sap.cloud.sdk.datamodel + openapi-core + + + com.google.code.findbugs + jsr305 + + + com.fasterxml.jackson.core + jackson-annotations + + + org.slf4j + slf4j-api + + + com.google.guava + guava + + + + org.projectlombok + lombok + provided + + + + org.junit.jupiter + junit-jupiter-api + test + + + org.wiremock + wiremock + test + + + org.assertj + assertj-core + test + + + + + + generate + + false + + generate + + + + + + com.sap.cloud.sdk.datamodel + openapi-generator-maven-plugin + + ${project.basedir}/src/main/java + beta + true + COMPILE + true + + + + orchestration + + generate + + generate-sources + + ${project.basedir}/src/main/resources/spec/grounding.yaml + com.sap.ai.sdk.grounding.client + com.sap.ai.sdk.grounding.model + + create + + protected + true + true + + + + + + + + + + diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/GroundingClient.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/GroundingClient.java new file mode 100644 index 000000000..526235fe0 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/GroundingClient.java @@ -0,0 +1,70 @@ +package com.sap.ai.sdk.grounding; + +import com.sap.ai.sdk.core.AiCoreService; +import com.sap.ai.sdk.grounding.client.PipelinesApi; +import com.sap.ai.sdk.grounding.client.RetrievalApi; +import com.sap.ai.sdk.grounding.client.VectorApi; +import javax.annotation.Nonnull; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import lombok.experimental.Tolerate; + +/** + * Service class for the Grounding APIs. + * + * @since 1.3.0 + */ +@RequiredArgsConstructor(access = AccessLevel.PUBLIC) +@Getter(value = AccessLevel.PROTECTED) +public class GroundingClient { + @Nonnull private final AiCoreService service; + @Nonnull private final String basePath; + + static final String DEFAULT_BASE_PATH = "lm/document-grounding/"; + + /** Default constructor. */ + @Tolerate + public GroundingClient() { + this(new AiCoreService()); + } + + /** + * Constructor with custom AI Core service instance. + * + * @param service The instance of AI Core service + */ + public GroundingClient(final @Nonnull AiCoreService service) { + this(service, DEFAULT_BASE_PATH); + } + + /** + * Get the Pipelines API. + * + * @return The Pipelines API. + */ + @Nonnull + public PipelinesApi pipelines() { + return new PipelinesApi(getService().getApiClient().setBasePath(getBasePath())); + } + + /** + * Get the Vector API. + * + * @return The Vector API. + */ + @Nonnull + public VectorApi vector() { + return new VectorApi(getService().getApiClient().setBasePath(getBasePath())); + } + + /** + * Get the Retrieval API. + * + * @return The Retrieval API. + */ + @Nonnull + public RetrievalApi retrieval() { + return new RetrievalApi(getService().getApiClient().setBasePath(getBasePath())); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/client/PipelinesApi.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/client/PipelinesApi.java new file mode 100644 index 000000000..c7310e26e --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/client/PipelinesApi.java @@ -0,0 +1,410 @@ +package com.sap.ai.sdk.grounding.client; + +import com.google.common.annotations.Beta; +import com.sap.ai.sdk.grounding.model.Pipeline; +import com.sap.ai.sdk.grounding.model.PipelineId; +import com.sap.ai.sdk.grounding.model.PipelinePostRequst; +import com.sap.ai.sdk.grounding.model.PipelineStatus; +import com.sap.ai.sdk.grounding.model.Pipelines; +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; +import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient; +import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.core.OpenApiResponse; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.util.UriComponentsBuilder; + +/** + * Document Grounding Pipeline API in version 0.1.0. + * + *

SAP AI Core - API Specification AI Data Management api's + */ +@Beta +public class PipelinesApi extends AbstractOpenApiService { + /** + * Instantiates this API class to invoke operations on the Document Grounding Pipeline API. + * + * @param httpDestination The destination that API should be used with + */ + public PipelinesApi(@Nonnull final Destination httpDestination) { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the Document Grounding Pipeline API based + * on a given {@link ApiClient}. + * + * @param apiClient ApiClient to invoke the API on + */ + @Beta + public PipelinesApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + /** + * Create a pipeline + * + *

201 - Returns pipelineId on successful creation. + * + *

400 - The specification of the resource was incorrect + * + * @param aiResourceGroup The value for the parameter aiResourceGroup + * @param pipelinePostRequst The value for the parameter pipelinePostRequst + * @return PipelineId + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public PipelineId createPipeline( + @Nonnull final String aiResourceGroup, @Nonnull final PipelinePostRequst pipelinePostRequst) + throws OpenApiRequestException { + final Object localVarPostBody = pipelinePostRequst; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling createPipeline"); + } + + // verify the required parameter 'pipelinePostRequst' is set + if (pipelinePostRequst == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'pipelinePostRequst' when calling pipelineV1PipelineEndpointsCreatePipeline"); + } + + final String localVarPath = UriComponentsBuilder.fromPath("/pipelines").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.POST, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Delete a pipeline by pipeline id + * + *

204 - No Content + * + *

400 - The specification of the resource was incorrect + * + * @param aiResourceGroup The value for the parameter aiResourceGroup + * @param pipelineId The ID of the pipeline to delete. + * @return An OpenApiResponse containing the status code of the HttpResponse. + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public OpenApiResponse deletePipelineById( + @Nonnull final String aiResourceGroup, @Nonnull final String pipelineId) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling deletePipelineById"); + } + + // verify the required parameter 'pipelineId' is set + if (pipelineId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'pipelineId' when calling deletePipelineById"); + } + + // create path and map variables + final Map localVarPathParams = new HashMap(); + localVarPathParams.put("pipelineId", pipelineId); + final String localVarPath = + UriComponentsBuilder.fromPath("/pipelines/{pipelineId}") + .buildAndExpand(localVarPathParams) + .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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + apiClient.invokeAPI( + localVarPath, + HttpMethod.DELETE, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + return new OpenApiResponse(apiClient); + } + + /** + * Get all pipelines + * + *

200 - Returns all pipelines for the tenant. + * + *

400 - The specification of the resource was incorrect + * + * @param aiResourceGroup (required) The value for the parameter aiResourceGroup + * @param $top (optional) Number of results to display + * @param $skip (optional) Number of results to be skipped from the ordered list of results + * @param $count (optional) When the $count field is set to false, the response contains a count + * of the items present in the response. When the $count field is set to true, the response + * contains a count of all the items present on the server, and not just the ones in the + * response. When the $count field is not passed, it is false by default. + * @return Pipelines + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Pipelines getAllPipelines( + @Nonnull final String aiResourceGroup, + @Nullable final Integer $top, + @Nullable final Integer $skip, + @Nullable final Boolean $count) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling getAllPipelines"); + } + + final String localVarPath = UriComponentsBuilder.fromPath("/pipelines").build().toUriString(); + + final MultiValueMap localVarQueryParams = + new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarFormParams = + new LinkedMultiValueMap(); + + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "$top", $top)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "$skip", $skip)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "$count", $count)); + + 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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.GET, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Get all pipelines + * + *

200 - Returns all pipelines for the tenant. + * + *

400 - The specification of the resource was incorrect + * + * @param aiResourceGroup The value for the parameter aiResourceGroup + * @return Pipelines + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Pipelines getAllPipelines(@Nonnull final String aiResourceGroup) + throws OpenApiRequestException { + return getAllPipelines(aiResourceGroup, null, null, null); + } + + /** + * Get details of a pipeline by pipeline id + * + *

200 - Returns the pipeline for an pipelineId + * + *

400 - The specification of the resource was incorrect + * + * @param aiResourceGroup The value for the parameter aiResourceGroup + * @param pipelineId The ID of the pipeline to get. + * @return Pipeline + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Pipeline getPipelineById( + @Nonnull final String aiResourceGroup, @Nonnull final String pipelineId) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling getPipelineById"); + } + + // verify the required parameter 'pipelineId' is set + if (pipelineId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'pipelineId' when calling getPipelineById"); + } + + // create path and map variables + final Map localVarPathParams = new HashMap(); + localVarPathParams.put("pipelineId", pipelineId); + final String localVarPath = + UriComponentsBuilder.fromPath("/pipelines/{pipelineId}") + .buildAndExpand(localVarPathParams) + .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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.GET, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Get pipeline status by pipeline id + * + *

200 - Returns the pipeline status for an pipelineId. + * + *

400 - The specification of the resource was incorrect + * + * @param aiResourceGroup The value for the parameter aiResourceGroup + * @param pipelineId The ID of the pipeline to get status. + * @return PipelineStatus + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public PipelineStatus getPipelineStatus( + @Nonnull final String aiResourceGroup, @Nonnull final String pipelineId) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling getPipelineStatus"); + } + + // verify the required parameter 'pipelineId' is set + if (pipelineId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'pipelineId' when calling getPipelineStatus"); + } + + // create path and map variables + final Map localVarPathParams = new HashMap(); + localVarPathParams.put("pipelineId", pipelineId); + final String localVarPath = + UriComponentsBuilder.fromPath("/pipelines/{pipelineId}/status") + .buildAndExpand(localVarPathParams) + .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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.GET, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/client/RetrievalApi.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/client/RetrievalApi.java new file mode 100644 index 000000000..c54345f38 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/client/RetrievalApi.java @@ -0,0 +1,287 @@ +package com.sap.ai.sdk.grounding.client; + +import com.google.common.annotations.Beta; +import com.sap.ai.sdk.grounding.model.DataRepositories; +import com.sap.ai.sdk.grounding.model.DataRepository; +import com.sap.ai.sdk.grounding.model.RetievalSearchResults; +import com.sap.ai.sdk.grounding.model.RetrievalSearchInput; +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; +import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient; +import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.util.UriComponentsBuilder; + +/** + * Document Grounding Pipeline API in version 0.1.0. + * + *

SAP AI Core - API Specification AI Data Management api's + */ +@Beta +public class RetrievalApi extends AbstractOpenApiService { + /** + * Instantiates this API class to invoke operations on the Document Grounding Pipeline API. + * + * @param httpDestination The destination that API should be used with + */ + public RetrievalApi(@Nonnull final Destination httpDestination) { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the Document Grounding Pipeline API based + * on a given {@link ApiClient}. + * + * @param apiClient ApiClient to invoke the API on + */ + @Beta + public RetrievalApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + /** + * List all DataRepository objects. + * + *

List all DataRepository objects. + * + *

200 - Successful Response + * + *

400 - The specification of the resource was incorrect + * + * @param aiResourceGroup (required) The value for the parameter aiResourceGroup + * @param $top (optional) Number of results to display + * @param $skip (optional) Number of results to be skipped from the ordered list of results + * @param $count (optional) When the $count field is set to false, the response contains a count + * of the items present in the response. When the $count field is set to true, the response + * contains a count of all the items present on the server, and not just the ones in the + * response. When the $count field is not passed, it is false by default. + * @return DataRepositories + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public DataRepositories getDataRepositories( + @Nonnull final String aiResourceGroup, + @Nullable final Integer $top, + @Nullable final Integer $skip, + @Nullable final Boolean $count) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling getDataRepositories"); + } + + final String localVarPath = + UriComponentsBuilder.fromPath("/retrieval/dataRepositories").build().toUriString(); + + final MultiValueMap localVarQueryParams = + new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarFormParams = + new LinkedMultiValueMap(); + + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "$top", $top)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "$skip", $skip)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "$count", $count)); + + 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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.GET, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * List all DataRepository objects. + * + *

List all DataRepository objects. + * + *

200 - Successful Response + * + *

400 - The specification of the resource was incorrect + * + * @param aiResourceGroup The value for the parameter aiResourceGroup + * @return DataRepositories + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public DataRepositories getDataRepositories(@Nonnull final String aiResourceGroup) + throws OpenApiRequestException { + return getDataRepositories(aiResourceGroup, null, null, null); + } + + /** + * List single DataRepository object. + * + *

List single DataRepository object. + * + *

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 The value for the parameter aiResourceGroup + * @param repositoryId The value for the parameter repositoryId + * @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 { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling getDataRepositoryById"); + } + + // verify the required parameter 'repositoryId' is set + if (repositoryId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'repositoryId' when calling getDataRepositoryById"); + } + + // create path and map variables + final Map localVarPathParams = new HashMap(); + localVarPathParams.put("repositoryId", repositoryId); + final String localVarPath = + UriComponentsBuilder.fromPath("/retrieval/dataRepositories/{repositoryId}") + .buildAndExpand(localVarPathParams) + .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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.GET, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Retrieve relevant content given a query string. + * + *

Retrieve relevant content given a query string. + * + *

200 - Successful Response + * + *

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

422 - There are validation issues with the data. + * + * @param aiResourceGroup The value for the parameter aiResourceGroup + * @param retrievalSearchInput The value for the parameter retrievalSearchInput + * @return RetievalSearchResults + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public RetievalSearchResults search( + @Nonnull final String aiResourceGroup, + @Nonnull final RetrievalSearchInput retrievalSearchInput) + throws OpenApiRequestException { + final Object localVarPostBody = retrievalSearchInput; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling search"); + } + + // verify the required parameter 'retrievalSearchInput' is set + if (retrievalSearchInput == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'retrievalSearchInput' when calling retrievalV1RetrievalEndpointsSearch"); + } + + final String localVarPath = + UriComponentsBuilder.fromPath("/retrieval/search").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.POST, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/client/VectorApi.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/client/VectorApi.java new file mode 100644 index 000000000..8a537258b --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/client/VectorApi.java @@ -0,0 +1,1052 @@ +package com.sap.ai.sdk.grounding.client; + +import com.google.common.annotations.Beta; +import com.sap.ai.sdk.grounding.model.Collection; +import com.sap.ai.sdk.grounding.model.CollectionRequest; +import com.sap.ai.sdk.grounding.model.CollectionsListResponse; +import com.sap.ai.sdk.grounding.model.DocumentCreateRequest; +import com.sap.ai.sdk.grounding.model.DocumentResponse; +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.SearchResults; +import com.sap.ai.sdk.grounding.model.TextSearchRequest; +import com.sap.ai.sdk.grounding.model.VectorV1VectorEndpointsGetCollectionCreationStatus200Response; +import com.sap.ai.sdk.grounding.model.VectorV1VectorEndpointsGetCollectionDeletionStatus200Response; +import com.sap.cloud.sdk.cloudplatform.connectivity.Destination; +import com.sap.cloud.sdk.services.openapi.apiclient.ApiClient; +import com.sap.cloud.sdk.services.openapi.core.AbstractOpenApiService; +import com.sap.cloud.sdk.services.openapi.core.OpenApiRequestException; +import com.sap.cloud.sdk.services.openapi.core.OpenApiResponse; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.util.UriComponentsBuilder; + +/** + * Document Grounding Pipeline API in version 0.1.0. + * + *

SAP AI Core - API Specification AI Data Management api's + */ +@Beta +public class VectorApi extends AbstractOpenApiService { + /** + * Instantiates this API class to invoke operations on the Document Grounding Pipeline API. + * + * @param httpDestination The destination that API should be used with + */ + public VectorApi(@Nonnull final Destination httpDestination) { + super(httpDestination); + } + + /** + * Instantiates this API class to invoke operations on the Document Grounding Pipeline API based + * on a given {@link ApiClient}. + * + * @param apiClient ApiClient to invoke the API on + */ + @Beta + public VectorApi(@Nonnull final ApiClient apiClient) { + super(apiClient); + } + + /** + * Create collection + * + *

Creates a collection. This operation is asynchronous. Poll the collection resource and check + * the status field to understand creation status. + * + *

202 - Successful Response + * + *

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

422 - There are validation issues with the data. + * + * @param aiResourceGroup The value for the parameter aiResourceGroup + * @param collectionRequest The value for the parameter collectionRequest + * @return An OpenApiResponse containing the status code of the HttpResponse. + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public OpenApiResponse createCollection( + @Nonnull final String aiResourceGroup, @Nonnull final CollectionRequest collectionRequest) + throws OpenApiRequestException { + final Object localVarPostBody = collectionRequest; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling createCollection"); + } + + // verify the required parameter 'collectionRequest' is set + if (collectionRequest == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'collectionRequest' when calling vectorV1VectorEndpointsCreateCollection"); + } + + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/collections").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() {}; + apiClient.invokeAPI( + localVarPath, + HttpMethod.POST, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + return new OpenApiResponse(apiClient); + } + + /** + * Create documents in collection + * + *

Create and stores one or multiple documents into a collection. If omitted, 'id' will + * be auto-generated. + * + *

201 - 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 The value for the parameter aiResourceGroup + * @param collectionId The value for the parameter collectionId + * @param documentCreateRequest The value for the parameter documentCreateRequest + * @return DocumentsListResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public DocumentsListResponse createDocuments( + @Nonnull final String aiResourceGroup, + @Nonnull final UUID collectionId, + @Nonnull final DocumentCreateRequest documentCreateRequest) + throws OpenApiRequestException { + final Object localVarPostBody = documentCreateRequest; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling createDocuments"); + } + + // verify the required parameter 'collectionId' is set + if (collectionId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'collectionId' when calling createDocuments"); + } + + // verify the required parameter 'documentCreateRequest' is set + if (documentCreateRequest == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'documentCreateRequest' when calling vectorV1VectorEndpointsCreateDocuments"); + } + + // create path and map variables + final Map localVarPathParams = new HashMap(); + localVarPathParams.put("collectionId", collectionId); + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/collections/{collectionId}/documents") + .buildAndExpand(localVarPathParams) + .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.POST, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Delete collection by ID + * + *

Deletes a specific collection by ID. This operation is asynchronous. Poll the collection for + * a 404 status code. + * + *

202 - 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 The value for the parameter aiResourceGroup + * @param collectionId The value for the parameter collectionId + * @return An OpenApiResponse containing the status code of the HttpResponse. + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public OpenApiResponse deleteCollectionById( + @Nonnull final String aiResourceGroup, @Nonnull final String collectionId) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling deleteCollectionById"); + } + + // verify the required parameter 'collectionId' is set + if (collectionId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'collectionId' when calling deleteCollectionById"); + } + + // create path and map variables + final Map localVarPathParams = new HashMap(); + localVarPathParams.put("collectionId", collectionId); + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/collections/{collectionId}") + .buildAndExpand(localVarPathParams) + .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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + apiClient.invokeAPI( + localVarPath, + HttpMethod.DELETE, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + return new OpenApiResponse(apiClient); + } + + /** + * Delete a document + * + *

Deletes a specific document of a collection. + * + *

204 - 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 The value for the parameter aiResourceGroup + * @param collectionId The value for the parameter collectionId + * @param documentId The value for the parameter documentId + * @return An OpenApiResponse containing the status code of the HttpResponse. + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public OpenApiResponse deleteDocumentById( + @Nonnull final String aiResourceGroup, + @Nonnull final UUID collectionId, + @Nonnull final UUID documentId) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling deleteDocumentById"); + } + + // verify the required parameter 'collectionId' is set + if (collectionId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'collectionId' when calling deleteDocumentById"); + } + + // verify the required parameter 'documentId' is set + if (documentId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'documentId' when calling deleteDocumentById"); + } + + // create path and map variables + final Map localVarPathParams = new HashMap(); + localVarPathParams.put("collectionId", collectionId); + localVarPathParams.put("documentId", documentId); + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/collections/{collectionId}/documents/{documentId}") + .buildAndExpand(localVarPathParams) + .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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + apiClient.invokeAPI( + localVarPath, + HttpMethod.DELETE, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + return new OpenApiResponse(apiClient); + } + + /** + * Get collections + * + *

Gets a list of collections. + * + *

200 - Successful Response + * + *

400 - The specification of the resource was incorrect + * + * @param aiResourceGroup (required) The value for the parameter aiResourceGroup + * @param $top (optional) Number of results to display + * @param $skip (optional) Number of results to be skipped from the ordered list of results + * @param $count (optional) When the $count field is set to false, the response contains a count + * of the items present in the response. When the $count field is set to true, the response + * contains a count of all the items present on the server, and not just the ones in the + * response. When the $count field is not passed, it is false by default. + * @return CollectionsListResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public CollectionsListResponse getAllCollections( + @Nonnull final String aiResourceGroup, + @Nullable final Integer $top, + @Nullable final Integer $skip, + @Nullable final Boolean $count) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling getAllCollections"); + } + + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/collections").build().toUriString(); + + final MultiValueMap localVarQueryParams = + new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarFormParams = + new LinkedMultiValueMap(); + + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "$top", $top)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "$skip", $skip)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "$count", $count)); + + 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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.GET, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Get collections + * + *

Gets a list of collections. + * + *

200 - Successful Response + * + *

400 - The specification of the resource was incorrect + * + * @param aiResourceGroup The value for the parameter aiResourceGroup + * @return CollectionsListResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public CollectionsListResponse getAllCollections(@Nonnull final String aiResourceGroup) + throws OpenApiRequestException { + return getAllCollections(aiResourceGroup, null, null, null); + } + + /** + * Get documents + * + *

Gets a list of documents of a collection. + * + *

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 (required) The value for the parameter aiResourceGroup + * @param collectionId (required) The value for the parameter collectionId + * @param $top (optional) Number of results to display + * @param $skip (optional) Number of results to be skipped from the ordered list of results + * @param $count (optional) When the $count field is set to false, the response contains a count + * of the items present in the response. When the $count field is set to true, the response + * contains a count of all the items present on the server, and not just the ones in the + * response. When the $count field is not passed, it is false by default. + * @return Documents + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Documents getAllDocuments( + @Nonnull final String aiResourceGroup, + @Nonnull final UUID collectionId, + @Nullable final Integer $top, + @Nullable final Integer $skip, + @Nullable final Boolean $count) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling getAllDocuments"); + } + + // verify the required parameter 'collectionId' is set + if (collectionId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'collectionId' when calling getAllDocuments"); + } + + // create path and map variables + final Map localVarPathParams = new HashMap(); + localVarPathParams.put("collectionId", collectionId); + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/collections/{collectionId}/documents") + .buildAndExpand(localVarPathParams) + .toUriString(); + + final MultiValueMap localVarQueryParams = + new LinkedMultiValueMap(); + final HttpHeaders localVarHeaderParams = new HttpHeaders(); + final MultiValueMap localVarFormParams = + new LinkedMultiValueMap(); + + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "$top", $top)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "$skip", $skip)); + localVarQueryParams.putAll(apiClient.parameterToMultiValueMap(null, "$count", $count)); + + 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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.GET, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Get documents + * + *

Gets a list of documents of a collection. + * + *

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 The value for the parameter aiResourceGroup + * @param collectionId The value for the parameter collectionId + * @return Documents + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Documents getAllDocuments( + @Nonnull final String aiResourceGroup, @Nonnull final UUID collectionId) + throws OpenApiRequestException { + return getAllDocuments(aiResourceGroup, collectionId, null, null, null); + } + + /** + * Get collection by ID + * + *

Gets a specific collection by ID. + * + *

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 The value for the parameter aiResourceGroup + * @param collectionId The value for the parameter collectionId + * @return Collection + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public Collection getCollectionById( + @Nonnull final String aiResourceGroup, @Nonnull final UUID collectionId) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling getCollectionById"); + } + + // verify the required parameter 'collectionId' is set + if (collectionId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'collectionId' when calling getCollectionById"); + } + + // create path and map variables + final Map localVarPathParams = new HashMap(); + localVarPathParams.put("collectionId", collectionId); + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/collections/{collectionId}") + .buildAndExpand(localVarPathParams) + .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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.GET, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Get collection status by ID + * + *

Gets a specific collection status from monitor by ID. + * + *

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 The value for the parameter aiResourceGroup + * @param id The value for the parameter id + * @return VectorV1VectorEndpointsGetCollectionCreationStatus200Response + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public VectorV1VectorEndpointsGetCollectionCreationStatus200Response getCollectionCreationStatus( + @Nonnull final String aiResourceGroup, @Nonnull final UUID id) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling getCollectionCreationStatus"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'id' when calling getCollectionCreationStatus"); + } + + // create path and map variables + final Map localVarPathParams = new HashMap(); + localVarPathParams.put("id", id); + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/collections/{id}/creationStatus") + .buildAndExpand(localVarPathParams) + .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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference + localVarReturnType = + new ParameterizedTypeReference< + VectorV1VectorEndpointsGetCollectionCreationStatus200Response>() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.GET, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Get collection status by ID + * + *

Gets a specific collection status from monitor by ID. + * + *

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 The value for the parameter aiResourceGroup + * @param id The value for the parameter id + * @return VectorV1VectorEndpointsGetCollectionDeletionStatus200Response + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public VectorV1VectorEndpointsGetCollectionDeletionStatus200Response getCollectionDeletionStatus( + @Nonnull final String aiResourceGroup, @Nonnull final UUID id) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling getCollectionDeletionStatus"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'id' when calling getCollectionDeletionStatus"); + } + + // create path and map variables + final Map localVarPathParams = new HashMap(); + localVarPathParams.put("id", id); + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/collections/{id}/deletionStatus") + .buildAndExpand(localVarPathParams) + .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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference + localVarReturnType = + new ParameterizedTypeReference< + VectorV1VectorEndpointsGetCollectionDeletionStatus200Response>() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.GET, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Get document by ID + * + *

Gets a specific document in a collection by ID. + * + *

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 The value for the parameter aiResourceGroup + * @param collectionId The value for the parameter collectionId + * @param documentId The value for the parameter documentId + * @return DocumentResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public DocumentResponse getDocumentById( + @Nonnull final String aiResourceGroup, + @Nonnull final UUID collectionId, + @Nonnull final UUID documentId) + throws OpenApiRequestException { + final Object localVarPostBody = null; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling getDocumentById"); + } + + // verify the required parameter 'collectionId' is set + if (collectionId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'collectionId' when calling getDocumentById"); + } + + // verify the required parameter 'documentId' is set + if (documentId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'documentId' when calling getDocumentById"); + } + + // create path and map variables + final Map localVarPathParams = new HashMap(); + localVarPathParams.put("collectionId", collectionId); + localVarPathParams.put("documentId", documentId); + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/collections/{collectionId}/documents/{documentId}") + .buildAndExpand(localVarPathParams) + .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 = {}; + final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + final String[] localVarAuthNames = new String[] {}; + + final ParameterizedTypeReference localVarReturnType = + new ParameterizedTypeReference() {}; + return apiClient.invokeAPI( + localVarPath, + HttpMethod.GET, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Search chunk by vector + * + *

Search chunk by vector + * + *

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 The value for the parameter aiResourceGroup + * @param textSearchRequest The value for the parameter textSearchRequest + * @return SearchResults + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public SearchResults search( + @Nonnull final String aiResourceGroup, @Nonnull final TextSearchRequest textSearchRequest) + throws OpenApiRequestException { + final Object localVarPostBody = textSearchRequest; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling search"); + } + + // verify the required parameter 'textSearchRequest' is set + if (textSearchRequest == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'textSearchRequest' when calling vectorV1VectorEndpointsSearch"); + } + + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/search").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.POST, + localVarQueryParams, + localVarPostBody, + localVarHeaderParams, + localVarFormParams, + localVarAccept, + localVarContentType, + localVarAuthNames, + localVarReturnType); + } + + /** + * Upsert documents in collection + * + *

Upserts the data of multiple documents into a collection. + * + *

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 The value for the parameter aiResourceGroup + * @param collectionId The value for the parameter collectionId + * @param documentUpdateRequest The value for the parameter documentUpdateRequest + * @return DocumentsListResponse + * @throws OpenApiRequestException if an error occurs while attempting to invoke the API + */ + @Nonnull + public DocumentsListResponse updateDocuments( + @Nonnull final String aiResourceGroup, + @Nonnull final UUID collectionId, + @Nonnull final DocumentUpdateRequest documentUpdateRequest) + throws OpenApiRequestException { + final Object localVarPostBody = documentUpdateRequest; + + // verify the required parameter 'aiResourceGroup' is set + if (aiResourceGroup == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'aiResourceGroup' when calling updateDocuments"); + } + + // verify the required parameter 'collectionId' is set + if (collectionId == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'collectionId' when calling updateDocuments"); + } + + // verify the required parameter 'documentUpdateRequest' is set + if (documentUpdateRequest == null) { + throw new OpenApiRequestException( + "Missing the required parameter 'documentUpdateRequest' when calling vectorV1VectorEndpointsUpdateDocuments"); + } + + // create path and map variables + final Map localVarPathParams = new HashMap(); + localVarPathParams.put("collectionId", collectionId); + final String localVarPath = + UriComponentsBuilder.fromPath("/vector/collections/{collectionId}/documents") + .buildAndExpand(localVarPathParams) + .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/grounding/src/main/java/com/sap/ai/sdk/grounding/model/ApiError.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/ApiError.java new file mode 100644 index 000000000..27df4b095 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/ApiError.java @@ -0,0 +1,361 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** ApiError */ +@Beta // CHECKSTYLE:OFF +public class ApiError +// CHECKSTYLE:ON +{ + @JsonProperty("code") + private String code; + + @JsonProperty("message") + private String message; + + @JsonProperty("requestId") + private String requestId; + + @JsonProperty("target") + private String target; + + @JsonProperty("details") + private List details = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ApiError. */ + protected ApiError() {} + + /** + * Set the code of this {@link ApiError} instance and return the same instance. + * + * @param code Descriptive error code (not http status code). + * @return The same instance of this {@link ApiError} class + */ + @Nonnull + public ApiError code(@Nonnull final String code) { + this.code = code; + return this; + } + + /** + * Descriptive error code (not http status code). + * + * @return code The code of this {@link ApiError} instance. + */ + @Nonnull + public String getCode() { + return code; + } + + /** + * Set the code of this {@link ApiError} instance. + * + * @param code Descriptive error code (not http status code). + */ + public void setCode(@Nonnull final String code) { + this.code = code; + } + + /** + * Set the message of this {@link ApiError} instance and return the same instance. + * + * @param message plaintext error description + * @return The same instance of this {@link ApiError} class + */ + @Nonnull + public ApiError message(@Nonnull final String message) { + this.message = message; + return this; + } + + /** + * plaintext error description + * + * @return message The message of this {@link ApiError} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link ApiError} instance. + * + * @param message plaintext error description + */ + public void setMessage(@Nonnull final String message) { + this.message = message; + } + + /** + * Set the requestId of this {@link ApiError} instance and return the same instance. + * + * @param requestId id of individual request + * @return The same instance of this {@link ApiError} class + */ + @Nonnull + public ApiError requestId(@Nullable final String requestId) { + this.requestId = requestId; + return this; + } + + /** + * id of individual request + * + * @return requestId The requestId of this {@link ApiError} instance. + */ + @Nonnull + public String getRequestId() { + return requestId; + } + + /** + * Set the requestId of this {@link ApiError} instance. + * + * @param requestId id of individual request + */ + public void setRequestId(@Nullable final String requestId) { + this.requestId = requestId; + } + + /** + * Set the target of this {@link ApiError} instance and return the same instance. + * + * @param target url that has been called + * @return The same instance of this {@link ApiError} class + */ + @Nonnull + public ApiError target(@Nullable final String target) { + this.target = target; + return this; + } + + /** + * url that has been called + * + * @return target The target of this {@link ApiError} instance. + */ + @Nonnull + public String getTarget() { + return target; + } + + /** + * Set the target of this {@link ApiError} instance. + * + * @param target url that has been called + */ + public void setTarget(@Nullable final String target) { + this.target = target; + } + + /** + * Set the details of this {@link ApiError} instance and return the same instance. + * + * @param details The details of this {@link ApiError} + * @return The same instance of this {@link ApiError} class + */ + @Nonnull + public ApiError details(@Nullable final List details) { + this.details = details; + return this; + } + + /** + * Add one details instance to this {@link ApiError}. + * + * @param detailsItem The details that should be added + * @return The same instance of type {@link ApiError} + */ + @Nonnull + public ApiError addDetailsItem(@Nonnull final DetailsErrorResponse detailsItem) { + if (this.details == null) { + this.details = new ArrayList<>(); + } + this.details.add(detailsItem); + return this; + } + + /** + * Get details + * + * @return details The details of this {@link ApiError} instance. + */ + @Nonnull + public List getDetails() { + return details; + } + + /** + * Set the details of this {@link ApiError} instance. + * + * @param details The details of this {@link ApiError} + */ + public void setDetails(@Nullable final List details) { + this.details = details; + } + + /** + * Get the names of the unrecognizable properties of the {@link ApiError}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ApiError} 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("ApiError has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ApiError} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (code != null) declaredFields.put("code", code); + if (message != null) declaredFields.put("message", message); + if (requestId != null) declaredFields.put("requestId", requestId); + if (target != null) declaredFields.put("target", target); + if (details != null) declaredFields.put("details", details); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ApiError} 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 ApiError apiError = (ApiError) o; + return Objects.equals(this.cloudSdkCustomFields, apiError.cloudSdkCustomFields) + && Objects.equals(this.code, apiError.code) + && Objects.equals(this.message, apiError.message) + && Objects.equals(this.requestId, apiError.requestId) + && Objects.equals(this.target, apiError.target) + && Objects.equals(this.details, apiError.details); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, requestId, target, details, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ApiError {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" requestId: ").append(toIndentedString(requestId)).append("\n"); + sb.append(" target: ").append(toIndentedString(target)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).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 ApiError} instance with + * all required arguments. + */ + public static Builder create() { + return (code) -> (message) -> new ApiError().code(code).message(message); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the code of this {@link ApiError} instance. + * + * @param code Descriptive error code (not http status code). + * @return The ApiError builder. + */ + Builder1 code(@Nonnull final String code); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the message of this {@link ApiError} instance. + * + * @param message plaintext error description + * @return The ApiError instance. + */ + ApiError message(@Nonnull final String message); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/BaseDocument.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/BaseDocument.java new file mode 100644 index 000000000..de9051dba --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/BaseDocument.java @@ -0,0 +1,286 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** Base class for documents, document requests and responses. */ +@Beta // CHECKSTYLE:OFF +public class BaseDocument +// CHECKSTYLE:ON +{ + @JsonProperty("chunks") + private List chunks = new ArrayList<>(); + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for BaseDocument. */ + protected BaseDocument() {} + + /** + * Set the chunks of this {@link BaseDocument} instance and return the same instance. + * + * @param chunks The chunks of this {@link BaseDocument} + * @return The same instance of this {@link BaseDocument} class + */ + @Nonnull + public BaseDocument chunks(@Nonnull final List chunks) { + this.chunks = chunks; + return this; + } + + /** + * Add one chunks instance to this {@link BaseDocument}. + * + * @param chunksItem The chunks that should be added + * @return The same instance of type {@link BaseDocument} + */ + @Nonnull + public BaseDocument addChunksItem(@Nonnull final TextOnlyBaseChunk chunksItem) { + if (this.chunks == null) { + this.chunks = new ArrayList<>(); + } + this.chunks.add(chunksItem); + return this; + } + + /** + * Get chunks + * + * @return chunks The chunks of this {@link BaseDocument} instance. + */ + @Nonnull + public List getChunks() { + return chunks; + } + + /** + * Set the chunks of this {@link BaseDocument} instance. + * + * @param chunks The chunks of this {@link BaseDocument} + */ + public void setChunks(@Nonnull final List chunks) { + this.chunks = chunks; + } + + /** + * Set the metadata of this {@link BaseDocument} instance and return the same instance. + * + * @param metadata The metadata of this {@link BaseDocument} + * @return The same instance of this {@link BaseDocument} class + */ + @Nonnull + public BaseDocument metadata(@Nonnull final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link BaseDocument}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link BaseDocument} + */ + @Nonnull + public BaseDocument addMetadataItem(@Nonnull final DocumentKeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link BaseDocument} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link BaseDocument} instance. + * + * @param metadata The metadata of this {@link BaseDocument} + */ + public void setMetadata(@Nonnull final List metadata) { + this.metadata = metadata; + } + + /** + * Get the names of the unrecognizable properties of the {@link BaseDocument}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link BaseDocument} 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("BaseDocument has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link BaseDocument} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (chunks != null) declaredFields.put("chunks", chunks); + if (metadata != null) declaredFields.put("metadata", metadata); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link BaseDocument} 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 BaseDocument baseDocument = (BaseDocument) o; + return Objects.equals(this.cloudSdkCustomFields, baseDocument.cloudSdkCustomFields) + && Objects.equals(this.chunks, baseDocument.chunks) + && Objects.equals(this.metadata, baseDocument.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(chunks, metadata, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class BaseDocument {\n"); + sb.append(" chunks: ").append(toIndentedString(chunks)).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 BaseDocument} instance + * with all required arguments. + */ + public static Builder create() { + return (chunks) -> (metadata) -> new BaseDocument().chunks(chunks).metadata(metadata); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the chunks of this {@link BaseDocument} instance. + * + * @param chunks The chunks of this {@link BaseDocument} + * @return The BaseDocument builder. + */ + Builder1 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 DocumentKeyValueListPair... metadata) { + return metadata(Arrays.asList(metadata)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Chunk.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Chunk.java new file mode 100644 index 000000000..5cc660335 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Chunk.java @@ -0,0 +1,287 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** Chunk */ +@Beta // CHECKSTYLE:OFF +public class Chunk +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + @JsonProperty("content") + private String content; + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for Chunk. */ + protected Chunk() {} + + /** + * Set the id of this {@link Chunk} instance and return the same instance. + * + * @param id The id of this {@link Chunk} + * @return The same instance of this {@link Chunk} class + */ + @Nonnull + public Chunk id(@Nonnull final String id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link Chunk} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link Chunk} instance. + * + * @param id The id of this {@link Chunk} + */ + public void setId(@Nonnull final String id) { + this.id = id; + } + + /** + * Set the content of this {@link Chunk} instance and return the same instance. + * + * @param content The content of this {@link Chunk} + * @return The same instance of this {@link Chunk} class + */ + @Nonnull + public Chunk content(@Nonnull final String content) { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link Chunk} instance. + */ + @Nonnull + public String getContent() { + return content; + } + + /** + * Set the content of this {@link Chunk} instance. + * + * @param content The content of this {@link Chunk} + */ + public void setContent(@Nonnull final String content) { + this.content = content; + } + + /** + * Set the metadata of this {@link Chunk} instance and return the same instance. + * + * @param metadata The metadata of this {@link Chunk} + * @return The same instance of this {@link Chunk} class + */ + @Nonnull + public Chunk metadata(@Nullable final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link Chunk}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link Chunk} + */ + @Nonnull + public Chunk addMetadataItem(@Nonnull final KeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link Chunk} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link Chunk} instance. + * + * @param metadata The metadata of this {@link Chunk} + */ + public void setMetadata(@Nullable final List metadata) { + this.metadata = metadata; + } + + /** + * Get the names of the unrecognizable properties of the {@link Chunk}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Chunk} 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("Chunk has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Chunk} 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 (content != null) declaredFields.put("content", content); + if (metadata != null) declaredFields.put("metadata", metadata); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Chunk} 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 Chunk chunk = (Chunk) o; + return Objects.equals(this.cloudSdkCustomFields, chunk.cloudSdkCustomFields) + && Objects.equals(this.id, chunk.id) + && Objects.equals(this.content, chunk.content) + && Objects.equals(this.metadata, chunk.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(id, content, metadata, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Chunk {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\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 Chunk} instance with + * all required arguments. + */ + public static Builder create() { + return (id) -> (content) -> new Chunk().id(id).content(content); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link Chunk} instance. + * + * @param id The id of this {@link Chunk} + * @return The Chunk builder. + */ + Builder1 id(@Nonnull final String id); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the content of this {@link Chunk} instance. + * + * @param content The content of this {@link Chunk} + * @return The Chunk instance. + */ + Chunk content(@Nonnull final String content); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Collection.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Collection.java new file mode 100644 index 000000000..3641e1a01 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Collection.java @@ -0,0 +1,327 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** A logical grouping of content. */ +@Beta // CHECKSTYLE:OFF +public class Collection +// CHECKSTYLE:ON +{ + @JsonProperty("title") + private String title; + + @JsonProperty("embeddingConfig") + private EmbeddingConfig embeddingConfig; + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonProperty("id") + private UUID id; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for Collection. */ + protected Collection() {} + + /** + * Set the title of this {@link Collection} instance and return the same instance. + * + * @param title The title of this {@link Collection} + * @return The same instance of this {@link Collection} class + */ + @Nonnull + public Collection title(@Nullable final String title) { + this.title = title; + return this; + } + + /** + * Get title + * + * @return title The title of this {@link Collection} instance. + */ + @Nonnull + public String getTitle() { + return title; + } + + /** + * Set the title of this {@link Collection} instance. + * + * @param title The title of this {@link Collection} + */ + public void setTitle(@Nullable final String title) { + this.title = title; + } + + /** + * Set the embeddingConfig of this {@link Collection} instance and return the same instance. + * + * @param embeddingConfig The embeddingConfig of this {@link Collection} + * @return The same instance of this {@link Collection} class + */ + @Nonnull + public Collection embeddingConfig(@Nonnull final EmbeddingConfig embeddingConfig) { + this.embeddingConfig = embeddingConfig; + return this; + } + + /** + * Get embeddingConfig + * + * @return embeddingConfig The embeddingConfig of this {@link Collection} instance. + */ + @Nonnull + public EmbeddingConfig getEmbeddingConfig() { + return embeddingConfig; + } + + /** + * Set the embeddingConfig of this {@link Collection} instance. + * + * @param embeddingConfig The embeddingConfig of this {@link Collection} + */ + public void setEmbeddingConfig(@Nonnull final EmbeddingConfig embeddingConfig) { + this.embeddingConfig = embeddingConfig; + } + + /** + * Set the metadata of this {@link Collection} instance and return the same instance. + * + * @param metadata Metadata attached to collection. Useful to restrict search to a subset of + * collections. + * @return The same instance of this {@link Collection} class + */ + @Nonnull + public Collection metadata(@Nullable final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link Collection}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link Collection} + */ + @Nonnull + public Collection addMetadataItem(@Nonnull final KeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Metadata attached to collection. Useful to restrict search to a subset of collections. + * + * @return metadata The metadata of this {@link Collection} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link Collection} instance. + * + * @param metadata Metadata attached to collection. Useful to restrict search to a subset of + * collections. + */ + public void setMetadata(@Nullable final List metadata) { + this.metadata = metadata; + } + + /** + * Set the id of this {@link Collection} instance and return the same instance. + * + * @param id Unique identifier of a collection. + * @return The same instance of this {@link Collection} class + */ + @Nonnull + public Collection id(@Nonnull final UUID id) { + this.id = id; + return this; + } + + /** + * Unique identifier of a collection. + * + * @return id The id of this {@link Collection} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link Collection} instance. + * + * @param id Unique identifier of a collection. + */ + public void setId(@Nonnull final UUID id) { + this.id = id; + } + + /** + * Get the names of the unrecognizable properties of the {@link Collection}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Collection} 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("Collection has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Collection} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (title != null) declaredFields.put("title", title); + if (embeddingConfig != null) declaredFields.put("embeddingConfig", embeddingConfig); + if (metadata != null) declaredFields.put("metadata", metadata); + if (id != null) declaredFields.put("id", id); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Collection} 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 Collection collection = (Collection) o; + return Objects.equals(this.cloudSdkCustomFields, collection.cloudSdkCustomFields) + && Objects.equals(this.title, collection.title) + && Objects.equals(this.embeddingConfig, collection.embeddingConfig) + && Objects.equals(this.metadata, collection.metadata) + && Objects.equals(this.id, collection.id); + } + + @Override + public int hashCode() { + return Objects.hash(title, embeddingConfig, metadata, id, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Collection {\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" embeddingConfig: ").append(toIndentedString(embeddingConfig)).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")); + 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 Collection} instance + * with all required arguments. + */ + public static Builder create() { + return (embeddingConfig) -> (id) -> new Collection().embeddingConfig(embeddingConfig).id(id); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the embeddingConfig of this {@link Collection} instance. + * + * @param embeddingConfig The embeddingConfig of this {@link Collection} + * @return The Collection builder. + */ + Builder1 embeddingConfig(@Nonnull final EmbeddingConfig embeddingConfig); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the id of this {@link Collection} instance. + * + * @param id Unique identifier of a collection. + * @return The Collection instance. + */ + Collection id(@Nonnull final UUID id); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionCreatedResponse.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionCreatedResponse.java new file mode 100644 index 000000000..b5ef361c8 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionCreatedResponse.java @@ -0,0 +1,237 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** CollectionCreatedResponse */ +@Beta // CHECKSTYLE:OFF +public class CollectionCreatedResponse + implements VectorV1VectorEndpointsGetCollectionCreationStatus200Response +// CHECKSTYLE:ON +{ + @JsonProperty("collectionURL") + private String collectionURL; + + @JsonProperty("status") + private String status; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for CollectionCreatedResponse. */ + protected CollectionCreatedResponse() {} + + /** + * Set the collectionURL of this {@link CollectionCreatedResponse} instance and return the same + * instance. + * + * @param collectionURL The collectionURL of this {@link CollectionCreatedResponse} + * @return The same instance of this {@link CollectionCreatedResponse} class + */ + @Nonnull + public CollectionCreatedResponse collectionURL(@Nonnull final String collectionURL) { + this.collectionURL = collectionURL; + return this; + } + + /** + * Get collectionURL + * + * @return collectionURL The collectionURL of this {@link CollectionCreatedResponse} instance. + */ + @Nonnull + public String getCollectionURL() { + return collectionURL; + } + + /** + * Set the collectionURL of this {@link CollectionCreatedResponse} instance. + * + * @param collectionURL The collectionURL of this {@link CollectionCreatedResponse} + */ + public void setCollectionURL(@Nonnull final String collectionURL) { + this.collectionURL = collectionURL; + } + + /** + * Set the status of this {@link CollectionCreatedResponse} instance and return the same instance. + * + * @param status The status of this {@link CollectionCreatedResponse} + * @return The same instance of this {@link CollectionCreatedResponse} class + */ + @Nonnull + public CollectionCreatedResponse status(@Nonnull final String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status The status of this {@link CollectionCreatedResponse} instance. + */ + @Nonnull + public String getStatus() { + return status; + } + + /** + * Set the status of this {@link CollectionCreatedResponse} instance. + * + * @param status The status of this {@link CollectionCreatedResponse} + */ + public void setStatus(@Nonnull final String status) { + this.status = status; + } + + /** + * Get the names of the unrecognizable properties of the {@link CollectionCreatedResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link CollectionCreatedResponse} 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( + "CollectionCreatedResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link CollectionCreatedResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (collectionURL != null) declaredFields.put("collectionURL", collectionURL); + if (status != null) declaredFields.put("status", status); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link CollectionCreatedResponse} 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 CollectionCreatedResponse collectionCreatedResponse = (CollectionCreatedResponse) o; + return Objects.equals(this.cloudSdkCustomFields, collectionCreatedResponse.cloudSdkCustomFields) + && Objects.equals(this.collectionURL, collectionCreatedResponse.collectionURL) + && Objects.equals(this.status, collectionCreatedResponse.status); + } + + @Override + public int hashCode() { + return Objects.hash(collectionURL, status, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class CollectionCreatedResponse {\n"); + sb.append(" collectionURL: ").append(toIndentedString(collectionURL)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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 + * CollectionCreatedResponse} instance with all required arguments. + */ + public static Builder create() { + return (collectionURL) -> + (status) -> new CollectionCreatedResponse().collectionURL(collectionURL).status(status); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the collectionURL of this {@link CollectionCreatedResponse} instance. + * + * @param collectionURL The collectionURL of this {@link CollectionCreatedResponse} + * @return The CollectionCreatedResponse builder. + */ + Builder1 collectionURL(@Nonnull final String collectionURL); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the status of this {@link CollectionCreatedResponse} instance. + * + * @param status The status of this {@link CollectionCreatedResponse} + * @return The CollectionCreatedResponse instance. + */ + CollectionCreatedResponse status(@Nonnull final String status); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionDeletedResponse.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionDeletedResponse.java new file mode 100644 index 000000000..a9dbd1862 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionDeletedResponse.java @@ -0,0 +1,237 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** CollectionDeletedResponse */ +@Beta // CHECKSTYLE:OFF +public class CollectionDeletedResponse + implements VectorV1VectorEndpointsGetCollectionDeletionStatus200Response +// CHECKSTYLE:ON +{ + @JsonProperty("collectionURL") + private String collectionURL; + + @JsonProperty("status") + private String status; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for CollectionDeletedResponse. */ + protected CollectionDeletedResponse() {} + + /** + * Set the collectionURL of this {@link CollectionDeletedResponse} instance and return the same + * instance. + * + * @param collectionURL The collectionURL of this {@link CollectionDeletedResponse} + * @return The same instance of this {@link CollectionDeletedResponse} class + */ + @Nonnull + public CollectionDeletedResponse collectionURL(@Nonnull final String collectionURL) { + this.collectionURL = collectionURL; + return this; + } + + /** + * Get collectionURL + * + * @return collectionURL The collectionURL of this {@link CollectionDeletedResponse} instance. + */ + @Nonnull + public String getCollectionURL() { + return collectionURL; + } + + /** + * Set the collectionURL of this {@link CollectionDeletedResponse} instance. + * + * @param collectionURL The collectionURL of this {@link CollectionDeletedResponse} + */ + public void setCollectionURL(@Nonnull final String collectionURL) { + this.collectionURL = collectionURL; + } + + /** + * Set the status of this {@link CollectionDeletedResponse} instance and return the same instance. + * + * @param status The status of this {@link CollectionDeletedResponse} + * @return The same instance of this {@link CollectionDeletedResponse} class + */ + @Nonnull + public CollectionDeletedResponse status(@Nonnull final String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status The status of this {@link CollectionDeletedResponse} instance. + */ + @Nonnull + public String getStatus() { + return status; + } + + /** + * Set the status of this {@link CollectionDeletedResponse} instance. + * + * @param status The status of this {@link CollectionDeletedResponse} + */ + public void setStatus(@Nonnull final String status) { + this.status = status; + } + + /** + * Get the names of the unrecognizable properties of the {@link CollectionDeletedResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link CollectionDeletedResponse} 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( + "CollectionDeletedResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link CollectionDeletedResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (collectionURL != null) declaredFields.put("collectionURL", collectionURL); + if (status != null) declaredFields.put("status", status); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link CollectionDeletedResponse} 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 CollectionDeletedResponse collectionDeletedResponse = (CollectionDeletedResponse) o; + return Objects.equals(this.cloudSdkCustomFields, collectionDeletedResponse.cloudSdkCustomFields) + && Objects.equals(this.collectionURL, collectionDeletedResponse.collectionURL) + && Objects.equals(this.status, collectionDeletedResponse.status); + } + + @Override + public int hashCode() { + return Objects.hash(collectionURL, status, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class CollectionDeletedResponse {\n"); + sb.append(" collectionURL: ").append(toIndentedString(collectionURL)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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 + * CollectionDeletedResponse} instance with all required arguments. + */ + public static Builder create() { + return (collectionURL) -> + (status) -> new CollectionDeletedResponse().collectionURL(collectionURL).status(status); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the collectionURL of this {@link CollectionDeletedResponse} instance. + * + * @param collectionURL The collectionURL of this {@link CollectionDeletedResponse} + * @return The CollectionDeletedResponse builder. + */ + Builder1 collectionURL(@Nonnull final String collectionURL); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the status of this {@link CollectionDeletedResponse} instance. + * + * @param status The status of this {@link CollectionDeletedResponse} + * @return The CollectionDeletedResponse instance. + */ + CollectionDeletedResponse status(@Nonnull final String status); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionPendingResponse.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionPendingResponse.java new file mode 100644 index 000000000..bbfb25035 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionPendingResponse.java @@ -0,0 +1,239 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +import java.net.URI; +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; + +/** CollectionPendingResponse */ +@Beta // CHECKSTYLE:OFF +public class CollectionPendingResponse + implements VectorV1VectorEndpointsGetCollectionCreationStatus200Response, + VectorV1VectorEndpointsGetCollectionDeletionStatus200Response +// CHECKSTYLE:ON +{ + @JsonProperty("Location") + private URI location; + + @JsonProperty("status") + private String status; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for CollectionPendingResponse. */ + protected CollectionPendingResponse() {} + + /** + * Set the location 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 URI location) { + this.location = location; + return this; + } + + /** + * Get location + * + * @return location The location of this {@link CollectionPendingResponse} instance. + */ + @Nonnull + public URI getLocation() { + return location; + } + + /** + * Set the location of this {@link CollectionPendingResponse} instance. + * + * @param location The location of this {@link CollectionPendingResponse} + */ + public void setLocation(@Nonnull final URI 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} + * @return The same instance of this {@link CollectionPendingResponse} class + */ + @Nonnull + public CollectionPendingResponse status(@Nonnull final String status) { + this.status = status; + return this; + } + + /** + * Get status + * + * @return status The status of this {@link CollectionPendingResponse} instance. + */ + @Nonnull + public String getStatus() { + return status; + } + + /** + * Set the status of this {@link CollectionPendingResponse} instance. + * + * @param status The status of this {@link CollectionPendingResponse} + */ + public void setStatus(@Nonnull final String status) { + this.status = status; + } + + /** + * Get the names of the unrecognizable properties of the {@link CollectionPendingResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link CollectionPendingResponse} 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( + "CollectionPendingResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link CollectionPendingResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (location != null) declaredFields.put("location", location); + if (status != null) declaredFields.put("status", status); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link CollectionPendingResponse} 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 CollectionPendingResponse collectionPendingResponse = (CollectionPendingResponse) o; + return Objects.equals(this.cloudSdkCustomFields, collectionPendingResponse.cloudSdkCustomFields) + && Objects.equals(this.location, collectionPendingResponse.location) + && Objects.equals(this.status, collectionPendingResponse.status); + } + + @Override + public int hashCode() { + return Objects.hash(location, status, cloudSdkCustomFields); + } + + @Override + @Nonnull + 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"); + 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 + * CollectionPendingResponse} instance with all required arguments. + */ + public static Builder create() { + return (location) -> + (status) -> new CollectionPendingResponse().location(location).status(status); + } + + /** 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 URI location); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the status of this {@link CollectionPendingResponse} instance. + * + * @param status The status of this {@link CollectionPendingResponse} + * @return The CollectionPendingResponse instance. + */ + CollectionPendingResponse status(@Nonnull final String status); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionRequest.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionRequest.java new file mode 100644 index 000000000..2de143724 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionRequest.java @@ -0,0 +1,279 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** A request for creating a new, single collection. */ +@Beta // CHECKSTYLE:OFF +public class CollectionRequest +// CHECKSTYLE:ON +{ + @JsonProperty("title") + private String title; + + @JsonProperty("embeddingConfig") + private EmbeddingConfig embeddingConfig; + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for CollectionRequest. */ + protected CollectionRequest() {} + + /** + * Set the title of this {@link CollectionRequest} instance and return the same instance. + * + * @param title The title of this {@link CollectionRequest} + * @return The same instance of this {@link CollectionRequest} class + */ + @Nonnull + public CollectionRequest title(@Nullable final String title) { + this.title = title; + return this; + } + + /** + * Get title + * + * @return title The title of this {@link CollectionRequest} instance. + */ + @Nonnull + public String getTitle() { + return title; + } + + /** + * Set the title of this {@link CollectionRequest} instance. + * + * @param title The title of this {@link CollectionRequest} + */ + public void setTitle(@Nullable final String title) { + this.title = title; + } + + /** + * Set the embeddingConfig of this {@link CollectionRequest} instance and return the same + * instance. + * + * @param embeddingConfig The embeddingConfig of this {@link CollectionRequest} + * @return The same instance of this {@link CollectionRequest} class + */ + @Nonnull + public CollectionRequest embeddingConfig(@Nonnull final EmbeddingConfig embeddingConfig) { + this.embeddingConfig = embeddingConfig; + return this; + } + + /** + * Get embeddingConfig + * + * @return embeddingConfig The embeddingConfig of this {@link CollectionRequest} instance. + */ + @Nonnull + public EmbeddingConfig getEmbeddingConfig() { + return embeddingConfig; + } + + /** + * Set the embeddingConfig of this {@link CollectionRequest} instance. + * + * @param embeddingConfig The embeddingConfig of this {@link CollectionRequest} + */ + public void setEmbeddingConfig(@Nonnull final EmbeddingConfig embeddingConfig) { + this.embeddingConfig = embeddingConfig; + } + + /** + * Set the metadata of this {@link CollectionRequest} instance and return the same instance. + * + * @param metadata Metadata attached to collection. Useful to restrict search to a subset of + * collections. + * @return The same instance of this {@link CollectionRequest} class + */ + @Nonnull + public CollectionRequest metadata(@Nullable final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link CollectionRequest}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link CollectionRequest} + */ + @Nonnull + public CollectionRequest addMetadataItem(@Nonnull final KeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Metadata attached to collection. Useful to restrict search to a subset of collections. + * + * @return metadata The metadata of this {@link CollectionRequest} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link CollectionRequest} instance. + * + * @param metadata Metadata attached to collection. Useful to restrict search to a subset of + * collections. + */ + public void setMetadata(@Nullable final List metadata) { + this.metadata = metadata; + } + + /** + * Get the names of the unrecognizable properties of the {@link CollectionRequest}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link CollectionRequest} 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("CollectionRequest has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link CollectionRequest} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (title != null) declaredFields.put("title", title); + if (embeddingConfig != null) declaredFields.put("embeddingConfig", embeddingConfig); + if (metadata != null) declaredFields.put("metadata", metadata); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link CollectionRequest} 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 CollectionRequest collectionRequest = (CollectionRequest) o; + return Objects.equals(this.cloudSdkCustomFields, collectionRequest.cloudSdkCustomFields) + && Objects.equals(this.title, collectionRequest.title) + && Objects.equals(this.embeddingConfig, collectionRequest.embeddingConfig) + && Objects.equals(this.metadata, collectionRequest.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(title, embeddingConfig, metadata, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class CollectionRequest {\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" embeddingConfig: ").append(toIndentedString(embeddingConfig)).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 CollectionRequest} + * instance with all required arguments. + */ + public static Builder create() { + return (embeddingConfig) -> new CollectionRequest().embeddingConfig(embeddingConfig); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the embeddingConfig of this {@link CollectionRequest} instance. + * + * @param embeddingConfig The embeddingConfig of this {@link CollectionRequest} + * @return The CollectionRequest instance. + */ + CollectionRequest embeddingConfig(@Nonnull final EmbeddingConfig embeddingConfig); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionsListResponse.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionsListResponse.java new file mode 100644 index 000000000..d5d263962 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/CollectionsListResponse.java @@ -0,0 +1,252 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** A response containing collections retrieved from the server. */ +@Beta // CHECKSTYLE:OFF +public class CollectionsListResponse +// CHECKSTYLE:ON +{ + @JsonProperty("resources") + private List resources = new ArrayList<>(); + + @JsonProperty("count") + private Integer count; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for CollectionsListResponse. */ + protected CollectionsListResponse() {} + + /** + * Set the resources of this {@link CollectionsListResponse} instance and return the same + * instance. + * + * @param resources The resources of this {@link CollectionsListResponse} + * @return The same instance of this {@link CollectionsListResponse} class + */ + @Nonnull + public CollectionsListResponse resources(@Nonnull final List resources) { + this.resources = resources; + return this; + } + + /** + * Add one resources instance to this {@link CollectionsListResponse}. + * + * @param resourcesItem The resources that should be added + * @return The same instance of type {@link CollectionsListResponse} + */ + @Nonnull + public CollectionsListResponse addResourcesItem(@Nonnull final Collection resourcesItem) { + if (this.resources == null) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; + } + + /** + * Get resources + * + * @return resources The resources of this {@link CollectionsListResponse} instance. + */ + @Nonnull + public List getResources() { + return resources; + } + + /** + * Set the resources of this {@link CollectionsListResponse} instance. + * + * @param resources The resources of this {@link CollectionsListResponse} + */ + public void setResources(@Nonnull final List resources) { + this.resources = resources; + } + + /** + * Set the count of this {@link CollectionsListResponse} instance and return the same instance. + * + * @param count The count of this {@link CollectionsListResponse} + * @return The same instance of this {@link CollectionsListResponse} class + */ + @Nonnull + public CollectionsListResponse count(@Nullable final Integer count) { + this.count = count; + return this; + } + + /** + * Get count + * + * @return count The count of this {@link CollectionsListResponse} instance. + */ + @Nonnull + public Integer getCount() { + return count; + } + + /** + * Set the count of this {@link CollectionsListResponse} instance. + * + * @param count The count of this {@link CollectionsListResponse} + */ + public void setCount(@Nullable final Integer count) { + this.count = count; + } + + /** + * Get the names of the unrecognizable properties of the {@link CollectionsListResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link CollectionsListResponse} 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( + "CollectionsListResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link CollectionsListResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (resources != null) declaredFields.put("resources", resources); + if (count != null) declaredFields.put("count", count); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link CollectionsListResponse} 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 CollectionsListResponse collectionsListResponse = (CollectionsListResponse) o; + return Objects.equals(this.cloudSdkCustomFields, collectionsListResponse.cloudSdkCustomFields) + && Objects.equals(this.resources, collectionsListResponse.resources) + && Objects.equals(this.count, collectionsListResponse.count); + } + + @Override + public int hashCode() { + return Objects.hash(resources, count, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class CollectionsListResponse {\n"); + sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).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 + * CollectionsListResponse} instance with all required arguments. + */ + public static Builder create() { + return (resources) -> new CollectionsListResponse().resources(resources); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the resources of this {@link CollectionsListResponse} instance. + * + * @param resources The resources of this {@link CollectionsListResponse} + * @return The CollectionsListResponse instance. + */ + CollectionsListResponse resources(@Nonnull final List resources); + + /** + * Set the resources of this {@link CollectionsListResponse} instance. + * + * @param resources The resources of this {@link CollectionsListResponse} + * @return The CollectionsListResponse instance. + */ + default CollectionsListResponse resources(@Nonnull final Collection... resources) { + return resources(Arrays.asList(resources)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositories.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositories.java new file mode 100644 index 000000000..4191562c5 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositories.java @@ -0,0 +1,250 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** DataRepositories */ +@Beta // CHECKSTYLE:OFF +public class DataRepositories +// CHECKSTYLE:ON +{ + @JsonProperty("resources") + private List resources = new ArrayList<>(); + + @JsonProperty("count") + private Integer count; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DataRepositories. */ + protected DataRepositories() {} + + /** + * Set the resources of this {@link DataRepositories} instance and return the same instance. + * + * @param resources The resources of this {@link DataRepositories} + * @return The same instance of this {@link DataRepositories} class + */ + @Nonnull + public DataRepositories resources(@Nonnull final List resources) { + this.resources = resources; + return this; + } + + /** + * Add one resources instance to this {@link DataRepositories}. + * + * @param resourcesItem The resources that should be added + * @return The same instance of type {@link DataRepositories} + */ + @Nonnull + public DataRepositories addResourcesItem(@Nonnull final DataRepository resourcesItem) { + if (this.resources == null) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; + } + + /** + * Get resources + * + * @return resources The resources of this {@link DataRepositories} instance. + */ + @Nonnull + public List getResources() { + return resources; + } + + /** + * Set the resources of this {@link DataRepositories} instance. + * + * @param resources The resources of this {@link DataRepositories} + */ + public void setResources(@Nonnull final List resources) { + this.resources = resources; + } + + /** + * Set the count of this {@link DataRepositories} instance and return the same instance. + * + * @param count The count of this {@link DataRepositories} + * @return The same instance of this {@link DataRepositories} class + */ + @Nonnull + public DataRepositories count(@Nullable final Integer count) { + this.count = count; + return this; + } + + /** + * Get count + * + * @return count The count of this {@link DataRepositories} instance. + */ + @Nonnull + public Integer getCount() { + return count; + } + + /** + * Set the count of this {@link DataRepositories} instance. + * + * @param count The count of this {@link DataRepositories} + */ + public void setCount(@Nullable final Integer count) { + this.count = count; + } + + /** + * Get the names of the unrecognizable properties of the {@link DataRepositories}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DataRepositories} 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("DataRepositories has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DataRepositories} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (resources != null) declaredFields.put("resources", resources); + if (count != null) declaredFields.put("count", count); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DataRepositories} 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 DataRepositories dataRepositories = (DataRepositories) o; + return Objects.equals(this.cloudSdkCustomFields, dataRepositories.cloudSdkCustomFields) + && Objects.equals(this.resources, dataRepositories.resources) + && Objects.equals(this.count, dataRepositories.count); + } + + @Override + public int hashCode() { + return Objects.hash(resources, count, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DataRepositories {\n"); + sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).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 DataRepositories} + * instance with all required arguments. + */ + public static Builder create() { + return (resources) -> new DataRepositories().resources(resources); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the resources of this {@link DataRepositories} instance. + * + * @param resources The resources of this {@link DataRepositories} + * @return The DataRepositories instance. + */ + DataRepositories resources(@Nonnull final List resources); + + /** + * Set the resources of this {@link DataRepositories} instance. + * + * @param resources The resources of this {@link DataRepositories} + * @return The DataRepositories instance. + */ + default DataRepositories resources(@Nonnull final DataRepository... resources) { + return resources(Arrays.asList(resources)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepository.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepository.java new file mode 100644 index 000000000..7bd332148 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepository.java @@ -0,0 +1,339 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** DataRepository schema expected by Retrieval. */ +@Beta // CHECKSTYLE:OFF +public class DataRepository +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private UUID id; + + @JsonProperty("title") + private String title; + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonProperty("type") + private DataRepositoryType type; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DataRepository. */ + protected DataRepository() {} + + /** + * Set the id of this {@link DataRepository} instance and return the same instance. + * + * @param id Unique identifier of this DataRepository. + * @return The same instance of this {@link DataRepository} class + */ + @Nonnull + public DataRepository id(@Nonnull final UUID id) { + this.id = id; + return this; + } + + /** + * Unique identifier of this DataRepository. + * + * @return id The id of this {@link DataRepository} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link DataRepository} instance. + * + * @param id Unique identifier of this DataRepository. + */ + public void setId(@Nonnull final UUID id) { + this.id = id; + } + + /** + * Set the title of this {@link DataRepository} instance and return the same instance. + * + * @param title The title of this {@link DataRepository} + * @return The same instance of this {@link DataRepository} class + */ + @Nonnull + public DataRepository title(@Nonnull final String title) { + this.title = title; + return this; + } + + /** + * Get title + * + * @return title The title of this {@link DataRepository} instance. + */ + @Nonnull + public String getTitle() { + return title; + } + + /** + * Set the title of this {@link DataRepository} instance. + * + * @param title The title of this {@link DataRepository} + */ + public void setTitle(@Nonnull final String title) { + this.title = title; + } + + /** + * Set the metadata of this {@link DataRepository} instance and return the same instance. + * + * @param metadata Metadata attached to DataRepository. Useful to later limit search to a subset + * of DataRepositories. + * @return The same instance of this {@link DataRepository} class + */ + @Nonnull + public DataRepository metadata(@Nullable final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link DataRepository}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link DataRepository} + */ + @Nonnull + public DataRepository addMetadataItem(@Nonnull final KeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Metadata attached to DataRepository. Useful to later limit search to a subset of + * DataRepositories. + * + * @return metadata The metadata of this {@link DataRepository} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link DataRepository} instance. + * + * @param metadata Metadata attached to DataRepository. Useful to later limit search to a subset + * of DataRepositories. + */ + public void setMetadata(@Nullable final List metadata) { + this.metadata = metadata; + } + + /** + * Set the type of this {@link DataRepository} instance and return the same instance. + * + * @param type The type of this {@link DataRepository} + * @return The same instance of this {@link DataRepository} class + */ + @Nonnull + public DataRepository type(@Nullable final DataRepositoryType type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link DataRepository} instance. + */ + @Nullable + public DataRepositoryType getType() { + return type; + } + + /** + * Set the type of this {@link DataRepository} instance. + * + * @param type The type of this {@link DataRepository} + */ + public void setType(@Nullable final DataRepositoryType type) { + this.type = type; + } + + /** + * Get the names of the unrecognizable properties of the {@link DataRepository}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DataRepository} 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("DataRepository has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DataRepository} 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 (title != null) declaredFields.put("title", title); + if (metadata != null) declaredFields.put("metadata", metadata); + if (type != null) declaredFields.put("type", type); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DataRepository} 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 DataRepository dataRepository = (DataRepository) o; + return Objects.equals(this.cloudSdkCustomFields, dataRepository.cloudSdkCustomFields) + && Objects.equals(this.id, dataRepository.id) + && Objects.equals(this.title, dataRepository.title) + && Objects.equals(this.metadata, dataRepository.metadata) + && Objects.equals(this.type, dataRepository.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, title, metadata, type, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DataRepository {\n"); + 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(" 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 type-safe, fluent-api builder object to construct a new {@link DataRepository} + * instance with all required arguments. + */ + public static Builder create() { + return (id) -> (title) -> (type) -> new DataRepository().id(id).title(title).type(type); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link DataRepository} instance. + * + * @param id Unique identifier of this DataRepository. + * @return The DataRepository builder. + */ + Builder1 id(@Nonnull final UUID id); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the title of this {@link DataRepository} instance. + * + * @param title The title of this {@link DataRepository} + * @return The DataRepository builder. + */ + Builder2 title(@Nonnull final String title); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the type of this {@link DataRepository} instance. + * + * @param type The type of this {@link DataRepository} + * @return The DataRepository instance. + */ + DataRepository type(@Nullable final DataRepositoryType type); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryType.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryType.java new file mode 100644 index 000000000..0d7d8fff9 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryType.java @@ -0,0 +1,62 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 DataRepositoryType */ +public enum DataRepositoryType { + VECTOR("vector"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + DataRepositoryType(String value) { + this.value = value; + } + + /** + * @return The enum value. + */ + @JsonValue + public String getValue() { + return value; + } + + /** + * @return The String representation of the enum value. + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Converts the given value to its enum representation. + * + * @param value The input value. + * @return The enum representation of the given value. + */ + @JsonCreator + public static DataRepositoryType fromValue(@Nonnull final String value) { + for (final DataRepositoryType b : DataRepositoryType.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryWithDocuments.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryWithDocuments.java new file mode 100644 index 000000000..f0e31ef6c --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DataRepositoryWithDocuments.java @@ -0,0 +1,375 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** DataRepository schema returned by the Vector search endpoint */ +@Beta // CHECKSTYLE:OFF +public class DataRepositoryWithDocuments +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private UUID id; + + @JsonProperty("title") + private String title; + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonProperty("documents") + private List documents = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DataRepositoryWithDocuments. */ + protected DataRepositoryWithDocuments() {} + + /** + * Set the id of this {@link DataRepositoryWithDocuments} instance and return the same instance. + * + * @param id Unique identifier of this DataRepository. + * @return The same instance of this {@link DataRepositoryWithDocuments} class + */ + @Nonnull + public DataRepositoryWithDocuments id(@Nonnull final UUID id) { + this.id = id; + return this; + } + + /** + * Unique identifier of this DataRepository. + * + * @return id The id of this {@link DataRepositoryWithDocuments} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link DataRepositoryWithDocuments} instance. + * + * @param id Unique identifier of this DataRepository. + */ + public void setId(@Nonnull final UUID id) { + this.id = id; + } + + /** + * Set the title of this {@link DataRepositoryWithDocuments} instance and return the same + * instance. + * + * @param title The title of this {@link DataRepositoryWithDocuments} + * @return The same instance of this {@link DataRepositoryWithDocuments} class + */ + @Nonnull + public DataRepositoryWithDocuments title(@Nonnull final String title) { + this.title = title; + return this; + } + + /** + * Get title + * + * @return title The title of this {@link DataRepositoryWithDocuments} instance. + */ + @Nonnull + public String getTitle() { + return title; + } + + /** + * Set the title of this {@link DataRepositoryWithDocuments} instance. + * + * @param title The title of this {@link DataRepositoryWithDocuments} + */ + public void setTitle(@Nonnull final String title) { + this.title = title; + } + + /** + * Set the metadata of this {@link DataRepositoryWithDocuments} instance and return the same + * instance. + * + * @param metadata Metadata attached to DataRepository. Useful to later limit search to a subset + * of DataRepositories. + * @return The same instance of this {@link DataRepositoryWithDocuments} class + */ + @Nonnull + public DataRepositoryWithDocuments metadata(@Nullable final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link DataRepositoryWithDocuments}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link DataRepositoryWithDocuments} + */ + @Nonnull + public DataRepositoryWithDocuments addMetadataItem(@Nonnull final KeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Metadata attached to DataRepository. Useful to later limit search to a subset of + * DataRepositories. + * + * @return metadata The metadata of this {@link DataRepositoryWithDocuments} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link DataRepositoryWithDocuments} instance. + * + * @param metadata Metadata attached to DataRepository. Useful to later limit search to a subset + * of DataRepositories. + */ + public void setMetadata(@Nullable final List metadata) { + this.metadata = metadata; + } + + /** + * Set the documents of this {@link DataRepositoryWithDocuments} instance and return the same + * instance. + * + * @param documents The documents of this {@link DataRepositoryWithDocuments} + * @return The same instance of this {@link DataRepositoryWithDocuments} class + */ + @Nonnull + public DataRepositoryWithDocuments documents(@Nonnull final List documents) { + this.documents = documents; + return this; + } + + /** + * Add one documents instance to this {@link DataRepositoryWithDocuments}. + * + * @param documentsItem The documents that should be added + * @return The same instance of type {@link DataRepositoryWithDocuments} + */ + @Nonnull + public DataRepositoryWithDocuments addDocumentsItem( + @Nonnull final RetrievalDocument documentsItem) { + if (this.documents == null) { + this.documents = new ArrayList<>(); + } + this.documents.add(documentsItem); + return this; + } + + /** + * Get documents + * + * @return documents The documents of this {@link DataRepositoryWithDocuments} instance. + */ + @Nonnull + public List getDocuments() { + return documents; + } + + /** + * Set the documents of this {@link DataRepositoryWithDocuments} instance. + * + * @param documents The documents of this {@link DataRepositoryWithDocuments} + */ + public void setDocuments(@Nonnull final List documents) { + this.documents = documents; + } + + /** + * Get the names of the unrecognizable properties of the {@link DataRepositoryWithDocuments}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DataRepositoryWithDocuments} + * 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( + "DataRepositoryWithDocuments has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DataRepositoryWithDocuments} 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 (title != null) declaredFields.put("title", title); + if (metadata != null) declaredFields.put("metadata", metadata); + if (documents != null) declaredFields.put("documents", documents); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DataRepositoryWithDocuments} 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 DataRepositoryWithDocuments dataRepositoryWithDocuments = (DataRepositoryWithDocuments) o; + return Objects.equals( + this.cloudSdkCustomFields, dataRepositoryWithDocuments.cloudSdkCustomFields) + && Objects.equals(this.id, dataRepositoryWithDocuments.id) + && Objects.equals(this.title, dataRepositoryWithDocuments.title) + && Objects.equals(this.metadata, dataRepositoryWithDocuments.metadata) + && Objects.equals(this.documents, dataRepositoryWithDocuments.documents); + } + + @Override + public int hashCode() { + return Objects.hash(id, title, metadata, documents, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DataRepositoryWithDocuments {\n"); + 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(" documents: ").append(toIndentedString(documents)).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 + * DataRepositoryWithDocuments} instance with all required arguments. + */ + public static Builder create() { + return (id) -> + (title) -> + (documents) -> + new DataRepositoryWithDocuments().id(id).title(title).documents(documents); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link DataRepositoryWithDocuments} instance. + * + * @param id Unique identifier of this DataRepository. + * @return The DataRepositoryWithDocuments builder. + */ + Builder1 id(@Nonnull final UUID id); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the title of this {@link DataRepositoryWithDocuments} instance. + * + * @param title The title of this {@link DataRepositoryWithDocuments} + * @return The DataRepositoryWithDocuments builder. + */ + Builder2 title(@Nonnull final String title); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the documents of this {@link DataRepositoryWithDocuments} instance. + * + * @param documents The documents of this {@link DataRepositoryWithDocuments} + * @return The DataRepositoryWithDocuments instance. + */ + DataRepositoryWithDocuments documents(@Nonnull final List documents); + + /** + * Set the documents of this {@link DataRepositoryWithDocuments} instance. + * + * @param documents The documents of this {@link DataRepositoryWithDocuments} + * @return The DataRepositoryWithDocuments instance. + */ + default DataRepositoryWithDocuments documents(@Nonnull final RetrievalDocument... documents) { + return documents(Arrays.asList(documents)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DetailsErrorResponse.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DetailsErrorResponse.java new file mode 100644 index 000000000..a31720334 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DetailsErrorResponse.java @@ -0,0 +1,209 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** DetailsErrorResponse */ +@Beta // CHECKSTYLE:OFF +public class DetailsErrorResponse +// CHECKSTYLE:ON +{ + @JsonProperty("code") + private String code; + + @JsonProperty("message") + private String message; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DetailsErrorResponse. */ + protected DetailsErrorResponse() {} + + /** + * Set the code of this {@link DetailsErrorResponse} instance and return the same instance. + * + * @param code Descriptive error code (not http status code) + * @return The same instance of this {@link DetailsErrorResponse} class + */ + @Nonnull + public DetailsErrorResponse code(@Nullable final String code) { + this.code = code; + return this; + } + + /** + * Descriptive error code (not http status code) + * + * @return code The code of this {@link DetailsErrorResponse} instance. + */ + @Nonnull + public String getCode() { + return code; + } + + /** + * Set the code of this {@link DetailsErrorResponse} instance. + * + * @param code Descriptive error code (not http status code) + */ + public void setCode(@Nullable final String code) { + this.code = code; + } + + /** + * Set the message of this {@link DetailsErrorResponse} instance and return the same instance. + * + * @param message Plaintext error description + * @return The same instance of this {@link DetailsErrorResponse} class + */ + @Nonnull + public DetailsErrorResponse message(@Nullable final String message) { + this.message = message; + return this; + } + + /** + * Plaintext error description + * + * @return message The message of this {@link DetailsErrorResponse} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link DetailsErrorResponse} instance. + * + * @param message Plaintext error description + */ + public void setMessage(@Nullable final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link DetailsErrorResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DetailsErrorResponse} 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( + "DetailsErrorResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DetailsErrorResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (code != null) declaredFields.put("code", code); + if (message != null) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DetailsErrorResponse} 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 DetailsErrorResponse detailsErrorResponse = (DetailsErrorResponse) o; + return Objects.equals(this.cloudSdkCustomFields, detailsErrorResponse.cloudSdkCustomFields) + && Objects.equals(this.code, detailsErrorResponse.code) + && Objects.equals(this.message, detailsErrorResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DetailsErrorResponse {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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 DetailsErrorResponse} instance. No arguments are required. */ + public static DetailsErrorResponse create() { + return new DetailsErrorResponse(); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentCreateRequest.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentCreateRequest.java new file mode 100644 index 000000000..1dd7a5e17 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentCreateRequest.java @@ -0,0 +1,214 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** A create request containing one or more new documents to create and store in a collection. */ +@Beta // CHECKSTYLE:OFF +public class DocumentCreateRequest +// CHECKSTYLE:ON +{ + @JsonProperty("documents") + private List documents = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DocumentCreateRequest. */ + protected DocumentCreateRequest() {} + + /** + * Set the documents of this {@link DocumentCreateRequest} instance and return the same instance. + * + * @param documents The documents of this {@link DocumentCreateRequest} + * @return The same instance of this {@link DocumentCreateRequest} class + */ + @Nonnull + public DocumentCreateRequest documents(@Nonnull final List documents) { + this.documents = documents; + return this; + } + + /** + * Add one documents instance to this {@link DocumentCreateRequest}. + * + * @param documentsItem The documents that should be added + * @return The same instance of type {@link DocumentCreateRequest} + */ + @Nonnull + public DocumentCreateRequest addDocumentsItem(@Nonnull final BaseDocument documentsItem) { + if (this.documents == null) { + this.documents = new ArrayList<>(); + } + this.documents.add(documentsItem); + return this; + } + + /** + * Get documents + * + * @return documents The documents of this {@link DocumentCreateRequest} instance. + */ + @Nonnull + public List getDocuments() { + return documents; + } + + /** + * Set the documents of this {@link DocumentCreateRequest} instance. + * + * @param documents The documents of this {@link DocumentCreateRequest} + */ + public void setDocuments(@Nonnull final List documents) { + this.documents = documents; + } + + /** + * Get the names of the unrecognizable properties of the {@link DocumentCreateRequest}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DocumentCreateRequest} 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( + "DocumentCreateRequest has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DocumentCreateRequest} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (documents != null) declaredFields.put("documents", documents); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DocumentCreateRequest} 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 DocumentCreateRequest documentCreateRequest = (DocumentCreateRequest) o; + return Objects.equals(this.cloudSdkCustomFields, documentCreateRequest.cloudSdkCustomFields) + && Objects.equals(this.documents, documentCreateRequest.documents); + } + + @Override + public int hashCode() { + return Objects.hash(documents, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DocumentCreateRequest {\n"); + sb.append(" documents: ").append(toIndentedString(documents)).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 DocumentCreateRequest} + * instance with all required arguments. + */ + public static Builder create() { + return (documents) -> new DocumentCreateRequest().documents(documents); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the documents of this {@link DocumentCreateRequest} instance. + * + * @param documents The documents of this {@link DocumentCreateRequest} + * @return The DocumentCreateRequest instance. + */ + DocumentCreateRequest documents(@Nonnull final List documents); + + /** + * Set the documents of this {@link DocumentCreateRequest} instance. + * + * @param documents The documents of this {@link DocumentCreateRequest} + * @return The DocumentCreateRequest instance. + */ + default DocumentCreateRequest documents(@Nonnull final BaseDocument... documents) { + return documents(Arrays.asList(documents)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentInput.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentInput.java new file mode 100644 index 000000000..a246e17fb --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentInput.java @@ -0,0 +1,336 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** A single document stored in a collection by ID. */ +@Beta // CHECKSTYLE:OFF +public class DocumentInput +// CHECKSTYLE:ON +{ + @JsonProperty("chunks") + private List chunks = new ArrayList<>(); + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonProperty("id") + private UUID id; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DocumentInput. */ + protected DocumentInput() {} + + /** + * Set the chunks of this {@link DocumentInput} instance and return the same instance. + * + * @param chunks The chunks of this {@link DocumentInput} + * @return The same instance of this {@link DocumentInput} class + */ + @Nonnull + public DocumentInput chunks(@Nonnull final List chunks) { + this.chunks = chunks; + return this; + } + + /** + * Add one chunks instance to this {@link DocumentInput}. + * + * @param chunksItem The chunks that should be added + * @return The same instance of type {@link DocumentInput} + */ + @Nonnull + public DocumentInput addChunksItem(@Nonnull final TextOnlyBaseChunk chunksItem) { + if (this.chunks == null) { + this.chunks = new ArrayList<>(); + } + this.chunks.add(chunksItem); + return this; + } + + /** + * Get chunks + * + * @return chunks The chunks of this {@link DocumentInput} instance. + */ + @Nonnull + public List getChunks() { + return chunks; + } + + /** + * Set the chunks of this {@link DocumentInput} instance. + * + * @param chunks The chunks of this {@link DocumentInput} + */ + public void setChunks(@Nonnull final List chunks) { + this.chunks = chunks; + } + + /** + * Set the metadata of this {@link DocumentInput} instance and return the same instance. + * + * @param metadata The metadata of this {@link DocumentInput} + * @return The same instance of this {@link DocumentInput} class + */ + @Nonnull + public DocumentInput metadata(@Nonnull final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link DocumentInput}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link DocumentInput} + */ + @Nonnull + public DocumentInput addMetadataItem(@Nonnull final DocumentKeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link DocumentInput} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link DocumentInput} instance. + * + * @param metadata The metadata of this {@link DocumentInput} + */ + public void setMetadata(@Nonnull final List metadata) { + this.metadata = metadata; + } + + /** + * Set the id of this {@link DocumentInput} instance and return the same instance. + * + * @param id Unique identifier of a document. + * @return The same instance of this {@link DocumentInput} class + */ + @Nonnull + public DocumentInput id(@Nonnull final UUID id) { + this.id = id; + return this; + } + + /** + * Unique identifier of a document. + * + * @return id The id of this {@link DocumentInput} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link DocumentInput} instance. + * + * @param id Unique identifier of a document. + */ + public void setId(@Nonnull final UUID id) { + this.id = id; + } + + /** + * Get the names of the unrecognizable properties of the {@link DocumentInput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DocumentInput} 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("DocumentInput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DocumentInput} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (chunks != null) declaredFields.put("chunks", chunks); + if (metadata != null) declaredFields.put("metadata", metadata); + if (id != null) declaredFields.put("id", id); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DocumentInput} 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 DocumentInput documentInput = (DocumentInput) o; + return Objects.equals(this.cloudSdkCustomFields, documentInput.cloudSdkCustomFields) + && Objects.equals(this.chunks, documentInput.chunks) + && Objects.equals(this.metadata, documentInput.metadata) + && Objects.equals(this.id, documentInput.id); + } + + @Override + public int hashCode() { + return Objects.hash(chunks, metadata, id, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DocumentInput {\n"); + sb.append(" chunks: ").append(toIndentedString(chunks)).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")); + 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 DocumentInput} instance + * with all required arguments. + */ + public static Builder create() { + return (chunks) -> + (metadata) -> (id) -> new DocumentInput().chunks(chunks).metadata(metadata).id(id); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the chunks of this {@link DocumentInput} instance. + * + * @param chunks The chunks of this {@link DocumentInput} + * @return The DocumentInput builder. + */ + Builder1 chunks(@Nonnull final List chunks); + + /** + * Set the chunks of this {@link DocumentInput} instance. + * + * @param chunks The chunks of this {@link DocumentInput} + * @return The DocumentInput 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 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 DocumentKeyValueListPair... metadata) { + return metadata(Arrays.asList(metadata)); + } + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the id of this {@link DocumentInput} instance. + * + * @param id Unique identifier of a document. + * @return The DocumentInput instance. + */ + DocumentInput id(@Nonnull final UUID id); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentKeyValueListPair.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentKeyValueListPair.java new file mode 100644 index 000000000..b40ff398d --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentKeyValueListPair.java @@ -0,0 +1,359 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** DocumentKeyValueListPair */ +@Beta // CHECKSTYLE:OFF +public class DocumentKeyValueListPair +// CHECKSTYLE:ON +{ + @JsonProperty("key") + private String key; + + @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 + @Nonnull + 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; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DocumentKeyValueListPair. */ + protected DocumentKeyValueListPair() {} + + /** + * Set the key of this {@link DocumentKeyValueListPair} instance and return the same instance. + * + * @param key The key of this {@link DocumentKeyValueListPair} + * @return The same instance of this {@link DocumentKeyValueListPair} class + */ + @Nonnull + public DocumentKeyValueListPair key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link DocumentKeyValueListPair} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link DocumentKeyValueListPair} instance. + * + * @param key The key of this {@link DocumentKeyValueListPair} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link DocumentKeyValueListPair} instance and return the same instance. + * + * @param value The value of this {@link DocumentKeyValueListPair} + * @return The same instance of this {@link DocumentKeyValueListPair} class + */ + @Nonnull + public DocumentKeyValueListPair value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link DocumentKeyValueListPair}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link DocumentKeyValueListPair} + */ + @Nonnull + public DocumentKeyValueListPair 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 DocumentKeyValueListPair} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link DocumentKeyValueListPair} instance. + * + * @param value The value of this {@link DocumentKeyValueListPair} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Set the matchMode of this {@link DocumentKeyValueListPair} instance and return the same + * instance. + * + * @param matchMode The matchMode of this {@link DocumentKeyValueListPair} + * @return The same instance of this {@link DocumentKeyValueListPair} class + */ + @Nonnull + public DocumentKeyValueListPair matchMode(@Nullable final MatchModeEnum matchMode) { + this.matchMode = matchMode; + return this; + } + + /** + * Get matchMode + * + * @return matchMode The matchMode of this {@link DocumentKeyValueListPair} instance. + */ + @Nullable + public MatchModeEnum getMatchMode() { + return matchMode; + } + + /** + * Set the matchMode of this {@link DocumentKeyValueListPair} instance. + * + * @param matchMode The matchMode of this {@link DocumentKeyValueListPair} + */ + public void setMatchMode(@Nullable final MatchModeEnum matchMode) { + this.matchMode = matchMode; + } + + /** + * Get the names of the unrecognizable properties of the {@link DocumentKeyValueListPair}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DocumentKeyValueListPair} 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( + "DocumentKeyValueListPair has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DocumentKeyValueListPair} 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 (matchMode != null) declaredFields.put("matchMode", matchMode); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DocumentKeyValueListPair} 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 DocumentKeyValueListPair documentKeyValueListPair = (DocumentKeyValueListPair) o; + return Objects.equals(this.cloudSdkCustomFields, documentKeyValueListPair.cloudSdkCustomFields) + && Objects.equals(this.key, documentKeyValueListPair.key) + && Objects.equals(this.value, documentKeyValueListPair.value) + && Objects.equals(this.matchMode, documentKeyValueListPair.matchMode); + } + + @Override + public int hashCode() { + return Objects.hash(key, value, matchMode, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DocumentKeyValueListPair {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" matchMode: ").append(toIndentedString(matchMode)).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 + * DocumentKeyValueListPair} instance with all required arguments. + */ + public static Builder create() { + return (key) -> (value) -> new DocumentKeyValueListPair().key(key).value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the key of this {@link DocumentKeyValueListPair} instance. + * + * @param key The key of this {@link DocumentKeyValueListPair} + * @return The DocumentKeyValueListPair builder. + */ + Builder1 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the value of this {@link DocumentKeyValueListPair} instance. + * + * @param value The value of this {@link DocumentKeyValueListPair} + * @return The DocumentKeyValueListPair instance. + */ + DocumentKeyValueListPair value(@Nonnull final List value); + + /** + * Set the value of this {@link DocumentKeyValueListPair} instance. + * + * @param value The value of this {@link DocumentKeyValueListPair} + * @return The DocumentKeyValueListPair instance. + */ + default DocumentKeyValueListPair value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentOutput.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentOutput.java new file mode 100644 index 000000000..5a62f69d9 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentOutput.java @@ -0,0 +1,314 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** DocumentOutput */ +@Beta // CHECKSTYLE:OFF +public class DocumentOutput +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private UUID id; + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonProperty("chunks") + private List chunks = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DocumentOutput. */ + protected DocumentOutput() {} + + /** + * Set the id of this {@link DocumentOutput} instance and return the same instance. + * + * @param id The id of this {@link DocumentOutput} + * @return The same instance of this {@link DocumentOutput} class + */ + @Nonnull + public DocumentOutput id(@Nonnull final UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link DocumentOutput} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link DocumentOutput} instance. + * + * @param id The id of this {@link DocumentOutput} + */ + public void setId(@Nonnull final UUID id) { + this.id = id; + } + + /** + * Set the metadata of this {@link DocumentOutput} instance and return the same instance. + * + * @param metadata The metadata of this {@link DocumentOutput} + * @return The same instance of this {@link DocumentOutput} class + */ + @Nonnull + public DocumentOutput metadata(@Nullable final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link DocumentOutput}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link DocumentOutput} + */ + @Nonnull + public DocumentOutput addMetadataItem(@Nonnull final DocumentKeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link DocumentOutput} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link DocumentOutput} instance. + * + * @param metadata The metadata of this {@link DocumentOutput} + */ + public void setMetadata(@Nullable final List metadata) { + this.metadata = metadata; + } + + /** + * Set the chunks of this {@link DocumentOutput} instance and return the same instance. + * + * @param chunks The chunks of this {@link DocumentOutput} + * @return The same instance of this {@link DocumentOutput} class + */ + @Nonnull + public DocumentOutput chunks(@Nonnull final List chunks) { + this.chunks = chunks; + return this; + } + + /** + * Add one chunks instance to this {@link DocumentOutput}. + * + * @param chunksItem The chunks that should be added + * @return The same instance of type {@link DocumentOutput} + */ + @Nonnull + public DocumentOutput addChunksItem(@Nonnull final Chunk chunksItem) { + if (this.chunks == null) { + this.chunks = new ArrayList<>(); + } + this.chunks.add(chunksItem); + return this; + } + + /** + * Get chunks + * + * @return chunks The chunks of this {@link DocumentOutput} instance. + */ + @Nonnull + public List getChunks() { + return chunks; + } + + /** + * Set the chunks of this {@link DocumentOutput} instance. + * + * @param chunks The chunks of this {@link DocumentOutput} + */ + public void setChunks(@Nonnull final List chunks) { + this.chunks = chunks; + } + + /** + * Get the names of the unrecognizable properties of the {@link DocumentOutput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DocumentOutput} 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("DocumentOutput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DocumentOutput} 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); + if (chunks != null) declaredFields.put("chunks", chunks); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DocumentOutput} 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 DocumentOutput documentOutput = (DocumentOutput) o; + return Objects.equals(this.cloudSdkCustomFields, documentOutput.cloudSdkCustomFields) + && Objects.equals(this.id, documentOutput.id) + && Objects.equals(this.metadata, documentOutput.metadata) + && Objects.equals(this.chunks, documentOutput.chunks); + } + + @Override + public int hashCode() { + return Objects.hash(id, metadata, chunks, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DocumentOutput {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" chunks: ").append(toIndentedString(chunks)).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 DocumentOutput} + * instance with all required arguments. + */ + public static Builder create() { + return (id) -> (chunks) -> new DocumentOutput().id(id).chunks(chunks); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link DocumentOutput} instance. + * + * @param id The id of this {@link DocumentOutput} + * @return The DocumentOutput builder. + */ + Builder1 id(@Nonnull final UUID id); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the chunks of this {@link DocumentOutput} instance. + * + * @param chunks The chunks of this {@link DocumentOutput} + * @return The DocumentOutput instance. + */ + DocumentOutput chunks(@Nonnull final List chunks); + + /** + * Set the chunks of this {@link DocumentOutput} instance. + * + * @param chunks The chunks of this {@link DocumentOutput} + * @return The DocumentOutput instance. + */ + default DocumentOutput chunks(@Nonnull final Chunk... chunks) { + return chunks(Arrays.asList(chunks)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentResponse.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentResponse.java new file mode 100644 index 000000000..ea869f9f7 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentResponse.java @@ -0,0 +1,336 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** A response containing information about a newly created, single document. */ +@Beta // CHECKSTYLE:OFF +public class DocumentResponse +// CHECKSTYLE:ON +{ + @JsonProperty("chunks") + private List chunks = new ArrayList<>(); + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonProperty("id") + private UUID id; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DocumentResponse. */ + protected DocumentResponse() {} + + /** + * Set the chunks of this {@link DocumentResponse} instance and return the same instance. + * + * @param chunks The chunks of this {@link DocumentResponse} + * @return The same instance of this {@link DocumentResponse} class + */ + @Nonnull + public DocumentResponse chunks(@Nonnull final List chunks) { + this.chunks = chunks; + return this; + } + + /** + * Add one chunks instance to this {@link DocumentResponse}. + * + * @param chunksItem The chunks that should be added + * @return The same instance of type {@link DocumentResponse} + */ + @Nonnull + public DocumentResponse addChunksItem(@Nonnull final TextOnlyBaseChunk chunksItem) { + if (this.chunks == null) { + this.chunks = new ArrayList<>(); + } + this.chunks.add(chunksItem); + return this; + } + + /** + * Get chunks + * + * @return chunks The chunks of this {@link DocumentResponse} instance. + */ + @Nonnull + public List getChunks() { + return chunks; + } + + /** + * Set the chunks of this {@link DocumentResponse} instance. + * + * @param chunks The chunks of this {@link DocumentResponse} + */ + public void setChunks(@Nonnull final List chunks) { + this.chunks = chunks; + } + + /** + * Set the metadata of this {@link DocumentResponse} instance and return the same instance. + * + * @param metadata The metadata of this {@link DocumentResponse} + * @return The same instance of this {@link DocumentResponse} class + */ + @Nonnull + public DocumentResponse metadata(@Nonnull final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link DocumentResponse}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link DocumentResponse} + */ + @Nonnull + public DocumentResponse addMetadataItem(@Nonnull final DocumentKeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link DocumentResponse} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link DocumentResponse} instance. + * + * @param metadata The metadata of this {@link DocumentResponse} + */ + public void setMetadata(@Nonnull final List metadata) { + this.metadata = metadata; + } + + /** + * Set the id of this {@link DocumentResponse} instance and return the same instance. + * + * @param id Unique identifier of a document. + * @return The same instance of this {@link DocumentResponse} class + */ + @Nonnull + public DocumentResponse id(@Nonnull final UUID id) { + this.id = id; + return this; + } + + /** + * Unique identifier of a document. + * + * @return id The id of this {@link DocumentResponse} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link DocumentResponse} instance. + * + * @param id Unique identifier of a document. + */ + public void setId(@Nonnull final UUID id) { + this.id = id; + } + + /** + * Get the names of the unrecognizable properties of the {@link DocumentResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DocumentResponse} 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("DocumentResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DocumentResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (chunks != null) declaredFields.put("chunks", chunks); + if (metadata != null) declaredFields.put("metadata", metadata); + if (id != null) declaredFields.put("id", id); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DocumentResponse} 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 DocumentResponse documentResponse = (DocumentResponse) o; + return Objects.equals(this.cloudSdkCustomFields, documentResponse.cloudSdkCustomFields) + && Objects.equals(this.chunks, documentResponse.chunks) + && Objects.equals(this.metadata, documentResponse.metadata) + && Objects.equals(this.id, documentResponse.id); + } + + @Override + public int hashCode() { + return Objects.hash(chunks, metadata, id, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DocumentResponse {\n"); + sb.append(" chunks: ").append(toIndentedString(chunks)).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")); + 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 DocumentResponse} + * instance with all required arguments. + */ + public static Builder create() { + return (chunks) -> + (metadata) -> (id) -> new DocumentResponse().chunks(chunks).metadata(metadata).id(id); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the chunks of this {@link DocumentResponse} instance. + * + * @param chunks The chunks of this {@link DocumentResponse} + * @return The DocumentResponse builder. + */ + Builder1 chunks(@Nonnull final List chunks); + + /** + * Set the chunks of this {@link DocumentResponse} instance. + * + * @param chunks The chunks of this {@link DocumentResponse} + * @return The DocumentResponse 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 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 DocumentKeyValueListPair... metadata) { + return metadata(Arrays.asList(metadata)); + } + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the id of this {@link DocumentResponse} instance. + * + * @param id Unique identifier of a document. + * @return The DocumentResponse instance. + */ + DocumentResponse id(@Nonnull final UUID id); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentUpdateRequest.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentUpdateRequest.java new file mode 100644 index 000000000..af482ebfb --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentUpdateRequest.java @@ -0,0 +1,217 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** + * An update request containing one or more documents to update existing documents in a collection + * by ID. + */ +@Beta // CHECKSTYLE:OFF +public class DocumentUpdateRequest +// CHECKSTYLE:ON +{ + @JsonProperty("documents") + private List documents = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DocumentUpdateRequest. */ + protected DocumentUpdateRequest() {} + + /** + * Set the documents of this {@link DocumentUpdateRequest} instance and return the same instance. + * + * @param documents The documents of this {@link DocumentUpdateRequest} + * @return The same instance of this {@link DocumentUpdateRequest} class + */ + @Nonnull + public DocumentUpdateRequest documents(@Nonnull final List documents) { + this.documents = documents; + return this; + } + + /** + * Add one documents instance to this {@link DocumentUpdateRequest}. + * + * @param documentsItem The documents that should be added + * @return The same instance of type {@link DocumentUpdateRequest} + */ + @Nonnull + public DocumentUpdateRequest addDocumentsItem(@Nonnull final DocumentInput documentsItem) { + if (this.documents == null) { + this.documents = new ArrayList<>(); + } + this.documents.add(documentsItem); + return this; + } + + /** + * Get documents + * + * @return documents The documents of this {@link DocumentUpdateRequest} instance. + */ + @Nonnull + public List getDocuments() { + return documents; + } + + /** + * Set the documents of this {@link DocumentUpdateRequest} instance. + * + * @param documents The documents of this {@link DocumentUpdateRequest} + */ + public void setDocuments(@Nonnull final List documents) { + this.documents = documents; + } + + /** + * Get the names of the unrecognizable properties of the {@link DocumentUpdateRequest}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DocumentUpdateRequest} 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( + "DocumentUpdateRequest has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DocumentUpdateRequest} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (documents != null) declaredFields.put("documents", documents); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DocumentUpdateRequest} 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 DocumentUpdateRequest documentUpdateRequest = (DocumentUpdateRequest) o; + return Objects.equals(this.cloudSdkCustomFields, documentUpdateRequest.cloudSdkCustomFields) + && Objects.equals(this.documents, documentUpdateRequest.documents); + } + + @Override + public int hashCode() { + return Objects.hash(documents, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DocumentUpdateRequest {\n"); + sb.append(" documents: ").append(toIndentedString(documents)).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 DocumentUpdateRequest} + * instance with all required arguments. + */ + public static Builder create() { + return (documents) -> new DocumentUpdateRequest().documents(documents); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the documents of this {@link DocumentUpdateRequest} instance. + * + * @param documents The documents of this {@link DocumentUpdateRequest} + * @return The DocumentUpdateRequest instance. + */ + DocumentUpdateRequest documents(@Nonnull final List documents); + + /** + * Set the documents of this {@link DocumentUpdateRequest} instance. + * + * @param documents The documents of this {@link DocumentUpdateRequest} + * @return The DocumentUpdateRequest instance. + */ + default DocumentUpdateRequest documents(@Nonnull final DocumentInput... documents) { + return documents(Arrays.asList(documents)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentWithoutChunks.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentWithoutChunks.java new file mode 100644 index 000000000..29eb40f8f --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentWithoutChunks.java @@ -0,0 +1,264 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** A single document stored in a collection by ID without exposing its chunks. */ +@Beta // CHECKSTYLE:OFF +public class DocumentWithoutChunks +// CHECKSTYLE:ON +{ + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonProperty("id") + private UUID id; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DocumentWithoutChunks. */ + protected DocumentWithoutChunks() {} + + /** + * Set the metadata of this {@link DocumentWithoutChunks} instance and return the same instance. + * + * @param metadata The metadata of this {@link DocumentWithoutChunks} + * @return The same instance of this {@link DocumentWithoutChunks} class + */ + @Nonnull + public DocumentWithoutChunks metadata(@Nonnull final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link DocumentWithoutChunks}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link DocumentWithoutChunks} + */ + @Nonnull + public DocumentWithoutChunks addMetadataItem( + @Nonnull final DocumentKeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link DocumentWithoutChunks} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link DocumentWithoutChunks} instance. + * + * @param metadata The metadata of this {@link DocumentWithoutChunks} + */ + public void setMetadata(@Nonnull final List metadata) { + this.metadata = metadata; + } + + /** + * Set the id of this {@link DocumentWithoutChunks} instance and return the same instance. + * + * @param id Unique identifier of a document. + * @return The same instance of this {@link DocumentWithoutChunks} class + */ + @Nonnull + public DocumentWithoutChunks id(@Nonnull final UUID id) { + this.id = id; + return this; + } + + /** + * Unique identifier of a document. + * + * @return id The id of this {@link DocumentWithoutChunks} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link DocumentWithoutChunks} instance. + * + * @param id Unique identifier of a document. + */ + public void setId(@Nonnull final UUID id) { + this.id = id; + } + + /** + * Get the names of the unrecognizable properties of the {@link DocumentWithoutChunks}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DocumentWithoutChunks} 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( + "DocumentWithoutChunks has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DocumentWithoutChunks} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (metadata != null) declaredFields.put("metadata", metadata); + if (id != null) declaredFields.put("id", id); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DocumentWithoutChunks} 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 DocumentWithoutChunks documentWithoutChunks = (DocumentWithoutChunks) o; + return Objects.equals(this.cloudSdkCustomFields, documentWithoutChunks.cloudSdkCustomFields) + && Objects.equals(this.metadata, documentWithoutChunks.metadata) + && Objects.equals(this.id, documentWithoutChunks.id); + } + + @Override + public int hashCode() { + return Objects.hash(metadata, id, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DocumentWithoutChunks {\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")); + 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 DocumentWithoutChunks} + * instance with all required arguments. + */ + public static Builder create() { + return (metadata) -> (id) -> new DocumentWithoutChunks().metadata(metadata).id(id); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the metadata of this {@link DocumentWithoutChunks} instance. + * + * @param metadata The metadata of this {@link DocumentWithoutChunks} + * @return The DocumentWithoutChunks builder. + */ + Builder1 metadata(@Nonnull final List metadata); + + /** + * Set the metadata of this {@link DocumentWithoutChunks} instance. + * + * @param metadata The metadata of this {@link DocumentWithoutChunks} + * @return The DocumentWithoutChunks builder. + */ + default Builder1 metadata(@Nonnull final DocumentKeyValueListPair... metadata) { + return metadata(Arrays.asList(metadata)); + } + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the id of this {@link DocumentWithoutChunks} instance. + * + * @param id Unique identifier of a document. + * @return The DocumentWithoutChunks instance. + */ + DocumentWithoutChunks id(@Nonnull final UUID id); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Documents.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Documents.java new file mode 100644 index 000000000..4ee81b280 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Documents.java @@ -0,0 +1,250 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** A response containing documents retrieved from the server. */ +@Beta // CHECKSTYLE:OFF +public class Documents +// CHECKSTYLE:ON +{ + @JsonProperty("resources") + private List resources = new ArrayList<>(); + + @JsonProperty("count") + private Integer count; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for Documents. */ + protected Documents() {} + + /** + * Set the resources of this {@link Documents} instance and return the same instance. + * + * @param resources The resources of this {@link Documents} + * @return The same instance of this {@link Documents} class + */ + @Nonnull + public Documents resources(@Nonnull final List resources) { + this.resources = resources; + return this; + } + + /** + * Add one resources instance to this {@link Documents}. + * + * @param resourcesItem The resources that should be added + * @return The same instance of type {@link Documents} + */ + @Nonnull + public Documents addResourcesItem(@Nonnull final DocumentWithoutChunks resourcesItem) { + if (this.resources == null) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; + } + + /** + * Get resources + * + * @return resources The resources of this {@link Documents} instance. + */ + @Nonnull + public List getResources() { + return resources; + } + + /** + * Set the resources of this {@link Documents} instance. + * + * @param resources The resources of this {@link Documents} + */ + public void setResources(@Nonnull final List resources) { + this.resources = resources; + } + + /** + * Set the count of this {@link Documents} instance and return the same instance. + * + * @param count The count of this {@link Documents} + * @return The same instance of this {@link Documents} class + */ + @Nonnull + public Documents count(@Nullable final Integer count) { + this.count = count; + return this; + } + + /** + * Get count + * + * @return count The count of this {@link Documents} instance. + */ + @Nonnull + public Integer getCount() { + return count; + } + + /** + * Set the count of this {@link Documents} instance. + * + * @param count The count of this {@link Documents} + */ + public void setCount(@Nullable final Integer count) { + this.count = count; + } + + /** + * Get the names of the unrecognizable properties of the {@link Documents}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Documents} 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("Documents has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Documents} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (resources != null) declaredFields.put("resources", resources); + if (count != null) declaredFields.put("count", count); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Documents} 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 Documents documents = (Documents) o; + return Objects.equals(this.cloudSdkCustomFields, documents.cloudSdkCustomFields) + && Objects.equals(this.resources, documents.resources) + && Objects.equals(this.count, documents.count); + } + + @Override + public int hashCode() { + return Objects.hash(resources, count, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Documents {\n"); + sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).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 Documents} instance + * with all required arguments. + */ + public static Builder create() { + return (resources) -> new Documents().resources(resources); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the resources of this {@link Documents} instance. + * + * @param resources The resources of this {@link Documents} + * @return The Documents instance. + */ + Documents resources(@Nonnull final List resources); + + /** + * Set the resources of this {@link Documents} instance. + * + * @param resources The resources of this {@link Documents} + * @return The Documents instance. + */ + default Documents resources(@Nonnull final DocumentWithoutChunks... resources) { + return resources(Arrays.asList(resources)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentsChunk.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentsChunk.java new file mode 100644 index 000000000..bcdfa2a07 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentsChunk.java @@ -0,0 +1,363 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** DocumentsChunk */ +@Beta // CHECKSTYLE:OFF +public class DocumentsChunk +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private UUID id; + + @JsonProperty("title") + private String title; + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonProperty("documents") + private List documents = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DocumentsChunk. */ + protected DocumentsChunk() {} + + /** + * Set the id of this {@link DocumentsChunk} instance and return the same instance. + * + * @param id The id of this {@link DocumentsChunk} + * @return The same instance of this {@link DocumentsChunk} class + */ + @Nonnull + public DocumentsChunk id(@Nonnull final UUID id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link DocumentsChunk} instance. + */ + @Nonnull + public UUID getId() { + return id; + } + + /** + * Set the id of this {@link DocumentsChunk} instance. + * + * @param id The id of this {@link DocumentsChunk} + */ + public void setId(@Nonnull final UUID id) { + this.id = id; + } + + /** + * Set the title of this {@link DocumentsChunk} instance and return the same instance. + * + * @param title The title of this {@link DocumentsChunk} + * @return The same instance of this {@link DocumentsChunk} class + */ + @Nonnull + public DocumentsChunk title(@Nonnull final String title) { + this.title = title; + return this; + } + + /** + * Get title + * + * @return title The title of this {@link DocumentsChunk} instance. + */ + @Nonnull + public String getTitle() { + return title; + } + + /** + * Set the title of this {@link DocumentsChunk} instance. + * + * @param title The title of this {@link DocumentsChunk} + */ + public void setTitle(@Nonnull final String title) { + this.title = title; + } + + /** + * Set the metadata of this {@link DocumentsChunk} instance and return the same instance. + * + * @param metadata The metadata of this {@link DocumentsChunk} + * @return The same instance of this {@link DocumentsChunk} class + */ + @Nonnull + public DocumentsChunk metadata(@Nullable final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link DocumentsChunk}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link DocumentsChunk} + */ + @Nonnull + public DocumentsChunk addMetadataItem(@Nonnull final KeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link DocumentsChunk} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link DocumentsChunk} instance. + * + * @param metadata The metadata of this {@link DocumentsChunk} + */ + public void setMetadata(@Nullable final List metadata) { + this.metadata = metadata; + } + + /** + * Set the documents of this {@link DocumentsChunk} instance and return the same instance. + * + * @param documents The documents of this {@link DocumentsChunk} + * @return The same instance of this {@link DocumentsChunk} class + */ + @Nonnull + public DocumentsChunk documents(@Nonnull final List documents) { + this.documents = documents; + return this; + } + + /** + * Add one documents instance to this {@link DocumentsChunk}. + * + * @param documentsItem The documents that should be added + * @return The same instance of type {@link DocumentsChunk} + */ + @Nonnull + public DocumentsChunk addDocumentsItem(@Nonnull final DocumentOutput documentsItem) { + if (this.documents == null) { + this.documents = new ArrayList<>(); + } + this.documents.add(documentsItem); + return this; + } + + /** + * Get documents + * + * @return documents The documents of this {@link DocumentsChunk} instance. + */ + @Nonnull + public List getDocuments() { + return documents; + } + + /** + * Set the documents of this {@link DocumentsChunk} instance. + * + * @param documents The documents of this {@link DocumentsChunk} + */ + public void setDocuments(@Nonnull final List documents) { + this.documents = documents; + } + + /** + * Get the names of the unrecognizable properties of the {@link DocumentsChunk}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DocumentsChunk} 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("DocumentsChunk has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DocumentsChunk} 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 (title != null) declaredFields.put("title", title); + if (metadata != null) declaredFields.put("metadata", metadata); + if (documents != null) declaredFields.put("documents", documents); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DocumentsChunk} 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 DocumentsChunk documentsChunk = (DocumentsChunk) o; + return Objects.equals(this.cloudSdkCustomFields, documentsChunk.cloudSdkCustomFields) + && Objects.equals(this.id, documentsChunk.id) + && Objects.equals(this.title, documentsChunk.title) + && Objects.equals(this.metadata, documentsChunk.metadata) + && Objects.equals(this.documents, documentsChunk.documents); + } + + @Override + public int hashCode() { + return Objects.hash(id, title, metadata, documents, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DocumentsChunk {\n"); + 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(" documents: ").append(toIndentedString(documents)).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 DocumentsChunk} + * instance with all required arguments. + */ + public static Builder create() { + return (id) -> + (title) -> (documents) -> new DocumentsChunk().id(id).title(title).documents(documents); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link DocumentsChunk} instance. + * + * @param id The id of this {@link DocumentsChunk} + * @return The DocumentsChunk builder. + */ + Builder1 id(@Nonnull final UUID id); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the title of this {@link DocumentsChunk} instance. + * + * @param title The title of this {@link DocumentsChunk} + * @return The DocumentsChunk builder. + */ + Builder2 title(@Nonnull final String title); + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the documents of this {@link DocumentsChunk} instance. + * + * @param documents The documents of this {@link DocumentsChunk} + * @return The DocumentsChunk instance. + */ + DocumentsChunk documents(@Nonnull final List documents); + + /** + * Set the documents of this {@link DocumentsChunk} instance. + * + * @param documents The documents of this {@link DocumentsChunk} + * @return The DocumentsChunk instance. + */ + default DocumentsChunk documents(@Nonnull final DocumentOutput... documents) { + return documents(Arrays.asList(documents)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentsListResponse.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentsListResponse.java new file mode 100644 index 000000000..bdfca2fd2 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/DocumentsListResponse.java @@ -0,0 +1,215 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** A response containing documents created or updated, retrieved from the server. */ +@Beta // CHECKSTYLE:OFF +public class DocumentsListResponse +// CHECKSTYLE:ON +{ + @JsonProperty("documents") + private List documents = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for DocumentsListResponse. */ + protected DocumentsListResponse() {} + + /** + * Set the documents of this {@link DocumentsListResponse} instance and return the same instance. + * + * @param documents The documents of this {@link DocumentsListResponse} + * @return The same instance of this {@link DocumentsListResponse} class + */ + @Nonnull + public DocumentsListResponse documents(@Nonnull final List documents) { + this.documents = documents; + return this; + } + + /** + * Add one documents instance to this {@link DocumentsListResponse}. + * + * @param documentsItem The documents that should be added + * @return The same instance of type {@link DocumentsListResponse} + */ + @Nonnull + public DocumentsListResponse addDocumentsItem( + @Nonnull final DocumentWithoutChunks documentsItem) { + if (this.documents == null) { + this.documents = new ArrayList<>(); + } + this.documents.add(documentsItem); + return this; + } + + /** + * Get documents + * + * @return documents The documents of this {@link DocumentsListResponse} instance. + */ + @Nonnull + public List getDocuments() { + return documents; + } + + /** + * Set the documents of this {@link DocumentsListResponse} instance. + * + * @param documents The documents of this {@link DocumentsListResponse} + */ + public void setDocuments(@Nonnull final List documents) { + this.documents = documents; + } + + /** + * Get the names of the unrecognizable properties of the {@link DocumentsListResponse}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link DocumentsListResponse} 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( + "DocumentsListResponse has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link DocumentsListResponse} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (documents != null) declaredFields.put("documents", documents); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link DocumentsListResponse} 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 DocumentsListResponse documentsListResponse = (DocumentsListResponse) o; + return Objects.equals(this.cloudSdkCustomFields, documentsListResponse.cloudSdkCustomFields) + && Objects.equals(this.documents, documentsListResponse.documents); + } + + @Override + public int hashCode() { + return Objects.hash(documents, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class DocumentsListResponse {\n"); + sb.append(" documents: ").append(toIndentedString(documents)).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 DocumentsListResponse} + * instance with all required arguments. + */ + public static Builder create() { + return (documents) -> new DocumentsListResponse().documents(documents); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the documents of this {@link DocumentsListResponse} instance. + * + * @param documents The documents of this {@link DocumentsListResponse} + * @return The DocumentsListResponse instance. + */ + DocumentsListResponse documents(@Nonnull final List documents); + + /** + * Set the documents of this {@link DocumentsListResponse} instance. + * + * @param documents The documents of this {@link DocumentsListResponse} + * @return The DocumentsListResponse instance. + */ + default DocumentsListResponse documents(@Nonnull final DocumentWithoutChunks... documents) { + return documents(Arrays.asList(documents)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/EmbeddingConfig.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/EmbeddingConfig.java new file mode 100644 index 000000000..2fd010eac --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/EmbeddingConfig.java @@ -0,0 +1,171 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** EmbeddingConfig */ +@Beta // CHECKSTYLE:OFF +public class EmbeddingConfig +// CHECKSTYLE:ON +{ + @JsonProperty("modelName") + private String modelName = "text-embedding-ada-002"; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for EmbeddingConfig. */ + protected EmbeddingConfig() {} + + /** + * Set the modelName of this {@link EmbeddingConfig} instance and return the same instance. + * + * @param modelName The modelName of this {@link EmbeddingConfig} + * @return The same instance of this {@link EmbeddingConfig} class + */ + @Nonnull + public EmbeddingConfig modelName(@Nullable final String modelName) { + this.modelName = modelName; + return this; + } + + /** + * Get modelName + * + * @return modelName The modelName of this {@link EmbeddingConfig} instance. + */ + @Nonnull + public String getModelName() { + return modelName; + } + + /** + * Set the modelName of this {@link EmbeddingConfig} instance. + * + * @param modelName The modelName of this {@link EmbeddingConfig} + */ + public void setModelName(@Nullable final String modelName) { + this.modelName = modelName; + } + + /** + * Get the names of the unrecognizable properties of the {@link EmbeddingConfig}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link EmbeddingConfig} 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("EmbeddingConfig has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link EmbeddingConfig} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (modelName != null) declaredFields.put("modelName", modelName); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link EmbeddingConfig} 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 EmbeddingConfig embeddingConfig = (EmbeddingConfig) o; + return Objects.equals(this.cloudSdkCustomFields, embeddingConfig.cloudSdkCustomFields) + && Objects.equals(this.modelName, embeddingConfig.modelName); + } + + @Override + public int hashCode() { + return Objects.hash(modelName, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class EmbeddingConfig {\n"); + sb.append(" modelName: ").append(toIndentedString(modelName)).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 EmbeddingConfig} instance. No arguments are required. */ + public static EmbeddingConfig create() { + return new EmbeddingConfig(); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/InlineObject.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/InlineObject.java new file mode 100644 index 000000000..350013675 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/InlineObject.java @@ -0,0 +1,171 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** InlineObject */ +@Beta // CHECKSTYLE:OFF +public class InlineObject +// CHECKSTYLE:ON +{ + @JsonProperty("error") + private ApiError error; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for InlineObject. */ + protected InlineObject() {} + + /** + * Set the error of this {@link InlineObject} instance and return the same instance. + * + * @param error The error of this {@link InlineObject} + * @return The same instance of this {@link InlineObject} class + */ + @Nonnull + public InlineObject error(@Nullable final ApiError error) { + this.error = error; + return this; + } + + /** + * Get error + * + * @return error The error of this {@link InlineObject} instance. + */ + @Nonnull + public ApiError getError() { + return error; + } + + /** + * Set the error of this {@link InlineObject} instance. + * + * @param error The error of this {@link InlineObject} + */ + public void setError(@Nullable final ApiError error) { + this.error = error; + } + + /** + * Get the names of the unrecognizable properties of the {@link InlineObject}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link InlineObject} 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("InlineObject has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link InlineObject} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (error != null) declaredFields.put("error", error); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link InlineObject} 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 InlineObject inlineObject = (InlineObject) o; + return Objects.equals(this.cloudSdkCustomFields, inlineObject.cloudSdkCustomFields) + && Objects.equals(this.error, inlineObject.error); + } + + @Override + public int hashCode() { + return Objects.hash(error, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class InlineObject {\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 new {@link InlineObject} instance. No arguments are required. */ + public static InlineObject create() { + return new InlineObject(); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/KeyValueListPair.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/KeyValueListPair.java new file mode 100644 index 000000000..7e920c44f --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/KeyValueListPair.java @@ -0,0 +1,261 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** KeyValueListPair */ +@Beta // CHECKSTYLE:OFF +public class KeyValueListPair +// CHECKSTYLE:ON +{ + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for KeyValueListPair. */ + protected KeyValueListPair() {} + + /** + * Set the key of this {@link KeyValueListPair} instance and return the same instance. + * + * @param key The key of this {@link KeyValueListPair} + * @return The same instance of this {@link KeyValueListPair} class + */ + @Nonnull + public KeyValueListPair key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link KeyValueListPair} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link KeyValueListPair} instance. + * + * @param key The key of this {@link KeyValueListPair} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link KeyValueListPair} instance and return the same instance. + * + * @param value The value of this {@link KeyValueListPair} + * @return The same instance of this {@link KeyValueListPair} class + */ + @Nonnull + public KeyValueListPair value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link KeyValueListPair}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link KeyValueListPair} + */ + @Nonnull + public KeyValueListPair addValueItem(@Nonnull final String valueItem) { + if (this.value == null) { + this.value = new ArrayList<>(); + } + this.value.add(valueItem); + return this; + } + + /** + * Get value + * + * @return value The value of this {@link KeyValueListPair} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link KeyValueListPair} instance. + * + * @param value The value of this {@link KeyValueListPair} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Get the names of the unrecognizable properties of the {@link KeyValueListPair}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link KeyValueListPair} instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException("KeyValueListPair has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link KeyValueListPair} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (key != null) declaredFields.put("key", key); + if (value != null) declaredFields.put("value", value); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link KeyValueListPair} instance. If the map previously + * contained a mapping for the key, the old value is replaced by the specified value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final KeyValueListPair keyValueListPair = (KeyValueListPair) o; + return Objects.equals(this.cloudSdkCustomFields, keyValueListPair.cloudSdkCustomFields) + && Objects.equals(this.key, keyValueListPair.key) + && Objects.equals(this.value, keyValueListPair.value); + } + + @Override + public int hashCode() { + return Objects.hash(key, value, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class KeyValueListPair {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link KeyValueListPair} + * instance with all required arguments. + */ + public static Builder create() { + return (key) -> (value) -> new KeyValueListPair().key(key).value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the key of this {@link KeyValueListPair} instance. + * + * @param key The key of this {@link KeyValueListPair} + * @return The KeyValueListPair builder. + */ + Builder1 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the value of this {@link KeyValueListPair} instance. + * + * @param value The value of this {@link KeyValueListPair} + * @return The KeyValueListPair instance. + */ + KeyValueListPair value(@Nonnull final List value); + + /** + * Set the value of this {@link KeyValueListPair} instance. + * + * @param value The value of this {@link KeyValueListPair} + * @return The KeyValueListPair instance. + */ + default KeyValueListPair value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PerFilterSearchResult.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PerFilterSearchResult.java new file mode 100644 index 000000000..229e3d2d3 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PerFilterSearchResult.java @@ -0,0 +1,263 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** PerFilterSearchResult */ +@Beta // CHECKSTYLE:OFF +public class PerFilterSearchResult +// CHECKSTYLE:ON +{ + @JsonProperty("filterId") + private String filterId; + + @JsonProperty("results") + private List results = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PerFilterSearchResult. */ + protected PerFilterSearchResult() {} + + /** + * Set the filterId of this {@link PerFilterSearchResult} instance and return the same instance. + * + * @param filterId The filterId of this {@link PerFilterSearchResult} + * @return The same instance of this {@link PerFilterSearchResult} class + */ + @Nonnull + public PerFilterSearchResult filterId(@Nonnull final String filterId) { + this.filterId = filterId; + return this; + } + + /** + * Get filterId + * + * @return filterId The filterId of this {@link PerFilterSearchResult} instance. + */ + @Nonnull + public String getFilterId() { + return filterId; + } + + /** + * Set the filterId of this {@link PerFilterSearchResult} instance. + * + * @param filterId The filterId of this {@link PerFilterSearchResult} + */ + public void setFilterId(@Nonnull final String filterId) { + this.filterId = filterId; + } + + /** + * Set the results of this {@link PerFilterSearchResult} instance and return the same instance. + * + * @param results The results of this {@link PerFilterSearchResult} + * @return The same instance of this {@link PerFilterSearchResult} class + */ + @Nonnull + public PerFilterSearchResult results(@Nonnull final List results) { + this.results = results; + return this; + } + + /** + * Add one results instance to this {@link PerFilterSearchResult}. + * + * @param resultsItem The results that should be added + * @return The same instance of type {@link PerFilterSearchResult} + */ + @Nonnull + public PerFilterSearchResult addResultsItem(@Nonnull final DocumentsChunk resultsItem) { + if (this.results == null) { + this.results = new ArrayList<>(); + } + this.results.add(resultsItem); + return this; + } + + /** + * Get results + * + * @return results The results of this {@link PerFilterSearchResult} instance. + */ + @Nonnull + public List getResults() { + return results; + } + + /** + * Set the results of this {@link PerFilterSearchResult} instance. + * + * @param results The results of this {@link PerFilterSearchResult} + */ + public void setResults(@Nonnull final List results) { + this.results = results; + } + + /** + * Get the names of the unrecognizable properties of the {@link PerFilterSearchResult}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PerFilterSearchResult} 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( + "PerFilterSearchResult has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PerFilterSearchResult} 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); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PerFilterSearchResult} 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 PerFilterSearchResult perFilterSearchResult = (PerFilterSearchResult) o; + return Objects.equals(this.cloudSdkCustomFields, perFilterSearchResult.cloudSdkCustomFields) + && Objects.equals(this.filterId, perFilterSearchResult.filterId) + && Objects.equals(this.results, perFilterSearchResult.results); + } + + @Override + public int hashCode() { + return Objects.hash(filterId, results, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PerFilterSearchResult {\n"); + sb.append(" filterId: ").append(toIndentedString(filterId)).append("\n"); + sb.append(" results: ").append(toIndentedString(results)).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 PerFilterSearchResult} + * instance with all required arguments. + */ + public static Builder create() { + return (filterId) -> + (results) -> new PerFilterSearchResult().filterId(filterId).results(results); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the filterId of this {@link PerFilterSearchResult} instance. + * + * @param filterId The filterId of this {@link PerFilterSearchResult} + * @return The PerFilterSearchResult builder. + */ + Builder1 filterId(@Nonnull final String filterId); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the results of this {@link PerFilterSearchResult} instance. + * + * @param results The results of this {@link PerFilterSearchResult} + * @return The PerFilterSearchResult instance. + */ + PerFilterSearchResult results(@Nonnull final List results); + + /** + * Set the results of this {@link PerFilterSearchResult} instance. + * + * @param results The results of this {@link PerFilterSearchResult} + * @return The PerFilterSearchResult instance. + */ + default PerFilterSearchResult results(@Nonnull final DocumentsChunk... results) { + return results(Arrays.asList(results)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Pipeline.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Pipeline.java new file mode 100644 index 000000000..0f938fa52 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Pipeline.java @@ -0,0 +1,245 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** Pipeline */ +@Beta // CHECKSTYLE:OFF +public class Pipeline +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + @JsonProperty("type") + private String type; + + @JsonProperty("configuration") + private PipelineConfiguration _configuration; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for Pipeline. */ + protected Pipeline() {} + + /** + * Set the id of this {@link Pipeline} instance and return the same instance. + * + * @param id The id of this {@link Pipeline} + * @return The same instance of this {@link Pipeline} class + */ + @Nonnull + public Pipeline id(@Nullable final String id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link Pipeline} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link Pipeline} instance. + * + * @param id The id of this {@link Pipeline} + */ + public void setId(@Nullable final String id) { + this.id = id; + } + + /** + * Set the type of this {@link Pipeline} instance and return the same instance. + * + * @param type The type of this {@link Pipeline} + * @return The same instance of this {@link Pipeline} class + */ + @Nonnull + public Pipeline type(@Nullable final String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link Pipeline} instance. + */ + @Nonnull + public String getType() { + return type; + } + + /** + * Set the type of this {@link Pipeline} instance. + * + * @param type The type of this {@link Pipeline} + */ + public void setType(@Nullable final String type) { + this.type = type; + } + + /** + * Set the _configuration of this {@link Pipeline} instance and return the same instance. + * + * @param _configuration The _configuration of this {@link Pipeline} + * @return The same instance of this {@link Pipeline} class + */ + @Nonnull + public Pipeline _configuration(@Nullable final PipelineConfiguration _configuration) { + this._configuration = _configuration; + return this; + } + + /** + * Get _configuration + * + * @return _configuration The _configuration of this {@link Pipeline} instance. + */ + @Nonnull + public PipelineConfiguration getConfiguration() { + return _configuration; + } + + /** + * Set the _configuration of this {@link Pipeline} instance. + * + * @param _configuration The _configuration of this {@link Pipeline} + */ + public void setConfiguration(@Nullable final PipelineConfiguration _configuration) { + this._configuration = _configuration; + } + + /** + * Get the names of the unrecognizable properties of the {@link Pipeline}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Pipeline} 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("Pipeline has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Pipeline} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (id != null) declaredFields.put("id", id); + if (type != null) declaredFields.put("type", type); + if (_configuration != null) declaredFields.put("_configuration", _configuration); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Pipeline} 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 Pipeline pipeline = (Pipeline) o; + return Objects.equals(this.cloudSdkCustomFields, pipeline.cloudSdkCustomFields) + && Objects.equals(this.id, pipeline.id) + && Objects.equals(this.type, pipeline.type) + && Objects.equals(this._configuration, pipeline._configuration); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, _configuration, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Pipeline {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" _configuration: ").append(toIndentedString(_configuration)).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 Pipeline} instance. No arguments are required. */ + public static Pipeline create() { + return new Pipeline(); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineConfiguration.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineConfiguration.java new file mode 100644 index 000000000..520f70862 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineConfiguration.java @@ -0,0 +1,211 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** PipelineConfiguration */ +@Beta // CHECKSTYLE:OFF +public class PipelineConfiguration +// CHECKSTYLE:ON +{ + @JsonProperty("destination") + private String destination; + + @JsonProperty("sharePoint") + private PipelineConfigurationSharePoint sharePoint; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PipelineConfiguration. */ + protected PipelineConfiguration() {} + + /** + * Set the destination of this {@link PipelineConfiguration} instance and return the same + * instance. + * + * @param destination The destination of this {@link PipelineConfiguration} + * @return The same instance of this {@link PipelineConfiguration} class + */ + @Nonnull + public PipelineConfiguration destination(@Nullable final String destination) { + this.destination = destination; + return this; + } + + /** + * Get destination + * + * @return destination The destination of this {@link PipelineConfiguration} instance. + */ + @Nonnull + public String getDestination() { + return destination; + } + + /** + * Set the destination of this {@link PipelineConfiguration} instance. + * + * @param destination The destination of this {@link PipelineConfiguration} + */ + public void setDestination(@Nullable final String destination) { + this.destination = destination; + } + + /** + * Set the sharePoint of this {@link PipelineConfiguration} instance and return the same instance. + * + * @param sharePoint The sharePoint of this {@link PipelineConfiguration} + * @return The same instance of this {@link PipelineConfiguration} class + */ + @Nonnull + public PipelineConfiguration sharePoint( + @Nullable final PipelineConfigurationSharePoint sharePoint) { + this.sharePoint = sharePoint; + return this; + } + + /** + * Get sharePoint + * + * @return sharePoint The sharePoint of this {@link PipelineConfiguration} instance. + */ + @Nonnull + public PipelineConfigurationSharePoint getSharePoint() { + return sharePoint; + } + + /** + * Set the sharePoint of this {@link PipelineConfiguration} instance. + * + * @param sharePoint The sharePoint of this {@link PipelineConfiguration} + */ + public void setSharePoint(@Nullable final PipelineConfigurationSharePoint sharePoint) { + this.sharePoint = sharePoint; + } + + /** + * Get the names of the unrecognizable properties of the {@link PipelineConfiguration}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PipelineConfiguration} 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( + "PipelineConfiguration has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PipelineConfiguration} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (destination != null) declaredFields.put("destination", destination); + if (sharePoint != null) declaredFields.put("sharePoint", sharePoint); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PipelineConfiguration} 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 PipelineConfiguration pipelineConfiguration = (PipelineConfiguration) o; + return Objects.equals(this.cloudSdkCustomFields, pipelineConfiguration.cloudSdkCustomFields) + && Objects.equals(this.destination, pipelineConfiguration.destination) + && Objects.equals(this.sharePoint, pipelineConfiguration.sharePoint); + } + + @Override + public int hashCode() { + return Objects.hash(destination, sharePoint, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PipelineConfiguration {\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append(" sharePoint: ").append(toIndentedString(sharePoint)).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 PipelineConfiguration} instance. No arguments are required. */ + public static PipelineConfiguration create() { + return new PipelineConfiguration(); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineConfigurationSharePoint.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineConfigurationSharePoint.java new file mode 100644 index 000000000..9659852d4 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineConfigurationSharePoint.java @@ -0,0 +1,178 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** PipelineConfigurationSharePoint */ +@Beta // CHECKSTYLE:OFF +public class PipelineConfigurationSharePoint +// CHECKSTYLE:ON +{ + @JsonProperty("site") + private PipelineConfigurationSharePointSite site; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PipelineConfigurationSharePoint. */ + protected PipelineConfigurationSharePoint() {} + + /** + * Set the site of this {@link PipelineConfigurationSharePoint} instance and return the same + * instance. + * + * @param site The site of this {@link PipelineConfigurationSharePoint} + * @return The same instance of this {@link PipelineConfigurationSharePoint} class + */ + @Nonnull + public PipelineConfigurationSharePoint site( + @Nullable final PipelineConfigurationSharePointSite site) { + this.site = site; + return this; + } + + /** + * Get site + * + * @return site The site of this {@link PipelineConfigurationSharePoint} instance. + */ + @Nonnull + public PipelineConfigurationSharePointSite getSite() { + return site; + } + + /** + * Set the site of this {@link PipelineConfigurationSharePoint} instance. + * + * @param site The site of this {@link PipelineConfigurationSharePoint} + */ + public void setSite(@Nullable final PipelineConfigurationSharePointSite site) { + this.site = site; + } + + /** + * Get the names of the unrecognizable properties of the {@link PipelineConfigurationSharePoint}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PipelineConfigurationSharePoint} + * 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( + "PipelineConfigurationSharePoint has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PipelineConfigurationSharePoint} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (site != null) declaredFields.put("site", site); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PipelineConfigurationSharePoint} 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 PipelineConfigurationSharePoint pipelineConfigurationSharePoint = + (PipelineConfigurationSharePoint) o; + return Objects.equals( + this.cloudSdkCustomFields, pipelineConfigurationSharePoint.cloudSdkCustomFields) + && Objects.equals(this.site, pipelineConfigurationSharePoint.site); + } + + @Override + public int hashCode() { + return Objects.hash(site, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PipelineConfigurationSharePoint {\n"); + sb.append(" site: ").append(toIndentedString(site)).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 PipelineConfigurationSharePoint} instance. No arguments are required. */ + public static PipelineConfigurationSharePoint create() { + return new PipelineConfigurationSharePoint(); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineConfigurationSharePointSite.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineConfigurationSharePointSite.java new file mode 100644 index 000000000..898ca0170 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineConfigurationSharePointSite.java @@ -0,0 +1,276 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** PipelineConfigurationSharePointSite */ +@Beta // CHECKSTYLE:OFF +public class PipelineConfigurationSharePointSite +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + @JsonProperty("name") + private String name; + + @JsonProperty("includePaths") + private List includePaths = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PipelineConfigurationSharePointSite. */ + protected PipelineConfigurationSharePointSite() {} + + /** + * Set the id of this {@link PipelineConfigurationSharePointSite} instance and return the same + * instance. + * + * @param id The id of this {@link PipelineConfigurationSharePointSite} + * @return The same instance of this {@link PipelineConfigurationSharePointSite} class + */ + @Nonnull + public PipelineConfigurationSharePointSite id(@Nullable final String id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link PipelineConfigurationSharePointSite} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link PipelineConfigurationSharePointSite} instance. + * + * @param id The id of this {@link PipelineConfigurationSharePointSite} + */ + public void setId(@Nullable final String id) { + this.id = id; + } + + /** + * Set the name of this {@link PipelineConfigurationSharePointSite} instance and return the same + * instance. + * + * @param name The name of this {@link PipelineConfigurationSharePointSite} + * @return The same instance of this {@link PipelineConfigurationSharePointSite} class + */ + @Nonnull + public PipelineConfigurationSharePointSite name(@Nullable final String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link PipelineConfigurationSharePointSite} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link PipelineConfigurationSharePointSite} instance. + * + * @param name The name of this {@link PipelineConfigurationSharePointSite} + */ + public void setName(@Nullable final String name) { + this.name = name; + } + + /** + * Set the includePaths of this {@link PipelineConfigurationSharePointSite} instance and return + * the same instance. + * + * @param includePaths The includePaths of this {@link PipelineConfigurationSharePointSite} + * @return The same instance of this {@link PipelineConfigurationSharePointSite} class + */ + @Nonnull + public PipelineConfigurationSharePointSite includePaths( + @Nullable final List includePaths) { + this.includePaths = includePaths; + return this; + } + + /** + * Add one includePaths instance to this {@link PipelineConfigurationSharePointSite}. + * + * @param includePathsItem The includePaths that should be added + * @return The same instance of type {@link PipelineConfigurationSharePointSite} + */ + @Nonnull + public PipelineConfigurationSharePointSite addIncludePathsItem( + @Nonnull final String includePathsItem) { + if (this.includePaths == null) { + this.includePaths = new ArrayList<>(); + } + this.includePaths.add(includePathsItem); + return this; + } + + /** + * Get includePaths + * + * @return includePaths The includePaths of this {@link PipelineConfigurationSharePointSite} + * instance. + */ + @Nonnull + public List getIncludePaths() { + return includePaths; + } + + /** + * Set the includePaths of this {@link PipelineConfigurationSharePointSite} instance. + * + * @param includePaths The includePaths of this {@link PipelineConfigurationSharePointSite} + */ + public void setIncludePaths(@Nullable final List includePaths) { + this.includePaths = includePaths; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * PipelineConfigurationSharePointSite}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PipelineConfigurationSharePointSite} + * 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( + "PipelineConfigurationSharePointSite has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PipelineConfigurationSharePointSite} 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 (name != null) declaredFields.put("name", name); + if (includePaths != null) declaredFields.put("includePaths", includePaths); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PipelineConfigurationSharePointSite} 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 PipelineConfigurationSharePointSite pipelineConfigurationSharePointSite = + (PipelineConfigurationSharePointSite) o; + return Objects.equals( + this.cloudSdkCustomFields, pipelineConfigurationSharePointSite.cloudSdkCustomFields) + && Objects.equals(this.id, pipelineConfigurationSharePointSite.id) + && Objects.equals(this.name, pipelineConfigurationSharePointSite.name) + && Objects.equals(this.includePaths, pipelineConfigurationSharePointSite.includePaths); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, includePaths, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PipelineConfigurationSharePointSite {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" includePaths: ").append(toIndentedString(includePaths)).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 PipelineConfigurationSharePointSite} instance. No arguments are required. + */ + public static PipelineConfigurationSharePointSite create() { + return new PipelineConfigurationSharePointSite(); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineId.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineId.java new file mode 100644 index 000000000..110c31f82 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineId.java @@ -0,0 +1,171 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** PipelineId */ +@Beta // CHECKSTYLE:OFF +public class PipelineId +// CHECKSTYLE:ON +{ + @JsonProperty("pipelineId") + private String pipelineId; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PipelineId. */ + protected PipelineId() {} + + /** + * Set the pipelineId of this {@link PipelineId} instance and return the same instance. + * + * @param pipelineId The pipelineId of this {@link PipelineId} + * @return The same instance of this {@link PipelineId} class + */ + @Nonnull + public PipelineId pipelineId(@Nullable final String pipelineId) { + this.pipelineId = pipelineId; + return this; + } + + /** + * Get pipelineId + * + * @return pipelineId The pipelineId of this {@link PipelineId} instance. + */ + @Nonnull + public String getPipelineId() { + return pipelineId; + } + + /** + * Set the pipelineId of this {@link PipelineId} instance. + * + * @param pipelineId The pipelineId of this {@link PipelineId} + */ + public void setPipelineId(@Nullable final String pipelineId) { + this.pipelineId = pipelineId; + } + + /** + * Get the names of the unrecognizable properties of the {@link PipelineId}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PipelineId} 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("PipelineId has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PipelineId} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (pipelineId != null) declaredFields.put("pipelineId", pipelineId); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PipelineId} 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 PipelineId pipelineId = (PipelineId) o; + return Objects.equals(this.cloudSdkCustomFields, pipelineId.cloudSdkCustomFields) + && Objects.equals(this.pipelineId, pipelineId.pipelineId); + } + + @Override + public int hashCode() { + return Objects.hash(pipelineId, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PipelineId {\n"); + sb.append(" pipelineId: ").append(toIndentedString(pipelineId)).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 PipelineId} instance. No arguments are required. */ + public static PipelineId create() { + return new PipelineId(); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelinePostRequst.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelinePostRequst.java new file mode 100644 index 000000000..e2b1fc748 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelinePostRequst.java @@ -0,0 +1,237 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** PipelinePostRequst */ +@Beta // CHECKSTYLE:OFF +public class PipelinePostRequst +// CHECKSTYLE:ON +{ + @JsonProperty("type") + private String type; + + @JsonProperty("configuration") + private PipelinePostRequstConfiguration _configuration; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PipelinePostRequst. */ + protected PipelinePostRequst() {} + + /** + * Set the type of this {@link PipelinePostRequst} instance and return the same instance. + * + * @param type The type of this {@link PipelinePostRequst} + * @return The same instance of this {@link PipelinePostRequst} class + */ + @Nonnull + public PipelinePostRequst type(@Nonnull final String type) { + this.type = type; + return this; + } + + /** + * Get type + * + * @return type The type of this {@link PipelinePostRequst} instance. + */ + @Nonnull + public String getType() { + return type; + } + + /** + * Set the type of this {@link PipelinePostRequst} instance. + * + * @param type The type of this {@link PipelinePostRequst} + */ + public void setType(@Nonnull final String type) { + this.type = type; + } + + /** + * Set the _configuration of this {@link PipelinePostRequst} instance and return the same + * instance. + * + * @param _configuration The _configuration of this {@link PipelinePostRequst} + * @return The same instance of this {@link PipelinePostRequst} class + */ + @Nonnull + public PipelinePostRequst _configuration( + @Nonnull final PipelinePostRequstConfiguration _configuration) { + this._configuration = _configuration; + return this; + } + + /** + * Get _configuration + * + * @return _configuration The _configuration of this {@link PipelinePostRequst} instance. + */ + @Nonnull + public PipelinePostRequstConfiguration getConfiguration() { + return _configuration; + } + + /** + * Set the _configuration of this {@link PipelinePostRequst} instance. + * + * @param _configuration The _configuration of this {@link PipelinePostRequst} + */ + public void setConfiguration(@Nonnull final PipelinePostRequstConfiguration _configuration) { + this._configuration = _configuration; + } + + /** + * Get the names of the unrecognizable properties of the {@link PipelinePostRequst}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PipelinePostRequst} 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("PipelinePostRequst has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PipelinePostRequst} 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 (_configuration != null) declaredFields.put("_configuration", _configuration); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PipelinePostRequst} 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 PipelinePostRequst pipelinePostRequst = (PipelinePostRequst) o; + return Objects.equals(this.cloudSdkCustomFields, pipelinePostRequst.cloudSdkCustomFields) + && Objects.equals(this.type, pipelinePostRequst.type) + && Objects.equals(this._configuration, pipelinePostRequst._configuration); + } + + @Override + public int hashCode() { + return Objects.hash(type, _configuration, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PipelinePostRequst {\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" _configuration: ").append(toIndentedString(_configuration)).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 PipelinePostRequst} + * instance with all required arguments. + */ + public static Builder create() { + return (type) -> + (_configuration) -> new PipelinePostRequst().type(type)._configuration(_configuration); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the type of this {@link PipelinePostRequst} instance. + * + * @param type The type of this {@link PipelinePostRequst} + * @return The PipelinePostRequst builder. + */ + Builder1 type(@Nonnull final String type); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the _configuration of this {@link PipelinePostRequst} instance. + * + * @param _configuration The _configuration of this {@link PipelinePostRequst} + * @return The PipelinePostRequst instance. + */ + PipelinePostRequst _configuration( + @Nonnull final PipelinePostRequstConfiguration _configuration); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelinePostRequstConfiguration.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelinePostRequstConfiguration.java new file mode 100644 index 000000000..6fe57ff4e --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelinePostRequstConfiguration.java @@ -0,0 +1,230 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** PipelinePostRequstConfiguration */ +@Beta // CHECKSTYLE:OFF +public class PipelinePostRequstConfiguration +// CHECKSTYLE:ON +{ + @JsonProperty("destination") + private String destination; + + @JsonProperty("sharePoint") + private PipelinePostRequstConfigurationSharePoint sharePoint; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PipelinePostRequstConfiguration. */ + protected PipelinePostRequstConfiguration() {} + + /** + * Set the destination of this {@link PipelinePostRequstConfiguration} instance and return the + * same instance. + * + * @param destination The destination of this {@link PipelinePostRequstConfiguration} + * @return The same instance of this {@link PipelinePostRequstConfiguration} class + */ + @Nonnull + public PipelinePostRequstConfiguration destination(@Nonnull final String destination) { + this.destination = destination; + return this; + } + + /** + * Get destination + * + * @return destination The destination of this {@link PipelinePostRequstConfiguration} instance. + */ + @Nonnull + public String getDestination() { + return destination; + } + + /** + * Set the destination of this {@link PipelinePostRequstConfiguration} instance. + * + * @param destination The destination of this {@link PipelinePostRequstConfiguration} + */ + public void setDestination(@Nonnull final String destination) { + this.destination = destination; + } + + /** + * Set the sharePoint of this {@link PipelinePostRequstConfiguration} instance and return the same + * instance. + * + * @param sharePoint The sharePoint of this {@link PipelinePostRequstConfiguration} + * @return The same instance of this {@link PipelinePostRequstConfiguration} class + */ + @Nonnull + public PipelinePostRequstConfiguration sharePoint( + @Nullable final PipelinePostRequstConfigurationSharePoint sharePoint) { + this.sharePoint = sharePoint; + return this; + } + + /** + * Get sharePoint + * + * @return sharePoint The sharePoint of this {@link PipelinePostRequstConfiguration} instance. + */ + @Nonnull + public PipelinePostRequstConfigurationSharePoint getSharePoint() { + return sharePoint; + } + + /** + * Set the sharePoint of this {@link PipelinePostRequstConfiguration} instance. + * + * @param sharePoint The sharePoint of this {@link PipelinePostRequstConfiguration} + */ + public void setSharePoint(@Nullable final PipelinePostRequstConfigurationSharePoint sharePoint) { + this.sharePoint = sharePoint; + } + + /** + * Get the names of the unrecognizable properties of the {@link PipelinePostRequstConfiguration}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PipelinePostRequstConfiguration} + * 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( + "PipelinePostRequstConfiguration has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PipelinePostRequstConfiguration} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (destination != null) declaredFields.put("destination", destination); + if (sharePoint != null) declaredFields.put("sharePoint", sharePoint); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PipelinePostRequstConfiguration} 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 PipelinePostRequstConfiguration pipelinePostRequstConfiguration = + (PipelinePostRequstConfiguration) o; + return Objects.equals( + this.cloudSdkCustomFields, pipelinePostRequstConfiguration.cloudSdkCustomFields) + && Objects.equals(this.destination, pipelinePostRequstConfiguration.destination) + && Objects.equals(this.sharePoint, pipelinePostRequstConfiguration.sharePoint); + } + + @Override + public int hashCode() { + return Objects.hash(destination, sharePoint, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PipelinePostRequstConfiguration {\n"); + sb.append(" destination: ").append(toIndentedString(destination)).append("\n"); + sb.append(" sharePoint: ").append(toIndentedString(sharePoint)).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 + * PipelinePostRequstConfiguration} instance with all required arguments. + */ + public static Builder create() { + return (destination) -> new PipelinePostRequstConfiguration().destination(destination); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the destination of this {@link PipelinePostRequstConfiguration} instance. + * + * @param destination The destination of this {@link PipelinePostRequstConfiguration} + * @return The PipelinePostRequstConfiguration instance. + */ + PipelinePostRequstConfiguration destination(@Nonnull final String destination); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelinePostRequstConfigurationSharePoint.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelinePostRequstConfigurationSharePoint.java new file mode 100644 index 000000000..7ae852f1e --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelinePostRequstConfigurationSharePoint.java @@ -0,0 +1,183 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** PipelinePostRequstConfigurationSharePoint */ +@Beta // CHECKSTYLE:OFF +public class PipelinePostRequstConfigurationSharePoint +// CHECKSTYLE:ON +{ + @JsonProperty("site") + private PipelinePostRequstConfigurationSharePointSite site; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PipelinePostRequstConfigurationSharePoint. */ + protected PipelinePostRequstConfigurationSharePoint() {} + + /** + * Set the site of this {@link PipelinePostRequstConfigurationSharePoint} instance and return the + * same instance. + * + * @param site The site of this {@link PipelinePostRequstConfigurationSharePoint} + * @return The same instance of this {@link PipelinePostRequstConfigurationSharePoint} class + */ + @Nonnull + public PipelinePostRequstConfigurationSharePoint site( + @Nullable final PipelinePostRequstConfigurationSharePointSite site) { + this.site = site; + return this; + } + + /** + * Get site + * + * @return site The site of this {@link PipelinePostRequstConfigurationSharePoint} instance. + */ + @Nonnull + public PipelinePostRequstConfigurationSharePointSite getSite() { + return site; + } + + /** + * Set the site of this {@link PipelinePostRequstConfigurationSharePoint} instance. + * + * @param site The site of this {@link PipelinePostRequstConfigurationSharePoint} + */ + public void setSite(@Nullable final PipelinePostRequstConfigurationSharePointSite site) { + this.site = site; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * PipelinePostRequstConfigurationSharePoint}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link + * PipelinePostRequstConfigurationSharePoint} 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( + "PipelinePostRequstConfigurationSharePoint has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PipelinePostRequstConfigurationSharePoint} + * instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (site != null) declaredFields.put("site", site); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PipelinePostRequstConfigurationSharePoint} + * 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 PipelinePostRequstConfigurationSharePoint pipelinePostRequstConfigurationSharePoint = + (PipelinePostRequstConfigurationSharePoint) o; + return Objects.equals( + this.cloudSdkCustomFields, + pipelinePostRequstConfigurationSharePoint.cloudSdkCustomFields) + && Objects.equals(this.site, pipelinePostRequstConfigurationSharePoint.site); + } + + @Override + public int hashCode() { + return Objects.hash(site, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PipelinePostRequstConfigurationSharePoint {\n"); + sb.append(" site: ").append(toIndentedString(site)).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 PipelinePostRequstConfigurationSharePoint} instance. No arguments are + * required. + */ + public static PipelinePostRequstConfigurationSharePoint create() { + return new PipelinePostRequstConfigurationSharePoint(); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelinePostRequstConfigurationSharePointSite.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelinePostRequstConfigurationSharePointSite.java new file mode 100644 index 000000000..f334bb7b8 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelinePostRequstConfigurationSharePointSite.java @@ -0,0 +1,244 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** PipelinePostRequstConfigurationSharePointSite */ +@Beta // CHECKSTYLE:OFF +public class PipelinePostRequstConfigurationSharePointSite +// CHECKSTYLE:ON +{ + @JsonProperty("name") + private String name; + + @JsonProperty("includePaths") + private List includePaths = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PipelinePostRequstConfigurationSharePointSite. */ + protected PipelinePostRequstConfigurationSharePointSite() {} + + /** + * Set the name of this {@link PipelinePostRequstConfigurationSharePointSite} instance and return + * the same instance. + * + * @param name The name of this {@link PipelinePostRequstConfigurationSharePointSite} + * @return The same instance of this {@link PipelinePostRequstConfigurationSharePointSite} class + */ + @Nonnull + public PipelinePostRequstConfigurationSharePointSite name(@Nullable final String name) { + this.name = name; + return this; + } + + /** + * Get name + * + * @return name The name of this {@link PipelinePostRequstConfigurationSharePointSite} instance. + */ + @Nonnull + public String getName() { + return name; + } + + /** + * Set the name of this {@link PipelinePostRequstConfigurationSharePointSite} instance. + * + * @param name The name of this {@link PipelinePostRequstConfigurationSharePointSite} + */ + public void setName(@Nullable final String name) { + this.name = name; + } + + /** + * Set the includePaths of this {@link PipelinePostRequstConfigurationSharePointSite} instance and + * return the same instance. + * + * @param includePaths The includePaths of this {@link + * PipelinePostRequstConfigurationSharePointSite} + * @return The same instance of this {@link PipelinePostRequstConfigurationSharePointSite} class + */ + @Nonnull + public PipelinePostRequstConfigurationSharePointSite includePaths( + @Nullable final List includePaths) { + this.includePaths = includePaths; + return this; + } + + /** + * Add one includePaths instance to this {@link PipelinePostRequstConfigurationSharePointSite}. + * + * @param includePathsItem The includePaths that should be added + * @return The same instance of type {@link PipelinePostRequstConfigurationSharePointSite} + */ + @Nonnull + public PipelinePostRequstConfigurationSharePointSite addIncludePathsItem( + @Nonnull final String includePathsItem) { + if (this.includePaths == null) { + this.includePaths = new ArrayList<>(); + } + this.includePaths.add(includePathsItem); + return this; + } + + /** + * Get includePaths + * + * @return includePaths The includePaths of this {@link + * PipelinePostRequstConfigurationSharePointSite} instance. + */ + @Nonnull + public List getIncludePaths() { + return includePaths; + } + + /** + * Set the includePaths of this {@link PipelinePostRequstConfigurationSharePointSite} instance. + * + * @param includePaths The includePaths of this {@link + * PipelinePostRequstConfigurationSharePointSite} + */ + public void setIncludePaths(@Nullable final List includePaths) { + this.includePaths = includePaths; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * PipelinePostRequstConfigurationSharePointSite}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link + * PipelinePostRequstConfigurationSharePointSite} 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( + "PipelinePostRequstConfigurationSharePointSite has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PipelinePostRequstConfigurationSharePointSite} + * instance including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (name != null) declaredFields.put("name", name); + if (includePaths != null) declaredFields.put("includePaths", includePaths); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PipelinePostRequstConfigurationSharePointSite} + * 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 PipelinePostRequstConfigurationSharePointSite + pipelinePostRequstConfigurationSharePointSite = + (PipelinePostRequstConfigurationSharePointSite) o; + return Objects.equals( + this.cloudSdkCustomFields, + pipelinePostRequstConfigurationSharePointSite.cloudSdkCustomFields) + && Objects.equals(this.name, pipelinePostRequstConfigurationSharePointSite.name) + && Objects.equals( + this.includePaths, pipelinePostRequstConfigurationSharePointSite.includePaths); + } + + @Override + public int hashCode() { + return Objects.hash(name, includePaths, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PipelinePostRequstConfigurationSharePointSite {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" includePaths: ").append(toIndentedString(includePaths)).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 PipelinePostRequstConfigurationSharePointSite} instance. No arguments are + * required. + */ + public static PipelinePostRequstConfigurationSharePointSite create() { + return new PipelinePostRequstConfigurationSharePointSite(); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineStatus.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineStatus.java new file mode 100644 index 000000000..7386aecbc --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/PipelineStatus.java @@ -0,0 +1,172 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +import java.time.OffsetDateTime; +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; + +/** PipelineStatus */ +@Beta // CHECKSTYLE:OFF +public class PipelineStatus +// CHECKSTYLE:ON +{ + @JsonProperty("lastStarted") + private OffsetDateTime lastStarted; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for PipelineStatus. */ + protected PipelineStatus() {} + + /** + * Set the lastStarted of this {@link PipelineStatus} instance and return the same instance. + * + * @param lastStarted The lastStarted of this {@link PipelineStatus} + * @return The same instance of this {@link PipelineStatus} class + */ + @Nonnull + public PipelineStatus lastStarted(@Nullable final OffsetDateTime lastStarted) { + this.lastStarted = lastStarted; + return this; + } + + /** + * Get lastStarted + * + * @return lastStarted The lastStarted of this {@link PipelineStatus} instance. + */ + @Nonnull + public OffsetDateTime getLastStarted() { + return lastStarted; + } + + /** + * Set the lastStarted of this {@link PipelineStatus} instance. + * + * @param lastStarted The lastStarted of this {@link PipelineStatus} + */ + public void setLastStarted(@Nullable final OffsetDateTime lastStarted) { + this.lastStarted = lastStarted; + } + + /** + * Get the names of the unrecognizable properties of the {@link PipelineStatus}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link PipelineStatus} 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("PipelineStatus has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link PipelineStatus} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (lastStarted != null) declaredFields.put("lastStarted", lastStarted); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link PipelineStatus} 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 PipelineStatus pipelineStatus = (PipelineStatus) o; + return Objects.equals(this.cloudSdkCustomFields, pipelineStatus.cloudSdkCustomFields) + && Objects.equals(this.lastStarted, pipelineStatus.lastStarted); + } + + @Override + public int hashCode() { + return Objects.hash(lastStarted, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class PipelineStatus {\n"); + sb.append(" lastStarted: ").append(toIndentedString(lastStarted)).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 PipelineStatus} instance. No arguments are required. */ + public static PipelineStatus create() { + return new PipelineStatus(); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Pipelines.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Pipelines.java new file mode 100644 index 000000000..8d44155c8 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/Pipelines.java @@ -0,0 +1,250 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** Pipelines */ +@Beta // CHECKSTYLE:OFF +public class Pipelines +// CHECKSTYLE:ON +{ + @JsonProperty("resources") + private List resources = new ArrayList<>(); + + @JsonProperty("count") + private Integer count; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for Pipelines. */ + protected Pipelines() {} + + /** + * Set the resources of this {@link Pipelines} instance and return the same instance. + * + * @param resources The resources of this {@link Pipelines} + * @return The same instance of this {@link Pipelines} class + */ + @Nonnull + public Pipelines resources(@Nonnull final List resources) { + this.resources = resources; + return this; + } + + /** + * Add one resources instance to this {@link Pipelines}. + * + * @param resourcesItem The resources that should be added + * @return The same instance of type {@link Pipelines} + */ + @Nonnull + public Pipelines addResourcesItem(@Nonnull final Pipeline resourcesItem) { + if (this.resources == null) { + this.resources = new ArrayList<>(); + } + this.resources.add(resourcesItem); + return this; + } + + /** + * Get resources + * + * @return resources The resources of this {@link Pipelines} instance. + */ + @Nonnull + public List getResources() { + return resources; + } + + /** + * Set the resources of this {@link Pipelines} instance. + * + * @param resources The resources of this {@link Pipelines} + */ + public void setResources(@Nonnull final List resources) { + this.resources = resources; + } + + /** + * Set the count of this {@link Pipelines} instance and return the same instance. + * + * @param count The count of this {@link Pipelines} + * @return The same instance of this {@link Pipelines} class + */ + @Nonnull + public Pipelines count(@Nullable final Integer count) { + this.count = count; + return this; + } + + /** + * Get count + * + * @return count The count of this {@link Pipelines} instance. + */ + @Nonnull + public Integer getCount() { + return count; + } + + /** + * Set the count of this {@link Pipelines} instance. + * + * @param count The count of this {@link Pipelines} + */ + public void setCount(@Nullable final Integer count) { + this.count = count; + } + + /** + * Get the names of the unrecognizable properties of the {@link Pipelines}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link Pipelines} 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("Pipelines has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link Pipelines} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (resources != null) declaredFields.put("resources", resources); + if (count != null) declaredFields.put("count", count); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link Pipelines} 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 Pipelines pipelines = (Pipelines) o; + return Objects.equals(this.cloudSdkCustomFields, pipelines.cloudSdkCustomFields) + && Objects.equals(this.resources, pipelines.resources) + && Objects.equals(this.count, pipelines.count); + } + + @Override + public int hashCode() { + return Objects.hash(resources, count, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Pipelines {\n"); + sb.append(" resources: ").append(toIndentedString(resources)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).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 Pipelines} instance + * with all required arguments. + */ + public static Builder create() { + return (resources) -> new Pipelines().resources(resources); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the resources of this {@link Pipelines} instance. + * + * @param resources The resources of this {@link Pipelines} + * @return The Pipelines instance. + */ + Pipelines resources(@Nonnull final List resources); + + /** + * Set the resources of this {@link Pipelines} instance. + * + * @param resources The resources of this {@link Pipelines} + * @return The Pipelines instance. + */ + default Pipelines resources(@Nonnull final Pipeline... resources) { + return resources(Arrays.asList(resources)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner.java new file mode 100644 index 000000000..735cca0cd --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner.java @@ -0,0 +1,261 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** ResultsInner */ +@Beta // CHECKSTYLE:OFF +public class ResultsInner +// CHECKSTYLE:ON +{ + @JsonProperty("filterId") + private String filterId; + + @JsonProperty("results") + private List results = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ResultsInner. */ + protected ResultsInner() {} + + /** + * Set the filterId of this {@link ResultsInner} instance and return the same instance. + * + * @param filterId The filterId of this {@link ResultsInner} + * @return The same instance of this {@link ResultsInner} class + */ + @Nonnull + public ResultsInner filterId(@Nonnull final String filterId) { + this.filterId = filterId; + return this; + } + + /** + * Get filterId + * + * @return filterId The filterId of this {@link ResultsInner} instance. + */ + @Nonnull + public String getFilterId() { + return filterId; + } + + /** + * Set the filterId of this {@link ResultsInner} instance. + * + * @param filterId The filterId of this {@link ResultsInner} + */ + public void setFilterId(@Nonnull final String filterId) { + this.filterId = filterId; + } + + /** + * Set the results of this {@link ResultsInner} instance and return the same instance. + * + * @param results The results of this {@link ResultsInner} + * @return The same instance of this {@link ResultsInner} class + */ + @Nonnull + public ResultsInner results(@Nonnull final List results) { + this.results = results; + return this; + } + + /** + * Add one results instance to this {@link ResultsInner}. + * + * @param resultsItem The results that should be added + * @return The same instance of type {@link ResultsInner} + */ + @Nonnull + public ResultsInner addResultsItem(@Nonnull final DocumentsChunk resultsItem) { + if (this.results == null) { + this.results = new ArrayList<>(); + } + this.results.add(resultsItem); + return this; + } + + /** + * Get results + * + * @return results The results of this {@link ResultsInner} instance. + */ + @Nonnull + public List getResults() { + return results; + } + + /** + * Set the results of this {@link ResultsInner} instance. + * + * @param results The results of this {@link ResultsInner} + */ + public void setResults(@Nonnull final List results) { + this.results = results; + } + + /** + * Get the names of the unrecognizable properties of the {@link ResultsInner}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ResultsInner} 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("ResultsInner has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ResultsInner} 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); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ResultsInner} 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 ResultsInner resultsInner = (ResultsInner) o; + return Objects.equals(this.cloudSdkCustomFields, resultsInner.cloudSdkCustomFields) + && Objects.equals(this.filterId, resultsInner.filterId) + && Objects.equals(this.results, resultsInner.results); + } + + @Override + public int hashCode() { + return Objects.hash(filterId, results, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ResultsInner {\n"); + sb.append(" filterId: ").append(toIndentedString(filterId)).append("\n"); + sb.append(" results: ").append(toIndentedString(results)).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 ResultsInner} instance + * with all required arguments. + */ + public static Builder create() { + return (filterId) -> (results) -> new ResultsInner().filterId(filterId).results(results); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the filterId of this {@link ResultsInner} instance. + * + * @param filterId The filterId of this {@link ResultsInner} + * @return The ResultsInner builder. + */ + Builder1 filterId(@Nonnull final String filterId); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the results of this {@link ResultsInner} instance. + * + * @param results The results of this {@link ResultsInner} + * @return The ResultsInner instance. + */ + ResultsInner results(@Nonnull final List results); + + /** + * Set the results of this {@link ResultsInner} instance. + * + * @param results The results of this {@link ResultsInner} + * @return The ResultsInner instance. + */ + default ResultsInner results(@Nonnull final DocumentsChunk... results) { + return results(Arrays.asList(results)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner1.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner1.java new file mode 100644 index 000000000..fb0ffb9a8 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/ResultsInner1.java @@ -0,0 +1,288 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** ResultsInner1 */ +@Beta // CHECKSTYLE:OFF +public class ResultsInner1 +// CHECKSTYLE:ON +{ + @JsonProperty("filterId") + private String filterId; + + @JsonProperty("results") + private List results = new ArrayList<>(); + + @JsonProperty("message") + private String message; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for ResultsInner1. */ + protected ResultsInner1() {} + + /** + * Set the filterId of this {@link ResultsInner1} instance and return the same instance. + * + * @param filterId The filterId of this {@link ResultsInner1} + * @return The same instance of this {@link ResultsInner1} class + */ + @Nonnull + public ResultsInner1 filterId(@Nonnull final String filterId) { + this.filterId = filterId; + return this; + } + + /** + * Get filterId + * + * @return filterId The filterId of this {@link ResultsInner1} instance. + */ + @Nonnull + public String getFilterId() { + return filterId; + } + + /** + * Set the filterId of this {@link ResultsInner1} instance. + * + * @param filterId The filterId of this {@link ResultsInner1} + */ + public void setFilterId(@Nonnull final String filterId) { + this.filterId = filterId; + } + + /** + * Set the results of this {@link ResultsInner1} instance and return the same instance. + * + * @param results List of returned results. + * @return The same instance of this {@link ResultsInner1} class + */ + @Nonnull + public ResultsInner1 results(@Nullable final List results) { + this.results = results; + return this; + } + + /** + * Add one results instance to this {@link ResultsInner1}. + * + * @param resultsItem The results that should be added + * @return The same instance of type {@link ResultsInner1} + */ + @Nonnull + public ResultsInner1 addResultsItem( + @Nonnull final RetievalDataRepositorySearchResult 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 ResultsInner1} instance. + */ + @Nonnull + public List getResults() { + return results; + } + + /** + * Set the results of this {@link ResultsInner1} instance. + * + * @param results List of returned results. + */ + public void setResults(@Nullable final List results) { + this.results = results; + } + + /** + * Set the message of this {@link ResultsInner1} instance and return the same instance. + * + * @param message The message of this {@link ResultsInner1} + * @return The same instance of this {@link ResultsInner1} class + */ + @Nonnull + public ResultsInner1 message(@Nonnull final String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link ResultsInner1} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link ResultsInner1} instance. + * + * @param message The message of this {@link ResultsInner1} + */ + public void setMessage(@Nonnull final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link ResultsInner1}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link ResultsInner1} 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("ResultsInner1 has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link ResultsInner1} 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 (message != null) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link ResultsInner1} 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 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.message, resultsInner1.message); + } + + @Override + public int hashCode() { + return Objects.hash(filterId, results, message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ResultsInner1 {\n"); + sb.append(" filterId: ").append(toIndentedString(filterId)).append("\n"); + sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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 ResultsInner1} instance + * with all required arguments. + */ + public static Builder create() { + return (filterId) -> (message) -> new ResultsInner1().filterId(filterId).message(message); + } + + /** Builder helper class. */ + 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 message of this {@link ResultsInner1} instance. + * + * @param message The message of this {@link ResultsInner1} + * @return The ResultsInner1 instance. + */ + ResultsInner1 message(@Nonnull final String message); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetievalDataRepositorySearchResult.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetievalDataRepositorySearchResult.java new file mode 100644 index 000000000..92add50bb --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetievalDataRepositorySearchResult.java @@ -0,0 +1,196 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** RetievalDataRepositorySearchResult */ +@Beta // CHECKSTYLE:OFF +public class RetievalDataRepositorySearchResult +// CHECKSTYLE:ON +{ + @JsonProperty("dataRepository") + private DataRepositoryWithDocuments dataRepository; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for RetievalDataRepositorySearchResult. */ + protected RetievalDataRepositorySearchResult() {} + + /** + * Set the dataRepository of this {@link RetievalDataRepositorySearchResult} instance and return + * the same instance. + * + * @param dataRepository The dataRepository of this {@link RetievalDataRepositorySearchResult} + * @return The same instance of this {@link RetievalDataRepositorySearchResult} class + */ + @Nonnull + public RetievalDataRepositorySearchResult dataRepository( + @Nonnull final DataRepositoryWithDocuments dataRepository) { + this.dataRepository = dataRepository; + return this; + } + + /** + * Get dataRepository + * + * @return dataRepository The dataRepository of this {@link RetievalDataRepositorySearchResult} + * instance. + */ + @Nonnull + public DataRepositoryWithDocuments getDataRepository() { + return dataRepository; + } + + /** + * Set the dataRepository of this {@link RetievalDataRepositorySearchResult} instance. + * + * @param dataRepository The dataRepository of this {@link RetievalDataRepositorySearchResult} + */ + public void setDataRepository(@Nonnull final DataRepositoryWithDocuments dataRepository) { + this.dataRepository = dataRepository; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * RetievalDataRepositorySearchResult}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link RetievalDataRepositorySearchResult} + * 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( + "RetievalDataRepositorySearchResult has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RetievalDataRepositorySearchResult} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (dataRepository != null) declaredFields.put("dataRepository", dataRepository); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RetievalDataRepositorySearchResult} 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 RetievalDataRepositorySearchResult retievalDataRepositorySearchResult = + (RetievalDataRepositorySearchResult) o; + return Objects.equals( + this.cloudSdkCustomFields, retievalDataRepositorySearchResult.cloudSdkCustomFields) + && Objects.equals(this.dataRepository, retievalDataRepositorySearchResult.dataRepository); + } + + @Override + public int hashCode() { + return Objects.hash(dataRepository, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class RetievalDataRepositorySearchResult {\n"); + sb.append(" dataRepository: ").append(toIndentedString(dataRepository)).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 + * RetievalDataRepositorySearchResult} instance with all required arguments. + */ + public static Builder create() { + return (dataRepository) -> + new RetievalDataRepositorySearchResult().dataRepository(dataRepository); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the dataRepository of this {@link RetievalDataRepositorySearchResult} instance. + * + * @param dataRepository The dataRepository of this {@link RetievalDataRepositorySearchResult} + * @return The RetievalDataRepositorySearchResult instance. + */ + RetievalDataRepositorySearchResult dataRepository( + @Nonnull final DataRepositoryWithDocuments dataRepository); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetievalPerFilterSearchResult.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetievalPerFilterSearchResult.java new file mode 100644 index 000000000..361e7e06e --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetievalPerFilterSearchResult.java @@ -0,0 +1,248 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** RetievalPerFilterSearchResult */ +@Beta // CHECKSTYLE:OFF +public class RetievalPerFilterSearchResult +// CHECKSTYLE:ON +{ + @JsonProperty("filterId") + private String filterId; + + @JsonProperty("results") + private List results = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for RetievalPerFilterSearchResult. */ + protected RetievalPerFilterSearchResult() {} + + /** + * Set the filterId of this {@link RetievalPerFilterSearchResult} instance and return the same + * instance. + * + * @param filterId The filterId of this {@link RetievalPerFilterSearchResult} + * @return The same instance of this {@link RetievalPerFilterSearchResult} class + */ + @Nonnull + public RetievalPerFilterSearchResult filterId(@Nonnull final String filterId) { + this.filterId = filterId; + return this; + } + + /** + * Get filterId + * + * @return filterId The filterId of this {@link RetievalPerFilterSearchResult} instance. + */ + @Nonnull + public String getFilterId() { + return filterId; + } + + /** + * Set the filterId of this {@link RetievalPerFilterSearchResult} instance. + * + * @param filterId The filterId of this {@link RetievalPerFilterSearchResult} + */ + public void setFilterId(@Nonnull final String filterId) { + this.filterId = filterId; + } + + /** + * Set the results of this {@link RetievalPerFilterSearchResult} instance and return the same + * instance. + * + * @param results List of returned results. + * @return The same instance of this {@link RetievalPerFilterSearchResult} class + */ + @Nonnull + public RetievalPerFilterSearchResult results( + @Nullable final List results) { + this.results = results; + return this; + } + + /** + * Add one results instance to this {@link RetievalPerFilterSearchResult}. + * + * @param resultsItem The results that should be added + * @return The same instance of type {@link RetievalPerFilterSearchResult} + */ + @Nonnull + public RetievalPerFilterSearchResult addResultsItem( + @Nonnull final RetievalDataRepositorySearchResult 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 RetievalPerFilterSearchResult} instance. + */ + @Nonnull + public List getResults() { + return results; + } + + /** + * Set the results of this {@link RetievalPerFilterSearchResult} instance. + * + * @param results List of returned results. + */ + public void setResults(@Nullable final List results) { + this.results = results; + } + + /** + * Get the names of the unrecognizable properties of the {@link RetievalPerFilterSearchResult}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link RetievalPerFilterSearchResult} + * 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( + "RetievalPerFilterSearchResult has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RetievalPerFilterSearchResult} 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); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RetievalPerFilterSearchResult} 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 RetievalPerFilterSearchResult retievalPerFilterSearchResult = + (RetievalPerFilterSearchResult) o; + return Objects.equals( + this.cloudSdkCustomFields, retievalPerFilterSearchResult.cloudSdkCustomFields) + && Objects.equals(this.filterId, retievalPerFilterSearchResult.filterId) + && Objects.equals(this.results, retievalPerFilterSearchResult.results); + } + + @Override + public int hashCode() { + return Objects.hash(filterId, results, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class RetievalPerFilterSearchResult {\n"); + sb.append(" filterId: ").append(toIndentedString(filterId)).append("\n"); + sb.append(" results: ").append(toIndentedString(results)).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 + * RetievalPerFilterSearchResult} instance with all required arguments. + */ + public static Builder create() { + return (filterId) -> new RetievalPerFilterSearchResult().filterId(filterId); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the filterId of this {@link RetievalPerFilterSearchResult} instance. + * + * @param filterId The filterId of this {@link RetievalPerFilterSearchResult} + * @return The RetievalPerFilterSearchResult instance. + */ + RetievalPerFilterSearchResult filterId(@Nonnull final String filterId); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetievalPerFilterSearchResultWithError.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetievalPerFilterSearchResultWithError.java new file mode 100644 index 000000000..0d52aa113 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetievalPerFilterSearchResultWithError.java @@ -0,0 +1,192 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** RetievalPerFilterSearchResultWithError */ +@Beta // CHECKSTYLE:OFF +public class RetievalPerFilterSearchResultWithError +// CHECKSTYLE:ON +{ + @JsonProperty("message") + private String message; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for RetievalPerFilterSearchResultWithError. */ + protected RetievalPerFilterSearchResultWithError() {} + + /** + * Set the message of this {@link RetievalPerFilterSearchResultWithError} instance and return the + * same instance. + * + * @param message The message of this {@link RetievalPerFilterSearchResultWithError} + * @return The same instance of this {@link RetievalPerFilterSearchResultWithError} class + */ + @Nonnull + public RetievalPerFilterSearchResultWithError message(@Nonnull final String message) { + this.message = message; + return this; + } + + /** + * Get message + * + * @return message The message of this {@link RetievalPerFilterSearchResultWithError} instance. + */ + @Nonnull + public String getMessage() { + return message; + } + + /** + * Set the message of this {@link RetievalPerFilterSearchResultWithError} instance. + * + * @param message The message of this {@link RetievalPerFilterSearchResultWithError} + */ + public void setMessage(@Nonnull final String message) { + this.message = message; + } + + /** + * Get the names of the unrecognizable properties of the {@link + * RetievalPerFilterSearchResultWithError}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link + * RetievalPerFilterSearchResultWithError} 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( + "RetievalPerFilterSearchResultWithError has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RetievalPerFilterSearchResultWithError} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (message != null) declaredFields.put("message", message); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RetievalPerFilterSearchResultWithError} 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 RetievalPerFilterSearchResultWithError retievalPerFilterSearchResultWithError = + (RetievalPerFilterSearchResultWithError) o; + return Objects.equals( + this.cloudSdkCustomFields, retievalPerFilterSearchResultWithError.cloudSdkCustomFields) + && Objects.equals(this.message, retievalPerFilterSearchResultWithError.message); + } + + @Override + public int hashCode() { + return Objects.hash(message, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class RetievalPerFilterSearchResultWithError {\n"); + sb.append(" message: ").append(toIndentedString(message)).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 + * RetievalPerFilterSearchResultWithError} instance with all required arguments. + */ + public static Builder create() { + return (message) -> new RetievalPerFilterSearchResultWithError().message(message); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the message of this {@link RetievalPerFilterSearchResultWithError} instance. + * + * @param message The message of this {@link RetievalPerFilterSearchResultWithError} + * @return The RetievalPerFilterSearchResultWithError instance. + */ + RetievalPerFilterSearchResultWithError message(@Nonnull final String message); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetievalSearchResults.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetievalSearchResults.java new file mode 100644 index 000000000..f8d39ba41 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetievalSearchResults.java @@ -0,0 +1,214 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** RetievalSearchResults */ +@Beta // CHECKSTYLE:OFF +public class RetievalSearchResults +// CHECKSTYLE:ON +{ + @JsonProperty("results") + private List results = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for RetievalSearchResults. */ + protected RetievalSearchResults() {} + + /** + * Set the results of this {@link RetievalSearchResults} instance and return the same instance. + * + * @param results List of returned results. + * @return The same instance of this {@link RetievalSearchResults} class + */ + @Nonnull + public RetievalSearchResults results(@Nonnull final List results) { + this.results = results; + return this; + } + + /** + * Add one results instance to this {@link RetievalSearchResults}. + * + * @param resultsItem The results that should be added + * @return The same instance of type {@link RetievalSearchResults} + */ + @Nonnull + public RetievalSearchResults addResultsItem(@Nonnull final ResultsInner1 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 RetievalSearchResults} instance. + */ + @Nonnull + public List getResults() { + return results; + } + + /** + * Set the results of this {@link RetievalSearchResults} instance. + * + * @param results List of returned results. + */ + public void setResults(@Nonnull final List results) { + this.results = results; + } + + /** + * Get the names of the unrecognizable properties of the {@link RetievalSearchResults}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link RetievalSearchResults} 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( + "RetievalSearchResults has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RetievalSearchResults} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (results != null) declaredFields.put("results", results); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RetievalSearchResults} 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 RetievalSearchResults retievalSearchResults = (RetievalSearchResults) o; + return Objects.equals(this.cloudSdkCustomFields, retievalSearchResults.cloudSdkCustomFields) + && Objects.equals(this.results, retievalSearchResults.results); + } + + @Override + public int hashCode() { + return Objects.hash(results, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class RetievalSearchResults {\n"); + sb.append(" results: ").append(toIndentedString(results)).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 RetievalSearchResults} + * instance with all required arguments. + */ + public static Builder create() { + return (results) -> new RetievalSearchResults().results(results); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the results of this {@link RetievalSearchResults} instance. + * + * @param results List of returned results. + * @return The RetievalSearchResults instance. + */ + RetievalSearchResults results(@Nonnull final List results); + + /** + * Set the results of this {@link RetievalSearchResults} instance. + * + * @param results List of returned results. + * @return The RetievalSearchResults instance. + */ + default RetievalSearchResults results(@Nonnull final ResultsInner1... results) { + return results(Arrays.asList(results)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalDocument.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalDocument.java new file mode 100644 index 000000000..56c2b1796 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalDocument.java @@ -0,0 +1,313 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** RetrievalDocument */ +@Beta // CHECKSTYLE:OFF +public class RetrievalDocument +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + @JsonProperty("metadata") + private List metadata = new ArrayList<>(); + + @JsonProperty("chunks") + private List chunks = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for RetrievalDocument. */ + protected RetrievalDocument() {} + + /** + * Set the id of this {@link RetrievalDocument} instance and return the same instance. + * + * @param id The id of this {@link RetrievalDocument} + * @return The same instance of this {@link RetrievalDocument} class + */ + @Nonnull + public RetrievalDocument id(@Nonnull final String id) { + this.id = id; + return this; + } + + /** + * Get id + * + * @return id The id of this {@link RetrievalDocument} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link RetrievalDocument} instance. + * + * @param id The id of this {@link RetrievalDocument} + */ + public void setId(@Nonnull final String id) { + this.id = id; + } + + /** + * Set the metadata of this {@link RetrievalDocument} instance and return the same instance. + * + * @param metadata The metadata of this {@link RetrievalDocument} + * @return The same instance of this {@link RetrievalDocument} class + */ + @Nonnull + public RetrievalDocument metadata(@Nullable final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link RetrievalDocument}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link RetrievalDocument} + */ + @Nonnull + public RetrievalDocument addMetadataItem(@Nonnull final DocumentKeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link RetrievalDocument} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link RetrievalDocument} instance. + * + * @param metadata The metadata of this {@link RetrievalDocument} + */ + public void setMetadata(@Nullable final List metadata) { + this.metadata = metadata; + } + + /** + * Set the chunks of this {@link RetrievalDocument} instance and return the same instance. + * + * @param chunks The chunks of this {@link RetrievalDocument} + * @return The same instance of this {@link RetrievalDocument} class + */ + @Nonnull + public RetrievalDocument chunks(@Nonnull final List chunks) { + this.chunks = chunks; + return this; + } + + /** + * Add one chunks instance to this {@link RetrievalDocument}. + * + * @param chunksItem The chunks that should be added + * @return The same instance of type {@link RetrievalDocument} + */ + @Nonnull + public RetrievalDocument addChunksItem(@Nonnull final Chunk chunksItem) { + if (this.chunks == null) { + this.chunks = new ArrayList<>(); + } + this.chunks.add(chunksItem); + return this; + } + + /** + * Get chunks + * + * @return chunks The chunks of this {@link RetrievalDocument} instance. + */ + @Nonnull + public List getChunks() { + return chunks; + } + + /** + * Set the chunks of this {@link RetrievalDocument} instance. + * + * @param chunks The chunks of this {@link RetrievalDocument} + */ + public void setChunks(@Nonnull final List chunks) { + this.chunks = chunks; + } + + /** + * Get the names of the unrecognizable properties of the {@link RetrievalDocument}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link RetrievalDocument} 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("RetrievalDocument has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RetrievalDocument} 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); + if (chunks != null) declaredFields.put("chunks", chunks); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RetrievalDocument} 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 RetrievalDocument retrievalDocument = (RetrievalDocument) o; + return Objects.equals(this.cloudSdkCustomFields, retrievalDocument.cloudSdkCustomFields) + && Objects.equals(this.id, retrievalDocument.id) + && Objects.equals(this.metadata, retrievalDocument.metadata) + && Objects.equals(this.chunks, retrievalDocument.chunks); + } + + @Override + public int hashCode() { + return Objects.hash(id, metadata, chunks, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class RetrievalDocument {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" chunks: ").append(toIndentedString(chunks)).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 RetrievalDocument} + * instance with all required arguments. + */ + public static Builder create() { + return (id) -> (chunks) -> new RetrievalDocument().id(id).chunks(chunks); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link RetrievalDocument} instance. + * + * @param id The id of this {@link RetrievalDocument} + * @return The RetrievalDocument builder. + */ + Builder1 id(@Nonnull final String id); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the chunks of this {@link RetrievalDocument} instance. + * + * @param chunks The chunks of this {@link RetrievalDocument} + * @return The RetrievalDocument instance. + */ + RetrievalDocument chunks(@Nonnull final List chunks); + + /** + * Set the chunks of this {@link RetrievalDocument} instance. + * + * @param chunks The chunks of this {@link RetrievalDocument} + * @return The RetrievalDocument instance. + */ + default RetrievalDocument chunks(@Nonnull final Chunk... chunks) { + return chunks(Arrays.asList(chunks)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchFilter.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchFilter.java new file mode 100644 index 000000000..ccf656b85 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchFilter.java @@ -0,0 +1,525 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** Limit scope of search to certain DataRepositories, Documents or Chunks. */ +@Beta // CHECKSTYLE:OFF +public class RetrievalSearchFilter +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + @JsonProperty("searchConfiguration") + private SearchConfiguration searchConfiguration; + + @JsonProperty("dataRepositories") + private List dataRepositories = new ArrayList<>(Arrays.asList("*")); + + @JsonProperty("dataRepositoryType") + private DataRepositoryType dataRepositoryType; + + @JsonProperty("dataRepositoryMetadata") + private List dataRepositoryMetadata = new ArrayList<>(); + + @JsonProperty("documentMetadata") + private List documentMetadata = new ArrayList<>(); + + @JsonProperty("chunkMetadata") + private List chunkMetadata = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for RetrievalSearchFilter. */ + protected RetrievalSearchFilter() {} + + /** + * Set the id of this {@link RetrievalSearchFilter} instance and return the same instance. + * + * @param id Identifier of this SearchFilter - unique per request. + * @return The same instance of this {@link RetrievalSearchFilter} class + */ + @Nonnull + public RetrievalSearchFilter id(@Nonnull final String id) { + this.id = id; + return this; + } + + /** + * Identifier of this SearchFilter - unique per request. + * + * @return id The id of this {@link RetrievalSearchFilter} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link RetrievalSearchFilter} instance. + * + * @param id Identifier of this SearchFilter - unique per request. + */ + public void setId(@Nonnull final String id) { + this.id = id; + } + + /** + * Set the searchConfiguration of this {@link RetrievalSearchFilter} instance and return the same + * instance. + * + * @param searchConfiguration The searchConfiguration of this {@link RetrievalSearchFilter} + * @return The same instance of this {@link RetrievalSearchFilter} class + */ + @Nonnull + public RetrievalSearchFilter searchConfiguration( + @Nullable final SearchConfiguration searchConfiguration) { + this.searchConfiguration = searchConfiguration; + return this; + } + + /** + * Get searchConfiguration + * + * @return searchConfiguration The searchConfiguration of this {@link RetrievalSearchFilter} + * instance. + */ + @Nonnull + public SearchConfiguration getSearchConfiguration() { + return searchConfiguration; + } + + /** + * Set the searchConfiguration of this {@link RetrievalSearchFilter} instance. + * + * @param searchConfiguration The searchConfiguration of this {@link RetrievalSearchFilter} + */ + public void setSearchConfiguration(@Nullable final SearchConfiguration searchConfiguration) { + this.searchConfiguration = searchConfiguration; + } + + /** + * Set the dataRepositories of this {@link RetrievalSearchFilter} 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 RetrievalSearchFilter} class + */ + @Nonnull + public RetrievalSearchFilter dataRepositories(@Nullable final List dataRepositories) { + this.dataRepositories = dataRepositories; + return this; + } + + /** + * Add one dataRepositories instance to this {@link RetrievalSearchFilter}. + * + * @param dataRepositoriesItem The dataRepositories that should be added + * @return The same instance of type {@link RetrievalSearchFilter} + */ + @Nonnull + public RetrievalSearchFilter 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 RetrievalSearchFilter} instance. + */ + @Nonnull + public List getDataRepositories() { + return dataRepositories; + } + + /** + * Set the dataRepositories of this {@link RetrievalSearchFilter} 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 RetrievalSearchFilter} instance and return the same + * instance. + * + * @param dataRepositoryType The dataRepositoryType of this {@link RetrievalSearchFilter} + * @return The same instance of this {@link RetrievalSearchFilter} class + */ + @Nonnull + public RetrievalSearchFilter dataRepositoryType( + @Nullable final DataRepositoryType dataRepositoryType) { + this.dataRepositoryType = dataRepositoryType; + return this; + } + + /** + * Get dataRepositoryType + * + * @return dataRepositoryType The dataRepositoryType of this {@link RetrievalSearchFilter} + * instance. + */ + @Nullable + public DataRepositoryType getDataRepositoryType() { + return dataRepositoryType; + } + + /** + * Set the dataRepositoryType of this {@link RetrievalSearchFilter} instance. + * + * @param dataRepositoryType The dataRepositoryType of this {@link RetrievalSearchFilter} + */ + public void setDataRepositoryType(@Nullable final DataRepositoryType dataRepositoryType) { + this.dataRepositoryType = dataRepositoryType; + } + + /** + * Set the dataRepositoryMetadata of this {@link RetrievalSearchFilter} 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 RetrievalSearchFilter} class + */ + @Nonnull + public RetrievalSearchFilter dataRepositoryMetadata( + @Nullable final List dataRepositoryMetadata) { + this.dataRepositoryMetadata = dataRepositoryMetadata; + return this; + } + + /** + * Add one dataRepositoryMetadata instance to this {@link RetrievalSearchFilter}. + * + * @param dataRepositoryMetadataItem The dataRepositoryMetadata that should be added + * @return The same instance of type {@link RetrievalSearchFilter} + */ + @Nonnull + public RetrievalSearchFilter addDataRepositoryMetadataItem( + @Nonnull final KeyValueListPair dataRepositoryMetadataItem) { + if (this.dataRepositoryMetadata == null) { + this.dataRepositoryMetadata = new ArrayList<>(); + } + this.dataRepositoryMetadata.add(dataRepositoryMetadataItem); + return this; + } + + /** + * Restrict DataRepositories considered during search to those annotated with the given metadata. + * Useful when combined with dataRepositories=['*'] + * + * @return dataRepositoryMetadata The dataRepositoryMetadata of this {@link RetrievalSearchFilter} + * instance. + */ + @Nonnull + public List getDataRepositoryMetadata() { + return dataRepositoryMetadata; + } + + /** + * Set the dataRepositoryMetadata of this {@link RetrievalSearchFilter} 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 RetrievalSearchFilter} 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 RetrievalSearchFilter} class + */ + @Nonnull + public RetrievalSearchFilter documentMetadata( + @Nullable final List documentMetadata) { + this.documentMetadata = documentMetadata; + return this; + } + + /** + * Add one documentMetadata instance to this {@link RetrievalSearchFilter}. + * + * @param documentMetadataItem The documentMetadata that should be added + * @return The same instance of type {@link RetrievalSearchFilter} + */ + @Nonnull + public RetrievalSearchFilter addDocumentMetadataItem( + @Nonnull final SearchDocumentKeyValueListPair documentMetadataItem) { + if (this.documentMetadata == null) { + this.documentMetadata = new ArrayList<>(); + } + this.documentMetadata.add(documentMetadataItem); + return this; + } + + /** + * Restrict documents considered during search to those annotated with the given metadata. + * + * @return documentMetadata The documentMetadata of this {@link RetrievalSearchFilter} instance. + */ + @Nonnull + public List getDocumentMetadata() { + return documentMetadata; + } + + /** + * Set the documentMetadata of this {@link RetrievalSearchFilter} 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 RetrievalSearchFilter} 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 RetrievalSearchFilter} class + */ + @Nonnull + public RetrievalSearchFilter chunkMetadata(@Nullable final List chunkMetadata) { + this.chunkMetadata = chunkMetadata; + return this; + } + + /** + * Add one chunkMetadata instance to this {@link RetrievalSearchFilter}. + * + * @param chunkMetadataItem The chunkMetadata that should be added + * @return The same instance of type {@link RetrievalSearchFilter} + */ + @Nonnull + public RetrievalSearchFilter addChunkMetadataItem( + @Nonnull final KeyValueListPair chunkMetadataItem) { + if (this.chunkMetadata == null) { + this.chunkMetadata = new ArrayList<>(); + } + this.chunkMetadata.add(chunkMetadataItem); + return this; + } + + /** + * Restrict chunks considered during search to those with the given metadata. + * + * @return chunkMetadata The chunkMetadata of this {@link RetrievalSearchFilter} instance. + */ + @Nonnull + public List getChunkMetadata() { + return chunkMetadata; + } + + /** + * Set the chunkMetadata of this {@link RetrievalSearchFilter} instance. + * + * @param chunkMetadata Restrict chunks considered during search to those with the given metadata. + */ + public void setChunkMetadata(@Nullable final List chunkMetadata) { + this.chunkMetadata = chunkMetadata; + } + + /** + * Get the names of the unrecognizable properties of the {@link RetrievalSearchFilter}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link RetrievalSearchFilter} 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( + "RetrievalSearchFilter has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RetrievalSearchFilter} 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 (dataRepositoryMetadata != null) + declaredFields.put("dataRepositoryMetadata", dataRepositoryMetadata); + if (documentMetadata != null) declaredFields.put("documentMetadata", documentMetadata); + if (chunkMetadata != null) declaredFields.put("chunkMetadata", chunkMetadata); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RetrievalSearchFilter} 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 RetrievalSearchFilter retrievalSearchFilter = (RetrievalSearchFilter) o; + return Objects.equals(this.cloudSdkCustomFields, retrievalSearchFilter.cloudSdkCustomFields) + && Objects.equals(this.id, retrievalSearchFilter.id) + && Objects.equals(this.searchConfiguration, retrievalSearchFilter.searchConfiguration) + && Objects.equals(this.dataRepositories, retrievalSearchFilter.dataRepositories) + && Objects.equals(this.dataRepositoryType, retrievalSearchFilter.dataRepositoryType) + && Objects.equals(this.dataRepositoryMetadata, retrievalSearchFilter.dataRepositoryMetadata) + && Objects.equals(this.documentMetadata, retrievalSearchFilter.documentMetadata) + && Objects.equals(this.chunkMetadata, retrievalSearchFilter.chunkMetadata); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + searchConfiguration, + dataRepositories, + dataRepositoryType, + dataRepositoryMetadata, + documentMetadata, + chunkMetadata, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class RetrievalSearchFilter {\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(" dataRepositoryMetadata: ") + .append(toIndentedString(dataRepositoryMetadata)) + .append("\n"); + sb.append(" documentMetadata: ").append(toIndentedString(documentMetadata)).append("\n"); + sb.append(" chunkMetadata: ").append(toIndentedString(chunkMetadata)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link RetrievalSearchFilter} + * instance with all required arguments. + */ + public static Builder create() { + return (id) -> + (dataRepositoryType) -> + new RetrievalSearchFilter().id(id).dataRepositoryType(dataRepositoryType); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link RetrievalSearchFilter} instance. + * + * @param id Identifier of this SearchFilter - unique per request. + * @return The RetrievalSearchFilter builder. + */ + Builder1 id(@Nonnull final String id); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the dataRepositoryType of this {@link RetrievalSearchFilter} instance. + * + * @param dataRepositoryType The dataRepositoryType of this {@link RetrievalSearchFilter} + * @return The RetrievalSearchFilter instance. + */ + RetrievalSearchFilter dataRepositoryType(@Nullable final DataRepositoryType dataRepositoryType); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInput.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInput.java new file mode 100644 index 000000000..70babbb27 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/RetrievalSearchInput.java @@ -0,0 +1,262 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** RetrievalSearchInput */ +@Beta // CHECKSTYLE:OFF +public class RetrievalSearchInput +// CHECKSTYLE:ON +{ + @JsonProperty("query") + private String query; + + @JsonProperty("filters") + private List filters = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for RetrievalSearchInput. */ + protected RetrievalSearchInput() {} + + /** + * Set the query of this {@link RetrievalSearchInput} instance and return the same instance. + * + * @param query Query string + * @return The same instance of this {@link RetrievalSearchInput} class + */ + @Nonnull + public RetrievalSearchInput query(@Nonnull final String query) { + this.query = query; + return this; + } + + /** + * Query string + * + * @return query The query of this {@link RetrievalSearchInput} instance. + */ + @Nonnull + public String getQuery() { + return query; + } + + /** + * Set the query of this {@link RetrievalSearchInput} instance. + * + * @param query Query string + */ + public void setQuery(@Nonnull final String query) { + this.query = query; + } + + /** + * Set the filters of this {@link RetrievalSearchInput} instance and return the same instance. + * + * @param filters The filters of this {@link RetrievalSearchInput} + * @return The same instance of this {@link RetrievalSearchInput} class + */ + @Nonnull + public RetrievalSearchInput filters(@Nonnull final List filters) { + this.filters = filters; + return this; + } + + /** + * Add one filters instance to this {@link RetrievalSearchInput}. + * + * @param filtersItem The filters that should be added + * @return The same instance of type {@link RetrievalSearchInput} + */ + @Nonnull + public RetrievalSearchInput addFiltersItem(@Nonnull final RetrievalSearchFilter filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * Get filters + * + * @return filters The filters of this {@link RetrievalSearchInput} instance. + */ + @Nonnull + public List getFilters() { + return filters; + } + + /** + * Set the filters of this {@link RetrievalSearchInput} instance. + * + * @param filters The filters of this {@link RetrievalSearchInput} + */ + public void setFilters(@Nonnull final List filters) { + this.filters = filters; + } + + /** + * Get the names of the unrecognizable properties of the {@link RetrievalSearchInput}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link RetrievalSearchInput} 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( + "RetrievalSearchInput has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link RetrievalSearchInput} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (query != null) declaredFields.put("query", query); + if (filters != null) declaredFields.put("filters", filters); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link RetrievalSearchInput} 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 RetrievalSearchInput retrievalSearchInput = (RetrievalSearchInput) o; + return Objects.equals(this.cloudSdkCustomFields, retrievalSearchInput.cloudSdkCustomFields) + && Objects.equals(this.query, retrievalSearchInput.query) + && Objects.equals(this.filters, retrievalSearchInput.filters); + } + + @Override + public int hashCode() { + return Objects.hash(query, filters, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class RetrievalSearchInput {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link RetrievalSearchInput} + * instance with all required arguments. + */ + public static Builder create() { + return (query) -> (filters) -> new RetrievalSearchInput().query(query).filters(filters); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the query of this {@link RetrievalSearchInput} instance. + * + * @param query Query string + * @return The RetrievalSearchInput builder. + */ + Builder1 query(@Nonnull final String query); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the filters of this {@link RetrievalSearchInput} instance. + * + * @param filters The filters of this {@link RetrievalSearchInput} + * @return The RetrievalSearchInput instance. + */ + RetrievalSearchInput filters(@Nonnull final List filters); + + /** + * Set the filters of this {@link RetrievalSearchInput} instance. + * + * @param filters The filters of this {@link RetrievalSearchInput} + * @return The RetrievalSearchInput instance. + */ + default RetrievalSearchInput filters(@Nonnull final RetrievalSearchFilter... filters) { + return filters(Arrays.asList(filters)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchConfiguration.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchConfiguration.java new file mode 100644 index 000000000..ff8eac94d --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchConfiguration.java @@ -0,0 +1,220 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** SearchConfiguration */ +@Beta // CHECKSTYLE:OFF +public class SearchConfiguration +// CHECKSTYLE:ON +{ + @JsonProperty("maxChunkCount") + private Integer maxChunkCount; + + @JsonProperty("maxDocumentCount") + private Integer maxDocumentCount; + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for SearchConfiguration. */ + protected SearchConfiguration() {} + + /** + * Set the maxChunkCount of this {@link SearchConfiguration} instance and return the same + * instance. + * + * @param maxChunkCount Maximum number of chunks to be returned. Cannot be used with + * 'maxDocumentCount'. Minimum: 0 Maximum: 0 + * @return The same instance of this {@link SearchConfiguration} class + */ + @Nonnull + public SearchConfiguration maxChunkCount(@Nullable final Integer maxChunkCount) { + this.maxChunkCount = maxChunkCount; + return this; + } + + /** + * Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. + * minimum: 0 maximum: 0 + * + * @return maxChunkCount The maxChunkCount of this {@link SearchConfiguration} instance. + */ + @Nonnull + public Integer getMaxChunkCount() { + return maxChunkCount; + } + + /** + * Set the maxChunkCount of this {@link SearchConfiguration} instance. + * + * @param maxChunkCount Maximum number of chunks to be returned. Cannot be used with + * 'maxDocumentCount'. Minimum: 0 Maximum: 0 + */ + public void setMaxChunkCount(@Nullable final Integer maxChunkCount) { + this.maxChunkCount = maxChunkCount; + } + + /** + * Set the maxDocumentCount of this {@link SearchConfiguration} instance and return the same + * instance. + * + * @param maxDocumentCount [Only supports 'vector' dataRepositoryType] - Maximum number of + * documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount + * is given, then only one chunk per document is returned. Minimum: 0 Maximum: 0 + * @return The same instance of this {@link SearchConfiguration} class + */ + @Nonnull + public SearchConfiguration maxDocumentCount(@Nullable final Integer maxDocumentCount) { + this.maxDocumentCount = maxDocumentCount; + return this; + } + + /** + * [Only supports 'vector' dataRepositoryType] - Maximum number of documents to be + * returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only + * one chunk per document is returned. minimum: 0 maximum: 0 + * + * @return maxDocumentCount The maxDocumentCount of this {@link SearchConfiguration} instance. + */ + @Nonnull + public Integer getMaxDocumentCount() { + return maxDocumentCount; + } + + /** + * Set the maxDocumentCount of this {@link SearchConfiguration} instance. + * + * @param maxDocumentCount [Only supports 'vector' dataRepositoryType] - Maximum number of + * documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount + * is given, then only one chunk per document is returned. Minimum: 0 Maximum: 0 + */ + public void setMaxDocumentCount(@Nullable final Integer maxDocumentCount) { + this.maxDocumentCount = maxDocumentCount; + } + + /** + * Get the names of the unrecognizable properties of the {@link SearchConfiguration}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SearchConfiguration} 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( + "SearchConfiguration has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SearchConfiguration} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (maxChunkCount != null) declaredFields.put("maxChunkCount", maxChunkCount); + if (maxDocumentCount != null) declaredFields.put("maxDocumentCount", maxDocumentCount); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SearchConfiguration} 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 SearchConfiguration searchConfiguration = (SearchConfiguration) o; + return Objects.equals(this.cloudSdkCustomFields, searchConfiguration.cloudSdkCustomFields) + && Objects.equals(this.maxChunkCount, searchConfiguration.maxChunkCount) + && Objects.equals(this.maxDocumentCount, searchConfiguration.maxDocumentCount); + } + + @Override + public int hashCode() { + return Objects.hash(maxChunkCount, maxDocumentCount, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SearchConfiguration {\n"); + sb.append(" maxChunkCount: ").append(toIndentedString(maxChunkCount)).append("\n"); + sb.append(" maxDocumentCount: ").append(toIndentedString(maxDocumentCount)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** Create a new {@link SearchConfiguration} instance. No arguments are required. */ + public static SearchConfiguration create() { + return new SearchConfiguration(); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchDocumentKeyValueListPair.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchDocumentKeyValueListPair.java new file mode 100644 index 000000000..89ba86ee0 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchDocumentKeyValueListPair.java @@ -0,0 +1,323 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Objects; +import java.util.Set; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +/** SearchDocumentKeyValueListPair */ +@Beta // CHECKSTYLE:OFF +public class SearchDocumentKeyValueListPair +// CHECKSTYLE:ON +{ + @JsonProperty("key") + private String key; + + @JsonProperty("value") + private List value = new ArrayList<>(); + + @JsonProperty("selectMode") + private List selectMode = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for SearchDocumentKeyValueListPair. */ + protected SearchDocumentKeyValueListPair() {} + + /** + * Set the key of this {@link SearchDocumentKeyValueListPair} instance and return the same + * instance. + * + * @param key The key of this {@link SearchDocumentKeyValueListPair} + * @return The same instance of this {@link SearchDocumentKeyValueListPair} class + */ + @Nonnull + public SearchDocumentKeyValueListPair key(@Nonnull final String key) { + this.key = key; + return this; + } + + /** + * Get key + * + * @return key The key of this {@link SearchDocumentKeyValueListPair} instance. + */ + @Nonnull + public String getKey() { + return key; + } + + /** + * Set the key of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param key The key of this {@link SearchDocumentKeyValueListPair} + */ + public void setKey(@Nonnull final String key) { + this.key = key; + } + + /** + * Set the value of this {@link SearchDocumentKeyValueListPair} instance and return the same + * instance. + * + * @param value The value of this {@link SearchDocumentKeyValueListPair} + * @return The same instance of this {@link SearchDocumentKeyValueListPair} class + */ + @Nonnull + public SearchDocumentKeyValueListPair value(@Nonnull final List value) { + this.value = value; + return this; + } + + /** + * Add one value instance to this {@link SearchDocumentKeyValueListPair}. + * + * @param valueItem The value that should be added + * @return The same instance of type {@link SearchDocumentKeyValueListPair} + */ + @Nonnull + public SearchDocumentKeyValueListPair addValueItem(@Nonnull final String valueItem) { + if (this.value == null) { + this.value = new ArrayList<>(); + } + this.value.add(valueItem); + return this; + } + + /** + * Get value + * + * @return value The value of this {@link SearchDocumentKeyValueListPair} instance. + */ + @Nonnull + public List getValue() { + return value; + } + + /** + * Set the value of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param value The value of this {@link SearchDocumentKeyValueListPair} + */ + public void setValue(@Nonnull final List value) { + this.value = value; + } + + /** + * Set the selectMode of this {@link SearchDocumentKeyValueListPair} instance and return the same + * instance. + * + * @param selectMode Select mode for search filters + * @return The same instance of this {@link SearchDocumentKeyValueListPair} class + */ + @Nonnull + public SearchDocumentKeyValueListPair selectMode( + @Nullable final List selectMode) { + this.selectMode = selectMode; + return this; + } + + /** + * Add one selectMode instance to this {@link SearchDocumentKeyValueListPair}. + * + * @param selectModeItem The selectMode that should be added + * @return The same instance of type {@link SearchDocumentKeyValueListPair} + */ + @Nonnull + public SearchDocumentKeyValueListPair addSelectModeItem( + @Nonnull final SearchSelectOptionEnum selectModeItem) { + if (this.selectMode == null) { + this.selectMode = new ArrayList<>(); + } + this.selectMode.add(selectModeItem); + return this; + } + + /** + * Select mode for search filters + * + * @return selectMode The selectMode of this {@link SearchDocumentKeyValueListPair} instance. + */ + @Nonnull + public List getSelectMode() { + return selectMode; + } + + /** + * Set the selectMode of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param selectMode Select mode for search filters + */ + public void setSelectMode(@Nullable final List selectMode) { + this.selectMode = selectMode; + } + + /** + * Get the names of the unrecognizable properties of the {@link SearchDocumentKeyValueListPair}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SearchDocumentKeyValueListPair} + * instance. + * + * @deprecated Use {@link #toMap()} instead. + * @param name The name of the property + * @return The value of the property + * @throws NoSuchElementException If no property with the given name could be found. + */ + @Nullable + @Deprecated + public Object getCustomField(@Nonnull final String name) throws NoSuchElementException { + if (!cloudSdkCustomFields.containsKey(name)) { + throw new NoSuchElementException( + "SearchDocumentKeyValueListPair has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SearchDocumentKeyValueListPair} instance + * including unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (key != null) declaredFields.put("key", key); + if (value != null) declaredFields.put("value", value); + if (selectMode != null) declaredFields.put("selectMode", selectMode); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SearchDocumentKeyValueListPair} instance. If the + * map previously contained a mapping for the key, the old value is replaced by the specified + * value. + * + * @param customFieldName The name of the property + * @param customFieldValue The value of the property + */ + @JsonIgnore + public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue) { + cloudSdkCustomFields.put(customFieldName, customFieldValue); + } + + @Override + public boolean equals(@Nullable final java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final SearchDocumentKeyValueListPair searchDocumentKeyValueListPair = + (SearchDocumentKeyValueListPair) o; + return Objects.equals( + this.cloudSdkCustomFields, searchDocumentKeyValueListPair.cloudSdkCustomFields) + && Objects.equals(this.key, searchDocumentKeyValueListPair.key) + && Objects.equals(this.value, searchDocumentKeyValueListPair.value) + && Objects.equals(this.selectMode, searchDocumentKeyValueListPair.selectMode); + } + + @Override + public int hashCode() { + return Objects.hash(key, value, selectMode, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SearchDocumentKeyValueListPair {\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" selectMode: ").append(toIndentedString(selectMode)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link + * SearchDocumentKeyValueListPair} instance with all required arguments. + */ + public static Builder create() { + return (key) -> (value) -> new SearchDocumentKeyValueListPair().key(key).value(value); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the key of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param key The key of this {@link SearchDocumentKeyValueListPair} + * @return The SearchDocumentKeyValueListPair builder. + */ + Builder1 key(@Nonnull final String key); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the value of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param value The value of this {@link SearchDocumentKeyValueListPair} + * @return The SearchDocumentKeyValueListPair instance. + */ + SearchDocumentKeyValueListPair value(@Nonnull final List value); + + /** + * Set the value of this {@link SearchDocumentKeyValueListPair} instance. + * + * @param value The value of this {@link SearchDocumentKeyValueListPair} + * @return The SearchDocumentKeyValueListPair instance. + */ + default SearchDocumentKeyValueListPair value(@Nonnull final String... value) { + return value(Arrays.asList(value)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchFilter.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchFilter.java new file mode 100644 index 000000000..fd5c629b5 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchFilter.java @@ -0,0 +1,488 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** SearchFilter */ +@Beta // CHECKSTYLE:OFF +public class SearchFilter +// CHECKSTYLE:ON +{ + @JsonProperty("id") + private String id; + + @JsonProperty("collectionIds") + private List collectionIds = new ArrayList<>(); + + @JsonProperty("configuration") + private SearchConfiguration _configuration; + + @JsonProperty("collectionMetadata") + private List collectionMetadata = new ArrayList<>(); + + @JsonProperty("documentMetadata") + private List documentMetadata = new ArrayList<>(); + + @JsonProperty("chunkMetadata") + private List chunkMetadata = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for SearchFilter. */ + protected SearchFilter() {} + + /** + * Set the id of this {@link SearchFilter} instance and return the same instance. + * + * @param id Identifier of this SearchFilter - unique per request. + * @return The same instance of this {@link SearchFilter} class + */ + @Nonnull + public SearchFilter id(@Nonnull final String id) { + this.id = id; + return this; + } + + /** + * Identifier of this SearchFilter - unique per request. + * + * @return id The id of this {@link SearchFilter} instance. + */ + @Nonnull + public String getId() { + return id; + } + + /** + * Set the id of this {@link SearchFilter} instance. + * + * @param id Identifier of this SearchFilter - unique per request. + */ + public void setId(@Nonnull final String id) { + this.id = id; + } + + /** + * Set the collectionIds of this {@link SearchFilter} instance and return the same instance. + * + * @param collectionIds The collectionIds of this {@link SearchFilter} + * @return The same instance of this {@link SearchFilter} class + */ + @Nonnull + public SearchFilter collectionIds(@Nonnull final List collectionIds) { + this.collectionIds = collectionIds; + return this; + } + + /** + * Add one collectionIds instance to this {@link SearchFilter}. + * + * @param collectionIdsItem The collectionIds that should be added + * @return The same instance of type {@link SearchFilter} + */ + @Nonnull + public SearchFilter addCollectionIdsItem(@Nonnull final String collectionIdsItem) { + if (this.collectionIds == null) { + this.collectionIds = new ArrayList<>(); + } + this.collectionIds.add(collectionIdsItem); + return this; + } + + /** + * Get collectionIds + * + * @return collectionIds The collectionIds of this {@link SearchFilter} instance. + */ + @Nonnull + public List getCollectionIds() { + return collectionIds; + } + + /** + * Set the collectionIds of this {@link SearchFilter} instance. + * + * @param collectionIds The collectionIds of this {@link SearchFilter} + */ + public void setCollectionIds(@Nonnull final List collectionIds) { + this.collectionIds = collectionIds; + } + + /** + * Set the _configuration of this {@link SearchFilter} instance and return the same instance. + * + * @param _configuration The _configuration of this {@link SearchFilter} + * @return The same instance of this {@link SearchFilter} class + */ + @Nonnull + public SearchFilter _configuration(@Nonnull final SearchConfiguration _configuration) { + this._configuration = _configuration; + return this; + } + + /** + * Get _configuration + * + * @return _configuration The _configuration of this {@link SearchFilter} instance. + */ + @Nonnull + public SearchConfiguration getConfiguration() { + return _configuration; + } + + /** + * Set the _configuration of this {@link SearchFilter} instance. + * + * @param _configuration The _configuration of this {@link SearchFilter} + */ + public void setConfiguration(@Nonnull final SearchConfiguration _configuration) { + this._configuration = _configuration; + } + + /** + * Set the collectionMetadata of this {@link SearchFilter} instance and return the same instance. + * + * @param collectionMetadata Restrict collections considered during search to those annotated with + * the given metadata. Useful when combined with collections=['*'] + * @return The same instance of this {@link SearchFilter} class + */ + @Nonnull + public SearchFilter collectionMetadata( + @Nullable final List collectionMetadata) { + this.collectionMetadata = collectionMetadata; + return this; + } + + /** + * Add one collectionMetadata instance to this {@link SearchFilter}. + * + * @param collectionMetadataItem The collectionMetadata that should be added + * @return The same instance of type {@link SearchFilter} + */ + @Nonnull + public SearchFilter addCollectionMetadataItem( + @Nonnull final KeyValueListPair collectionMetadataItem) { + if (this.collectionMetadata == null) { + this.collectionMetadata = new ArrayList<>(); + } + this.collectionMetadata.add(collectionMetadataItem); + return this; + } + + /** + * Restrict collections considered during search to those annotated with the given metadata. + * Useful when combined with collections=['*'] + * + * @return collectionMetadata The collectionMetadata of this {@link SearchFilter} instance. + */ + @Nonnull + public List getCollectionMetadata() { + return collectionMetadata; + } + + /** + * Set the collectionMetadata of this {@link SearchFilter} instance. + * + * @param collectionMetadata Restrict collections considered during search to those annotated with + * the given metadata. Useful when combined with collections=['*'] + */ + public void setCollectionMetadata(@Nullable final List collectionMetadata) { + this.collectionMetadata = collectionMetadata; + } + + /** + * Set the documentMetadata of this {@link SearchFilter} 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 SearchFilter} class + */ + @Nonnull + public SearchFilter documentMetadata( + @Nullable final List documentMetadata) { + this.documentMetadata = documentMetadata; + return this; + } + + /** + * Add one documentMetadata instance to this {@link SearchFilter}. + * + * @param documentMetadataItem The documentMetadata that should be added + * @return The same instance of type {@link SearchFilter} + */ + @Nonnull + public SearchFilter addDocumentMetadataItem( + @Nonnull final SearchDocumentKeyValueListPair documentMetadataItem) { + if (this.documentMetadata == null) { + this.documentMetadata = new ArrayList<>(); + } + this.documentMetadata.add(documentMetadataItem); + return this; + } + + /** + * Restrict documents considered during search to those annotated with the given metadata. + * + * @return documentMetadata The documentMetadata of this {@link SearchFilter} instance. + */ + @Nonnull + public List getDocumentMetadata() { + return documentMetadata; + } + + /** + * Set the documentMetadata of this {@link SearchFilter} 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 SearchFilter} 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 SearchFilter} class + */ + @Nonnull + public SearchFilter chunkMetadata(@Nullable final List chunkMetadata) { + this.chunkMetadata = chunkMetadata; + return this; + } + + /** + * Add one chunkMetadata instance to this {@link SearchFilter}. + * + * @param chunkMetadataItem The chunkMetadata that should be added + * @return The same instance of type {@link SearchFilter} + */ + @Nonnull + public SearchFilter addChunkMetadataItem(@Nonnull final KeyValueListPair chunkMetadataItem) { + if (this.chunkMetadata == null) { + this.chunkMetadata = new ArrayList<>(); + } + this.chunkMetadata.add(chunkMetadataItem); + return this; + } + + /** + * Restrict chunks considered during search to those with the given metadata. + * + * @return chunkMetadata The chunkMetadata of this {@link SearchFilter} instance. + */ + @Nonnull + public List getChunkMetadata() { + return chunkMetadata; + } + + /** + * Set the chunkMetadata of this {@link SearchFilter} instance. + * + * @param chunkMetadata Restrict chunks considered during search to those with the given metadata. + */ + public void setChunkMetadata(@Nullable final List chunkMetadata) { + this.chunkMetadata = chunkMetadata; + } + + /** + * Get the names of the unrecognizable properties of the {@link SearchFilter}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SearchFilter} 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("SearchFilter has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SearchFilter} 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 (collectionIds != null) declaredFields.put("collectionIds", collectionIds); + if (_configuration != null) declaredFields.put("_configuration", _configuration); + if (collectionMetadata != null) declaredFields.put("collectionMetadata", collectionMetadata); + if (documentMetadata != null) declaredFields.put("documentMetadata", documentMetadata); + if (chunkMetadata != null) declaredFields.put("chunkMetadata", chunkMetadata); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SearchFilter} 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 SearchFilter searchFilter = (SearchFilter) o; + return Objects.equals(this.cloudSdkCustomFields, searchFilter.cloudSdkCustomFields) + && Objects.equals(this.id, searchFilter.id) + && Objects.equals(this.collectionIds, searchFilter.collectionIds) + && Objects.equals(this._configuration, searchFilter._configuration) + && Objects.equals(this.collectionMetadata, searchFilter.collectionMetadata) + && Objects.equals(this.documentMetadata, searchFilter.documentMetadata) + && Objects.equals(this.chunkMetadata, searchFilter.chunkMetadata); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + collectionIds, + _configuration, + collectionMetadata, + documentMetadata, + chunkMetadata, + cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SearchFilter {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" collectionIds: ").append(toIndentedString(collectionIds)).append("\n"); + sb.append(" _configuration: ").append(toIndentedString(_configuration)).append("\n"); + sb.append(" collectionMetadata: ").append(toIndentedString(collectionMetadata)).append("\n"); + sb.append(" documentMetadata: ").append(toIndentedString(documentMetadata)).append("\n"); + sb.append(" chunkMetadata: ").append(toIndentedString(chunkMetadata)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link SearchFilter} instance + * with all required arguments. + */ + public static Builder create() { + return (id) -> + (collectionIds) -> + (_configuration) -> + new SearchFilter() + .id(id) + .collectionIds(collectionIds) + ._configuration(_configuration); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the id of this {@link SearchFilter} instance. + * + * @param id Identifier of this SearchFilter - unique per request. + * @return The SearchFilter builder. + */ + Builder1 id(@Nonnull final String id); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the collectionIds of this {@link SearchFilter} instance. + * + * @param collectionIds The collectionIds of this {@link SearchFilter} + * @return The SearchFilter builder. + */ + Builder2 collectionIds(@Nonnull final List collectionIds); + + /** + * Set the collectionIds of this {@link SearchFilter} instance. + * + * @param collectionIds The collectionIds of this {@link SearchFilter} + * @return The SearchFilter builder. + */ + default Builder2 collectionIds(@Nonnull final String... collectionIds) { + return collectionIds(Arrays.asList(collectionIds)); + } + } + + /** Builder helper class. */ + public interface Builder2 { + /** + * Set the _configuration of this {@link SearchFilter} instance. + * + * @param _configuration The _configuration of this {@link SearchFilter} + * @return The SearchFilter instance. + */ + SearchFilter _configuration(@Nonnull final SearchConfiguration _configuration); + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchResults.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchResults.java new file mode 100644 index 000000000..54006b046 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchResults.java @@ -0,0 +1,213 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** SearchResults */ +@Beta // CHECKSTYLE:OFF +public class SearchResults +// CHECKSTYLE:ON +{ + @JsonProperty("results") + private List results = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for SearchResults. */ + protected SearchResults() {} + + /** + * Set the results of this {@link SearchResults} instance and return the same instance. + * + * @param results List of returned results. + * @return The same instance of this {@link SearchResults} class + */ + @Nonnull + public SearchResults results(@Nonnull final List results) { + this.results = results; + return this; + } + + /** + * Add one results instance to this {@link SearchResults}. + * + * @param resultsItem The results that should be added + * @return The same instance of type {@link SearchResults} + */ + @Nonnull + public SearchResults addResultsItem(@Nonnull final ResultsInner 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 SearchResults} instance. + */ + @Nonnull + public List getResults() { + return results; + } + + /** + * Set the results of this {@link SearchResults} instance. + * + * @param results List of returned results. + */ + public void setResults(@Nonnull final List results) { + this.results = results; + } + + /** + * Get the names of the unrecognizable properties of the {@link SearchResults}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link SearchResults} 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("SearchResults has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link SearchResults} instance including unrecognized + * properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (results != null) declaredFields.put("results", results); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link SearchResults} 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 SearchResults searchResults = (SearchResults) o; + return Objects.equals(this.cloudSdkCustomFields, searchResults.cloudSdkCustomFields) + && Objects.equals(this.results, searchResults.results); + } + + @Override + public int hashCode() { + return Objects.hash(results, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class SearchResults {\n"); + sb.append(" results: ").append(toIndentedString(results)).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 SearchResults} instance + * with all required arguments. + */ + public static Builder create() { + return (results) -> new SearchResults().results(results); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the results of this {@link SearchResults} instance. + * + * @param results List of returned results. + * @return The SearchResults instance. + */ + SearchResults results(@Nonnull final List results); + + /** + * Set the results of this {@link SearchResults} instance. + * + * @param results List of returned results. + * @return The SearchResults instance. + */ + default SearchResults results(@Nonnull final ResultsInner... results) { + return results(Arrays.asList(results)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchSelectOptionEnum.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchSelectOptionEnum.java new file mode 100644 index 000000000..59262938e --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/SearchSelectOptionEnum.java @@ -0,0 +1,62 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 SearchSelectOptionEnum */ +public enum SearchSelectOptionEnum { + IGNORE_IF_KEY_ABSENT("ignoreIfKeyAbsent"), + + UNKNOWN_DEFAULT_OPEN_API("unknown_default_open_api"); + + private final String value; + + SearchSelectOptionEnum(String value) { + this.value = value; + } + + /** + * @return The enum value. + */ + @JsonValue + public String getValue() { + return value; + } + + /** + * @return The String representation of the enum value. + */ + @Override + @Nonnull + public String toString() { + return String.valueOf(value); + } + + /** + * Converts the given value to its enum representation. + * + * @param value The input value. + * @return The enum representation of the given value. + */ + @JsonCreator + public static SearchSelectOptionEnum fromValue(@Nonnull final String value) { + for (final SearchSelectOptionEnum b : SearchSelectOptionEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + return null; + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextOnlyBaseChunk.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextOnlyBaseChunk.java new file mode 100644 index 000000000..e6df16da1 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextOnlyBaseChunk.java @@ -0,0 +1,261 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** TextOnlyBaseChunk */ +@Beta // CHECKSTYLE:OFF +public class TextOnlyBaseChunk +// 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 TextOnlyBaseChunk. */ + protected TextOnlyBaseChunk() {} + + /** + * Set the content of this {@link TextOnlyBaseChunk} instance and return the same instance. + * + * @param content The content of this {@link TextOnlyBaseChunk} + * @return The same instance of this {@link TextOnlyBaseChunk} class + */ + @Nonnull + public TextOnlyBaseChunk content(@Nonnull final String content) { + this.content = content; + return this; + } + + /** + * Get content + * + * @return content The content of this {@link TextOnlyBaseChunk} instance. + */ + @Nonnull + public String getContent() { + return content; + } + + /** + * Set the content of this {@link TextOnlyBaseChunk} instance. + * + * @param content The content of this {@link TextOnlyBaseChunk} + */ + public void setContent(@Nonnull final String content) { + this.content = content; + } + + /** + * Set the metadata of this {@link TextOnlyBaseChunk} instance and return the same instance. + * + * @param metadata The metadata of this {@link TextOnlyBaseChunk} + * @return The same instance of this {@link TextOnlyBaseChunk} class + */ + @Nonnull + public TextOnlyBaseChunk metadata(@Nonnull final List metadata) { + this.metadata = metadata; + return this; + } + + /** + * Add one metadata instance to this {@link TextOnlyBaseChunk}. + * + * @param metadataItem The metadata that should be added + * @return The same instance of type {@link TextOnlyBaseChunk} + */ + @Nonnull + public TextOnlyBaseChunk addMetadataItem(@Nonnull final KeyValueListPair metadataItem) { + if (this.metadata == null) { + this.metadata = new ArrayList<>(); + } + this.metadata.add(metadataItem); + return this; + } + + /** + * Get metadata + * + * @return metadata The metadata of this {@link TextOnlyBaseChunk} instance. + */ + @Nonnull + public List getMetadata() { + return metadata; + } + + /** + * Set the metadata of this {@link TextOnlyBaseChunk} instance. + * + * @param metadata The metadata of this {@link TextOnlyBaseChunk} + */ + public void setMetadata(@Nonnull final List metadata) { + this.metadata = metadata; + } + + /** + * Get the names of the unrecognizable properties of the {@link TextOnlyBaseChunk}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TextOnlyBaseChunk} 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("TextOnlyBaseChunk has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TextOnlyBaseChunk} 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 TextOnlyBaseChunk} 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 TextOnlyBaseChunk textOnlyBaseChunk = (TextOnlyBaseChunk) o; + return Objects.equals(this.cloudSdkCustomFields, textOnlyBaseChunk.cloudSdkCustomFields) + && Objects.equals(this.content, textOnlyBaseChunk.content) + && Objects.equals(this.metadata, textOnlyBaseChunk.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(content, metadata, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class TextOnlyBaseChunk {\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 TextOnlyBaseChunk} + * instance with all required arguments. + */ + public static Builder create() { + return (content) -> (metadata) -> new TextOnlyBaseChunk().content(content).metadata(metadata); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the content of this {@link TextOnlyBaseChunk} instance. + * + * @param content The content of this {@link TextOnlyBaseChunk} + * @return The TextOnlyBaseChunk builder. + */ + Builder1 content(@Nonnull final String content); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the metadata of this {@link TextOnlyBaseChunk} instance. + * + * @param metadata The metadata of this {@link TextOnlyBaseChunk} + * @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 KeyValueListPair... metadata) { + return metadata(Arrays.asList(metadata)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextSearchRequest.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextSearchRequest.java new file mode 100644 index 000000000..c0b7c9f9f --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/TextSearchRequest.java @@ -0,0 +1,261 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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 com.google.common.annotations.Beta; +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; + +/** TextSearchRequest */ +@Beta // CHECKSTYLE:OFF +public class TextSearchRequest +// CHECKSTYLE:ON +{ + @JsonProperty("query") + private String query; + + @JsonProperty("filters") + private List filters = new ArrayList<>(); + + @JsonAnySetter @JsonAnyGetter + private final Map cloudSdkCustomFields = new LinkedHashMap<>(); + + /** Default constructor for TextSearchRequest. */ + protected TextSearchRequest() {} + + /** + * Set the query of this {@link TextSearchRequest} instance and return the same instance. + * + * @param query Query string + * @return The same instance of this {@link TextSearchRequest} class + */ + @Nonnull + public TextSearchRequest query(@Nonnull final String query) { + this.query = query; + return this; + } + + /** + * Query string + * + * @return query The query of this {@link TextSearchRequest} instance. + */ + @Nonnull + public String getQuery() { + return query; + } + + /** + * Set the query of this {@link TextSearchRequest} instance. + * + * @param query Query string + */ + public void setQuery(@Nonnull final String query) { + this.query = query; + } + + /** + * Set the filters of this {@link TextSearchRequest} instance and return the same instance. + * + * @param filters The filters of this {@link TextSearchRequest} + * @return The same instance of this {@link TextSearchRequest} class + */ + @Nonnull + public TextSearchRequest filters(@Nonnull final List filters) { + this.filters = filters; + return this; + } + + /** + * Add one filters instance to this {@link TextSearchRequest}. + * + * @param filtersItem The filters that should be added + * @return The same instance of type {@link TextSearchRequest} + */ + @Nonnull + public TextSearchRequest addFiltersItem(@Nonnull final SearchFilter filtersItem) { + if (this.filters == null) { + this.filters = new ArrayList<>(); + } + this.filters.add(filtersItem); + return this; + } + + /** + * Get filters + * + * @return filters The filters of this {@link TextSearchRequest} instance. + */ + @Nonnull + public List getFilters() { + return filters; + } + + /** + * Set the filters of this {@link TextSearchRequest} instance. + * + * @param filters The filters of this {@link TextSearchRequest} + */ + public void setFilters(@Nonnull final List filters) { + this.filters = filters; + } + + /** + * Get the names of the unrecognizable properties of the {@link TextSearchRequest}. + * + * @return The set of properties names + */ + @JsonIgnore + @Nonnull + public Set getCustomFieldNames() { + return cloudSdkCustomFields.keySet(); + } + + /** + * Get the value of an unrecognizable property of this {@link TextSearchRequest} 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("TextSearchRequest has no field with name '" + name + "'."); + } + return cloudSdkCustomFields.get(name); + } + + /** + * Get the value of all properties of this {@link TextSearchRequest} instance including + * unrecognized properties. + * + * @return The map of all properties + */ + @JsonIgnore + @Nonnull + public Map toMap() { + final Map declaredFields = new LinkedHashMap<>(cloudSdkCustomFields); + if (query != null) declaredFields.put("query", query); + if (filters != null) declaredFields.put("filters", filters); + return declaredFields; + } + + /** + * Set an unrecognizable property of this {@link TextSearchRequest} 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 TextSearchRequest textSearchRequest = (TextSearchRequest) o; + return Objects.equals(this.cloudSdkCustomFields, textSearchRequest.cloudSdkCustomFields) + && Objects.equals(this.query, textSearchRequest.query) + && Objects.equals(this.filters, textSearchRequest.filters); + } + + @Override + public int hashCode() { + return Objects.hash(query, filters, cloudSdkCustomFields); + } + + @Override + @Nonnull + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class TextSearchRequest {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + cloudSdkCustomFields.forEach( + (k, v) -> + sb.append(" ").append(k).append(": ").append(toIndentedString(v)).append("\n")); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(final java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + /** + * Create a type-safe, fluent-api builder object to construct a new {@link TextSearchRequest} + * instance with all required arguments. + */ + public static Builder create() { + return (query) -> (filters) -> new TextSearchRequest().query(query).filters(filters); + } + + /** Builder helper class. */ + public interface Builder { + /** + * Set the query of this {@link TextSearchRequest} instance. + * + * @param query Query string + * @return The TextSearchRequest builder. + */ + Builder1 query(@Nonnull final String query); + } + + /** Builder helper class. */ + public interface Builder1 { + /** + * Set the filters of this {@link TextSearchRequest} instance. + * + * @param filters The filters of this {@link TextSearchRequest} + * @return The TextSearchRequest instance. + */ + TextSearchRequest filters(@Nonnull final List filters); + + /** + * Set the filters of this {@link TextSearchRequest} instance. + * + * @param filters The filters of this {@link TextSearchRequest} + * @return The TextSearchRequest instance. + */ + default TextSearchRequest filters(@Nonnull final SearchFilter... filters) { + return filters(Arrays.asList(filters)); + } + } +} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorV1VectorEndpointsGetCollectionCreationStatus200Response.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorV1VectorEndpointsGetCollectionCreationStatus200Response.java new file mode 100644 index 000000000..1076ef6ea --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorV1VectorEndpointsGetCollectionCreationStatus200Response.java @@ -0,0 +1,25 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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; +import com.google.common.annotations.Beta; + +/** VectorV1VectorEndpointsGetCollectionCreationStatus200Response */ +@Beta +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CollectionCreatedResponse.class), + @JsonSubTypes.Type(value = CollectionPendingResponse.class), +}) +public interface VectorV1VectorEndpointsGetCollectionCreationStatus200Response {} diff --git a/grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorV1VectorEndpointsGetCollectionDeletionStatus200Response.java b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorV1VectorEndpointsGetCollectionDeletionStatus200Response.java new file mode 100644 index 000000000..ac70f1047 --- /dev/null +++ b/grounding/src/main/java/com/sap/ai/sdk/grounding/model/VectorV1VectorEndpointsGetCollectionDeletionStatus200Response.java @@ -0,0 +1,25 @@ +/* + * Document Grounding Pipeline API + * SAP AI Core - API Specification AI Data Management api's + * + * + * + * 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; +import com.google.common.annotations.Beta; + +/** VectorV1VectorEndpointsGetCollectionDeletionStatus200Response */ +@Beta +@JsonTypeInfo(use = JsonTypeInfo.Id.DEDUCTION) +@JsonSubTypes({ + @JsonSubTypes.Type(value = CollectionDeletedResponse.class), + @JsonSubTypes.Type(value = CollectionPendingResponse.class), +}) +public interface VectorV1VectorEndpointsGetCollectionDeletionStatus200Response {} diff --git a/grounding/src/main/resources/spec/grounding.yaml b/grounding/src/main/resources/spec/grounding.yaml new file mode 100644 index 000000000..7fb749a0d --- /dev/null +++ b/grounding/src/main/resources/spec/grounding.yaml @@ -0,0 +1,1602 @@ +openapi: 3.0.0 +info: + title: Document Grounding Pipeline API + version: 0.1.0 + description: "SAP AI Core - API Specification AI Data Management api's" + contact: + name: SAP AI Core +tags: + - name: pipelines + description: Tag for pipelines component + - name: vector + description: Tag for vector component + - name: retrieval + description: Tag for retrieval component +servers: + - url: '/v2/lm/document-grounding' +paths: + '/pipelines': + post: + operationId: pipeline.v1.pipeline_endpoints.create_pipeline + x-sap-cloud-sdk-operation-name: createPipeline + description: 'Create a pipeline' + tags: + - pipelines + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/PipelinePostRequst' + responses: + '201': + description: Returns pipelineId on successful creation. + content: + application/json: + schema: + $ref: '#/components/schemas/PipelineId' + '400': + $ref: '#/components/responses/BadRequest' + get: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + operationId: pipeline.v1.pipeline_endpoints.get_all_pipelines + x-sap-cloud-sdk-operation-name: getAllPipelines + description: 'Get all pipelines' + tags: + - pipelines + responses: + '200': + description: Returns all pipelines for the tenant. + content: + application/json: + schema: + $ref: '#/components/schemas/Pipelines' + '400': + $ref: '#/components/responses/BadRequest' + '/pipelines/{pipelineId}': + get: + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_by_id + x-sap-cloud-sdk-operation-name: getPipelineById + description: 'Get details of a pipeline by pipeline id' + tags: + - pipelines + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to get. + responses: + '200': + description: Returns the pipeline for an pipelineId + content: + application/json: + schema: + $ref: '#/components/schemas/Pipeline' + '400': + $ref: '#/components/responses/BadRequest' + delete: + operationId: pipeline.v1.pipeline_endpoints.delete_pipeline_by_id + x-sap-cloud-sdk-operation-name: deletePipelineById + description: 'Delete a pipeline by pipeline id' + tags: + - pipelines + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to delete. + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequest' + '/pipelines/{pipelineId}/status': + get: + operationId: pipeline.v1.pipeline_endpoints.get_pipeline_status + x-sap-cloud-sdk-operation-name: getPipelineStatus + description: 'Get pipeline status by pipeline id' + tags: + - pipelines + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - name: pipelineId + in: path + required: true + schema: + type: string + description: The ID of the pipeline to get status. + responses: + '200': + description: Returns the pipeline status for an pipelineId. + content: + application/json: + schema: + $ref: '#/components/schemas/PipelineStatus' + '400': + $ref: '#/components/responses/BadRequest' + '/vector/collections': + get: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + tags: + - vector + summary: Get collections + description: Gets a list of collections. + operationId: vector.v1.vector_endpoints.get_all_collections + x-sap-cloud-sdk-operation-name: getAllCollections + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/CollectionsListResponse' + '400': + $ref: '#/components/responses/BadRequest' + post: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + tags: + - vector + summary: Create collection + description: Creates a collection. This operation is asynchronous. Poll the collection resource and check the status field to understand creation status. + operationId: vector.v1.vector_endpoints.create_collection + x-sap-cloud-sdk-operation-name: createCollection + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CollectionRequest' + required: true + responses: + '202': + description: Successful Response + headers: + Location: + description: The newly created collections monitor url + schema: + $ref: '#/components/schemas/CollectionPendingResponse' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{collectionId}': + get: + tags: + - vector + summary: Get collection by ID + description: Gets a specific collection by ID. + operationId: vector.v1.vector_endpoints.get_collection_by_id + x-sap-cloud-sdk-operation-name: getCollectionById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Collection' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + delete: + tags: + - vector + summary: Delete collection by ID + description: Deletes a specific collection by ID. This operation is asynchronous. Poll the collection for a 404 status code. + operationId: vector.v1.vector_endpoints.delete_collection_by_id + x-sap-cloud-sdk-operation-name: deleteCollectionById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - name: collectionId + in: path + required: true + schema: + type: string + title: Collectionid + responses: + '202': + description: Successful Response + headers: + Location: + description: The deleted collections monitor url + schema: + $ref: '#/components/schemas/CollectionPendingResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{collectionId}/documents/{documentId}': + get: + tags: + - vector + summary: Get document by ID + description: Gets a specific document in a collection by ID. + operationId: vector.v1.vector_endpoints.get_document_by_id + x-sap-cloud-sdk-operation-name: getDocumentById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + - name: documentId + in: path + required: true + schema: + type: string + format: uuid + title: Documentid + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + delete: + tags: + - vector + summary: Delete a document + description: Deletes a specific document of a collection. + operationId: vector.v1.vector_endpoints.delete_document_by_id + x-sap-cloud-sdk-operation-name: deleteDocumentById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + - name: documentId + in: path + required: true + schema: + type: string + format: uuid + title: Documentid + responses: + '204': + description: Successful Response + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{collectionId}/documents': + get: + tags: + - vector + summary: Get documents + description: Gets a list of documents of a collection. + operationId: vector.v1.vector_endpoints.get_all_documents + x-sap-cloud-sdk-operation-name: getAllDocuments + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/Documents' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + post: + tags: + - vector + summary: Create documents in collection + description: Create and stores one or multiple documents into a collection. If omitted, 'id' will be auto-generated. + operationId: vector.v1.vector_endpoints.create_documents + x-sap-cloud-sdk-operation-name: createDocuments + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentCreateRequest' + responses: + '201': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentsListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + patch: + tags: + - vector + summary: Upsert documents in collection + description: Upserts the data of multiple documents into a collection. + operationId: vector.v1.vector_endpoints.update_documents + x-sap-cloud-sdk-operation-name: updateDocuments + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - name: collectionId + in: path + required: true + schema: + type: string + format: uuid + title: Collectionid + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentUpdateRequest' + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentsListResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/search': + post: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + tags: + - vector + summary: Search chunk by vector + description: 'Search chunk by vector' + operationId: vector.v1.vector_endpoints.search + x-sap-cloud-sdk-operation-name: search + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TextSearchRequest' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/SearchResults' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{id}/creationStatus': + get: + tags: + - vector + summary: Get collection status by ID + description: Gets a specific collection status from monitor by ID. + operationId: vector.v1.vector_endpoints.get_collection_creation_status + x-sap-cloud-sdk-operation-name: getCollectionCreationStatus + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + format: uuid + title: ID + responses: + '200': + description: Successful Response + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CollectionCreatedResponse' + - $ref: '#/components/schemas/CollectionPendingResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/vector/collections/{id}/deletionStatus': + get: + tags: + - vector + summary: Get collection status by ID + description: Gets a specific collection status from monitor by ID. + operationId: vector.v1.vector_endpoints.get_collection_deletion_status + x-sap-cloud-sdk-operation-name: getCollectionDeletionStatus + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - name: id + in: path + required: true + schema: + type: string + format: uuid + title: Id + responses: + '200': + description: Successful Response + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/CollectionDeletedResponse' + - $ref: '#/components/schemas/CollectionPendingResponse' + '400': + $ref: '#/components/responses/BadRequest' + '404': + $ref: '#/components/responses/NotFound' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '/retrieval/dataRepositories': + get: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - $ref: '#/components/parameters/top' + - $ref: '#/components/parameters/skip' + - $ref: '#/components/parameters/count' + tags: + - retrieval + summary: List all DataRepository objects. + description: List all DataRepository objects. + operationId: retrieval.v1.retrieval_endpoints.get_data_repositories + x-sap-cloud-sdk-operation-name: getDataRepositories + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DataRepositories' + '400': + $ref: '#/components/responses/BadRequest' + '/retrieval/dataRepositories/{repositoryId}': + get: + tags: + - retrieval + summary: List single DataRepository object. + description: List single DataRepository object. + operationId: retrieval.v1.retrieval_endpoints.get_data_repository_by_id + x-sap-cloud-sdk-operation-name: getDataRepositoryById + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + - name: repositoryId + in: path + required: true + schema: + type: string + format: uuid + title: Repositoryid + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/DataRepository' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/UnprocessableEntity' + '404': + $ref: '#/components/responses/NotFound' + '/retrieval/search': + post: + parameters: + - in: header + name: AI-Resource-Group + required: true + schema: + type: string + tags: + - retrieval + summary: Retrieve relevant content given a query string. + description: Retrieve relevant content given a query string. + operationId: retrieval.v1.retrieval_endpoints.search + x-sap-cloud-sdk-operation-name: search + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RetrievalSearchInput' + required: true + responses: + '200': + description: Successful Response + content: + application/json: + schema: + $ref: '#/components/schemas/RetievalSearchResults' + '400': + $ref: '#/components/responses/BadRequest' + '422': + $ref: '#/components/responses/UnprocessableEntity' +components: + schemas: + PipelinePostRequst: + type: object + required: + - type + - configuration + additionalProperties: true + properties: + type: + type: string + example: MSSharePoint + configuration: + type: object + additionalProperties: true + required: + - destination + properties: + destination: + type: string + example: destination-name + sharePoint: + type: object + additionalProperties: true + properties: + site: + type: object + additionalProperties: true + properties: + name: + type: string + example: sharepoint-site-name + includePaths: + type: array + items: + type: string + example: ['/testFolder1', 'testFolder2'] + Pipelines: + properties: + resources: + type: array + items: + $ref: '#/components/schemas/Pipeline' + title: Get Pipelines + count: + type: integer + type: object + required: + - resources + title: Pipelines + Pipeline: + type: object + properties: + id: + type: string + example: uuid + type: + type: string + example: MSSharePoint + configuration: + type: object + properties: + destination: + type: string + example: destination-name + sharePoint: + type: object + properties: + site: + type: object + properties: + id: + type: string + example: sharepoint-site-id + name: + type: string + example: sharepoint-site-name + includePaths: + type: array + items: + type: string + example: ['/testFolder1', 'testFolder2'] + PipelineStatus: + type: object + properties: + lastStarted: + type: string + format: date-time + example: '2024-02-15T12:45:00.000Z' + PipelineId: + type: object + properties: + pipelineId: + type: string + example: uuid + + Chunk: + properties: + id: + type: string + title: Id + content: + type: string + title: Content + metadata: + type: array + items: + $ref: '#/components/schemas/KeyValueListPair' + title: Metadata + default: [] + type: object + required: + - id + - content + title: Chunk + DocumentKeyValueListPair: + additionalProperties: true + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + matchMode: + type: string + title: MatchMode + additionalProperties: true + description: Default match mode for search filters + default: ANY + anyOf: + - enum: + - ANY + - ALL + - {} + type: object + required: + - key + - value + title: DocumentKeyValueListPair + KeyValueListPair: + additionalProperties: true + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + type: object + required: + - key + - value + title: KeyValueListPair + Document-Output: + properties: + id: + type: string + format: uuid + title: Id + metadata: + items: + $ref: '#/components/schemas/DocumentKeyValueListPair' + type: array + title: Metadata + default: [] + chunks: + items: + $ref: '#/components/schemas/Chunk' + type: array + title: Chunks + type: object + required: + - id + - chunks + title: Document + DocumentsChunk: + properties: + id: + type: string + format: uuid + title: Id + title: + type: string + title: Title + metadata: + items: + $ref: '#/components/schemas/KeyValueListPair' + type: array + title: Metadata + default: [] + documents: + items: + $ref: '#/components/schemas/Document-Output' + type: array + title: Documents + type: object + required: + - id + - title + - documents + title: DocumentsChunk + PerFilterSearchResult: + properties: + filterId: + type: string + title: Filterid + results: + items: + $ref: '#/components/schemas/DocumentsChunk' + type: array + title: Results + type: object + required: + - filterId + - results + title: PerFilterSearchResult + SearchConfiguration: + additionalProperties: true + properties: + maxChunkCount: + type: integer + minimum: 0 + maximum: 0 + exclusiveMinimum: true + title: Maxchunkcount + description: Maximum number of chunks to be returned. Cannot be used with 'maxDocumentCount'. + maxDocumentCount: + type: integer + minimum: 0 + maximum: 0 + exclusiveMinimum: true + title: Maxdocumentcount + description: "[Only supports 'vector' dataRepositoryType] - Maximum number of documents to be returned. Cannot be used with 'maxChunkCount'. If maxDocumentCount is given, then only one chunk per document is returned." + type: object + title: SearchConfiguration + SearchDocumentKeyValueListPair: + additionalProperties: true + properties: + key: + type: string + maxLength: 1024 + title: Key + value: + type: array + items: + type: string + maxLength: 1024 + title: Value + selectMode: + type: array + items: + $ref: '#/components/schemas/SearchSelectOptionEnum' + title: Selectmode + description: Select mode for search filters + type: object + required: + - key + - value + title: SearchDocumentKeyValueListPair + SearchResults: + properties: + results: + type: array + items: + anyOf: + - $ref: '#/components/schemas/PerFilterSearchResult' + title: Results + description: List of returned results. + type: object + required: + - results + title: SearchResults + CollectionsListResponse: + properties: + resources: + items: + $ref: '#/components/schemas/Collection' + type: array + title: Collections + count: + type: integer + type: object + required: + - resources + title: CollectionsListResponse + description: A response containing collections retrieved from the server. + CollectionRequest: + additionalProperties: true + properties: + title: + type: string + title: Title + embeddingConfig: + $ref: '#/components/schemas/EmbeddingConfig' + metadata: + items: + $ref: '#/components/schemas/KeyValueListPair' + type: array + title: Metadata + description: >- + Metadata attached to collection. Useful to restrict search to a + subset of collections. + default: [] + type: object + required: + - embeddingConfig + title: CollectionRequest + description: A request for creating a new, single collection. + CollectionCreatedResponse: + properties: + collectionURL: + type: string + title: Collectionurl + status: + type: string + title: Status + type: object + required: + - collectionURL + - status + title: CollectionCreatedResponse + CollectionPendingResponse: + properties: + Location: + type: string + title: Location + format: uri + status: + type: string + title: Status + type: object + required: + - Location + - status + title: CollectionPendingResponse + CollectionDeletedResponse: + properties: + collectionURL: + type: string + title: Collectionurl + status: + type: string + title: Status + type: object + required: + - collectionURL + - status + title: CollectionDeletedResponse + BaseDocument: + additionalProperties: true + properties: + chunks: + items: + $ref: '#/components/schemas/TextOnlyBaseChunk' + type: array + title: Chunks + metadata: + items: + $ref: '#/components/schemas/DocumentKeyValueListPair' + type: array + title: Metadata + type: object + required: + - chunks + - metadata + title: BaseDocument + description: Base class for documents, document requests and responses. + DocumentCreateRequest: + additionalProperties: true + properties: + documents: + items: + $ref: '#/components/schemas/BaseDocument' + type: array + title: Documents + type: object + required: + - documents + title: DocumentCreateRequest + description: >- + A create request containing one or more new documents to create and + store in a collection. + Document-Input: + additionalProperties: true + properties: + chunks: + items: + $ref: '#/components/schemas/TextOnlyBaseChunk' + type: array + title: Chunks + metadata: + items: + $ref: '#/components/schemas/DocumentKeyValueListPair' + type: array + title: Metadata + id: + type: string + format: uuid + title: Id + description: Unique identifier of a document. + type: object + required: + - chunks + - metadata + - id + title: Document + description: A single document stored in a collection by ID. + DocumentUpdateRequest: + additionalProperties: true + properties: + documents: + items: + $ref: '#/components/schemas/Document-Input' + type: array + title: Documents + type: object + required: + - documents + title: DocumentUpdateRequest + description: >- + An update request containing one or more documents to update existing + documents in a collection by ID. + DocumentWithoutChunks: + properties: + metadata: + items: + $ref: '#/components/schemas/DocumentKeyValueListPair' + type: array + title: Metadata + id: + type: string + format: uuid + title: Id + description: Unique identifier of a document. + type: object + required: + - metadata + - id + title: DocumentWithoutChunks + description: >- + A single document stored in a collection by ID without exposing its + chunks. + DocumentsListResponse: + properties: + documents: + items: + $ref: '#/components/schemas/DocumentWithoutChunks' + type: array + title: Documents + type: object + required: + - documents + title: DocumentsListResponse + description: A response containing documents created or updated, retrieved from the server. + Documents: + properties: + resources: + items: + $ref: '#/components/schemas/DocumentWithoutChunks' + type: array + title: Documents + count: + type: integer + type: object + required: + - resources + title: Documents + description: A response containing documents retrieved from the server. + TextOnlyBaseChunk: + additionalProperties: true + properties: + content: + type: string + title: Content + metadata: + items: + $ref: '#/components/schemas/KeyValueListPair' + type: array + title: Metadata + type: object + required: + - content + - metadata + title: TextOnlyBaseChunk + DocumentResponse: + properties: + chunks: + items: + $ref: '#/components/schemas/TextOnlyBaseChunk' + type: array + title: Chunks + metadata: + items: + $ref: '#/components/schemas/DocumentKeyValueListPair' + type: array + title: Metadata + id: + type: string + format: uuid + title: Id + description: Unique identifier of a document. + type: object + required: + - chunks + - metadata + - id + title: DocumentResponse + description: >- + A response containing information about a newly created, single + document. + SearchSelectOptionEnum: + type: string + anyOf: + - enum: + - ignoreIfKeyAbsent + - {} + default: ignoreIfKeyAbsent + title: SearchSelectOptionEnum + SearchFilter: + additionalProperties: true + properties: + id: + type: string + title: Id + description: Identifier of this SearchFilter - unique per request. + collectionIds: + items: + type: string + type: array + title: Collectionids + configuration: + $ref: '#/components/schemas/SearchConfiguration' + collectionMetadata: + items: + $ref: '#/components/schemas/KeyValueListPair' + type: array + maxItems: 2000 + title: Collectionmetadata + description: >- + Restrict collections considered during search to those annotated + with the given metadata. Useful when combined with collections=['*'] + default: [] + documentMetadata: + items: + $ref: '#/components/schemas/SearchDocumentKeyValueListPair' + type: array + maxItems: 2000 + title: Documentmetadata + description: >- + Restrict documents considered during search to those annotated with + the given metadata. + default: [] + chunkMetadata: + items: + $ref: '#/components/schemas/KeyValueListPair' + type: array + maxItems: 2000 + title: Chunkmetadata + description: >- + Restrict chunks considered during search to those with the given + metadata. + default: [] + type: object + required: + - id + - collectionIds + - configuration + title: SearchFilter + TextSearchRequest: + additionalProperties: true + properties: + query: + type: string + maxLength: 2000 + minLength: 1 + title: Query + description: Query string + filters: + items: + $ref: '#/components/schemas/SearchFilter' + type: array + title: Filters + type: object + required: + - query + - filters + title: TextSearchRequest + EmbeddingConfig: + additionalProperties: true + properties: + modelName: + type: string + maxLength: 1024 + title: Modelname + default: text-embedding-ada-002 + type: object + title: EmbeddingConfig + Collection: + properties: + title: + type: string + title: Title + embeddingConfig: + $ref: '#/components/schemas/EmbeddingConfig' + metadata: + items: + $ref: '#/components/schemas/KeyValueListPair' + type: array + title: Metadata + description: >- + Metadata attached to collection. Useful to restrict search to a + subset of collections. + default: [] + id: + type: string + format: uuid + title: Id + description: Unique identifier of a collection. + type: object + required: + - embeddingConfig + - id + title: Collection + description: A logical grouping of content. + DataRepositoryType: + type: string + anyOf: + - enum: + - vector + - {} + title: DataRepositoryType + DataRepository: + properties: + id: + type: string + format: uuid + title: Id + description: Unique identifier of this DataRepository. + title: + type: string + title: Title + metadata: + type: array + items: + $ref: '#/components/schemas/KeyValueListPair' + title: Metadata + description: Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories. + default: [] + type: + $ref: '#/components/schemas/DataRepositoryType' + type: object + required: + - id + - title + - type + title: DataRepository + description: DataRepository schema expected by Retrieval. + DataRepositories: + properties: + resources: + type: array + items: + $ref: '#/components/schemas/DataRepository' + title: Datarepositories + count: + type: integer + type: object + required: + - resources + title: DataRepositories + RetrievalSearchInput: + additionalProperties: true + properties: + query: + type: string + minLength: 1 + title: Query + description: Query string + filters: + type: array + items: + $ref: '#/components/schemas/RetrievalSearchFilter' + title: Filters + type: object + required: + - query + - filters + title: SearchInput + RetrievalSearchFilter: + additionalProperties: true + properties: + id: + type: string + title: Id + description: Identifier of this SearchFilter - unique per request. + searchConfiguration: + $ref: '#/components/schemas/SearchConfiguration' + 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' + dataRepositoryMetadata: + type: array + items: + $ref: '#/components/schemas/KeyValueListPair' + title: Datarepositorymetadata + description: Restrict DataRepositories considered during search to those annotated with the given metadata. Useful when combined with dataRepositories=['*'] + default: [] + documentMetadata: + type: array + items: + $ref: '#/components/schemas/SearchDocumentKeyValueListPair' + title: Documentmetadata + description: Restrict documents considered during search to those annotated with the given metadata. + default: [] + chunkMetadata: + type: array + items: + $ref: '#/components/schemas/KeyValueListPair' + title: Chunkmetadata + description: Restrict chunks considered during search to those with the given metadata. + default: [] + type: object + required: + - id + - dataRepositoryType + title: RetrievalSearchFilter + description: Limit scope of search to certain DataRepositories, Documents or Chunks. + RetrievalDocument: + properties: + id: + type: string + title: Id + metadata: + type: array + items: + $ref: '#/components/schemas/DocumentKeyValueListPair' + title: Metadata + default: [] + chunks: + type: array + items: + $ref: '#/components/schemas/Chunk' + title: Chunks + type: object + required: + - id + - chunks + title: RetrievalDocument + DataRepositoryWithDocuments: + properties: + id: + type: string + format: uuid + title: Id + description: Unique identifier of this DataRepository. + title: + type: string + title: Title + metadata: + type: array + items: + $ref: '#/components/schemas/KeyValueListPair' + title: Metadata + description: Metadata attached to DataRepository. Useful to later limit search to a subset of DataRepositories. + documents: + type: array + items: + $ref: '#/components/schemas/RetrievalDocument' + title: Documents + type: object + required: + - id + - title + - documents + title: DataRepositoryWithDocuments + description: DataRepository schema returned by the Vector search endpoint + RetievalDataRepositorySearchResult: + properties: + dataRepository: + $ref: '#/components/schemas/DataRepositoryWithDocuments' + type: object + required: + - dataRepository + title: DataRepositorySearchResult + RetievalPerFilterSearchResult: + properties: + filterId: + type: string + title: Filterid + results: + type: array + items: + $ref: '#/components/schemas/RetievalDataRepositorySearchResult' + title: Results + description: List of returned results. + default: [] + type: object + required: + - filterId + title: PerFilterSearchResult + RetievalPerFilterSearchResultWithError: + properties: + message: + type: string + title: Message + type: object + required: + - message + title: PerFilterSearchResultError + RetievalSearchResults: + properties: + results: + type: array + items: + anyOf: + - $ref: '#/components/schemas/RetievalPerFilterSearchResult' + - $ref: '#/components/schemas/RetievalPerFilterSearchResultWithError' + title: Results + description: List of returned results. + type: object + required: + - results + title: SearchResults + + ### ### ######################## ### ### + ### ### ### Error ### ### ### + ### ### ######################## ### ### + + ApiError: + required: + - code + - message + type: object + properties: + code: + description: >- + Descriptive error code (not http status code). + type: string + message: + description: plaintext error description + type: string + requestId: + description: id of individual request + type: string + target: + description: url that has been called + type: string + details: + type: array + items: + $ref: '#/components/schemas/DetailsErrorResponse' + + DetailsErrorResponse: + type: object + properties: + code: + description: Descriptive error code (not http status code) + type: string + message: + description: Plaintext error description + type: string + + ### *** ***************************************************** *** ### + ### *** *** Start of responses *** *** ### + ### *** ***************************************************** *** ### + + responses: + BadRequest: + content: + application/json: + schema: + type: object + properties: + error: + $ref: '#/components/schemas/ApiError' + description: The specification of the resource was incorrect + + NotFound: + content: + application/json: + schema: + type: object + properties: + error: + $ref: '#/components/schemas/ApiError' + description: The specification of the resource was incorrect + + UnprocessableEntity: + description: There are validation issues with the data. + content: + application/json: + schema: + type: object + properties: + error: + $ref: '#/components/schemas/ApiError' + + parameters: + top: + name: $top + description: Number of results to display + in: query + required: false + schema: + type: integer + minimum: 0 + example: 10 + + skip: + name: $skip + description: Number of results to be skipped from the ordered list of results + in: query + required: false + schema: + type: integer + minimum: 0 + example: 10 + + count: + name: $count + description: When the $count field is set to false, the response contains a count of the items present in the response. When the $count field is set to true, the response contains a count of all the items present on the server, and not just the ones in the response. When the $count field is not passed, it is false by default. + in: query + required: false + schema: + type: boolean + example: true \ No newline at end of file diff --git a/grounding/src/test/java/com/sap/ai/sdk/grounding/GroundingClientTest.java b/grounding/src/test/java/com/sap/ai/sdk/grounding/GroundingClientTest.java new file mode 100644 index 000000000..9447cc5b3 --- /dev/null +++ b/grounding/src/test/java/com/sap/ai/sdk/grounding/GroundingClientTest.java @@ -0,0 +1,133 @@ +package com.sap.ai.sdk.grounding; + +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; +import static org.assertj.core.api.Assertions.assertThat; + +import com.github.tomakehurst.wiremock.junit5.WireMockExtension; +import com.sap.ai.sdk.core.AiCoreService; +import com.sap.ai.sdk.grounding.client.PipelinesApi; +import com.sap.ai.sdk.grounding.client.RetrievalApi; +import com.sap.ai.sdk.grounding.client.VectorApi; +import com.sap.ai.sdk.grounding.model.CollectionsListResponse; +import com.sap.ai.sdk.grounding.model.DataRepositories; +import com.sap.ai.sdk.grounding.model.DataRepositoryType; +import com.sap.ai.sdk.grounding.model.DocumentKeyValueListPair; +import com.sap.ai.sdk.grounding.model.DocumentResponse; +import com.sap.ai.sdk.grounding.model.Documents; +import com.sap.ai.sdk.grounding.model.KeyValueListPair; +import com.sap.ai.sdk.grounding.model.Pipelines; +import com.sap.cloud.sdk.cloudplatform.connectivity.DefaultHttpDestination; +import com.sap.cloud.sdk.cloudplatform.connectivity.HttpDestination; +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +public class GroundingClientTest { + + @RegisterExtension + private static final WireMockExtension WM = + WireMockExtension.newInstance().options(wireMockConfig().dynamicPort()).build(); + + private final HttpDestination DESTINATION = DefaultHttpDestination.builder(WM.baseUrl()).build(); + private final AiCoreService SERVICE = new AiCoreService().withBaseDestination(DESTINATION); + + @Test + void testPipelines() { + final PipelinesApi api = new GroundingClient(SERVICE).pipelines(); + + final Pipelines allPipelines = api.getAllPipelines("reosurceGroup"); + assertThat(allPipelines).isNotNull(); + assertThat(allPipelines.getResources()).isEmpty(); + } + + @Test + void testVector() { + final VectorApi api = new GroundingClient(SERVICE).vector(); + + final CollectionsListResponse collections = api.getAllCollections("reosurceGroup"); + assertThat(collections).isNotNull(); + assertThat(collections.getResources()) + .isNotNull() + .hasSize(1) + .satisfiesExactly( + c -> { + assertThat(c).isNotNull(); + assertThat(c.getId()).isNotNull(); + assertThat(c.getTitle()).isEqualTo("test-collection"); + assertThat(c.getEmbeddingConfig()).isNotNull(); + assertThat(c.getEmbeddingConfig().getModelName()).isEqualTo("text-embedding-ada-999"); + final var meta = KeyValueListPair.create().key("purpose").value("grounding test"); + assertThat(c.getMetadata()).isNotNull().containsExactly(meta); + }); + + final UUID collectionId = collections.getResources().get(0).getId(); + final Documents documents = api.getAllDocuments("reosurceGroup", collectionId); + assertThat(documents).isNotNull(); + final DocumentKeyValueListPair documentMeta = + DocumentKeyValueListPair.create() + .key("url") + .value("http://hello.com", "123") + .matchMode(DocumentKeyValueListPair.MatchModeEnum.ANY); + assertThat(documents.getResources()) + .isNotNull() + .hasSize(1) + .satisfiesExactly( + d -> { + assertThat(d).isNotNull(); + assertThat(d.getId()).isNotNull(); + assertThat(d.getMetadata()).isNotNull().containsExactly(documentMeta); + }); + + final UUID documentId = documents.getResources().get(0).getId(); + final DocumentResponse document = + api.getDocumentById("reosurceGroup", collectionId, documentId); + assertThat(document).isNotNull(); + assertThat(document.getId()).isEqualTo(documentId); + assertThat(document.getMetadata()).isNotNull().containsExactly(documentMeta); + assertThat(document.getChunks()) + .isNotNull() + .satisfiesExactly( + d1 -> { + assertThat(d1).isNotNull(); + assertThat(d1.getContent()).isNotEmpty(); + final var m1 = KeyValueListPair.create().key("index").value("1"); + final var m2 = + KeyValueListPair.create().key("sap.document-grounding/language").value("en"); + assertThat(d1.getMetadata()).isNotNull().containsExactly(m1, m2); + }, + d2 -> { + assertThat(d2).isNotNull(); + assertThat(d2.getContent()).isNotEmpty(); + final var m1 = KeyValueListPair.create().key("index").value("2"); + final var m2 = + KeyValueListPair.create().key("sap.document-grounding/language").value("en"); + assertThat(d2.getMetadata()).isNotNull().containsExactly(m1, m2); + }); + } + + @Test + void testRetrieval() { + final RetrievalApi api = new GroundingClient(SERVICE).retrieval(); + + DataRepositories repositories = api.getDataRepositories("reosurceGroup"); + assertThat(repositories).isNotNull(); + assertThat(repositories.getResources()) + .isNotEmpty() + .satisfiesExactly( + r -> { + assertThat(r).isNotNull(); + assertThat(r.getId()).isNotNull(); + assertThat(r.getTitle()).isEqualTo("test-collection"); + assertThat(r.getType()).isEqualTo(DataRepositoryType.VECTOR); + final var meta = KeyValueListPair.create().key("purpose").value("grounding test"); + assertThat(r.getMetadata()).isNotNull().containsExactly(meta); + }, + r2 -> { + assertThat(r2).isNotNull(); + assertThat(r2.getId()).isNotNull(); + assertThat(r2.getTitle()).isEqualTo("This is another collection"); + assertThat(r2.getType()).isEqualTo(DataRepositoryType.VECTOR); + assertThat(r2.getMetadata()).isNotNull().isEmpty(); + }); + } +} diff --git a/grounding/src/test/resources/mappings/pipelines.json b/grounding/src/test/resources/mappings/pipelines.json new file mode 100644 index 000000000..7b5405b66 --- /dev/null +++ b/grounding/src/test/resources/mappings/pipelines.json @@ -0,0 +1,14 @@ +{ + "request": { + "method": "GET", + "url": "/v2/lm/document-grounding/pipelines" + }, + + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": {"count": 0, "resources": []} + } +} diff --git a/grounding/src/test/resources/mappings/retrieval.json b/grounding/src/test/resources/mappings/retrieval.json new file mode 100644 index 000000000..5b74ebfba --- /dev/null +++ b/grounding/src/test/resources/mappings/retrieval.json @@ -0,0 +1,36 @@ +{ + "request": { + "method": "GET", + "url": "/v2/lm/document-grounding/retrieval/dataRepositories" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "count": 2, + "resources": [ + { + "id": "001766c1-05c7-41fe-a3d7-c1fb02fc1473", + "title": "test-collection", + "metadata": [ + { + "key": "purpose", + "value": [ + "grounding test" + ] + } + ], + "type": "vector" + }, + { + "id": "61451b0d-ea10-4eac-ae2a-a0a00a33a505", + "title": "This is another collection", + "metadata": [], + "type": "vector" + } + ] + } + } +} diff --git a/grounding/src/test/resources/mappings/vector.json b/grounding/src/test/resources/mappings/vector.json new file mode 100644 index 000000000..d58491ded --- /dev/null +++ b/grounding/src/test/resources/mappings/vector.json @@ -0,0 +1,127 @@ +{ + "mappings": [ + { + "request": { + "method": "GET", + "url": "/v2/lm/document-grounding/vector/collections" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "count": 1, + "resources": [ + { + "title": "test-collection", + "embeddingConfig": { + "modelName": "text-embedding-ada-999" + }, + "metadata": [ + { + "key": "purpose", + "value": [ + "grounding test" + ] + } + ], + "id": "e57c5e98-0c6e-4076-b619-61654234b447" + } + ] + } + } + }, + { + "request": { + "method": "GET", + "url": "/v2/lm/document-grounding/vector/collections/e57c5e98-0c6e-4076-b619-61654234b447/documents" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "count": 1, + "resources": [ + { + "metadata": [ + { + "key": "url", + "value": [ + "http://hello.com", + "123" + ], + "matchMode": "ANY" + } + ], + "id": "89c75c12-3c60-4a8a-84ec-4e72b74b1c8b" + } + ] + } + } + }, + { + "request": { + "method": "GET", + "url": "/v2/lm/document-grounding/vector/collections/e57c5e98-0c6e-4076-b619-61654234b447/documents/89c75c12-3c60-4a8a-84ec-4e72b74b1c8b" + }, + "response": { + "status": 200, + "headers": { + "Content-Type": "application/json" + }, + "jsonBody": { + "chunks": [ + { + "content": "Joule is the AI copilot that truly understands your business. Joule revolutionizes how you interact with your SAP business systems, making every touchpoint count and every task simpler.", + "metadata": [ + { + "key": "index", + "value": [ + "1" + ] + }, + { + "key": "sap.document-grounding/language", + "value": [ + "en" + ] + } + ] + }, + { + "content": "It enables the companion of the Intelligent Enterprise, guiding you through content discovery within SAP Ecosystem, and giving a transparent role-based access to the relevant processes from everywhere. This is the one assistant experience, a unified and delightful user experience across SAP\u2019s \u01ee solution portfolio.", + "metadata": [ + { + "key": "index", + "value": [ + "2" + ] + }, + { + "key": "sap.document-grounding/language", + "value": [ + "en" + ] + } + ] + } + ], + "metadata": [ + { + "key": "url", + "value": [ + "http://hello.com", + "123" + ], + "matchMode": "ANY" + } + ], + "id": "89c75c12-3c60-4a8a-84ec-4e72b74b1c8b" + } + } + } + ] +} diff --git a/pom.xml b/pom.xml index b029a90d4..a93dad0ce 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,7 @@ core orchestration + grounding foundation-models/openai @@ -203,6 +204,11 @@ orchestration ${project.version} + + com.sap.ai.sdk + grounding + ${project.version} + com.sap.ai.sdk.foundationmodels openai @@ -620,6 +626,8 @@ https://gitbox.apache.org/repos/asf?p=maven-pmd-plugin.git;a=blob_plain;f=src/ma com/sap/ai/sdk/core/model/* com/sap/ai/sdk/foundationmodels/openai/generated/model/* com/sap/ai/sdk/orchestration/model/* + com/sap/ai/sdk/grounding/client/* + com/sap/ai/sdk/grounding/model/* @@ -642,6 +650,8 @@ https://gitbox.apache.org/repos/asf?p=maven-pmd-plugin.git;a=blob_plain;f=src/ma com/sap/ai/sdk/core/model/* com/sap/ai/sdk/orchestration/model/* com/sap/ai/sdk/foundationmodels/openai/generated/model/* + com/sap/ai/sdk/grounding/client/* + com/sap/ai/sdk/grounding/model/* com/sap/ai/sdk/app/**/* diff --git a/sample-code/spring-app/pom.xml b/sample-code/spring-app/pom.xml index a8c348c85..227fd234f 100644 --- a/sample-code/spring-app/pom.xml +++ b/sample-code/spring-app/pom.xml @@ -57,10 +57,18 @@ com.sap.ai.sdk orchestration + + com.sap.ai.sdk + grounding + com.sap.cloud.sdk.cloudplatform cloudplatform-core + + com.sap.cloud.sdk.datamodel + openapi-core + org.springframework.ai spring-ai-core diff --git a/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/GroundingController.java b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/GroundingController.java new file mode 100644 index 000000000..c1a427c72 --- /dev/null +++ b/sample-code/spring-app/src/main/java/com/sap/ai/sdk/app/controllers/GroundingController.java @@ -0,0 +1,209 @@ +package com.sap.ai.sdk.app.controllers; + +import static com.sap.ai.sdk.foundationmodels.openai.OpenAiModel.TEXT_EMBEDDING_ADA_002; +import static java.time.LocalDate.now; +import static java.util.stream.Collectors.joining; + +import com.sap.ai.sdk.grounding.GroundingClient; +import com.sap.ai.sdk.grounding.client.PipelinesApi; +import com.sap.ai.sdk.grounding.client.RetrievalApi; +import com.sap.ai.sdk.grounding.client.VectorApi; +import com.sap.ai.sdk.grounding.model.BaseDocument; +import com.sap.ai.sdk.grounding.model.Collection; +import com.sap.ai.sdk.grounding.model.CollectionRequest; +import com.sap.ai.sdk.grounding.model.DataRepository; +import com.sap.ai.sdk.grounding.model.DataRepositoryType; +import com.sap.ai.sdk.grounding.model.DocumentCreateRequest; +import com.sap.ai.sdk.grounding.model.DocumentKeyValueListPair; +import com.sap.ai.sdk.grounding.model.DocumentWithoutChunks; +import com.sap.ai.sdk.grounding.model.EmbeddingConfig; +import com.sap.ai.sdk.grounding.model.KeyValueListPair; +import com.sap.ai.sdk.grounding.model.Pipeline; +import com.sap.ai.sdk.grounding.model.ResultsInner1; +import com.sap.ai.sdk.grounding.model.RetrievalSearchFilter; +import com.sap.ai.sdk.grounding.model.RetrievalSearchInput; +import com.sap.ai.sdk.grounding.model.SearchConfiguration; +import com.sap.ai.sdk.grounding.model.TextOnlyBaseChunk; +import java.time.format.TextStyle; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** Endpoints for AI Core Grounding operations */ +@Slf4j +@RestController +@SuppressWarnings("unused") +@RequestMapping("/grounding") +class GroundingController { + + private static final PipelinesApi CLIENT_PIPELINES = new GroundingClient().pipelines(); + private static final RetrievalApi CLIENT_RETRIEVAL = new GroundingClient().retrieval(); + private static final VectorApi CLIENT_VECTOR = new GroundingClient().vector(); + private static final String RESOURCE_GROUP = "ai-sdk-java-e2e"; + + /** Retrieve (up to 10) grounding pipeline entities. */ + @GetMapping("/pipelines/list") + Object getAllPipelines( + @Nullable @RequestParam(value = "format", required = false) final String format) { + final var pipelines = CLIENT_PIPELINES.getAllPipelines(RESOURCE_GROUP, 10, 0, true); + log.info("Found {} pipelines", pipelines.getResources().size()); + + if ("json".equals(format)) { + return pipelines; + } + final var ids = pipelines.getResources().stream().map(Pipeline::getId).collect(joining(", ")); + return "Found pipelines with ids: " + ids; + } + + /** Retrieve all grounding data repositories. */ + @GetMapping("/retrieval/repositories") + Object getAllRepositories( + @Nullable @RequestParam(value = "format", required = false) final String format) { + final var repositories = CLIENT_RETRIEVAL.getDataRepositories(RESOURCE_GROUP); + log.info("Found {} data repositories", repositories.getResources().size()); + + if ("json".equals(format)) { + return repositories; + } + final var titles = + repositories.getResources().stream().map(DataRepository::getTitle).collect(joining(", ")); + return "Found repositories with titles: " + titles; + } + + /** Search for grounding documents that match a specific search term, in all data repositories. */ + @GetMapping("/retrieval/search") + Object searchInDocuments( + @Nullable @RequestParam(value = "format", required = false) final String format) { + final var filter = + RetrievalSearchFilter.create() + .id("question") + .dataRepositoryType(DataRepositoryType.VECTOR) + .dataRepositories(List.of("*")) + .searchConfiguration(SearchConfiguration.create().maxChunkCount(10)); + final var q = RetrievalSearchInput.create().query("When was the last upload?").filters(filter); + final var results = CLIENT_RETRIEVAL.search(RESOURCE_GROUP, q); + + if ("json".equals(format)) { + return results; + } + final var messages = results.getResults().stream().map(ResultsInner1::getMessage).toList(); + return "Found the following response(s): " + messages; + } + + /** Get all grounding document collections. */ + @GetMapping("/vector/collections") + Object getAllCollections( + @Nullable @RequestParam(value = "format", required = false) final String format) { + final var collections = CLIENT_VECTOR.getAllCollections(RESOURCE_GROUP); + if ("json".equals(format)) { + return collections; + } + final var items = + collections.getResources().stream().map(Collection::getTitle).collect(joining(", ")); + return "The following collections are available: %s.".formatted(items); + } + + /** Get all items by a specific grounding document collection id. */ + @GetMapping("/vector/collection/by-id/{id}/documents") + Object getDocumentsByCollectionId( + @Nonnull @PathVariable("id") final UUID collectionId, + @Nullable @RequestParam(value = "format", required = false) final String format) { + final var documents = CLIENT_VECTOR.getAllDocuments(RESOURCE_GROUP, collectionId); + if ("json".equals(format)) { + return documents; + } + final var ids = documents.getResources().stream().map(DocumentWithoutChunks::getId).toList(); + return "The following document ids are available: %s.".formatted(ids); + } + + /** Create a new grounding document collection. */ + @GetMapping("/vector/collection/create") + String createCollection( + @Nullable @RequestParam(value = "format", required = false) final String format) { + final var embeddingConfig = EmbeddingConfig.create().modelName(TEXT_EMBEDDING_ADA_002.name()); + final var request = CollectionRequest.create().embeddingConfig(embeddingConfig).title("e2e"); + final var documents = CLIENT_VECTOR.createCollection(RESOURCE_GROUP, request); + final Map> headers = documents.getHeaders(); + + final var locationHeader = headers.get("Location").get(0); + return locationHeader.replaceAll("^.*?/([a-f0-9-]+)/.*?$", "$1"); + } + + /** Create a new vector for a given grounding document collection. */ + @GetMapping("/vector/collection/by-id/{id}/day") + Object createDocument( + @Nonnull @PathVariable("id") final UUID collectionId, + @Nullable @RequestParam(value = "format", required = false) final String format) { + final var dayOfWeek = now().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.ENGLISH); + final var documentContent = "Last upload on " + dayOfWeek; + + final var chunkMeta = KeyValueListPair.create().key("context").value("day-of-week"); + final var chunk = TextOnlyBaseChunk.create().content(documentContent).metadata(chunkMeta); + final var docMeta = DocumentKeyValueListPair.create().key("purpose").value("testing"); + final var doc = BaseDocument.create().chunks(chunk).metadata(docMeta); + final var request = DocumentCreateRequest.create().documents(doc); + final var response = CLIENT_VECTOR.createDocuments(RESOURCE_GROUP, collectionId, request); + + if ("json".equals(format)) { + return response; + } + final var ids = response.getDocuments().stream().map(DocumentWithoutChunks::getId).toList(); + return "The following document ids are available: %s.".formatted(ids); + } + + /** Delete all items from a given grounding document collection. */ + @GetMapping("/vector/collection/by-id/{id}/clear") + Object deleteDocuments( + @Nonnull @PathVariable("id") final UUID collectionId, + @Nullable @RequestParam(value = "format", required = false) final String format) { + final var dayOfWeek = now().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.ENGLISH); + final var chunkMeta = KeyValueListPair.create().key("context").value("day-of-week"); + final var chunk = + TextOnlyBaseChunk.create().content("Today is " + dayOfWeek).metadata(chunkMeta); + final var docMeta = DocumentKeyValueListPair.create().key("purpose").value("testing"); + final var doc = BaseDocument.create().chunks(chunk).metadata(docMeta); + final var request = DocumentCreateRequest.create().documents(doc); + + final var documents = CLIENT_VECTOR.getAllDocuments(RESOURCE_GROUP, collectionId); + final var ids = documents.getResources().stream().map(DocumentWithoutChunks::getId).toList(); + log.info("Deleting collection {} with {} documents: {}", collectionId, ids.size(), ids); + + for (final var documentId : ids) { + final var del = CLIENT_VECTOR.deleteDocumentById(RESOURCE_GROUP, collectionId, documentId); + if (del.getStatusCode() >= 400) { + final var msg = "Document {} could not be deleted, status code [{}], headers: {}"; + log.error(msg, documentId, del.getStatusCode(), del.getHeaders()); + throw new IllegalStateException("Document deletion failed for id " + documentId); + } + } + final var response = CLIENT_VECTOR.deleteCollectionById(RESOURCE_GROUP, collectionId + ""); + + if ("json".equals(format)) { + return response; + } + return response.getStatusCode() >= 400 ? "Failed to delete collection" : "Deletion successful"; + } + + /** Get vector chunks from a given grounding document. */ + @GetMapping("/vector/collection/by-id/{collectionId}/document/by-id/{documentId}") + Object getDocumentChunksById( + @Nonnull @PathVariable("collectionId") final UUID collectionId, + @Nonnull @PathVariable("documentId") final UUID documentId, + @Nullable @RequestParam(value = "format", required = false) final String format) { + final var document = CLIENT_VECTOR.getDocumentById(RESOURCE_GROUP, collectionId, documentId); + if ("json".equals(format)) { + return document; + } + final var ids = document.getChunks().stream().map(TextOnlyBaseChunk::getContent).toList(); + return "The following document ids are available: %s.".formatted(ids); + } +} diff --git a/sample-code/spring-app/src/main/resources/static/grounding.png b/sample-code/spring-app/src/main/resources/static/grounding.png new file mode 100644 index 000000000..d16d0f4b8 Binary files /dev/null and b/sample-code/spring-app/src/main/resources/static/grounding.png differ diff --git a/sample-code/spring-app/src/main/resources/static/index.html b/sample-code/spring-app/src/main/resources/static/index.html index 2dee34e4d..342addc3e 100644 --- a/sample-code/spring-app/src/main/resources/static/index.html +++ b/sample-code/spring-app/src/main/resources/static/index.html @@ -578,6 +578,58 @@

Orchestration Integration
+ +
+
+
+
+ Grounding Logo +

Grounding

+
+ The Grounding API offers additional context for enhancing your Orchestration LLM calls. + For more information, check the Wiki +
+
+
    +
  • +
    + +
    + List all active pipelines in the grounding module. They can be used to index document storages like Sharepoint pages or SFTP servers. +
    +
    +
  • +
  • +
    + +
    + Show all available document collections. +
    +
    +
  • +
  • +
    + +
    + Search in current document collections for a prompt. +
    +
    +
  • +
+
+
+
diff --git a/sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/GroundingTest.java b/sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/GroundingTest.java new file mode 100644 index 000000000..250cc1639 --- /dev/null +++ b/sample-code/spring-app/src/test/java/com/sap/ai/sdk/app/controllers/GroundingTest.java @@ -0,0 +1,146 @@ +package com.sap.ai.sdk.app.controllers; + +import static java.time.LocalDate.now; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import com.sap.ai.sdk.grounding.model.CollectionsListResponse; +import com.sap.ai.sdk.grounding.model.DataRepositories; +import com.sap.ai.sdk.grounding.model.DocumentResponse; +import com.sap.ai.sdk.grounding.model.Documents; +import com.sap.ai.sdk.grounding.model.DocumentsListResponse; +import com.sap.ai.sdk.grounding.model.Pipelines; +import com.sap.ai.sdk.grounding.model.RetievalSearchResults; +import com.sap.cloud.sdk.services.openapi.core.OpenApiResponse; +import java.time.format.TextStyle; +import java.util.Locale; +import java.util.UUID; +import org.junit.jupiter.api.Test; + +class GroundingTest { + /** Java end-to-end test specific configuration ID. "name":"config-java-e2e-test" */ + public static final String CONFIG_ID = "67e8d039-c7f1-4179-9f8f-60d158a36b0e"; + + private static final String JSON_FORMAT = "json"; + + @Test + void testPipelinesGetAll() { + final var controller = new GroundingController(); + + final var result = controller.getAllPipelines(JSON_FORMAT); + assertThat(result).isInstanceOf(Pipelines.class); + final var pipelinesList = ((Pipelines) result).getResources(); + final var pipelinesCount = ((Pipelines) result).getCount(); + + // we don't have testable data yet, but the endpoint works without errors + assertThat(pipelinesCount).isEqualTo(0); + assertThat(pipelinesList).isEmpty(); + } + + @Test + void testRepositoriesGetAll() { + final var controller = new GroundingController(); + + final var result = controller.getAllRepositories(JSON_FORMAT); + assertThat(result).isInstanceOf(DataRepositories.class); + final var repositoryList = ((DataRepositories) result).getResources(); + final var repositoryCount = ((DataRepositories) result).getCount(); + + assertThat(repositoryCount).isGreaterThan(0); + for (final var repository : repositoryList) { + assertThat(repository.getId()).isNotNull(); + assertThat(repository.getTitle()).isNotNull(); + } + } + + @Test + void testCreateDeleteCollection() { + final var controller = new GroundingController(); + + // (1) CREATE COLLECTION + final var collectionId = controller.createCollection(JSON_FORMAT); + final var collectionUuid = UUID.fromString(collectionId); + assertThat(collectionId).isNotNull(); + + // (1.1) TEST COLLECTION LOOKUP + this.testCollectionsGetAll(); + + // (2) SANITY CHECK: NO DOCUMENTS + final var documentsEmpty = controller.getDocumentsByCollectionId(collectionUuid, JSON_FORMAT); + assertThat(documentsEmpty).isInstanceOf(Documents.class); + assertThat(((Documents) documentsEmpty).getCount()).isEqualTo(0); + assertThat(((Documents) documentsEmpty).getResources()).isNotNull().isEmpty(); + + // (3) UPLOAD A DOCUMENT + final var documentsCreated = controller.createDocument(collectionUuid, JSON_FORMAT); + assertThat(documentsCreated).isInstanceOf(DocumentsListResponse.class); + final var document = ((DocumentsListResponse) documentsCreated).getDocuments(); + assertThat(document).isNotNull().hasSize(1); + + // (3.1) TEST DOCUMENT LOOKUP + this.testGetDocumentById(collectionUuid, document.get(0).getId()); + + // (4) SEARCH FOR DOCUMENTS + Object search = controller.searchInDocuments(JSON_FORMAT); + assertThat(search).isInstanceOf(RetievalSearchResults.class); + final var dayOfWeek = now().getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.ENGLISH); + this.assertDocumentSearchResult((RetievalSearchResults) search, dayOfWeek); + + // (5) DELETE COLLECTION + Object deletion = controller.deleteDocuments(collectionUuid, JSON_FORMAT); + assertThat(deletion).isInstanceOf(OpenApiResponse.class); + assertThat(((OpenApiResponse) deletion).getStatusCode()).isEqualTo(202); + + // (6) SANITY CHECK: NO COLLECTION + assertThatThrownBy(() -> controller.getDocumentsByCollectionId(collectionUuid, JSON_FORMAT)) + .hasMessageContaining("404 Not Found"); + } + + private void assertDocumentSearchResult(RetievalSearchResults search, String dayOfWeek) { + assertThat(search.getResults()).isNotEmpty(); + for (final var resultsByFilter : search.getResults()) { + assertThat(resultsByFilter.getFilterId()).isEqualTo("question"); + assertThat(resultsByFilter.getResults()).isNotEmpty(); + for (final var result : resultsByFilter.getResults()) { + assertThat(result.getDataRepository().getDocuments()).isNotEmpty(); + for (final var document : result.getDataRepository().getDocuments()) { + assertThat(document.getChunks()).isNotEmpty(); + for (final var chunk : document.getChunks()) { + assertThat(chunk.getContent()).contains(dayOfWeek); + } + } + } + } + } + + void testCollectionsGetAll() { + final var controller = new GroundingController(); + + final var result = controller.getAllCollections(JSON_FORMAT); + assertThat(result).isInstanceOf(CollectionsListResponse.class); + final var collectionsList = ((CollectionsListResponse) result).getResources(); + final var collectionsCount = ((CollectionsListResponse) result).getCount(); + + assertThat(collectionsCount).isGreaterThan(0); + for (final var collection : collectionsList) { + assertThat(collection.getId()).isNotNull(); + assertThat(collection.getTitle()).isNotEmpty(); + assertThat(collection.getEmbeddingConfig()).isNotNull(); + assertThat(collection.getEmbeddingConfig().getModelName()).isNotNull(); + } + } + + void testGetDocumentById(UUID collectionId, UUID documentId) { + final var controller = new GroundingController(); + + final var result = controller.getDocumentChunksById(collectionId, documentId, JSON_FORMAT); + assertThat(result).isInstanceOf(DocumentResponse.class); + final var chunks = ((DocumentResponse) result).getChunks(); + + assertThat(chunks).isNotEmpty(); + for (final var chunk : chunks) { + assertThat(chunk.getContent()).isNotEmpty(); + assertThat(chunk.getMetadata()).isNotNull().isNotEmpty(); + } + } +}