Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
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.DocumentBulkDeleteRequest;
import com.sap.ai.sdk.grounding.model.DocumentBulkDeleteResponse;
import com.sap.ai.sdk.grounding.model.DocumentCreateRequest;
import com.sap.ai.sdk.grounding.model.DocumentResponse;
import com.sap.ai.sdk.grounding.model.DocumentUpdateRequest;
Expand Down Expand Up @@ -217,6 +219,77 @@ public DocumentsListResponse createDocuments(
localVarReturnType);
}

/**
* Delete list of documents across collections
*
* <p>Deletes list of documents across collections.
*
* <p><b>200</b> - Successful Response
*
* <p><b>400</b> - The specification of the resource was incorrect
*
* <p><b>404</b> - The specification of the resource was incorrect
*
* <p><b>422</b> - There are validation issues with the data.
*
* @param aiResourceGroup Resource Group ID
* @param documentBulkDeleteRequest The value for the parameter documentBulkDeleteRequest
* @return DocumentBulkDeleteResponse
* @throws OpenApiRequestException if an error occurs while attempting to invoke the API
*/
@Nonnull
public DocumentBulkDeleteResponse deleteAllDocuments(
@Nonnull final String aiResourceGroup,
@Nonnull final DocumentBulkDeleteRequest documentBulkDeleteRequest)
throws OpenApiRequestException {
final Object localVarPostBody = documentBulkDeleteRequest;

// verify the required parameter 'aiResourceGroup' is set
if (aiResourceGroup == null) {
throw new OpenApiRequestException(
"Missing the required parameter 'aiResourceGroup' when calling deleteAllDocuments");
}

// verify the required parameter 'documentBulkDeleteRequest' is set
if (documentBulkDeleteRequest == null) {
throw new OpenApiRequestException(
"Missing the required parameter 'documentBulkDeleteRequest' when calling vectorV1VectorEndpointsDeleteAllDocuments");
}

final String localVarPath =
UriComponentsBuilder.fromPath("/vector/documents").build().toUriString();

final MultiValueMap<String, String> localVarQueryParams =
new LinkedMultiValueMap<String, String>();
final HttpHeaders localVarHeaderParams = new HttpHeaders();
final MultiValueMap<String, Object> localVarFormParams =
new LinkedMultiValueMap<String, Object>();

if (aiResourceGroup != null)
localVarHeaderParams.add("AI-Resource-Group", apiClient.parameterToString(aiResourceGroup));

final String[] localVarAccepts = {"application/json"};
final List<MediaType> localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {"application/json"};
final MediaType localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

final String[] localVarAuthNames = new String[] {};

final ParameterizedTypeReference<DocumentBulkDeleteResponse> localVarReturnType =
new ParameterizedTypeReference<DocumentBulkDeleteResponse>() {};
return apiClient.invokeAPI(
localVarPath,
HttpMethod.DELETE,
localVarQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarFormParams,
localVarAccept,
localVarContentType,
localVarAuthNames,
localVarReturnType);
}

/**
* Delete collection by ID
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

Expand All @@ -39,6 +40,9 @@ public class CollectionRequest
@JsonProperty("metadata")
private List<VectorKeyValueListPair> metadata = new ArrayList<>();

@JsonProperty("id")
private UUID id;

@JsonAnySetter @JsonAnyGetter
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();

Expand Down Expand Up @@ -156,6 +160,37 @@ public void setMetadata(@Nullable final List<VectorKeyValueListPair> metadata) {
this.metadata = metadata;
}

/**
* Set the id of this {@link CollectionRequest} instance and return the same instance.
*
* @param id Unique identifier of a collection.
* @return The same instance of this {@link CollectionRequest} class
*/
@Nonnull
public CollectionRequest id(@Nullable final UUID id) {
this.id = id;
return this;
}

/**
* Unique identifier of a collection.
*
* @return id The id of this {@link CollectionRequest} instance.
*/
@Nonnull
public UUID getId() {
return id;
}

/**
* Set the id of this {@link CollectionRequest} instance.
*
* @param id Unique identifier of a collection.
*/
public void setId(@Nullable final UUID id) {
this.id = id;
}

/**
* Get the names of the unrecognizable properties of the {@link CollectionRequest}.
*
Expand Down Expand Up @@ -197,6 +232,7 @@ public Map<String, Object> toMap() {
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;
}

Expand Down Expand Up @@ -224,12 +260,13 @@ public boolean equals(@Nullable final java.lang.Object 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);
&& Objects.equals(this.metadata, collectionRequest.metadata)
&& Objects.equals(this.id, collectionRequest.id);
}

@Override
public int hashCode() {
return Objects.hash(title, embeddingConfig, metadata, cloudSdkCustomFields);
return Objects.hash(title, embeddingConfig, metadata, id, cloudSdkCustomFields);
}

@Override
Expand All @@ -240,6 +277,7 @@ public String toString() {
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"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
/*
* Grounding
* Grounding is a service designed to handle data-related tasks, such as grounding and retrieval, using vector databases. It provides specialized data retrieval through these databases, grounding the retrieval process with your own external and context-relevant data. Grounding combines generative AI capabilities with the ability to use real-time, precise data to improve decision-making and business operations for specific AI-driven business solutions.
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

package com.sap.ai.sdk.grounding.model;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

/** A request to delete documents by their IDs. */
// CHECKSTYLE:OFF
public class DocumentBulkDeleteRequest
// CHECKSTYLE:ON
{
@JsonProperty("ids")
private List<UUID> ids = new ArrayList<>();

@JsonAnySetter @JsonAnyGetter
private final Map<String, Object> cloudSdkCustomFields = new LinkedHashMap<>();

/** Default constructor for DocumentBulkDeleteRequest. */
protected DocumentBulkDeleteRequest() {}

/**
* Set the ids of this {@link DocumentBulkDeleteRequest} instance and return the same instance.
*
* @param ids List of document IDs to delete
* @return The same instance of this {@link DocumentBulkDeleteRequest} class
*/
@Nonnull
public DocumentBulkDeleteRequest ids(@Nonnull final List<UUID> ids) {
this.ids = ids;
return this;
}

/**
* Add one ids instance to this {@link DocumentBulkDeleteRequest}.
*
* @param idsItem The ids that should be added
* @return The same instance of type {@link DocumentBulkDeleteRequest}
*/
@Nonnull
public DocumentBulkDeleteRequest addIdsItem(@Nonnull final UUID idsItem) {
if (this.ids == null) {
this.ids = new ArrayList<>();
}
this.ids.add(idsItem);
return this;
}

/**
* List of document IDs to delete
*
* @return ids The ids of this {@link DocumentBulkDeleteRequest} instance.
*/
@Nonnull
public List<UUID> getIds() {
return ids;
}

/**
* Set the ids of this {@link DocumentBulkDeleteRequest} instance.
*
* @param ids List of document IDs to delete
*/
public void setIds(@Nonnull final List<UUID> ids) {
this.ids = ids;
}

/**
* Get the names of the unrecognizable properties of the {@link DocumentBulkDeleteRequest}.
*
* @return The set of properties names
*/
@JsonIgnore
@Nonnull
public Set<String> getCustomFieldNames() {
return cloudSdkCustomFields.keySet();
}

/**
* Get the value of an unrecognizable property of this {@link DocumentBulkDeleteRequest} 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(
"DocumentBulkDeleteRequest has no field with name '" + name + "'.");
}
return cloudSdkCustomFields.get(name);
}

/**
* Get the value of all properties of this {@link DocumentBulkDeleteRequest} instance including
* unrecognized properties.
*
* @return The map of all properties
*/
@JsonIgnore
@Nonnull
public Map<String, Object> toMap() {
final Map<String, Object> declaredFields = new LinkedHashMap<>(cloudSdkCustomFields);
if (ids != null) declaredFields.put("ids", ids);
return declaredFields;
}

/**
* Set an unrecognizable property of this {@link DocumentBulkDeleteRequest} 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 DocumentBulkDeleteRequest documentBulkDeleteRequest = (DocumentBulkDeleteRequest) o;
return Objects.equals(this.cloudSdkCustomFields, documentBulkDeleteRequest.cloudSdkCustomFields)
&& Objects.equals(this.ids, documentBulkDeleteRequest.ids);
}

@Override
public int hashCode() {
return Objects.hash(ids, cloudSdkCustomFields);
}

@Override
@Nonnull
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("class DocumentBulkDeleteRequest {\n");
sb.append(" ids: ").append(toIndentedString(ids)).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
* DocumentBulkDeleteRequest} instance with all required arguments.
*/
public static Builder create() {
return (ids) -> new DocumentBulkDeleteRequest().ids(ids);
}

/** Builder helper class. */
public interface Builder {
/**
* Set the ids of this {@link DocumentBulkDeleteRequest} instance.
*
* @param ids List of document IDs to delete
* @return The DocumentBulkDeleteRequest instance.
*/
DocumentBulkDeleteRequest ids(@Nonnull final List<UUID> ids);

/**
* Set the ids of this {@link DocumentBulkDeleteRequest} instance.
*
* @param ids List of document IDs to delete
* @return The DocumentBulkDeleteRequest instance.
*/
default DocumentBulkDeleteRequest ids(@Nonnull final UUID... ids) {
return ids(Arrays.asList(ids));
}
}
}
Loading