diff --git a/codegen/apis b/codegen/apis index 39e90e26..24c62612 160000 --- a/codegen/apis +++ b/codegen/apis @@ -1 +1 @@ -Subproject commit 39e90e26073686ed3a46d3db1e8b91e845bde90c +Subproject commit 24c62612dad963af00da4baa29c173c954244ac7 diff --git a/src/integration/java/io/pinecone/CleanupAllTestResourcesListener.java b/src/integration/java/io/pinecone/CleanupAllTestResourcesListener.java index 0aac8b3f..a21ffe17 100644 --- a/src/integration/java/io/pinecone/CleanupAllTestResourcesListener.java +++ b/src/integration/java/io/pinecone/CleanupAllTestResourcesListener.java @@ -7,6 +7,10 @@ public class CleanupAllTestResourcesListener implements TestExecutionListener { @Override public void testPlanExecutionFinished(TestPlan testPlan) { - TestResourcesManager.getInstance().cleanupResources(); + try { + TestResourcesManager.getInstance().cleanupResources(); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } } } \ No newline at end of file diff --git a/src/integration/java/io/pinecone/helpers/TestResourcesManager.java b/src/integration/java/io/pinecone/helpers/TestResourcesManager.java index e5079d3a..5f92f19d 100644 --- a/src/integration/java/io/pinecone/helpers/TestResourcesManager.java +++ b/src/integration/java/io/pinecone/helpers/TestResourcesManager.java @@ -256,12 +256,20 @@ public CollectionModel getOrCreateCollectionModel() throws InterruptedException * Cleans up any resources that have been created by the manager. Called in {@link io.pinecone.CleanupAllTestResourcesListener} * after all tests have finished running. */ - public void cleanupResources() { + public void cleanupResources() throws InterruptedException { if (podIndexName != null) { + if(pineconeClient.describeIndex(podIndexName).getDeletionProtection() == DeletionProtection.ENABLED) { + pineconeClient.configurePodsIndex(podIndexName, DeletionProtection.DISABLED); + Thread.sleep(5000); + } pineconeClient.deleteIndex(podIndexName); } if (serverlessIndexName != null) { + if(pineconeClient.describeIndex(serverlessIndexName).getDeletionProtection() == DeletionProtection.ENABLED) { + pineconeClient.configureServerlessIndex(serverlessIndexName, DeletionProtection.DISABLED, null); + Thread.sleep(5000); + } pineconeClient.deleteIndex(serverlessIndexName); } @@ -387,8 +395,5 @@ private void seedIndex(List vectorIds, String indexName, String namespac totalTimeWaitedForVectors += 2000; indexStats = indexClient.describeIndexStats(); } - if (indexStats.getTotalVectorCount() == 0 && totalTimeWaitedForVectors >= 60000) { - throw new PineconeException("Failed to seed index " + indexName + "with vectors"); - } } } diff --git a/src/integration/java/io/pinecone/integration/inference/EmbedTest.java b/src/integration/java/io/pinecone/integration/inference/EmbedTest.java index ba547d96..5fbd1982 100644 --- a/src/integration/java/io/pinecone/integration/inference/EmbedTest.java +++ b/src/integration/java/io/pinecone/integration/inference/EmbedTest.java @@ -35,7 +35,7 @@ public void testGenerateEmbeddings() throws ApiException { assertNotNull(embeddings, "Expected embedding to be not null"); Assertions.assertEquals(embeddingModel, embeddings.getModel()); - Assertions.assertEquals(1024, embeddings.getData().get(0).getValues().size()); + Assertions.assertEquals(1024, embeddings.getData().get(0).getDenseEmbedding().getValues().size()); Assertions.assertEquals(2, embeddings.getData().size()); } diff --git a/src/integration/java/io/pinecone/integration/inference/RerankTest.java b/src/integration/java/io/pinecone/integration/inference/RerankTest.java index 54c5183f..2a27f388 100644 --- a/src/integration/java/io/pinecone/integration/inference/RerankTest.java +++ b/src/integration/java/io/pinecone/integration/inference/RerankTest.java @@ -22,24 +22,24 @@ public class RerankTest { public void testRerank() throws ApiException { String model = "bge-reranker-v2-m3"; String query = "The tech company Apple is known for its innovative products like the iPhone."; - List> documents = new ArrayList<>(); + List> documents = new ArrayList<>(); - Map doc1 = new HashMap<>(); + Map doc1 = new HashMap<>(); doc1.put("id", "vec1"); doc1.put("my_field", "Apple is a popular fruit known for its sweetness and crisp texture."); documents.add(doc1); - Map doc2 = new HashMap<>(); + Map doc2 = new HashMap<>(); doc2.put("id", "vec2"); doc2.put("my_field", "Many people enjoy eating apples as a healthy snack."); documents.add(doc2); - Map doc3 = new HashMap<>(); + Map doc3 = new HashMap<>(); doc3.put("id", "vec3"); doc3.put("my_field", "Apple Inc. has revolutionized the tech industry with its sleek designs and user-friendly interfaces."); documents.add(doc3); - Map doc4 = new HashMap<>(); + Map doc4 = new HashMap<>(); doc4.put("id", "vec4"); doc4.put("my_field", "An apple a day keeps the doctor away, as the saying goes."); documents.add(doc4); @@ -47,7 +47,7 @@ public void testRerank() throws ApiException { List rankFields = Arrays.asList("my_field"); int topN = 2; boolean returnDocuments = true; - Map parameters = new HashMap<>(); + Map parameters = new HashMap<>(); parameters.put("truncate", "END"); RerankResult result = inference.rerank(model, query, documents, rankFields, topN, returnDocuments, parameters); @@ -63,24 +63,24 @@ public void testRerank() throws ApiException { public void testRerankWithRequiredParameters() throws ApiException { String model = "bge-reranker-v2-m3"; String query = "The tech company Apple is known for its innovative products like the iPhone."; - List> documents = new ArrayList<>(); + List> documents = new ArrayList<>(); - Map doc1 = new HashMap<>(); + Map doc1 = new HashMap<>(); doc1.put("id", "vec1"); doc1.put("text", "Apple is a popular fruit known for its sweetness and crisp texture."); documents.add(doc1); - Map doc2 = new HashMap<>(); + Map doc2 = new HashMap<>(); doc2.put("id", "vec2"); doc2.put("text", "Many people enjoy eating apples as a healthy snack."); documents.add(doc2); - Map doc3 = new HashMap<>(); + Map doc3 = new HashMap<>(); doc3.put("id", "vec3"); doc3.put("text", "Apple Inc. has revolutionized the tech industry with its sleek designs and user-friendly interfaces."); documents.add(doc3); - Map doc4 = new HashMap<>(); + Map doc4 = new HashMap<>(); doc4.put("id", "vec4"); doc4.put("text", "An apple a day keeps the doctor away, as the saying goes."); documents.add(doc4); diff --git a/src/main/java/io/pinecone/clients/Inference.java b/src/main/java/io/pinecone/clients/Inference.java index 14da5f66..47064b70 100644 --- a/src/main/java/io/pinecone/clients/Inference.java +++ b/src/main/java/io/pinecone/clients/Inference.java @@ -49,12 +49,9 @@ public Inference(PineconeConfig config) { * @throws ApiException If the API call fails, an ApiException is thrown. */ public EmbeddingsList embed(String model, Map parameters, List inputs) throws ApiException { - EmbedRequestParameters embedRequestParameters = new EmbedRequestParameters(); - parameters.forEach(embedRequestParameters::putAdditionalProperty); - EmbedRequest embedRequest = new EmbedRequest() .model(model) - .parameters(embedRequestParameters) + .parameters(parameters) .inputs(convertToEmbedInputs(inputs)); return inferenceApi.embed(embedRequest); @@ -74,7 +71,7 @@ public EmbeddingsList embed(String model, Map parameters, List> documents) throws ApiException { + List> documents) throws ApiException { return rerank(model, query, documents, @@ -100,11 +97,11 @@ public RerankResult rerank(String model, */ public RerankResult rerank(String model, String query, - List> documents, + List> documents, List rankFields, int topN, boolean returnDocuments, - Map parameters) throws ApiException { + Map parameters) throws ApiException { RerankRequest rerankRequest = new RerankRequest(); rerankRequest diff --git a/src/main/java/org/openapitools/db_control/client/ApiCallback.java b/src/main/java/org/openapitools/db_control/client/ApiCallback.java index 710a4ff5..1fbcdb21 100644 --- a/src/main/java/org/openapitools/db_control/client/ApiCallback.java +++ b/src/main/java/org/openapitools/db_control/client/ApiCallback.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_control/client/ApiClient.java b/src/main/java/org/openapitools/db_control/client/ApiClient.java index fa75cf16..39477a57 100644 --- a/src/main/java/org/openapitools/db_control/client/ApiClient.java +++ b/src/main/java/org/openapitools/db_control/client/ApiClient.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -140,7 +140,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/2024-10/java"); + setUserAgent("OpenAPI-Generator/2025-01/java"); authentications = new HashMap(); } diff --git a/src/main/java/org/openapitools/db_control/client/ApiException.java b/src/main/java/org/openapitools/db_control/client/ApiException.java index 7e43c5ac..6b2aecb9 100644 --- a/src/main/java/org/openapitools/db_control/client/ApiException.java +++ b/src/main/java/org/openapitools/db_control/client/ApiException.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/src/main/java/org/openapitools/db_control/client/ApiResponse.java b/src/main/java/org/openapitools/db_control/client/ApiResponse.java index becef8ad..9dada288 100644 --- a/src/main/java/org/openapitools/db_control/client/ApiResponse.java +++ b/src/main/java/org/openapitools/db_control/client/ApiResponse.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_control/client/Configuration.java b/src/main/java/org/openapitools/db_control/client/Configuration.java index e742b5c3..02eeb112 100644 --- a/src/main/java/org/openapitools/db_control/client/Configuration.java +++ b/src/main/java/org/openapitools/db_control/client/Configuration.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -13,9 +13,9 @@ package org.openapitools.db_control.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class Configuration { - public static final String VERSION = "2024-10"; + public static final String VERSION = "2025-01"; private static ApiClient defaultApiClient = new ApiClient(); diff --git a/src/main/java/org/openapitools/db_control/client/GzipRequestInterceptor.java b/src/main/java/org/openapitools/db_control/client/GzipRequestInterceptor.java index 888a2cbd..568c6f92 100644 --- a/src/main/java/org/openapitools/db_control/client/GzipRequestInterceptor.java +++ b/src/main/java/org/openapitools/db_control/client/GzipRequestInterceptor.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_control/client/JSON.java b/src/main/java/org/openapitools/db_control/client/JSON.java index cb3c1727..4daeab8f 100644 --- a/src/main/java/org/openapitools/db_control/client/JSON.java +++ b/src/main/java/org/openapitools/db_control/client/JSON.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -96,9 +96,12 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.CollectionList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.CollectionModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.ConfigureIndexRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.ConfigureIndexRequestEmbed.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.ConfigureIndexRequestSpec.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.ConfigureIndexRequestSpecPod.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.CreateCollectionRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.CreateIndexForModelRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.CreateIndexForModelRequestEmbed.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.CreateIndexRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.ErrorResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.ErrorResponseError.CustomTypeAdapterFactory()); @@ -107,6 +110,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.IndexModelSpec.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.IndexModelStatus.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.IndexSpec.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.ModelIndexEmbed.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.PodSpec.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.PodSpecMetadataConfig.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_control.client.model.ServerlessSpec.CustomTypeAdapterFactory()); diff --git a/src/main/java/org/openapitools/db_control/client/Pair.java b/src/main/java/org/openapitools/db_control/client/Pair.java index 8cc5ec2c..86fca965 100644 --- a/src/main/java/org/openapitools/db_control/client/Pair.java +++ b/src/main/java/org/openapitools/db_control/client/Pair.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -13,7 +13,7 @@ package org.openapitools.db_control.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/org/openapitools/db_control/client/ProgressRequestBody.java b/src/main/java/org/openapitools/db_control/client/ProgressRequestBody.java index 7b1c0703..07002b23 100644 --- a/src/main/java/org/openapitools/db_control/client/ProgressRequestBody.java +++ b/src/main/java/org/openapitools/db_control/client/ProgressRequestBody.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_control/client/ProgressResponseBody.java b/src/main/java/org/openapitools/db_control/client/ProgressResponseBody.java index 1dc61234..9e2cb8ab 100644 --- a/src/main/java/org/openapitools/db_control/client/ProgressResponseBody.java +++ b/src/main/java/org/openapitools/db_control/client/ProgressResponseBody.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_control/client/StringUtil.java b/src/main/java/org/openapitools/db_control/client/StringUtil.java index bed2d712..2d129fae 100644 --- a/src/main/java/org/openapitools/db_control/client/StringUtil.java +++ b/src/main/java/org/openapitools/db_control/client/StringUtil.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/org/openapitools/db_control/client/api/ManageIndexesApi.java b/src/main/java/org/openapitools/db_control/client/api/ManageIndexesApi.java index 507089c0..75f7b88b 100644 --- a/src/main/java/org/openapitools/db_control/client/api/ManageIndexesApi.java +++ b/src/main/java/org/openapitools/db_control/client/api/ManageIndexesApi.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -31,6 +31,7 @@ import org.openapitools.db_control.client.model.CollectionModel; import org.openapitools.db_control.client.model.ConfigureIndexRequest; import org.openapitools.db_control.client.model.CreateCollectionRequest; +import org.openapitools.db_control.client.model.CreateIndexForModelRequest; import org.openapitools.db_control.client.model.CreateIndexRequest; import org.openapitools.db_control.client.model.ErrorResponse; import org.openapitools.db_control.client.model.IndexList; @@ -163,7 +164,7 @@ private okhttp3.Call configureIndexValidateBeforeCall(String indexName, Configur /** * Configure an index - * This operation configures an existing index. For serverless indexes, you can configure only index deletion protection and tags. For pod-based indexes, you can configure the pod size, number of replicas, tags, and index deletion protection. It is not possible to change the pod type of a pod-based index. However, you can create a collection from a pod-based index and then [create a new pod-based index with a different pod type](http://docs.pinecone.io/guides/indexes/create-an-index#create-an-index-from-a-collection) from the collection. For guidance and examples, see [Configure an index](http://docs.pinecone.io/guides/indexes/configure-an-index). + * This operation configures an existing index. For serverless indexes, you can configure index deletion protection, tags, and integrated inference embedding settings for the index. For pod-based indexes, you can configure the pod size, number of replicas, tags, and index deletion protection. It is not possible to change the pod type of a pod-based index. However, you can create a collection from a pod-based index and then [create a new pod-based index with a different pod type](http://docs.pinecone.io/guides/indexes/pods/create-a-pod-based-index#create-a-pod-index-from-a-collection) from the collection. For guidance and examples, see [Configure an index](http://docs.pinecone.io/guides/indexes/pods/manage-pod-based-indexes). * @param indexName The name of the index to configure. (required) * @param configureIndexRequest The desired pod size and replica configuration for the index. (required) * @return IndexModel @@ -188,7 +189,7 @@ public IndexModel configureIndex(String indexName, ConfigureIndexRequest configu /** * Configure an index - * This operation configures an existing index. For serverless indexes, you can configure only index deletion protection and tags. For pod-based indexes, you can configure the pod size, number of replicas, tags, and index deletion protection. It is not possible to change the pod type of a pod-based index. However, you can create a collection from a pod-based index and then [create a new pod-based index with a different pod type](http://docs.pinecone.io/guides/indexes/create-an-index#create-an-index-from-a-collection) from the collection. For guidance and examples, see [Configure an index](http://docs.pinecone.io/guides/indexes/configure-an-index). + * This operation configures an existing index. For serverless indexes, you can configure index deletion protection, tags, and integrated inference embedding settings for the index. For pod-based indexes, you can configure the pod size, number of replicas, tags, and index deletion protection. It is not possible to change the pod type of a pod-based index. However, you can create a collection from a pod-based index and then [create a new pod-based index with a different pod type](http://docs.pinecone.io/guides/indexes/pods/create-a-pod-based-index#create-a-pod-index-from-a-collection) from the collection. For guidance and examples, see [Configure an index](http://docs.pinecone.io/guides/indexes/pods/manage-pod-based-indexes). * @param indexName The name of the index to configure. (required) * @param configureIndexRequest The desired pod size and replica configuration for the index. (required) * @return ApiResponse<IndexModel> @@ -214,7 +215,7 @@ public ApiResponse configureIndexWithHttpInfo(String indexName, Conf /** * Configure an index (asynchronously) - * This operation configures an existing index. For serverless indexes, you can configure only index deletion protection and tags. For pod-based indexes, you can configure the pod size, number of replicas, tags, and index deletion protection. It is not possible to change the pod type of a pod-based index. However, you can create a collection from a pod-based index and then [create a new pod-based index with a different pod type](http://docs.pinecone.io/guides/indexes/create-an-index#create-an-index-from-a-collection) from the collection. For guidance and examples, see [Configure an index](http://docs.pinecone.io/guides/indexes/configure-an-index). + * This operation configures an existing index. For serverless indexes, you can configure index deletion protection, tags, and integrated inference embedding settings for the index. For pod-based indexes, you can configure the pod size, number of replicas, tags, and index deletion protection. It is not possible to change the pod type of a pod-based index. However, you can create a collection from a pod-based index and then [create a new pod-based index with a different pod type](http://docs.pinecone.io/guides/indexes/pods/create-a-pod-based-index#create-a-pod-index-from-a-collection) from the collection. For guidance and examples, see [Configure an index](http://docs.pinecone.io/guides/indexes/pods/manage-pod-based-indexes). * @param indexName The name of the index to configure. (required) * @param configureIndexRequest The desired pod size and replica configuration for the index. (required) * @param _callback The callback to be executed when the API call finishes @@ -469,7 +470,7 @@ private okhttp3.Call createIndexValidateBeforeCall(CreateIndexRequest createInde /** * Create an index - * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/indexes/create-an-index#create-a-serverless-index). + * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/indexes/create-an-index#create-a-serverless-index). * @param createIndexRequest The desired configuration for the index. (required) * @return IndexModel * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -494,7 +495,7 @@ public IndexModel createIndex(CreateIndexRequest createIndexRequest) throws ApiE /** * Create an index - * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/indexes/create-an-index#create-a-serverless-index). + * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/indexes/create-an-index#create-a-serverless-index). * @param createIndexRequest The desired configuration for the index. (required) * @return ApiResponse<IndexModel> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -520,7 +521,7 @@ public ApiResponse createIndexWithHttpInfo(CreateIndexRequest create /** * Create an index (asynchronously) - * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/indexes/create-an-index#create-a-serverless-index). + * This operation deploys a Pinecone index. This is where you specify the measure of similarity, the dimension of vectors to be stored in the index, which cloud provider you would like to deploy with, and more. For guidance and examples, see [Create an index](https://docs.pinecone.io/guides/indexes/create-an-index#create-a-serverless-index). * @param createIndexRequest The desired configuration for the index. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call @@ -546,6 +547,153 @@ public okhttp3.Call createIndexAsync(CreateIndexRequest createIndexRequest, fina localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for createIndexForModel + * @param createIndexForModelRequest The desired configuration for the index and associated embedding model. (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + + + +
Status Code Description Response Headers
201 The index has successfully been created for the embedding model. -
400 Bad request. The request body included invalid request parameters. -
401 Unauthorized. Possible causes: Invalid API key. -
404 Unknown cloud or region when creating a serverless index. -
409 Index of given name already exists. -
422 Unprocessable entity. The request body could not be deserialized. -
500 Internal server error. -
+ */ + public okhttp3.Call createIndexForModelCall(CreateIndexForModelRequest createIndexForModelRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = createIndexForModelRequest; + + // create path and map variables + String localVarPath = "/indexes/create-for-model"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createIndexForModelValidateBeforeCall(CreateIndexForModelRequest createIndexForModelRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createIndexForModelRequest' is set + if (createIndexForModelRequest == null) { + throw new ApiException("Missing the required parameter 'createIndexForModelRequest' when calling createIndexForModel(Async)"); + } + + return createIndexForModelCall(createIndexForModelRequest, _callback); + + } + + /** + * Create an index for an embedding model + * This operation creates a serverless integrated inference index for a specific embedding model. Refer to the [model guide](https://docs.pinecone.io/guides/inference/understanding-inference#embedding-models) for available models and model details. + * @param createIndexForModelRequest The desired configuration for the index and associated embedding model. (required) + * @return IndexModel + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Status Code Description Response Headers
201 The index has successfully been created for the embedding model. -
400 Bad request. The request body included invalid request parameters. -
401 Unauthorized. Possible causes: Invalid API key. -
404 Unknown cloud or region when creating a serverless index. -
409 Index of given name already exists. -
422 Unprocessable entity. The request body could not be deserialized. -
500 Internal server error. -
+ */ + public IndexModel createIndexForModel(CreateIndexForModelRequest createIndexForModelRequest) throws ApiException { + ApiResponse localVarResp = createIndexForModelWithHttpInfo(createIndexForModelRequest); + return localVarResp.getData(); + } + + /** + * Create an index for an embedding model + * This operation creates a serverless integrated inference index for a specific embedding model. Refer to the [model guide](https://docs.pinecone.io/guides/inference/understanding-inference#embedding-models) for available models and model details. + * @param createIndexForModelRequest The desired configuration for the index and associated embedding model. (required) + * @return ApiResponse<IndexModel> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + + + +
Status Code Description Response Headers
201 The index has successfully been created for the embedding model. -
400 Bad request. The request body included invalid request parameters. -
401 Unauthorized. Possible causes: Invalid API key. -
404 Unknown cloud or region when creating a serverless index. -
409 Index of given name already exists. -
422 Unprocessable entity. The request body could not be deserialized. -
500 Internal server error. -
+ */ + public ApiResponse createIndexForModelWithHttpInfo(CreateIndexForModelRequest createIndexForModelRequest) throws ApiException { + okhttp3.Call localVarCall = createIndexForModelValidateBeforeCall(createIndexForModelRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Create an index for an embedding model (asynchronously) + * This operation creates a serverless integrated inference index for a specific embedding model. Refer to the [model guide](https://docs.pinecone.io/guides/inference/understanding-inference#embedding-models) for available models and model details. + * @param createIndexForModelRequest The desired configuration for the index and associated embedding model. (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + + + + +
Status Code Description Response Headers
201 The index has successfully been created for the embedding model. -
400 Bad request. The request body included invalid request parameters. -
401 Unauthorized. Possible causes: Invalid API key. -
404 Unknown cloud or region when creating a serverless index. -
409 Index of given name already exists. -
422 Unprocessable entity. The request body could not be deserialized. -
500 Internal server error. -
+ */ + public okhttp3.Call createIndexForModelAsync(CreateIndexForModelRequest createIndexForModelRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createIndexForModelValidateBeforeCall(createIndexForModelRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for deleteCollection * @param collectionName The name of the collection. (required) diff --git a/src/main/java/org/openapitools/db_control/client/auth/ApiKeyAuth.java b/src/main/java/org/openapitools/db_control/client/auth/ApiKeyAuth.java index 27eee2da..05644cf9 100644 --- a/src/main/java/org/openapitools/db_control/client/auth/ApiKeyAuth.java +++ b/src/main/java/org/openapitools/db_control/client/auth/ApiKeyAuth.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/org/openapitools/db_control/client/auth/Authentication.java b/src/main/java/org/openapitools/db_control/client/auth/Authentication.java index 26f0f01b..38161489 100644 --- a/src/main/java/org/openapitools/db_control/client/auth/Authentication.java +++ b/src/main/java/org/openapitools/db_control/client/auth/Authentication.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_control/client/auth/HttpBasicAuth.java b/src/main/java/org/openapitools/db_control/client/auth/HttpBasicAuth.java index 73b459ad..26ad3637 100644 --- a/src/main/java/org/openapitools/db_control/client/auth/HttpBasicAuth.java +++ b/src/main/java/org/openapitools/db_control/client/auth/HttpBasicAuth.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_control/client/auth/HttpBearerAuth.java b/src/main/java/org/openapitools/db_control/client/auth/HttpBearerAuth.java index 5f6e021a..9a3fbef8 100644 --- a/src/main/java/org/openapitools/db_control/client/auth/HttpBearerAuth.java +++ b/src/main/java/org/openapitools/db_control/client/auth/HttpBearerAuth.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/src/main/java/org/openapitools/db_control/client/model/AbstractOpenApiSchema.java b/src/main/java/org/openapitools/db_control/client/model/AbstractOpenApiSchema.java index df16d288..854b1fde 100644 --- a/src/main/java/org/openapitools/db_control/client/model/AbstractOpenApiSchema.java +++ b/src/main/java/org/openapitools/db_control/client/model/AbstractOpenApiSchema.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -23,7 +23,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/org/openapitools/db_control/client/model/CollectionList.java b/src/main/java/org/openapitools/db_control/client/model/CollectionList.java index 8d523b91..0b8e2062 100644 --- a/src/main/java/org/openapitools/db_control/client/model/CollectionList.java +++ b/src/main/java/org/openapitools/db_control/client/model/CollectionList.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -52,7 +52,7 @@ /** * The list of collections that exist in the project. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class CollectionList { public static final String SERIALIZED_NAME_COLLECTIONS = "collections"; @SerializedName(SERIALIZED_NAME_COLLECTIONS) diff --git a/src/main/java/org/openapitools/db_control/client/model/CollectionModel.java b/src/main/java/org/openapitools/db_control/client/model/CollectionModel.java index a1a9bd4d..d70cf62a 100644 --- a/src/main/java/org/openapitools/db_control/client/model/CollectionModel.java +++ b/src/main/java/org/openapitools/db_control/client/model/CollectionModel.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * The CollectionModel describes the configuration and status of a Pinecone collection. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class CollectionModel { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequest.java b/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequest.java index 49935fd8..7c992897 100644 --- a/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequest.java +++ b/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequest.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -23,9 +23,9 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import org.openapitools.db_control.client.model.ConfigureIndexRequestEmbed; import org.openapitools.db_control.client.model.ConfigureIndexRequestSpec; import org.openapitools.db_control.client.model.DeletionProtection; -import org.openapitools.jackson.nullable.JsonNullable; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -54,7 +54,7 @@ /** * Configuration used to scale an index. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class ConfigureIndexRequest { public static final String SERIALIZED_NAME_SPEC = "spec"; @SerializedName(SERIALIZED_NAME_SPEC) @@ -66,7 +66,11 @@ public class ConfigureIndexRequest { public static final String SERIALIZED_NAME_TAGS = "tags"; @SerializedName(SERIALIZED_NAME_TAGS) - private Map tags; + private Map tags = new HashMap<>(); + + public static final String SERIALIZED_NAME_EMBED = "embed"; + @SerializedName(SERIALIZED_NAME_EMBED) + private ConfigureIndexRequestEmbed embed; public ConfigureIndexRequest() { } @@ -128,7 +132,7 @@ public ConfigureIndexRequest putTagsItem(String key, String tagsItem) { } /** - * Custom user tags added to an index. Keys must be alphanumeric and 80 characters or less. Values must be 120 characters or less. + * Custom user tags added to an index. Keys must be 80 characters or less. Values must be 120 characters or less. Keys must be alphanumeric, '_', or '-'. Values must be alphanumeric, ';', '@', '_', '-', '.', '+', or ' '. To unset a key, set the value to be an empty string. * @return tags **/ @javax.annotation.Nullable @@ -141,6 +145,27 @@ public void setTags(Map tags) { this.tags = tags; } + + public ConfigureIndexRequest embed(ConfigureIndexRequestEmbed embed) { + + this.embed = embed; + return this; + } + + /** + * Get embed + * @return embed + **/ + @javax.annotation.Nullable + public ConfigureIndexRequestEmbed getEmbed() { + return embed; + } + + + public void setEmbed(ConfigureIndexRequestEmbed embed) { + this.embed = embed; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -198,24 +223,14 @@ public boolean equals(Object o) { ConfigureIndexRequest configureIndexRequest = (ConfigureIndexRequest) o; return Objects.equals(this.spec, configureIndexRequest.spec) && Objects.equals(this.deletionProtection, configureIndexRequest.deletionProtection) && - Objects.equals(this.tags, configureIndexRequest.tags)&& + Objects.equals(this.tags, configureIndexRequest.tags) && + Objects.equals(this.embed, configureIndexRequest.embed)&& Objects.equals(this.additionalProperties, configureIndexRequest.additionalProperties); } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - @Override public int hashCode() { - return Objects.hash(spec, deletionProtection, tags, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + return Objects.hash(spec, deletionProtection, tags, embed, additionalProperties); } @Override @@ -225,6 +240,7 @@ public String toString() { sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); sb.append(" deletionProtection: ").append(toIndentedString(deletionProtection)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" embed: ").append(toIndentedString(embed)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -251,6 +267,7 @@ private String toIndentedString(Object o) { openapiFields.add("spec"); openapiFields.add("deletion_protection"); openapiFields.add("tags"); + openapiFields.add("embed"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); @@ -273,6 +290,10 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (jsonObj.get("spec") != null && !jsonObj.get("spec").isJsonNull()) { ConfigureIndexRequestSpec.validateJsonElement(jsonObj.get("spec")); } + // validate the optional field `embed` + if (jsonObj.get("embed") != null && !jsonObj.get("embed").isJsonNull()) { + ConfigureIndexRequestEmbed.validateJsonElement(jsonObj.get("embed")); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequestEmbed.java b/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequestEmbed.java new file mode 100644 index 00000000..e7c86410 --- /dev/null +++ b/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequestEmbed.java @@ -0,0 +1,368 @@ +/* + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_control.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_control.client.JSON; + +/** + * Configure the integrated inference embedding settings for this index. You can convert an existing index to an integrated index by specifying the embedding model and field_map. The index vector type and dimension must match the model vector type and dimension, and the index similarity metric must be supported by the model. Refer to the [model guide](https://docs.pinecone.io/guides/inference/understanding-inference#embedding-models) for available models and model details. You can later change the embedding configuration to update the field map, read parameters, or write parameters. Once set, the model cannot be changed. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") +public class ConfigureIndexRequestEmbed { + public static final String SERIALIZED_NAME_MODEL = "model"; + @SerializedName(SERIALIZED_NAME_MODEL) + private String model; + + public static final String SERIALIZED_NAME_FIELD_MAP = "field_map"; + @SerializedName(SERIALIZED_NAME_FIELD_MAP) + private Object fieldMap; + + public static final String SERIALIZED_NAME_READ_PARAMETERS = "read_parameters"; + @SerializedName(SERIALIZED_NAME_READ_PARAMETERS) + private Object readParameters; + + public static final String SERIALIZED_NAME_WRITE_PARAMETERS = "write_parameters"; + @SerializedName(SERIALIZED_NAME_WRITE_PARAMETERS) + private Object writeParameters; + + public ConfigureIndexRequestEmbed() { + } + + public ConfigureIndexRequestEmbed model(String model) { + + this.model = model; + return this; + } + + /** + * The name of the embedding model to use with the index. The index dimension and model dimension must match, and the index similarity metric must be supported by the model. The index embedding model cannot be changed once set. + * @return model + **/ + @javax.annotation.Nullable + public String getModel() { + return model; + } + + + public void setModel(String model) { + this.model = model; + } + + + public ConfigureIndexRequestEmbed fieldMap(Object fieldMap) { + + this.fieldMap = fieldMap; + return this; + } + + /** + * Identifies the name of the text field from your document model that will be embedded. + * @return fieldMap + **/ + @javax.annotation.Nullable + public Object getFieldMap() { + return fieldMap; + } + + + public void setFieldMap(Object fieldMap) { + this.fieldMap = fieldMap; + } + + + public ConfigureIndexRequestEmbed readParameters(Object readParameters) { + + this.readParameters = readParameters; + return this; + } + + /** + * The read parameters for the embedding model. + * @return readParameters + **/ + @javax.annotation.Nullable + public Object getReadParameters() { + return readParameters; + } + + + public void setReadParameters(Object readParameters) { + this.readParameters = readParameters; + } + + + public ConfigureIndexRequestEmbed writeParameters(Object writeParameters) { + + this.writeParameters = writeParameters; + return this; + } + + /** + * The write parameters for the embedding model. + * @return writeParameters + **/ + @javax.annotation.Nullable + public Object getWriteParameters() { + return writeParameters; + } + + + public void setWriteParameters(Object writeParameters) { + this.writeParameters = writeParameters; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ConfigureIndexRequestEmbed instance itself + */ + public ConfigureIndexRequestEmbed putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConfigureIndexRequestEmbed configureIndexRequestEmbed = (ConfigureIndexRequestEmbed) o; + return Objects.equals(this.model, configureIndexRequestEmbed.model) && + Objects.equals(this.fieldMap, configureIndexRequestEmbed.fieldMap) && + Objects.equals(this.readParameters, configureIndexRequestEmbed.readParameters) && + Objects.equals(this.writeParameters, configureIndexRequestEmbed.writeParameters)&& + Objects.equals(this.additionalProperties, configureIndexRequestEmbed.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(model, fieldMap, readParameters, writeParameters, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConfigureIndexRequestEmbed {\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + sb.append(" fieldMap: ").append(toIndentedString(fieldMap)).append("\n"); + sb.append(" readParameters: ").append(toIndentedString(readParameters)).append("\n"); + sb.append(" writeParameters: ").append(toIndentedString(writeParameters)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("model"); + openapiFields.add("field_map"); + openapiFields.add("read_parameters"); + openapiFields.add("write_parameters"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ConfigureIndexRequestEmbed + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConfigureIndexRequestEmbed.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConfigureIndexRequestEmbed is not found in the empty JSON string", ConfigureIndexRequestEmbed.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("model") != null && !jsonObj.get("model").isJsonNull()) && !jsonObj.get("model").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `model` to be a primitive type in the JSON string but got `%s`", jsonObj.get("model").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConfigureIndexRequestEmbed.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConfigureIndexRequestEmbed' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConfigureIndexRequestEmbed.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConfigureIndexRequestEmbed value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ConfigureIndexRequestEmbed read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ConfigureIndexRequestEmbed instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConfigureIndexRequestEmbed given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConfigureIndexRequestEmbed + * @throws IOException if the JSON string is invalid with respect to ConfigureIndexRequestEmbed + */ + public static ConfigureIndexRequestEmbed fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConfigureIndexRequestEmbed.class); + } + + /** + * Convert an instance of ConfigureIndexRequestEmbed to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequestSpec.java b/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequestSpec.java index 37fa0fa1..8e6cc681 100644 --- a/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequestSpec.java +++ b/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequestSpec.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -50,7 +50,7 @@ /** * ConfigureIndexRequestSpec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class ConfigureIndexRequestSpec { public static final String SERIALIZED_NAME_POD = "pod"; @SerializedName(SERIALIZED_NAME_POD) diff --git a/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequestSpecPod.java b/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequestSpecPod.java index 26a00dd4..c4f054a7 100644 --- a/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequestSpecPod.java +++ b/src/main/java/org/openapitools/db_control/client/model/ConfigureIndexRequestSpecPod.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * ConfigureIndexRequestSpecPod */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class ConfigureIndexRequestSpecPod { public static final String SERIALIZED_NAME_REPLICAS = "replicas"; @SerializedName(SERIALIZED_NAME_REPLICAS) diff --git a/src/main/java/org/openapitools/db_control/client/model/CreateCollectionRequest.java b/src/main/java/org/openapitools/db_control/client/model/CreateCollectionRequest.java index 62f36c4f..df9c320b 100644 --- a/src/main/java/org/openapitools/db_control/client/model/CreateCollectionRequest.java +++ b/src/main/java/org/openapitools/db_control/client/model/CreateCollectionRequest.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * The configuration needed to create a Pinecone collection. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class CreateCollectionRequest { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) diff --git a/src/main/java/org/openapitools/db_control/client/model/CreateIndexForModelRequest.java b/src/main/java/org/openapitools/db_control/client/model/CreateIndexForModelRequest.java new file mode 100644 index 00000000..f8a0ef51 --- /dev/null +++ b/src/main/java/org/openapitools/db_control/client/model/CreateIndexForModelRequest.java @@ -0,0 +1,504 @@ +/* + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_control.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.openapitools.db_control.client.model.CreateIndexForModelRequestEmbed; +import org.openapitools.db_control.client.model.DeletionProtection; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_control.client.JSON; + +/** + * The desired configuration for the index and associated embedding model. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") +public class CreateIndexForModelRequest { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + + /** + * The public cloud where you would like your index hosted. + */ + @JsonAdapter(CloudEnum.Adapter.class) + public enum CloudEnum { + GCP("gcp"), + + AWS("aws"), + + AZURE("azure"); + + private String value; + + CloudEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static CloudEnum fromValue(String value) { + for (CloudEnum b : CloudEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final CloudEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public CloudEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return CloudEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_CLOUD = "cloud"; + @SerializedName(SERIALIZED_NAME_CLOUD) + private CloudEnum cloud; + + public static final String SERIALIZED_NAME_REGION = "region"; + @SerializedName(SERIALIZED_NAME_REGION) + private String region; + + public static final String SERIALIZED_NAME_DELETION_PROTECTION = "deletion_protection"; + @SerializedName(SERIALIZED_NAME_DELETION_PROTECTION) + private DeletionProtection deletionProtection = DeletionProtection.DISABLED; + + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private Map tags = new HashMap<>(); + + public static final String SERIALIZED_NAME_EMBED = "embed"; + @SerializedName(SERIALIZED_NAME_EMBED) + private CreateIndexForModelRequestEmbed embed; + + public CreateIndexForModelRequest() { + } + + public CreateIndexForModelRequest name(String name) { + + this.name = name; + return this; + } + + /** + * The name of the index. Resource name must be 1-45 characters long, start and end with an alphanumeric character, and consist only of lower case alphanumeric characters or '-'. + * @return name + **/ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + + public void setName(String name) { + this.name = name; + } + + + public CreateIndexForModelRequest cloud(CloudEnum cloud) { + + this.cloud = cloud; + return this; + } + + /** + * The public cloud where you would like your index hosted. + * @return cloud + **/ + @javax.annotation.Nonnull + public CloudEnum getCloud() { + return cloud; + } + + + public void setCloud(CloudEnum cloud) { + this.cloud = cloud; + } + + + public CreateIndexForModelRequest region(String region) { + + this.region = region; + return this; + } + + /** + * The region where you would like your index to be created. + * @return region + **/ + @javax.annotation.Nonnull + public String getRegion() { + return region; + } + + + public void setRegion(String region) { + this.region = region; + } + + + public CreateIndexForModelRequest deletionProtection(DeletionProtection deletionProtection) { + + this.deletionProtection = deletionProtection; + return this; + } + + /** + * Get deletionProtection + * @return deletionProtection + **/ + @javax.annotation.Nullable + public DeletionProtection getDeletionProtection() { + return deletionProtection; + } + + + public void setDeletionProtection(DeletionProtection deletionProtection) { + this.deletionProtection = deletionProtection; + } + + + public CreateIndexForModelRequest tags(Map tags) { + + this.tags = tags; + return this; + } + + public CreateIndexForModelRequest putTagsItem(String key, String tagsItem) { + if (this.tags == null) { + this.tags = new HashMap<>(); + } + this.tags.put(key, tagsItem); + return this; + } + + /** + * Custom user tags added to an index. Keys must be 80 characters or less. Values must be 120 characters or less. Keys must be alphanumeric, '_', or '-'. Values must be alphanumeric, ';', '@', '_', '-', '.', '+', or ' '. To unset a key, set the value to be an empty string. + * @return tags + **/ + @javax.annotation.Nullable + public Map getTags() { + return tags; + } + + + public void setTags(Map tags) { + this.tags = tags; + } + + + public CreateIndexForModelRequest embed(CreateIndexForModelRequestEmbed embed) { + + this.embed = embed; + return this; + } + + /** + * Get embed + * @return embed + **/ + @javax.annotation.Nonnull + public CreateIndexForModelRequestEmbed getEmbed() { + return embed; + } + + + public void setEmbed(CreateIndexForModelRequestEmbed embed) { + this.embed = embed; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateIndexForModelRequest instance itself + */ + public CreateIndexForModelRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateIndexForModelRequest createIndexForModelRequest = (CreateIndexForModelRequest) o; + return Objects.equals(this.name, createIndexForModelRequest.name) && + Objects.equals(this.cloud, createIndexForModelRequest.cloud) && + Objects.equals(this.region, createIndexForModelRequest.region) && + Objects.equals(this.deletionProtection, createIndexForModelRequest.deletionProtection) && + Objects.equals(this.tags, createIndexForModelRequest.tags) && + Objects.equals(this.embed, createIndexForModelRequest.embed)&& + Objects.equals(this.additionalProperties, createIndexForModelRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, cloud, region, deletionProtection, tags, embed, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateIndexForModelRequest {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" cloud: ").append(toIndentedString(cloud)).append("\n"); + sb.append(" region: ").append(toIndentedString(region)).append("\n"); + sb.append(" deletionProtection: ").append(toIndentedString(deletionProtection)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" embed: ").append(toIndentedString(embed)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("cloud"); + openapiFields.add("region"); + openapiFields.add("deletion_protection"); + openapiFields.add("tags"); + openapiFields.add("embed"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("cloud"); + openapiRequiredFields.add("region"); + openapiRequiredFields.add("embed"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateIndexForModelRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateIndexForModelRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateIndexForModelRequest is not found in the empty JSON string", CreateIndexForModelRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateIndexForModelRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("name").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `name` to be a primitive type in the JSON string but got `%s`", jsonObj.get("name").toString())); + } + if (!jsonObj.get("cloud").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `cloud` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cloud").toString())); + } + if (!jsonObj.get("region").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `region` to be a primitive type in the JSON string but got `%s`", jsonObj.get("region").toString())); + } + // validate the required field `embed` + CreateIndexForModelRequestEmbed.validateJsonElement(jsonObj.get("embed")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateIndexForModelRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateIndexForModelRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateIndexForModelRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateIndexForModelRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateIndexForModelRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateIndexForModelRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateIndexForModelRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateIndexForModelRequest + * @throws IOException if the JSON string is invalid with respect to CreateIndexForModelRequest + */ + public static CreateIndexForModelRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateIndexForModelRequest.class); + } + + /** + * Convert an instance of CreateIndexForModelRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_control/client/model/CreateIndexForModelRequestEmbed.java b/src/main/java/org/openapitools/db_control/client/model/CreateIndexForModelRequestEmbed.java new file mode 100644 index 00000000..5e13b2ad --- /dev/null +++ b/src/main/java/org/openapitools/db_control/client/model/CreateIndexForModelRequestEmbed.java @@ -0,0 +1,457 @@ +/* + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_control.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_control.client.JSON; + +/** + * Specify the integrated inference embedding configuration for the index. Once set the model cannot be changed, but you can later update the embedding configuration for an integrated inference index including field map, read parameters, or write parameters. Refer to the [model guide](https://docs.pinecone.io/guides/inference/understanding-inference#embedding-models) for available models and model details. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") +public class CreateIndexForModelRequestEmbed { + public static final String SERIALIZED_NAME_MODEL = "model"; + @SerializedName(SERIALIZED_NAME_MODEL) + private String model; + + /** + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. If not specified, the metric will be defaulted according to the model. Cannot be updated once set. + */ + @JsonAdapter(MetricEnum.Adapter.class) + public enum MetricEnum { + COSINE("cosine"), + + EUCLIDEAN("euclidean"), + + DOTPRODUCT("dotproduct"); + + private String value; + + MetricEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MetricEnum fromValue(String value) { + for (MetricEnum b : MetricEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MetricEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MetricEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MetricEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_METRIC = "metric"; + @SerializedName(SERIALIZED_NAME_METRIC) + private MetricEnum metric; + + public static final String SERIALIZED_NAME_FIELD_MAP = "field_map"; + @SerializedName(SERIALIZED_NAME_FIELD_MAP) + private Object fieldMap; + + public static final String SERIALIZED_NAME_READ_PARAMETERS = "read_parameters"; + @SerializedName(SERIALIZED_NAME_READ_PARAMETERS) + private Object readParameters; + + public static final String SERIALIZED_NAME_WRITE_PARAMETERS = "write_parameters"; + @SerializedName(SERIALIZED_NAME_WRITE_PARAMETERS) + private Object writeParameters; + + public CreateIndexForModelRequestEmbed() { + } + + public CreateIndexForModelRequestEmbed model(String model) { + + this.model = model; + return this; + } + + /** + * The name of the embedding model to use for the index. + * @return model + **/ + @javax.annotation.Nonnull + public String getModel() { + return model; + } + + + public void setModel(String model) { + this.model = model; + } + + + public CreateIndexForModelRequestEmbed metric(MetricEnum metric) { + + this.metric = metric; + return this; + } + + /** + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. If not specified, the metric will be defaulted according to the model. Cannot be updated once set. + * @return metric + **/ + @javax.annotation.Nullable + public MetricEnum getMetric() { + return metric; + } + + + public void setMetric(MetricEnum metric) { + this.metric = metric; + } + + + public CreateIndexForModelRequestEmbed fieldMap(Object fieldMap) { + + this.fieldMap = fieldMap; + return this; + } + + /** + * Identifies the name of the text field from your document model that will be embedded. + * @return fieldMap + **/ + @javax.annotation.Nonnull + public Object getFieldMap() { + return fieldMap; + } + + + public void setFieldMap(Object fieldMap) { + this.fieldMap = fieldMap; + } + + + public CreateIndexForModelRequestEmbed readParameters(Object readParameters) { + + this.readParameters = readParameters; + return this; + } + + /** + * The read parameters for the embedding model. + * @return readParameters + **/ + @javax.annotation.Nullable + public Object getReadParameters() { + return readParameters; + } + + + public void setReadParameters(Object readParameters) { + this.readParameters = readParameters; + } + + + public CreateIndexForModelRequestEmbed writeParameters(Object writeParameters) { + + this.writeParameters = writeParameters; + return this; + } + + /** + * The write parameters for the embedding model. + * @return writeParameters + **/ + @javax.annotation.Nullable + public Object getWriteParameters() { + return writeParameters; + } + + + public void setWriteParameters(Object writeParameters) { + this.writeParameters = writeParameters; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the CreateIndexForModelRequestEmbed instance itself + */ + public CreateIndexForModelRequestEmbed putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateIndexForModelRequestEmbed createIndexForModelRequestEmbed = (CreateIndexForModelRequestEmbed) o; + return Objects.equals(this.model, createIndexForModelRequestEmbed.model) && + Objects.equals(this.metric, createIndexForModelRequestEmbed.metric) && + Objects.equals(this.fieldMap, createIndexForModelRequestEmbed.fieldMap) && + Objects.equals(this.readParameters, createIndexForModelRequestEmbed.readParameters) && + Objects.equals(this.writeParameters, createIndexForModelRequestEmbed.writeParameters)&& + Objects.equals(this.additionalProperties, createIndexForModelRequestEmbed.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(model, metric, fieldMap, readParameters, writeParameters, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateIndexForModelRequestEmbed {\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + sb.append(" metric: ").append(toIndentedString(metric)).append("\n"); + sb.append(" fieldMap: ").append(toIndentedString(fieldMap)).append("\n"); + sb.append(" readParameters: ").append(toIndentedString(readParameters)).append("\n"); + sb.append(" writeParameters: ").append(toIndentedString(writeParameters)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("model"); + openapiFields.add("metric"); + openapiFields.add("field_map"); + openapiFields.add("read_parameters"); + openapiFields.add("write_parameters"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("model"); + openapiRequiredFields.add("field_map"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateIndexForModelRequestEmbed + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateIndexForModelRequestEmbed.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateIndexForModelRequestEmbed is not found in the empty JSON string", CreateIndexForModelRequestEmbed.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateIndexForModelRequestEmbed.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("model").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `model` to be a primitive type in the JSON string but got `%s`", jsonObj.get("model").toString())); + } + if ((jsonObj.get("metric") != null && !jsonObj.get("metric").isJsonNull()) && !jsonObj.get("metric").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `metric` to be a primitive type in the JSON string but got `%s`", jsonObj.get("metric").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateIndexForModelRequestEmbed.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateIndexForModelRequestEmbed' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateIndexForModelRequestEmbed.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateIndexForModelRequestEmbed value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public CreateIndexForModelRequestEmbed read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + CreateIndexForModelRequestEmbed instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateIndexForModelRequestEmbed given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateIndexForModelRequestEmbed + * @throws IOException if the JSON string is invalid with respect to CreateIndexForModelRequestEmbed + */ + public static CreateIndexForModelRequestEmbed fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateIndexForModelRequestEmbed.class); + } + + /** + * Convert an instance of CreateIndexForModelRequestEmbed to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_control/client/model/CreateIndexRequest.java b/src/main/java/org/openapitools/db_control/client/model/CreateIndexRequest.java index 91ce1b07..64e209d4 100644 --- a/src/main/java/org/openapitools/db_control/client/model/CreateIndexRequest.java +++ b/src/main/java/org/openapitools/db_control/client/model/CreateIndexRequest.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -25,7 +25,6 @@ import java.util.Map; import org.openapitools.db_control.client.model.DeletionProtection; import org.openapitools.db_control.client.model.IndexSpec; -import org.openapitools.jackson.nullable.JsonNullable; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -54,7 +53,7 @@ /** * The configuration needed to create a Pinecone index. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class CreateIndexRequest { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -65,7 +64,7 @@ public class CreateIndexRequest { private Integer dimension; /** - * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. If the 'vector_type' is 'sparse', the metric must be 'dotproduct'. If the `vector_type` is `dense`, the metric defaults to 'cosine'. */ @JsonAdapter(MetricEnum.Adapter.class) public enum MetricEnum { @@ -115,7 +114,7 @@ public MetricEnum read(final JsonReader jsonReader) throws IOException { public static final String SERIALIZED_NAME_METRIC = "metric"; @SerializedName(SERIALIZED_NAME_METRIC) - private MetricEnum metric = MetricEnum.COSINE; + private MetricEnum metric; public static final String SERIALIZED_NAME_DELETION_PROTECTION = "deletion_protection"; @SerializedName(SERIALIZED_NAME_DELETION_PROTECTION) @@ -123,12 +122,16 @@ public MetricEnum read(final JsonReader jsonReader) throws IOException { public static final String SERIALIZED_NAME_TAGS = "tags"; @SerializedName(SERIALIZED_NAME_TAGS) - private Map tags; + private Map tags = new HashMap<>(); public static final String SERIALIZED_NAME_SPEC = "spec"; @SerializedName(SERIALIZED_NAME_SPEC) private IndexSpec spec; + public static final String SERIALIZED_NAME_VECTOR_TYPE = "vector_type"; + @SerializedName(SERIALIZED_NAME_VECTOR_TYPE) + private String vectorType = "dense"; + public CreateIndexRequest() { } @@ -165,7 +168,7 @@ public CreateIndexRequest dimension(Integer dimension) { * maximum: 20000 * @return dimension **/ - @javax.annotation.Nonnull + @javax.annotation.Nullable public Integer getDimension() { return dimension; } @@ -183,7 +186,7 @@ public CreateIndexRequest metric(MetricEnum metric) { } /** - * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. If the 'vector_type' is 'sparse', the metric must be 'dotproduct'. If the `vector_type` is `dense`, the metric defaults to 'cosine'. * @return metric **/ @javax.annotation.Nullable @@ -233,7 +236,7 @@ public CreateIndexRequest putTagsItem(String key, String tagsItem) { } /** - * Custom user tags added to an index. Keys must be alphanumeric and 80 characters or less. Values must be 120 characters or less. + * Custom user tags added to an index. Keys must be 80 characters or less. Values must be 120 characters or less. Keys must be alphanumeric, '_', or '-'. Values must be alphanumeric, ';', '@', '_', '-', '.', '+', or ' '. To unset a key, set the value to be an empty string. * @return tags **/ @javax.annotation.Nullable @@ -267,6 +270,27 @@ public void setSpec(IndexSpec spec) { this.spec = spec; } + + public CreateIndexRequest vectorType(String vectorType) { + + this.vectorType = vectorType; + return this; + } + + /** + * The index vector type. You can use 'dense' or 'sparse'. If 'dense', the vector dimension must be specified. If 'sparse', the vector dimension should not be specified. + * @return vectorType + **/ + @javax.annotation.Nullable + public String getVectorType() { + return vectorType; + } + + + public void setVectorType(String vectorType) { + this.vectorType = vectorType; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -327,24 +351,14 @@ public boolean equals(Object o) { Objects.equals(this.metric, createIndexRequest.metric) && Objects.equals(this.deletionProtection, createIndexRequest.deletionProtection) && Objects.equals(this.tags, createIndexRequest.tags) && - Objects.equals(this.spec, createIndexRequest.spec)&& + Objects.equals(this.spec, createIndexRequest.spec) && + Objects.equals(this.vectorType, createIndexRequest.vectorType)&& Objects.equals(this.additionalProperties, createIndexRequest.additionalProperties); } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - @Override public int hashCode() { - return Objects.hash(name, dimension, metric, deletionProtection, tags, spec, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + return Objects.hash(name, dimension, metric, deletionProtection, tags, spec, vectorType, additionalProperties); } @Override @@ -357,6 +371,7 @@ public String toString() { sb.append(" deletionProtection: ").append(toIndentedString(deletionProtection)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); + sb.append(" vectorType: ").append(toIndentedString(vectorType)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -386,11 +401,11 @@ private String toIndentedString(Object o) { openapiFields.add("deletion_protection"); openapiFields.add("tags"); openapiFields.add("spec"); + openapiFields.add("vector_type"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); openapiRequiredFields.add("name"); - openapiRequiredFields.add("dimension"); openapiRequiredFields.add("spec"); } @@ -422,6 +437,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } // validate the required field `spec` IndexSpec.validateJsonElement(jsonObj.get("spec")); + if ((jsonObj.get("vector_type") != null && !jsonObj.get("vector_type").isJsonNull()) && !jsonObj.get("vector_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `vector_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("vector_type").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/org/openapitools/db_control/client/model/DeletionProtection.java b/src/main/java/org/openapitools/db_control/client/model/DeletionProtection.java index 9b58e475..54322460 100644 --- a/src/main/java/org/openapitools/db_control/client/model/DeletionProtection.java +++ b/src/main/java/org/openapitools/db_control/client/model/DeletionProtection.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -23,7 +23,7 @@ import com.google.gson.stream.JsonWriter; /** - * Whether [deletion protection](http://docs.pinecone.io/guides/indexes/prevent-index-deletion) is enabled/disabled for the index. + * Whether [deletion protection](http://docs.pinecone.io/guides/indexes/manage-indexes#configure-deletion-protection) is enabled/disabled for the index. */ @JsonAdapter(DeletionProtection.Adapter.class) public enum DeletionProtection { diff --git a/src/main/java/org/openapitools/db_control/client/model/ErrorResponse.java b/src/main/java/org/openapitools/db_control/client/model/ErrorResponse.java index 4c253f7d..8a59502e 100644 --- a/src/main/java/org/openapitools/db_control/client/model/ErrorResponse.java +++ b/src/main/java/org/openapitools/db_control/client/model/ErrorResponse.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -50,7 +50,7 @@ /** * The response shape used for all error responses. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class ErrorResponse { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) diff --git a/src/main/java/org/openapitools/db_control/client/model/ErrorResponseError.java b/src/main/java/org/openapitools/db_control/client/model/ErrorResponseError.java index f44bd8ee..8ee6f30d 100644 --- a/src/main/java/org/openapitools/db_control/client/model/ErrorResponseError.java +++ b/src/main/java/org/openapitools/db_control/client/model/ErrorResponseError.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * Detailed information about the error that occurred. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class ErrorResponseError { /** * Gets or Sets code diff --git a/src/main/java/org/openapitools/db_control/client/model/IndexList.java b/src/main/java/org/openapitools/db_control/client/model/IndexList.java index 152ede26..89e27c1b 100644 --- a/src/main/java/org/openapitools/db_control/client/model/IndexList.java +++ b/src/main/java/org/openapitools/db_control/client/model/IndexList.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -52,7 +52,7 @@ /** * The list of indexes that exist in the project. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class IndexList { public static final String SERIALIZED_NAME_INDEXES = "indexes"; @SerializedName(SERIALIZED_NAME_INDEXES) diff --git a/src/main/java/org/openapitools/db_control/client/model/IndexModel.java b/src/main/java/org/openapitools/db_control/client/model/IndexModel.java index 4765a2d5..2850b44f 100644 --- a/src/main/java/org/openapitools/db_control/client/model/IndexModel.java +++ b/src/main/java/org/openapitools/db_control/client/model/IndexModel.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -26,7 +26,7 @@ import org.openapitools.db_control.client.model.DeletionProtection; import org.openapitools.db_control.client.model.IndexModelSpec; import org.openapitools.db_control.client.model.IndexModelStatus; -import org.openapitools.jackson.nullable.JsonNullable; +import org.openapitools.db_control.client.model.ModelIndexEmbed; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -55,7 +55,7 @@ /** * The IndexModel describes the configuration and status of a Pinecone index. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class IndexModel { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) @@ -66,7 +66,7 @@ public class IndexModel { private Integer dimension; /** - * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. If the 'vector_type' is 'sparse', the metric must be 'dotproduct'. If the `vector_type` is `dense`, the metric defaults to 'cosine'. */ @JsonAdapter(MetricEnum.Adapter.class) public enum MetricEnum { @@ -116,7 +116,7 @@ public MetricEnum read(final JsonReader jsonReader) throws IOException { public static final String SERIALIZED_NAME_METRIC = "metric"; @SerializedName(SERIALIZED_NAME_METRIC) - private MetricEnum metric = MetricEnum.COSINE; + private MetricEnum metric; public static final String SERIALIZED_NAME_HOST = "host"; @SerializedName(SERIALIZED_NAME_HOST) @@ -128,7 +128,11 @@ public MetricEnum read(final JsonReader jsonReader) throws IOException { public static final String SERIALIZED_NAME_TAGS = "tags"; @SerializedName(SERIALIZED_NAME_TAGS) - private Map tags; + private Map tags = new HashMap<>(); + + public static final String SERIALIZED_NAME_EMBED = "embed"; + @SerializedName(SERIALIZED_NAME_EMBED) + private ModelIndexEmbed embed; public static final String SERIALIZED_NAME_SPEC = "spec"; @SerializedName(SERIALIZED_NAME_SPEC) @@ -138,6 +142,10 @@ public MetricEnum read(final JsonReader jsonReader) throws IOException { @SerializedName(SERIALIZED_NAME_STATUS) private IndexModelStatus status; + public static final String SERIALIZED_NAME_VECTOR_TYPE = "vector_type"; + @SerializedName(SERIALIZED_NAME_VECTOR_TYPE) + private String vectorType = "dense"; + public IndexModel() { } @@ -174,7 +182,7 @@ public IndexModel dimension(Integer dimension) { * maximum: 20000 * @return dimension **/ - @javax.annotation.Nonnull + @javax.annotation.Nullable public Integer getDimension() { return dimension; } @@ -192,7 +200,7 @@ public IndexModel metric(MetricEnum metric) { } /** - * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. If the 'vector_type' is 'sparse', the metric must be 'dotproduct'. If the `vector_type` is `dense`, the metric defaults to 'cosine'. * @return metric **/ @javax.annotation.Nonnull @@ -263,7 +271,7 @@ public IndexModel putTagsItem(String key, String tagsItem) { } /** - * Custom user tags added to an index. Keys must be alphanumeric and 80 characters or less. Values must be 120 characters or less. + * Custom user tags added to an index. Keys must be 80 characters or less. Values must be 120 characters or less. Keys must be alphanumeric, '_', or '-'. Values must be alphanumeric, ';', '@', '_', '-', '.', '+', or ' '. To unset a key, set the value to be an empty string. * @return tags **/ @javax.annotation.Nullable @@ -277,6 +285,27 @@ public void setTags(Map tags) { } + public IndexModel embed(ModelIndexEmbed embed) { + + this.embed = embed; + return this; + } + + /** + * Get embed + * @return embed + **/ + @javax.annotation.Nullable + public ModelIndexEmbed getEmbed() { + return embed; + } + + + public void setEmbed(ModelIndexEmbed embed) { + this.embed = embed; + } + + public IndexModel spec(IndexModelSpec spec) { this.spec = spec; @@ -318,6 +347,27 @@ public void setStatus(IndexModelStatus status) { this.status = status; } + + public IndexModel vectorType(String vectorType) { + + this.vectorType = vectorType; + return this; + } + + /** + * The index vector type. You can use 'dense' or 'sparse'. If 'dense', the vector dimension must be specified. If 'sparse', the vector dimension should not be specified. + * @return vectorType + **/ + @javax.annotation.Nonnull + public String getVectorType() { + return vectorType; + } + + + public void setVectorType(String vectorType) { + this.vectorType = vectorType; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -379,25 +429,16 @@ public boolean equals(Object o) { Objects.equals(this.host, indexModel.host) && Objects.equals(this.deletionProtection, indexModel.deletionProtection) && Objects.equals(this.tags, indexModel.tags) && + Objects.equals(this.embed, indexModel.embed) && Objects.equals(this.spec, indexModel.spec) && - Objects.equals(this.status, indexModel.status)&& + Objects.equals(this.status, indexModel.status) && + Objects.equals(this.vectorType, indexModel.vectorType)&& Objects.equals(this.additionalProperties, indexModel.additionalProperties); } - private static boolean equalsNullable(JsonNullable a, JsonNullable b) { - return a == b || (a != null && b != null && a.isPresent() && b.isPresent() && Objects.deepEquals(a.get(), b.get())); - } - @Override public int hashCode() { - return Objects.hash(name, dimension, metric, host, deletionProtection, tags, spec, status, additionalProperties); - } - - private static int hashCodeNullable(JsonNullable a) { - if (a == null) { - return 1; - } - return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + return Objects.hash(name, dimension, metric, host, deletionProtection, tags, embed, spec, status, vectorType, additionalProperties); } @Override @@ -410,8 +451,10 @@ public String toString() { sb.append(" host: ").append(toIndentedString(host)).append("\n"); sb.append(" deletionProtection: ").append(toIndentedString(deletionProtection)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" embed: ").append(toIndentedString(embed)).append("\n"); sb.append(" spec: ").append(toIndentedString(spec)).append("\n"); sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" vectorType: ").append(toIndentedString(vectorType)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -441,17 +484,19 @@ private String toIndentedString(Object o) { openapiFields.add("host"); openapiFields.add("deletion_protection"); openapiFields.add("tags"); + openapiFields.add("embed"); openapiFields.add("spec"); openapiFields.add("status"); + openapiFields.add("vector_type"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); openapiRequiredFields.add("name"); - openapiRequiredFields.add("dimension"); openapiRequiredFields.add("metric"); openapiRequiredFields.add("host"); openapiRequiredFields.add("spec"); openapiRequiredFields.add("status"); + openapiRequiredFields.add("vector_type"); } /** @@ -483,10 +528,17 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (!jsonObj.get("host").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `host` to be a primitive type in the JSON string but got `%s`", jsonObj.get("host").toString())); } + // validate the optional field `embed` + if (jsonObj.get("embed") != null && !jsonObj.get("embed").isJsonNull()) { + ModelIndexEmbed.validateJsonElement(jsonObj.get("embed")); + } // validate the required field `spec` IndexModelSpec.validateJsonElement(jsonObj.get("spec")); // validate the required field `status` IndexModelStatus.validateJsonElement(jsonObj.get("status")); + if (!jsonObj.get("vector_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `vector_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("vector_type").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/org/openapitools/db_control/client/model/IndexModelSpec.java b/src/main/java/org/openapitools/db_control/client/model/IndexModelSpec.java index 37e64681..df87eb37 100644 --- a/src/main/java/org/openapitools/db_control/client/model/IndexModelSpec.java +++ b/src/main/java/org/openapitools/db_control/client/model/IndexModelSpec.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -51,7 +51,7 @@ /** * IndexModelSpec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class IndexModelSpec { public static final String SERIALIZED_NAME_POD = "pod"; @SerializedName(SERIALIZED_NAME_POD) diff --git a/src/main/java/org/openapitools/db_control/client/model/IndexModelStatus.java b/src/main/java/org/openapitools/db_control/client/model/IndexModelStatus.java index b4871d11..e8e97190 100644 --- a/src/main/java/org/openapitools/db_control/client/model/IndexModelStatus.java +++ b/src/main/java/org/openapitools/db_control/client/model/IndexModelStatus.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * IndexModelStatus */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class IndexModelStatus { public static final String SERIALIZED_NAME_READY = "ready"; @SerializedName(SERIALIZED_NAME_READY) diff --git a/src/main/java/org/openapitools/db_control/client/model/IndexSpec.java b/src/main/java/org/openapitools/db_control/client/model/IndexSpec.java index 8a967b41..ac1ef9cc 100644 --- a/src/main/java/org/openapitools/db_control/client/model/IndexSpec.java +++ b/src/main/java/org/openapitools/db_control/client/model/IndexSpec.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,9 +49,9 @@ import org.openapitools.db_control.client.JSON; /** - * The spec object defines how the index should be deployed. For serverless indexes, you define only the [cloud and region](http://docs.pinecone.io/guides/indexes/understanding-indexes#cloud-regions) where the index should be hosted. For pod-based indexes, you define the [environment](http://docs.pinecone.io/guides/indexes/understanding-indexes#pod-environments) where the index should be hosted, the [pod type and size](http://docs.pinecone.io/guides/indexes/understanding-indexes#pod-types) to use, and other index characteristics. + * The spec object defines how the index should be deployed. For serverless indexes, you define only the [cloud and region](http://docs.pinecone.io/guides/indexes/understanding-indexes#cloud-regions) where the index should be hosted. For pod-based indexes, you define the [environment](http://docs.pinecone.io/guides/indexes/pods/understanding-pod-based-indexes#pod-environments) where the index should be hosted, the [pod type and size](http://docs.pinecone.io/guides/indexes/pods/understanding-pod-based-indexes#pod-types) to use, and other index characteristics. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class IndexSpec { public static final String SERIALIZED_NAME_SERVERLESS = "serverless"; @SerializedName(SERIALIZED_NAME_SERVERLESS) diff --git a/src/main/java/org/openapitools/db_control/client/model/ModelIndexEmbed.java b/src/main/java/org/openapitools/db_control/client/model/ModelIndexEmbed.java new file mode 100644 index 00000000..d358f313 --- /dev/null +++ b/src/main/java/org/openapitools/db_control/client/model/ModelIndexEmbed.java @@ -0,0 +1,517 @@ +/* + * Pinecone Control Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_control.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_control.client.JSON; + +/** + * The embedding model and document fields mapped to embedding inputs. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") +public class ModelIndexEmbed { + public static final String SERIALIZED_NAME_MODEL = "model"; + @SerializedName(SERIALIZED_NAME_MODEL) + private String model; + + /** + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. If not specified, the metric will be defaulted according to the model. Cannot be updated once set. + */ + @JsonAdapter(MetricEnum.Adapter.class) + public enum MetricEnum { + COSINE("cosine"), + + EUCLIDEAN("euclidean"), + + DOTPRODUCT("dotproduct"); + + private String value; + + MetricEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static MetricEnum fromValue(String value) { + for (MetricEnum b : MetricEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final MetricEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public MetricEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return MetricEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_METRIC = "metric"; + @SerializedName(SERIALIZED_NAME_METRIC) + private MetricEnum metric; + + public static final String SERIALIZED_NAME_DIMENSION = "dimension"; + @SerializedName(SERIALIZED_NAME_DIMENSION) + private Integer dimension; + + public static final String SERIALIZED_NAME_VECTOR_TYPE = "vector_type"; + @SerializedName(SERIALIZED_NAME_VECTOR_TYPE) + private String vectorType = "dense"; + + public static final String SERIALIZED_NAME_FIELD_MAP = "field_map"; + @SerializedName(SERIALIZED_NAME_FIELD_MAP) + private Object fieldMap; + + public static final String SERIALIZED_NAME_READ_PARAMETERS = "read_parameters"; + @SerializedName(SERIALIZED_NAME_READ_PARAMETERS) + private Object readParameters; + + public static final String SERIALIZED_NAME_WRITE_PARAMETERS = "write_parameters"; + @SerializedName(SERIALIZED_NAME_WRITE_PARAMETERS) + private Object writeParameters; + + public ModelIndexEmbed() { + } + + public ModelIndexEmbed model(String model) { + + this.model = model; + return this; + } + + /** + * The name of the embedding model used to create the index. + * @return model + **/ + @javax.annotation.Nonnull + public String getModel() { + return model; + } + + + public void setModel(String model) { + this.model = model; + } + + + public ModelIndexEmbed metric(MetricEnum metric) { + + this.metric = metric; + return this; + } + + /** + * The distance metric to be used for similarity search. You can use 'euclidean', 'cosine', or 'dotproduct'. If not specified, the metric will be defaulted according to the model. Cannot be updated once set. + * @return metric + **/ + @javax.annotation.Nullable + public MetricEnum getMetric() { + return metric; + } + + + public void setMetric(MetricEnum metric) { + this.metric = metric; + } + + + public ModelIndexEmbed dimension(Integer dimension) { + + this.dimension = dimension; + return this; + } + + /** + * The dimensions of the vectors to be inserted in the index. + * minimum: 1 + * maximum: 20000 + * @return dimension + **/ + @javax.annotation.Nullable + public Integer getDimension() { + return dimension; + } + + + public void setDimension(Integer dimension) { + this.dimension = dimension; + } + + + public ModelIndexEmbed vectorType(String vectorType) { + + this.vectorType = vectorType; + return this; + } + + /** + * The index vector type. You can use 'dense' or 'sparse'. If 'dense', the vector dimension must be specified. If 'sparse', the vector dimension should not be specified. + * @return vectorType + **/ + @javax.annotation.Nullable + public String getVectorType() { + return vectorType; + } + + + public void setVectorType(String vectorType) { + this.vectorType = vectorType; + } + + + public ModelIndexEmbed fieldMap(Object fieldMap) { + + this.fieldMap = fieldMap; + return this; + } + + /** + * Identifies the name of the text field from your document model that is embedded. + * @return fieldMap + **/ + @javax.annotation.Nullable + public Object getFieldMap() { + return fieldMap; + } + + + public void setFieldMap(Object fieldMap) { + this.fieldMap = fieldMap; + } + + + public ModelIndexEmbed readParameters(Object readParameters) { + + this.readParameters = readParameters; + return this; + } + + /** + * The read parameters for the embedding model. + * @return readParameters + **/ + @javax.annotation.Nullable + public Object getReadParameters() { + return readParameters; + } + + + public void setReadParameters(Object readParameters) { + this.readParameters = readParameters; + } + + + public ModelIndexEmbed writeParameters(Object writeParameters) { + + this.writeParameters = writeParameters; + return this; + } + + /** + * The write parameters for the embedding model. + * @return writeParameters + **/ + @javax.annotation.Nullable + public Object getWriteParameters() { + return writeParameters; + } + + + public void setWriteParameters(Object writeParameters) { + this.writeParameters = writeParameters; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the ModelIndexEmbed instance itself + */ + public ModelIndexEmbed putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelIndexEmbed modelIndexEmbed = (ModelIndexEmbed) o; + return Objects.equals(this.model, modelIndexEmbed.model) && + Objects.equals(this.metric, modelIndexEmbed.metric) && + Objects.equals(this.dimension, modelIndexEmbed.dimension) && + Objects.equals(this.vectorType, modelIndexEmbed.vectorType) && + Objects.equals(this.fieldMap, modelIndexEmbed.fieldMap) && + Objects.equals(this.readParameters, modelIndexEmbed.readParameters) && + Objects.equals(this.writeParameters, modelIndexEmbed.writeParameters)&& + Objects.equals(this.additionalProperties, modelIndexEmbed.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(model, metric, dimension, vectorType, fieldMap, readParameters, writeParameters, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelIndexEmbed {\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + sb.append(" metric: ").append(toIndentedString(metric)).append("\n"); + sb.append(" dimension: ").append(toIndentedString(dimension)).append("\n"); + sb.append(" vectorType: ").append(toIndentedString(vectorType)).append("\n"); + sb.append(" fieldMap: ").append(toIndentedString(fieldMap)).append("\n"); + sb.append(" readParameters: ").append(toIndentedString(readParameters)).append("\n"); + sb.append(" writeParameters: ").append(toIndentedString(writeParameters)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("model"); + openapiFields.add("metric"); + openapiFields.add("dimension"); + openapiFields.add("vector_type"); + openapiFields.add("field_map"); + openapiFields.add("read_parameters"); + openapiFields.add("write_parameters"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("model"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ModelIndexEmbed + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ModelIndexEmbed.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ModelIndexEmbed is not found in the empty JSON string", ModelIndexEmbed.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ModelIndexEmbed.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("model").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `model` to be a primitive type in the JSON string but got `%s`", jsonObj.get("model").toString())); + } + if ((jsonObj.get("metric") != null && !jsonObj.get("metric").isJsonNull()) && !jsonObj.get("metric").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `metric` to be a primitive type in the JSON string but got `%s`", jsonObj.get("metric").toString())); + } + if ((jsonObj.get("vector_type") != null && !jsonObj.get("vector_type").isJsonNull()) && !jsonObj.get("vector_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `vector_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("vector_type").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ModelIndexEmbed.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ModelIndexEmbed' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ModelIndexEmbed.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ModelIndexEmbed value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public ModelIndexEmbed read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + ModelIndexEmbed instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ModelIndexEmbed given an JSON string + * + * @param jsonString JSON string + * @return An instance of ModelIndexEmbed + * @throws IOException if the JSON string is invalid with respect to ModelIndexEmbed + */ + public static ModelIndexEmbed fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ModelIndexEmbed.class); + } + + /** + * Convert an instance of ModelIndexEmbed to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_control/client/model/PodSpec.java b/src/main/java/org/openapitools/db_control/client/model/PodSpec.java index 7a8d1638..c9a7f56d 100644 --- a/src/main/java/org/openapitools/db_control/client/model/PodSpec.java +++ b/src/main/java/org/openapitools/db_control/client/model/PodSpec.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -50,7 +50,7 @@ /** * Configuration needed to deploy a pod-based index. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class PodSpec { public static final String SERIALIZED_NAME_ENVIRONMENT = "environment"; @SerializedName(SERIALIZED_NAME_ENVIRONMENT) diff --git a/src/main/java/org/openapitools/db_control/client/model/PodSpecMetadataConfig.java b/src/main/java/org/openapitools/db_control/client/model/PodSpecMetadataConfig.java index 08fc15c9..4455b093 100644 --- a/src/main/java/org/openapitools/db_control/client/model/PodSpecMetadataConfig.java +++ b/src/main/java/org/openapitools/db_control/client/model/PodSpecMetadataConfig.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -51,7 +51,7 @@ /** * Configuration for the behavior of Pinecone's internal metadata index. By default, all metadata is indexed; when `metadata_config` is present, only specified metadata fields are indexed. These configurations are only valid for use with pod-based indexes. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class PodSpecMetadataConfig { public static final String SERIALIZED_NAME_INDEXED = "indexed"; @SerializedName(SERIALIZED_NAME_INDEXED) diff --git a/src/main/java/org/openapitools/db_control/client/model/ServerlessSpec.java b/src/main/java/org/openapitools/db_control/client/model/ServerlessSpec.java index e8ad7c33..efb01c03 100644 --- a/src/main/java/org/openapitools/db_control/client/model/ServerlessSpec.java +++ b/src/main/java/org/openapitools/db_control/client/model/ServerlessSpec.java @@ -2,7 +2,7 @@ * Pinecone Control Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * Configuration needed to deploy a serverless index. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:10.542209Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:18.406889Z[Etc/UTC]") public class ServerlessSpec { /** * The public cloud where you would like your index hosted. @@ -139,7 +139,7 @@ public ServerlessSpec region(String region) { } /** - * The region where you would like your index to be created. + * The region where you would like your index to be created. * @return region **/ @javax.annotation.Nonnull diff --git a/src/main/java/org/openapitools/db_data/client/ApiCallback.java b/src/main/java/org/openapitools/db_data/client/ApiCallback.java index 2fc57d7c..9cc00479 100644 --- a/src/main/java/org/openapitools/db_data/client/ApiCallback.java +++ b/src/main/java/org/openapitools/db_data/client/ApiCallback.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_data/client/ApiClient.java b/src/main/java/org/openapitools/db_data/client/ApiClient.java index 61121f9b..67632fb3 100644 --- a/src/main/java/org/openapitools/db_data/client/ApiClient.java +++ b/src/main/java/org/openapitools/db_data/client/ApiClient.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -147,7 +147,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/2024-10/java"); + setUserAgent("OpenAPI-Generator/2025-01/java"); authentications = new HashMap(); } diff --git a/src/main/java/org/openapitools/db_data/client/ApiException.java b/src/main/java/org/openapitools/db_data/client/ApiException.java index 5d7b0d75..ab6e38e0 100644 --- a/src/main/java/org/openapitools/db_data/client/ApiException.java +++ b/src/main/java/org/openapitools/db_data/client/ApiException.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/src/main/java/org/openapitools/db_data/client/ApiResponse.java b/src/main/java/org/openapitools/db_data/client/ApiResponse.java index 70d11f6f..818729b6 100644 --- a/src/main/java/org/openapitools/db_data/client/ApiResponse.java +++ b/src/main/java/org/openapitools/db_data/client/ApiResponse.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_data/client/Configuration.java b/src/main/java/org/openapitools/db_data/client/Configuration.java index d0d524d4..03afa1d6 100644 --- a/src/main/java/org/openapitools/db_data/client/Configuration.java +++ b/src/main/java/org/openapitools/db_data/client/Configuration.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -13,9 +13,9 @@ package org.openapitools.db_data.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class Configuration { - public static final String VERSION = "2024-10"; + public static final String VERSION = "2025-01"; private static ApiClient defaultApiClient = new ApiClient(); diff --git a/src/main/java/org/openapitools/db_data/client/GzipRequestInterceptor.java b/src/main/java/org/openapitools/db_data/client/GzipRequestInterceptor.java index 65d12982..1cdc68b5 100644 --- a/src/main/java/org/openapitools/db_data/client/GzipRequestInterceptor.java +++ b/src/main/java/org/openapitools/db_data/client/GzipRequestInterceptor.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_data/client/JSON.java b/src/main/java/org/openapitools/db_data/client/JSON.java index c180d7c9..3adbeadb 100644 --- a/src/main/java/org/openapitools/db_data/client/JSON.java +++ b/src/main/java/org/openapitools/db_data/client/JSON.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -96,6 +96,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.DeleteRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.DescribeIndexStatsRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.FetchResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.Hit.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.ImportErrorMode.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.ImportModel.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.IndexDescription.CustomTypeAdapterFactory()); @@ -110,11 +111,20 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.QueryVector.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.RpcStatus.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.ScoredVector.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.SearchRecordsRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.SearchRecordsRequestQuery.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.SearchRecordsRequestRerank.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.SearchRecordsResponse.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.SearchRecordsResponseResult.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.SearchRecordsVector.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.SearchUsage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.SearchVector.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.SingleQueryResults.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.SparseValues.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.StartImportRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.StartImportResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.UpdateRequest.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.UpsertRecord.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.UpsertRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.UpsertResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.db_data.client.model.Usage.CustomTypeAdapterFactory()); diff --git a/src/main/java/org/openapitools/db_data/client/Pair.java b/src/main/java/org/openapitools/db_data/client/Pair.java index 4f9e98e4..902e03fb 100644 --- a/src/main/java/org/openapitools/db_data/client/Pair.java +++ b/src/main/java/org/openapitools/db_data/client/Pair.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -13,7 +13,7 @@ package org.openapitools.db_data.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/org/openapitools/db_data/client/ProgressRequestBody.java b/src/main/java/org/openapitools/db_data/client/ProgressRequestBody.java index 1e2f1b86..6c29bbd0 100644 --- a/src/main/java/org/openapitools/db_data/client/ProgressRequestBody.java +++ b/src/main/java/org/openapitools/db_data/client/ProgressRequestBody.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_data/client/ProgressResponseBody.java b/src/main/java/org/openapitools/db_data/client/ProgressResponseBody.java index 8ae7270a..23010a8f 100644 --- a/src/main/java/org/openapitools/db_data/client/ProgressResponseBody.java +++ b/src/main/java/org/openapitools/db_data/client/ProgressResponseBody.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_data/client/StringUtil.java b/src/main/java/org/openapitools/db_data/client/StringUtil.java index 68c71a7e..2073f569 100644 --- a/src/main/java/org/openapitools/db_data/client/StringUtil.java +++ b/src/main/java/org/openapitools/db_data/client/StringUtil.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/org/openapitools/db_data/client/api/BulkOperationsApi.java b/src/main/java/org/openapitools/db_data/client/api/BulkOperationsApi.java index d98d7314..da713ea4 100644 --- a/src/main/java/org/openapitools/db_data/client/api/BulkOperationsApi.java +++ b/src/main/java/org/openapitools/db_data/client/api/BulkOperationsApi.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -78,7 +78,7 @@ public void setCustomBaseUrl(String customBaseUrl) { /** * Build call for cancelBulkImport - * @param id (required) + * @param id Unique identifier for the import operation. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object @@ -149,8 +149,8 @@ private okhttp3.Call cancelBulkImportValidateBeforeCall(String id, final ApiCall /** * Cancel an import - * The `cancel_import` operation cancels an import operation if it is not yet finished. It has no effect if the operation is already finished. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). - * @param id (required) + * Cancel an import operation if it is not yet finished. It has no effect if the operation is already finished. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). + * @param id Unique identifier for the import operation. (required) * @return Object * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -169,8 +169,8 @@ public Object cancelBulkImport(String id) throws ApiException { /** * Cancel an import - * The `cancel_import` operation cancels an import operation if it is not yet finished. It has no effect if the operation is already finished. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). - * @param id (required) + * Cancel an import operation if it is not yet finished. It has no effect if the operation is already finished. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). + * @param id Unique identifier for the import operation. (required) * @return ApiResponse<Object> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details @@ -190,8 +190,8 @@ public ApiResponse cancelBulkImportWithHttpInfo(String id) throws ApiExc /** * Cancel an import (asynchronously) - * The `cancel_import` operation cancels an import operation if it is not yet finished. It has no effect if the operation is already finished. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). - * @param id (required) + * Cancel an import operation if it is not yet finished. It has no effect if the operation is already finished. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). + * @param id Unique identifier for the import operation. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -213,14 +213,14 @@ public okhttp3.Call cancelBulkImportAsync(String id, final ApiCallback _ } /** * Build call for describeBulkImport - * @param id (required) + * @param id Unique identifier for the import operation. (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details - + @@ -284,14 +284,14 @@ private okhttp3.Call describeBulkImportValidateBeforeCall(String id, final ApiCa /** * Describe an import - * The `describe_import` operation returns details of a specific import operation. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). - * @param id (required) + * Return details of a specific import operation. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). + * @param id Unique identifier for the import operation. (required) * @return ImportModel * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Details of the import operation -
200 Details of the import operation. -
400 Bad request. The request body included invalid request parameters. -
4XX An unexpected error response. -
5XX An unexpected error response. -
- + @@ -304,14 +304,14 @@ public ImportModel describeBulkImport(String id) throws ApiException { /** * Describe an import - * The `describe_import` operation returns details of a specific import operation. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). - * @param id (required) + * Return details of a specific import operation. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). + * @param id Unique identifier for the import operation. (required) * @return ApiResponse<ImportModel> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 Details of the import operation -
200 Details of the import operation. -
400 Bad request. The request body included invalid request parameters. -
4XX An unexpected error response. -
5XX An unexpected error response. -
- + @@ -325,15 +325,15 @@ public ApiResponse describeBulkImportWithHttpInfo(String id) throws /** * Describe an import (asynchronously) - * The `describe_import` operation returns details of a specific import operation. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). - * @param id (required) + * Return details of a specific import operation. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). + * @param id Unique identifier for the import operation. (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 Details of the import operation -
200 Details of the import operation. -
400 Bad request. The request body included invalid request parameters. -
4XX An unexpected error response. -
5XX An unexpected error response. -
- + @@ -422,7 +422,7 @@ private okhttp3.Call listBulkImportsValidateBeforeCall(Integer limit, String pag /** * List imports - * The `list_imports` operation lists all recent and ongoing import operations. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). + * List all recent and ongoing import operations. By default, this returns up to 100 imports per page. If the `limit` parameter is set, `list` returns up to that number of imports instead. Whenever there are additional IDs to return, the response also includes a `pagination_token` that you can use to get the next batch of imports. When the response does not include a `pagination_token`, there are no more imports to return. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). * @param limit Max number of operations to return per page. (optional) * @param paginationToken Pagination token to continue a previous listing operation. (optional) * @return ListImportsResponse @@ -443,7 +443,7 @@ public ListImportsResponse listBulkImports(Integer limit, String paginationToken /** * List imports - * The `list_imports` operation lists all recent and ongoing import operations. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). + * List all recent and ongoing import operations. By default, this returns up to 100 imports per page. If the `limit` parameter is set, `list` returns up to that number of imports instead. Whenever there are additional IDs to return, the response also includes a `pagination_token` that you can use to get the next batch of imports. When the response does not include a `pagination_token`, there are no more imports to return. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). * @param limit Max number of operations to return per page. (optional) * @param paginationToken Pagination token to continue a previous listing operation. (optional) * @return ApiResponse<ListImportsResponse> @@ -465,7 +465,7 @@ public ApiResponse listBulkImportsWithHttpInfo(Integer limi /** * List imports (asynchronously) - * The `list_imports` operation lists all recent and ongoing import operations. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). + * List all recent and ongoing import operations. By default, this returns up to 100 imports per page. If the `limit` parameter is set, `list` returns up to that number of imports instead. Whenever there are additional IDs to return, the response also includes a `pagination_token` that you can use to get the next batch of imports. When the response does not include a `pagination_token`, there are no more imports to return. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). * @param limit Max number of operations to return per page. (optional) * @param paginationToken Pagination token to continue a previous listing operation. (optional) * @param _callback The callback to be executed when the API call finishes @@ -560,7 +560,7 @@ private okhttp3.Call startBulkImportValidateBeforeCall(StartImportRequest startI /** * Start import - * The `start_import` operation starts an asynchronous import of vectors from object storage into an index. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). + * Start an asynchronous import of vectors from object storage into an index. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). * @param startImportRequest (required) * @return StartImportResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -580,7 +580,7 @@ public StartImportResponse startBulkImport(StartImportRequest startImportRequest /** * Start import - * The `start_import` operation starts an asynchronous import of vectors from object storage into an index. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). + * Start an asynchronous import of vectors from object storage into an index. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). * @param startImportRequest (required) * @return ApiResponse<StartImportResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -601,7 +601,7 @@ public ApiResponse startBulkImportWithHttpInfo(StartImportR /** * Start import (asynchronously) - * The `start_import` operation starts an asynchronous import of vectors from object storage into an index. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). + * Start an asynchronous import of vectors from object storage into an index. For guidance and examples, see [Import data](https://docs.pinecone.io/guides/data/import-data). * @param startImportRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call diff --git a/src/main/java/org/openapitools/db_data/client/api/VectorOperationsApi.java b/src/main/java/org/openapitools/db_data/client/api/VectorOperationsApi.java index 9b779163..0f64974f 100644 --- a/src/main/java/org/openapitools/db_data/client/api/VectorOperationsApi.java +++ b/src/main/java/org/openapitools/db_data/client/api/VectorOperationsApi.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -35,7 +35,10 @@ import org.openapitools.db_data.client.model.QueryRequest; import org.openapitools.db_data.client.model.QueryResponse; import org.openapitools.db_data.client.model.RpcStatus; +import org.openapitools.db_data.client.model.SearchRecordsRequest; +import org.openapitools.db_data.client.model.SearchRecordsResponse; import org.openapitools.db_data.client.model.UpdateRequest; +import org.openapitools.db_data.client.model.UpsertRecord; import org.openapitools.db_data.client.model.UpsertRequest; import org.openapitools.db_data.client.model.UpsertResponse; @@ -155,7 +158,7 @@ private okhttp3.Call deleteVectorsValidateBeforeCall(DeleteRequest deleteRequest /** * Delete vectors - * The `delete` operation deletes vectors, by id, from a single namespace. For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/data/delete-data). + * Delete vectors, by id, from a single namespace. For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/data/delete-data). * @param deleteRequest (required) * @return Object * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -175,7 +178,7 @@ public Object deleteVectors(DeleteRequest deleteRequest) throws ApiException { /** * Delete vectors - * The `delete` operation deletes vectors, by id, from a single namespace. For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/data/delete-data). + * Delete vectors, by id, from a single namespace. For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/data/delete-data). * @param deleteRequest (required) * @return ApiResponse<Object> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -196,7 +199,7 @@ public ApiResponse deleteVectorsWithHttpInfo(DeleteRequest deleteRequest /** * Delete vectors (asynchronously) - * The `delete` operation deletes vectors, by id, from a single namespace. For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/data/delete-data). + * Delete vectors, by id, from a single namespace. For guidance and examples, see [Delete data](https://docs.pinecone.io/guides/data/delete-data). * @param deleteRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call @@ -290,7 +293,7 @@ private okhttp3.Call describeIndexStatsValidateBeforeCall(DescribeIndexStatsRequ /** * Get index stats - * The `describe_index_stats` operation returns statistics about the contents of an index, including the vector count per namespace, the number of dimensions, and the index fullness. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. For pod-based indexes, the index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://docs.pinecone.io/reference/api/control-plane/describe_index). + * Return statistics about the contents of an index, including the vector count per namespace, the number of dimensions, and the index fullness. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. * @param describeIndexStatsRequest (required) * @return IndexDescription * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -310,7 +313,7 @@ public IndexDescription describeIndexStats(DescribeIndexStatsRequest describeInd /** * Get index stats - * The `describe_index_stats` operation returns statistics about the contents of an index, including the vector count per namespace, the number of dimensions, and the index fullness. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. For pod-based indexes, the index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://docs.pinecone.io/reference/api/control-plane/describe_index). + * Return statistics about the contents of an index, including the vector count per namespace, the number of dimensions, and the index fullness. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. * @param describeIndexStatsRequest (required) * @return ApiResponse<IndexDescription> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -331,7 +334,7 @@ public ApiResponse describeIndexStatsWithHttpInfo(DescribeInde /** * Get index stats (asynchronously) - * The `describe_index_stats` operation returns statistics about the contents of an index, including the vector count per namespace, the number of dimensions, and the index fullness. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. For pod-based indexes, the index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://docs.pinecone.io/reference/api/control-plane/describe_index). + * Return statistics about the contents of an index, including the vector count per namespace, the number of dimensions, and the index fullness. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. * @param describeIndexStatsRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call @@ -433,7 +436,7 @@ private okhttp3.Call fetchVectorsValidateBeforeCall(List ids, String nam /** * Fetch vectors - * The `fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/data/fetch-data). + * Look up and return vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/data/fetch-data). * @param ids The vector IDs to fetch. Does not accept values containing spaces. (required) * @param namespace (optional) * @return FetchResponse @@ -454,7 +457,7 @@ public FetchResponse fetchVectors(List ids, String namespace) throws Api /** * Fetch vectors - * The `fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/data/fetch-data). + * Look up and return vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/data/fetch-data). * @param ids The vector IDs to fetch. Does not accept values containing spaces. (required) * @param namespace (optional) * @return ApiResponse<FetchResponse> @@ -476,7 +479,7 @@ public ApiResponse fetchVectorsWithHttpInfo(List ids, Str /** * Fetch vectors (asynchronously) - * The `fetch` operation looks up and returns vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/data/fetch-data). + * Look up and return vectors, by ID, from a single namespace. The returned vectors include the vector data and/or metadata. For guidance and examples, see [Fetch data](https://docs.pinecone.io/guides/data/fetch-data). * @param ids The vector IDs to fetch. Does not accept values containing spaces. (required) * @param namespace (optional) * @param _callback The callback to be executed when the API call finishes @@ -584,7 +587,7 @@ private okhttp3.Call listVectorsValidateBeforeCall(String prefix, Long limit, St /** * List vector IDs - * The `list` operation lists the IDs of vectors in a single namespace of a serverless index. An optional prefix can be passed to limit the results to IDs with a common prefix. `list` returns up to 100 IDs at a time by default in sorted order (bitwise \"C\" collation). If the `limit` parameter is set, `list` returns up to that number of IDs instead. Whenever there are additional IDs to return, the response also includes a `pagination_token` that you can use to get the next batch of IDs. When the response does not include a `pagination_token`, there are no more IDs to return. For guidance and examples, see [List record IDs](https://docs.pinecone.io/guides/data/list-record-ids). **Note:** `list_vectors` is supported only for serverless indexes. + * List the IDs of vectors in a single namespace of a serverless index. An optional prefix can be passed to limit the results to IDs with a common prefix. This returns up to 100 IDs at a time by default in sorted order (bitwise \"C\" collation). If the `limit` parameter is set, `list` returns up to that number of IDs instead. Whenever there are additional IDs to return, the response also includes a `pagination_token` that you can use to get the next batch of IDs. When the response does not include a `pagination_token`, there are no more IDs to return. For guidance and examples, see [List record IDs](https://docs.pinecone.io/guides/data/list-record-ids). **Note:** `list` is supported only for serverless indexes. * @param prefix The vector IDs to fetch. Does not accept values containing spaces. (optional) * @param limit Max number of IDs to return per page. (optional) * @param paginationToken Pagination token to continue a previous listing operation. (optional) @@ -607,7 +610,7 @@ public ListResponse listVectors(String prefix, Long limit, String paginationToke /** * List vector IDs - * The `list` operation lists the IDs of vectors in a single namespace of a serverless index. An optional prefix can be passed to limit the results to IDs with a common prefix. `list` returns up to 100 IDs at a time by default in sorted order (bitwise \"C\" collation). If the `limit` parameter is set, `list` returns up to that number of IDs instead. Whenever there are additional IDs to return, the response also includes a `pagination_token` that you can use to get the next batch of IDs. When the response does not include a `pagination_token`, there are no more IDs to return. For guidance and examples, see [List record IDs](https://docs.pinecone.io/guides/data/list-record-ids). **Note:** `list_vectors` is supported only for serverless indexes. + * List the IDs of vectors in a single namespace of a serverless index. An optional prefix can be passed to limit the results to IDs with a common prefix. This returns up to 100 IDs at a time by default in sorted order (bitwise \"C\" collation). If the `limit` parameter is set, `list` returns up to that number of IDs instead. Whenever there are additional IDs to return, the response also includes a `pagination_token` that you can use to get the next batch of IDs. When the response does not include a `pagination_token`, there are no more IDs to return. For guidance and examples, see [List record IDs](https://docs.pinecone.io/guides/data/list-record-ids). **Note:** `list` is supported only for serverless indexes. * @param prefix The vector IDs to fetch. Does not accept values containing spaces. (optional) * @param limit Max number of IDs to return per page. (optional) * @param paginationToken Pagination token to continue a previous listing operation. (optional) @@ -631,7 +634,7 @@ public ApiResponse listVectorsWithHttpInfo(String prefix, Long lim /** * List vector IDs (asynchronously) - * The `list` operation lists the IDs of vectors in a single namespace of a serverless index. An optional prefix can be passed to limit the results to IDs with a common prefix. `list` returns up to 100 IDs at a time by default in sorted order (bitwise \"C\" collation). If the `limit` parameter is set, `list` returns up to that number of IDs instead. Whenever there are additional IDs to return, the response also includes a `pagination_token` that you can use to get the next batch of IDs. When the response does not include a `pagination_token`, there are no more IDs to return. For guidance and examples, see [List record IDs](https://docs.pinecone.io/guides/data/list-record-ids). **Note:** `list_vectors` is supported only for serverless indexes. + * List the IDs of vectors in a single namespace of a serverless index. An optional prefix can be passed to limit the results to IDs with a common prefix. This returns up to 100 IDs at a time by default in sorted order (bitwise \"C\" collation). If the `limit` parameter is set, `list` returns up to that number of IDs instead. Whenever there are additional IDs to return, the response also includes a `pagination_token` that you can use to get the next batch of IDs. When the response does not include a `pagination_token`, there are no more IDs to return. For guidance and examples, see [List record IDs](https://docs.pinecone.io/guides/data/list-record-ids). **Note:** `list` is supported only for serverless indexes. * @param prefix The vector IDs to fetch. Does not accept values containing spaces. (optional) * @param limit Max number of IDs to return per page. (optional) * @param paginationToken Pagination token to continue a previous listing operation. (optional) @@ -728,7 +731,7 @@ private okhttp3.Call queryVectorsValidateBeforeCall(QueryRequest queryRequest, f /** * Query vectors - * The `query` operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. For guidance and examples, see [Query data](https://docs.pinecone.io/guides/data/query-data). + * Search a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. For guidance and examples, see [Query data](https://docs.pinecone.io/guides/data/query-data). * @param queryRequest (required) * @return QueryResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -748,7 +751,7 @@ public QueryResponse queryVectors(QueryRequest queryRequest) throws ApiException /** * Query vectors - * The `query` operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. For guidance and examples, see [Query data](https://docs.pinecone.io/guides/data/query-data). + * Search a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. For guidance and examples, see [Query data](https://docs.pinecone.io/guides/data/query-data). * @param queryRequest (required) * @return ApiResponse<QueryResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -769,7 +772,7 @@ public ApiResponse queryVectorsWithHttpInfo(QueryRequest queryReq /** * Query vectors (asynchronously) - * The `query` operation searches a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. For guidance and examples, see [Query data](https://docs.pinecone.io/guides/data/query-data). + * Search a namespace, using a query vector. It retrieves the ids of the most similar items in a namespace, along with their similarity scores. For guidance and examples, see [Query data](https://docs.pinecone.io/guides/data/query-data). * @param queryRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call @@ -790,6 +793,151 @@ public okhttp3.Call queryVectorsAsync(QueryRequest queryRequest, final ApiCallba localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for searchRecordsNamespace + * @param namespace The namespace to search. (required) + * @param searchRecordsRequest (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details +
Status Code Description Response Headers
200 Details of the import operation -
200 Details of the import operation. -
400 Bad request. The request body included invalid request parameters. -
4XX An unexpected error response. -
5XX An unexpected error response. -
+ + + + + +
Status Code Description Response Headers
200 A successful search namespace response. -
400 Bad request. The request body included invalid request parameters. -
4XX An unexpected error response. -
5XX An unexpected error response. -
+ */ + public okhttp3.Call searchRecordsNamespaceCall(String namespace, SearchRecordsRequest searchRecordsRequest, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = searchRecordsRequest; + + // create path and map variables + String localVarPath = "/records/namespaces/{namespace}/search" + .replace("{" + "namespace" + "}", localVarApiClient.escapeString(namespace.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call searchRecordsNamespaceValidateBeforeCall(String namespace, SearchRecordsRequest searchRecordsRequest, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'namespace' is set + if (namespace == null) { + throw new ApiException("Missing the required parameter 'namespace' when calling searchRecordsNamespace(Async)"); + } + + // verify the required parameter 'searchRecordsRequest' is set + if (searchRecordsRequest == null) { + throw new ApiException("Missing the required parameter 'searchRecordsRequest' when calling searchRecordsNamespace(Async)"); + } + + return searchRecordsNamespaceCall(namespace, searchRecordsRequest, _callback); + + } + + /** + * Search a namespace + * This operation converts a query to a vector embedding and then searches a namespace using the embedding. It returns the most similar records in the namespace, along with their similarity scores. + * @param namespace The namespace to search. (required) + * @param searchRecordsRequest (required) + * @return SearchRecordsResponse + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 A successful search namespace response. -
400 Bad request. The request body included invalid request parameters. -
4XX An unexpected error response. -
5XX An unexpected error response. -
+ */ + public SearchRecordsResponse searchRecordsNamespace(String namespace, SearchRecordsRequest searchRecordsRequest) throws ApiException { + ApiResponse localVarResp = searchRecordsNamespaceWithHttpInfo(namespace, searchRecordsRequest); + return localVarResp.getData(); + } + + /** + * Search a namespace + * This operation converts a query to a vector embedding and then searches a namespace using the embedding. It returns the most similar records in the namespace, along with their similarity scores. + * @param namespace The namespace to search. (required) + * @param searchRecordsRequest (required) + * @return ApiResponse<SearchRecordsResponse> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 A successful search namespace response. -
400 Bad request. The request body included invalid request parameters. -
4XX An unexpected error response. -
5XX An unexpected error response. -
+ */ + public ApiResponse searchRecordsNamespaceWithHttpInfo(String namespace, SearchRecordsRequest searchRecordsRequest) throws ApiException { + okhttp3.Call localVarCall = searchRecordsNamespaceValidateBeforeCall(namespace, searchRecordsRequest, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + /** + * Search a namespace (asynchronously) + * This operation converts a query to a vector embedding and then searches a namespace using the embedding. It returns the most similar records in the namespace, along with their similarity scores. + * @param namespace The namespace to search. (required) + * @param searchRecordsRequest (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 A successful search namespace response. -
400 Bad request. The request body included invalid request parameters. -
4XX An unexpected error response. -
5XX An unexpected error response. -
+ */ + public okhttp3.Call searchRecordsNamespaceAsync(String namespace, SearchRecordsRequest searchRecordsRequest, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = searchRecordsNamespaceValidateBeforeCall(namespace, searchRecordsRequest, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } /** * Build call for updateVector * @param updateRequest (required) @@ -863,7 +1011,7 @@ private okhttp3.Call updateVectorValidateBeforeCall(UpdateRequest updateRequest, /** * Update a vector - * The `update` operation updates a vector in a namespace. If a value is included, it will overwrite the previous value. If a `set_metadata` is included, the values of the fields specified in it will be added or overwrite the previous value. For guidance and examples, see [Update data](https://docs.pinecone.io/guides/data/update-data). + * Update a vector in a namespace. If a value is included, it will overwrite the previous value. If a `set_metadata` is included, the values of the fields specified in it will be added or overwrite the previous value. For guidance and examples, see [Update data](https://docs.pinecone.io/guides/data/update-data). * @param updateRequest (required) * @return Object * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -883,7 +1031,7 @@ public Object updateVector(UpdateRequest updateRequest) throws ApiException { /** * Update a vector - * The `update` operation updates a vector in a namespace. If a value is included, it will overwrite the previous value. If a `set_metadata` is included, the values of the fields specified in it will be added or overwrite the previous value. For guidance and examples, see [Update data](https://docs.pinecone.io/guides/data/update-data). + * Update a vector in a namespace. If a value is included, it will overwrite the previous value. If a `set_metadata` is included, the values of the fields specified in it will be added or overwrite the previous value. For guidance and examples, see [Update data](https://docs.pinecone.io/guides/data/update-data). * @param updateRequest (required) * @return ApiResponse<Object> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -904,7 +1052,7 @@ public ApiResponse updateVectorWithHttpInfo(UpdateRequest updateRequest) /** * Update a vector (asynchronously) - * The `update` operation updates a vector in a namespace. If a value is included, it will overwrite the previous value. If a `set_metadata` is included, the values of the fields specified in it will be added or overwrite the previous value. For guidance and examples, see [Update data](https://docs.pinecone.io/guides/data/update-data). + * Update a vector in a namespace. If a value is included, it will overwrite the previous value. If a `set_metadata` is included, the values of the fields specified in it will be added or overwrite the previous value. For guidance and examples, see [Update data](https://docs.pinecone.io/guides/data/update-data). * @param updateRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call @@ -925,6 +1073,147 @@ public okhttp3.Call updateVectorAsync(UpdateRequest updateRequest, final ApiCall localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } + /** + * Build call for upsertRecordsNamespace + * @param namespace The namespace to upsert records into. (required) + * @param upsertRecord (required) + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 A successful response. -
400 Bad request. The request body included invalid request parameters. -
4XX An unexpected error response. -
5XX An unexpected error response. -
+ */ + public okhttp3.Call upsertRecordsNamespaceCall(String namespace, List upsertRecord, final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = upsertRecord; + + // create path and map variables + String localVarPath = "/records/namespaces/{namespace}/upsert" + .replace("{" + "namespace" + "}", localVarApiClient.escapeString(namespace.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/x-ndjson" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { "ApiKeyAuth" }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call upsertRecordsNamespaceValidateBeforeCall(String namespace, List upsertRecord, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'namespace' is set + if (namespace == null) { + throw new ApiException("Missing the required parameter 'namespace' when calling upsertRecordsNamespace(Async)"); + } + + // verify the required parameter 'upsertRecord' is set + if (upsertRecord == null) { + throw new ApiException("Missing the required parameter 'upsertRecord' when calling upsertRecordsNamespace(Async)"); + } + + return upsertRecordsNamespaceCall(namespace, upsertRecord, _callback); + + } + + /** + * Upsert records into a namespace + * This operation converts input data to vector embeddings and then upserts the embeddings into a namespace. + * @param namespace The namespace to upsert records into. (required) + * @param upsertRecord (required) + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 A successful response. -
400 Bad request. The request body included invalid request parameters. -
4XX An unexpected error response. -
5XX An unexpected error response. -
+ */ + public void upsertRecordsNamespace(String namespace, List upsertRecord) throws ApiException { + upsertRecordsNamespaceWithHttpInfo(namespace, upsertRecord); + } + + /** + * Upsert records into a namespace + * This operation converts input data to vector embeddings and then upserts the embeddings into a namespace. + * @param namespace The namespace to upsert records into. (required) + * @param upsertRecord (required) + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 A successful response. -
400 Bad request. The request body included invalid request parameters. -
4XX An unexpected error response. -
5XX An unexpected error response. -
+ */ + public ApiResponse upsertRecordsNamespaceWithHttpInfo(String namespace, List upsertRecord) throws ApiException { + okhttp3.Call localVarCall = upsertRecordsNamespaceValidateBeforeCall(namespace, upsertRecord, null); + return localVarApiClient.execute(localVarCall); + } + + /** + * Upsert records into a namespace (asynchronously) + * This operation converts input data to vector embeddings and then upserts the embeddings into a namespace. + * @param namespace The namespace to upsert records into. (required) + * @param upsertRecord (required) + * @param _callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 A successful response. -
400 Bad request. The request body included invalid request parameters. -
4XX An unexpected error response. -
5XX An unexpected error response. -
+ */ + public okhttp3.Call upsertRecordsNamespaceAsync(String namespace, List upsertRecord, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = upsertRecordsNamespaceValidateBeforeCall(namespace, upsertRecord, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } /** * Build call for upsertVectors * @param upsertRequest (required) @@ -998,7 +1287,7 @@ private okhttp3.Call upsertVectorsValidateBeforeCall(UpsertRequest upsertRequest /** * Upsert vectors - * The `upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/data/upsert-data). + * Write vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/data/upsert-data). * @param upsertRequest (required) * @return UpsertResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -1018,7 +1307,7 @@ public UpsertResponse upsertVectors(UpsertRequest upsertRequest) throws ApiExcep /** * Upsert vectors - * The `upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/data/upsert-data). + * Write vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/data/upsert-data). * @param upsertRequest (required) * @return ApiResponse<UpsertResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -1039,7 +1328,7 @@ public ApiResponse upsertVectorsWithHttpInfo(UpsertRequest upser /** * Upsert vectors (asynchronously) - * The `upsert` operation writes vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/data/upsert-data). + * Write vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value. For guidance and examples, see [Upsert data](https://docs.pinecone.io/guides/data/upsert-data). * @param upsertRequest (required) * @param _callback The callback to be executed when the API call finishes * @return The request call diff --git a/src/main/java/org/openapitools/db_data/client/auth/ApiKeyAuth.java b/src/main/java/org/openapitools/db_data/client/auth/ApiKeyAuth.java index fd83c119..2060fe53 100644 --- a/src/main/java/org/openapitools/db_data/client/auth/ApiKeyAuth.java +++ b/src/main/java/org/openapitools/db_data/client/auth/ApiKeyAuth.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/org/openapitools/db_data/client/auth/Authentication.java b/src/main/java/org/openapitools/db_data/client/auth/Authentication.java index 21567b36..501d69e6 100644 --- a/src/main/java/org/openapitools/db_data/client/auth/Authentication.java +++ b/src/main/java/org/openapitools/db_data/client/auth/Authentication.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_data/client/auth/HttpBasicAuth.java b/src/main/java/org/openapitools/db_data/client/auth/HttpBasicAuth.java index a422af32..ef761ef8 100644 --- a/src/main/java/org/openapitools/db_data/client/auth/HttpBasicAuth.java +++ b/src/main/java/org/openapitools/db_data/client/auth/HttpBasicAuth.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_data/client/auth/HttpBearerAuth.java b/src/main/java/org/openapitools/db_data/client/auth/HttpBearerAuth.java index 1cef876a..7878e42b 100644 --- a/src/main/java/org/openapitools/db_data/client/auth/HttpBearerAuth.java +++ b/src/main/java/org/openapitools/db_data/client/auth/HttpBearerAuth.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/src/main/java/org/openapitools/db_data/client/model/AbstractOpenApiSchema.java b/src/main/java/org/openapitools/db_data/client/model/AbstractOpenApiSchema.java index 77fd8763..16a34e3d 100644 --- a/src/main/java/org/openapitools/db_data/client/model/AbstractOpenApiSchema.java +++ b/src/main/java/org/openapitools/db_data/client/model/AbstractOpenApiSchema.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -23,7 +23,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/org/openapitools/db_data/client/model/DeleteRequest.java b/src/main/java/org/openapitools/db_data/client/model/DeleteRequest.java index 12769dc3..87b9de72 100644 --- a/src/main/java/org/openapitools/db_data/client/model/DeleteRequest.java +++ b/src/main/java/org/openapitools/db_data/client/model/DeleteRequest.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -51,7 +51,7 @@ /** * The request for the `delete` operation. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class DeleteRequest { public static final String SERIALIZED_NAME_IDS = "ids"; @SerializedName(SERIALIZED_NAME_IDS) @@ -150,7 +150,7 @@ public DeleteRequest filter(Object filter) { } /** - * If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata). Serverless indexes do not support delete by metadata. Instead, you can use the `list` operation to fetch the vector IDs based on their common ID prefix and then delete the records by ID. + * If specified, the metadata filter here will be used to select the vectors to delete. This is mutually exclusive with specifying ids to delete in the ids param or using delete_all=True. See [Understanding metadata](https://docs.pinecone.io/guides/data/understanding-metadata). Serverless indexes do not support delete by metadata. Instead, you can use the `list` operation to fetch the vector IDs based on their common ID prefix and then delete the records by ID. * @return filter **/ @javax.annotation.Nullable diff --git a/src/main/java/org/openapitools/db_data/client/model/DescribeIndexStatsRequest.java b/src/main/java/org/openapitools/db_data/client/model/DescribeIndexStatsRequest.java index 20fb8859..0a922597 100644 --- a/src/main/java/org/openapitools/db_data/client/model/DescribeIndexStatsRequest.java +++ b/src/main/java/org/openapitools/db_data/client/model/DescribeIndexStatsRequest.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * The request for the `describe_index_stats` operation. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class DescribeIndexStatsRequest { public static final String SERIALIZED_NAME_FILTER = "filter"; @SerializedName(SERIALIZED_NAME_FILTER) @@ -65,7 +65,7 @@ public DescribeIndexStatsRequest filter(Object filter) { } /** - * If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata). Serverless indexes do not support filtering `describe_index_stats` by metadata. + * If this parameter is present, the operation only returns statistics for vectors that satisfy the filter. See [Understanding metadata](https://docs.pinecone.io/guides/data/understanding-metadata). Serverless indexes do not support filtering `describe_index_stats` by metadata. * @return filter **/ @javax.annotation.Nullable diff --git a/src/main/java/org/openapitools/db_data/client/model/FetchResponse.java b/src/main/java/org/openapitools/db_data/client/model/FetchResponse.java index 1b04417f..d4fabf5e 100644 --- a/src/main/java/org/openapitools/db_data/client/model/FetchResponse.java +++ b/src/main/java/org/openapitools/db_data/client/model/FetchResponse.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -53,7 +53,7 @@ /** * The response for the `fetch` operation. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class FetchResponse { public static final String SERIALIZED_NAME_VECTORS = "vectors"; @SerializedName(SERIALIZED_NAME_VECTORS) diff --git a/src/main/java/org/openapitools/db_data/client/model/Hit.java b/src/main/java/org/openapitools/db_data/client/model/Hit.java new file mode 100644 index 00000000..b8187846 --- /dev/null +++ b/src/main/java/org/openapitools/db_data/client/model/Hit.java @@ -0,0 +1,350 @@ +/* + * Pinecone Data Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_data.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_data.client.JSON; + +/** + * A record whose vector values are similar to the provided search query. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") +public class Hit { + public static final String SERIALIZED_NAME_ID = "_id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public static final String SERIALIZED_NAME_SCORE = "_score"; + @SerializedName(SERIALIZED_NAME_SCORE) + private Float score; + + public static final String SERIALIZED_NAME_FIELDS = "fields"; + @SerializedName(SERIALIZED_NAME_FIELDS) + private Object fields; + + public Hit() { + } + + public Hit id(String id) { + + this.id = id; + return this; + } + + /** + * The record id of the search hit. + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + + public Hit score(Float score) { + + this.score = score; + return this; + } + + /** + * The similarity score of the returned record. + * @return score + **/ + @javax.annotation.Nonnull + public Float getScore() { + return score; + } + + + public void setScore(Float score) { + this.score = score; + } + + + public Hit fields(Object fields) { + + this.fields = fields; + return this; + } + + /** + * The selected record fields associated with the search hit. + * @return fields + **/ + @javax.annotation.Nonnull + public Object getFields() { + return fields; + } + + + public void setFields(Object fields) { + this.fields = fields; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the Hit instance itself + */ + public Hit putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Hit hit = (Hit) o; + return Objects.equals(this.id, hit.id) && + Objects.equals(this.score, hit.score) && + Objects.equals(this.fields, hit.fields)&& + Objects.equals(this.additionalProperties, hit.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, score, fields, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Hit {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_id"); + openapiFields.add("_score"); + openapiFields.add("fields"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_id"); + openapiRequiredFields.add("_score"); + openapiRequiredFields.add("fields"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to Hit + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Hit.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Hit is not found in the empty JSON string", Hit.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Hit.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Hit.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Hit' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Hit.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Hit value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public Hit read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + Hit instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of Hit given an JSON string + * + * @param jsonString JSON string + * @return An instance of Hit + * @throws IOException if the JSON string is invalid with respect to Hit + */ + public static Hit fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Hit.class); + } + + /** + * Convert an instance of Hit to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_data/client/model/ImportErrorMode.java b/src/main/java/org/openapitools/db_data/client/model/ImportErrorMode.java index 8a849fc7..88dc0844 100644 --- a/src/main/java/org/openapitools/db_data/client/model/ImportErrorMode.java +++ b/src/main/java/org/openapitools/db_data/client/model/ImportErrorMode.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * Indicates how to respond to errors during the import process. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class ImportErrorMode { /** * Indicates how to respond to errors during the import process. diff --git a/src/main/java/org/openapitools/db_data/client/model/ImportModel.java b/src/main/java/org/openapitools/db_data/client/model/ImportModel.java index fee47648..5a9e41a9 100644 --- a/src/main/java/org/openapitools/db_data/client/model/ImportModel.java +++ b/src/main/java/org/openapitools/db_data/client/model/ImportModel.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -50,7 +50,7 @@ /** * The model for an import operation. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class ImportModel { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -252,7 +252,7 @@ public ImportModel percentComplete(Float percentComplete) { } /** - * The progress made by the operation out of 100 + * The progress made by the operation, as a percentage. * minimum: 0.0 * maximum: 100.0 * @return percentComplete diff --git a/src/main/java/org/openapitools/db_data/client/model/IndexDescription.java b/src/main/java/org/openapitools/db_data/client/model/IndexDescription.java index ce82686f..e1672294 100644 --- a/src/main/java/org/openapitools/db_data/client/model/IndexDescription.java +++ b/src/main/java/org/openapitools/db_data/client/model/IndexDescription.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -52,7 +52,7 @@ /** * The response for the `describe_index_stats` operation. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class IndexDescription { public static final String SERIALIZED_NAME_NAMESPACES = "namespaces"; @SerializedName(SERIALIZED_NAME_NAMESPACES) @@ -70,6 +70,14 @@ public class IndexDescription { @SerializedName(SERIALIZED_NAME_TOTAL_VECTOR_COUNT) private Long totalVectorCount; + public static final String SERIALIZED_NAME_METRIC = "metric"; + @SerializedName(SERIALIZED_NAME_METRIC) + private String metric; + + public static final String SERIALIZED_NAME_VECTOR_TYPE = "vectorType"; + @SerializedName(SERIALIZED_NAME_VECTOR_TYPE) + private String vectorType; + public IndexDescription() { } @@ -109,7 +117,7 @@ public IndexDescription dimension(Long dimension) { } /** - * The dimension of the indexed vectors. + * The dimension of the indexed vectors. Not specified if `sparse` index. * @return dimension **/ @javax.annotation.Nullable @@ -130,7 +138,7 @@ public IndexDescription indexFullness(Float indexFullness) { } /** - * The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://docs.pinecone.io/reference/api/control-plane/describe_index). + * The fullness of the index, regardless of whether a metadata filter expression was passed. The granularity of this metric is 10%. Serverless indexes scale automatically as needed, so index fullness is relevant only for pod-based indexes. The index fullness result may be inaccurate during pod resizing; to get the status of a pod resizing process, use [`describe_index`](https://docs.pinecone.io/reference/api/2024-10/control-plane/describe_index). * @return indexFullness **/ @javax.annotation.Nullable @@ -164,6 +172,48 @@ public void setTotalVectorCount(Long totalVectorCount) { this.totalVectorCount = totalVectorCount; } + + public IndexDescription metric(String metric) { + + this.metric = metric; + return this; + } + + /** + * The metric used to measure similarity. + * @return metric + **/ + @javax.annotation.Nullable + public String getMetric() { + return metric; + } + + + public void setMetric(String metric) { + this.metric = metric; + } + + + public IndexDescription vectorType(String vectorType) { + + this.vectorType = vectorType; + return this; + } + + /** + * The type of vectors stored in the index. + * @return vectorType + **/ + @javax.annotation.Nullable + public String getVectorType() { + return vectorType; + } + + + public void setVectorType(String vectorType) { + this.vectorType = vectorType; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -222,13 +272,15 @@ public boolean equals(Object o) { return Objects.equals(this.namespaces, indexDescription.namespaces) && Objects.equals(this.dimension, indexDescription.dimension) && Objects.equals(this.indexFullness, indexDescription.indexFullness) && - Objects.equals(this.totalVectorCount, indexDescription.totalVectorCount)&& + Objects.equals(this.totalVectorCount, indexDescription.totalVectorCount) && + Objects.equals(this.metric, indexDescription.metric) && + Objects.equals(this.vectorType, indexDescription.vectorType)&& Objects.equals(this.additionalProperties, indexDescription.additionalProperties); } @Override public int hashCode() { - return Objects.hash(namespaces, dimension, indexFullness, totalVectorCount, additionalProperties); + return Objects.hash(namespaces, dimension, indexFullness, totalVectorCount, metric, vectorType, additionalProperties); } @Override @@ -239,6 +291,8 @@ public String toString() { sb.append(" dimension: ").append(toIndentedString(dimension)).append("\n"); sb.append(" indexFullness: ").append(toIndentedString(indexFullness)).append("\n"); sb.append(" totalVectorCount: ").append(toIndentedString(totalVectorCount)).append("\n"); + sb.append(" metric: ").append(toIndentedString(metric)).append("\n"); + sb.append(" vectorType: ").append(toIndentedString(vectorType)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -266,6 +320,8 @@ private String toIndentedString(Object o) { openapiFields.add("dimension"); openapiFields.add("indexFullness"); openapiFields.add("totalVectorCount"); + openapiFields.add("metric"); + openapiFields.add("vectorType"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); @@ -284,6 +340,12 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti } } JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("metric") != null && !jsonObj.get("metric").isJsonNull()) && !jsonObj.get("metric").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `metric` to be a primitive type in the JSON string but got `%s`", jsonObj.get("metric").toString())); + } + if ((jsonObj.get("vectorType") != null && !jsonObj.get("vectorType").isJsonNull()) && !jsonObj.get("vectorType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `vectorType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("vectorType").toString())); + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/org/openapitools/db_data/client/model/ListImportsResponse.java b/src/main/java/org/openapitools/db_data/client/model/ListImportsResponse.java index df7348b6..93b6871c 100644 --- a/src/main/java/org/openapitools/db_data/client/model/ListImportsResponse.java +++ b/src/main/java/org/openapitools/db_data/client/model/ListImportsResponse.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -53,7 +53,7 @@ /** * The response for the `list_imports` operation. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class ListImportsResponse { public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) diff --git a/src/main/java/org/openapitools/db_data/client/model/ListItem.java b/src/main/java/org/openapitools/db_data/client/model/ListItem.java index 6d21c60d..b770d956 100644 --- a/src/main/java/org/openapitools/db_data/client/model/ListItem.java +++ b/src/main/java/org/openapitools/db_data/client/model/ListItem.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * ListItem */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class ListItem { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/src/main/java/org/openapitools/db_data/client/model/ListResponse.java b/src/main/java/org/openapitools/db_data/client/model/ListResponse.java index 309039dc..2ef20337 100644 --- a/src/main/java/org/openapitools/db_data/client/model/ListResponse.java +++ b/src/main/java/org/openapitools/db_data/client/model/ListResponse.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -54,7 +54,7 @@ /** * The response for the `list` operation. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class ListResponse { public static final String SERIALIZED_NAME_VECTORS = "vectors"; @SerializedName(SERIALIZED_NAME_VECTORS) diff --git a/src/main/java/org/openapitools/db_data/client/model/NamespaceSummary.java b/src/main/java/org/openapitools/db_data/client/model/NamespaceSummary.java index a0ce407e..027afd1d 100644 --- a/src/main/java/org/openapitools/db_data/client/model/NamespaceSummary.java +++ b/src/main/java/org/openapitools/db_data/client/model/NamespaceSummary.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * A summary of the contents of a namespace. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class NamespaceSummary { public static final String SERIALIZED_NAME_VECTOR_COUNT = "vectorCount"; @SerializedName(SERIALIZED_NAME_VECTOR_COUNT) diff --git a/src/main/java/org/openapitools/db_data/client/model/Pagination.java b/src/main/java/org/openapitools/db_data/client/model/Pagination.java index d7372f3d..d73e826e 100644 --- a/src/main/java/org/openapitools/db_data/client/model/Pagination.java +++ b/src/main/java/org/openapitools/db_data/client/model/Pagination.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * Pagination */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class Pagination { public static final String SERIALIZED_NAME_NEXT = "next"; @SerializedName(SERIALIZED_NAME_NEXT) diff --git a/src/main/java/org/openapitools/db_data/client/model/ProtobufAny.java b/src/main/java/org/openapitools/db_data/client/model/ProtobufAny.java index 9124df58..bb7b04d6 100644 --- a/src/main/java/org/openapitools/db_data/client/model/ProtobufAny.java +++ b/src/main/java/org/openapitools/db_data/client/model/ProtobufAny.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * ProtobufAny */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class ProtobufAny { public static final String SERIALIZED_NAME_TYPE_URL = "typeUrl"; @SerializedName(SERIALIZED_NAME_TYPE_URL) diff --git a/src/main/java/org/openapitools/db_data/client/model/ProtobufNullValue.java b/src/main/java/org/openapitools/db_data/client/model/ProtobufNullValue.java index e0a709b3..128e67f1 100644 --- a/src/main/java/org/openapitools/db_data/client/model/ProtobufNullValue.java +++ b/src/main/java/org/openapitools/db_data/client/model/ProtobufNullValue.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/db_data/client/model/QueryRequest.java b/src/main/java/org/openapitools/db_data/client/model/QueryRequest.java index 261856b9..b3b649ae 100644 --- a/src/main/java/org/openapitools/db_data/client/model/QueryRequest.java +++ b/src/main/java/org/openapitools/db_data/client/model/QueryRequest.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -53,7 +53,7 @@ /** * The request for the `query` operation. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class QueryRequest { public static final String SERIALIZED_NAME_NAMESPACE = "namespace"; @SerializedName(SERIALIZED_NAME_NAMESPACE) @@ -146,7 +146,7 @@ public QueryRequest filter(Object filter) { } /** - * The filter to apply. You can use vector metadata to limit your search. See [Filter with metadata](https://docs.pinecone.io/guides/data/filter-with-metadata). + * The filter to apply. You can use vector metadata to limit your search. See [Understanding metadata](https://docs.pinecone.io/guides/data/understanding-metadata). * @return filter **/ @javax.annotation.Nullable diff --git a/src/main/java/org/openapitools/db_data/client/model/QueryResponse.java b/src/main/java/org/openapitools/db_data/client/model/QueryResponse.java index 49183922..df0c92e5 100644 --- a/src/main/java/org/openapitools/db_data/client/model/QueryResponse.java +++ b/src/main/java/org/openapitools/db_data/client/model/QueryResponse.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -54,7 +54,7 @@ /** * The response for the `query` operation. These are the matches found for a particular query vector. The matches are ordered from most similar to least similar. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class QueryResponse { public static final String SERIALIZED_NAME_RESULTS = "results"; @Deprecated diff --git a/src/main/java/org/openapitools/db_data/client/model/QueryVector.java b/src/main/java/org/openapitools/db_data/client/model/QueryVector.java index ee2b777b..35d72069 100644 --- a/src/main/java/org/openapitools/db_data/client/model/QueryVector.java +++ b/src/main/java/org/openapitools/db_data/client/model/QueryVector.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -54,7 +54,7 @@ * @deprecated */ @Deprecated -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class QueryVector { public static final String SERIALIZED_NAME_VALUES = "values"; @SerializedName(SERIALIZED_NAME_VALUES) diff --git a/src/main/java/org/openapitools/db_data/client/model/RpcStatus.java b/src/main/java/org/openapitools/db_data/client/model/RpcStatus.java index 81d7dde7..e57fd4cc 100644 --- a/src/main/java/org/openapitools/db_data/client/model/RpcStatus.java +++ b/src/main/java/org/openapitools/db_data/client/model/RpcStatus.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -52,7 +52,7 @@ /** * RpcStatus */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class RpcStatus { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) diff --git a/src/main/java/org/openapitools/db_data/client/model/ScoredVector.java b/src/main/java/org/openapitools/db_data/client/model/ScoredVector.java index 7d553748..0c0441d5 100644 --- a/src/main/java/org/openapitools/db_data/client/model/ScoredVector.java +++ b/src/main/java/org/openapitools/db_data/client/model/ScoredVector.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -52,7 +52,7 @@ /** * ScoredVector */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class ScoredVector { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/src/main/java/org/openapitools/db_data/client/model/SearchRecordsRequest.java b/src/main/java/org/openapitools/db_data/client/model/SearchRecordsRequest.java new file mode 100644 index 00000000..bb5ba63d --- /dev/null +++ b/src/main/java/org/openapitools/db_data/client/model/SearchRecordsRequest.java @@ -0,0 +1,367 @@ +/* + * Pinecone Data Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_data.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.db_data.client.model.SearchRecordsRequestQuery; +import org.openapitools.db_data.client.model.SearchRecordsRequestRerank; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_data.client.JSON; + +/** + * A search request for records in a specific namespace. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") +public class SearchRecordsRequest { + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private SearchRecordsRequestQuery query; + + public static final String SERIALIZED_NAME_FIELDS = "fields"; + @SerializedName(SERIALIZED_NAME_FIELDS) + private List fields; + + public static final String SERIALIZED_NAME_RERANK = "rerank"; + @SerializedName(SERIALIZED_NAME_RERANK) + private SearchRecordsRequestRerank rerank; + + public SearchRecordsRequest() { + } + + public SearchRecordsRequest query(SearchRecordsRequestQuery query) { + + this.query = query; + return this; + } + + /** + * Get query + * @return query + **/ + @javax.annotation.Nonnull + public SearchRecordsRequestQuery getQuery() { + return query; + } + + + public void setQuery(SearchRecordsRequestQuery query) { + this.query = query; + } + + + public SearchRecordsRequest fields(List fields) { + + this.fields = fields; + return this; + } + + public SearchRecordsRequest addFieldsItem(String fieldsItem) { + if (this.fields == null) { + this.fields = new ArrayList<>(); + } + this.fields.add(fieldsItem); + return this; + } + + /** + * The fields to return in the search results. + * @return fields + **/ + @javax.annotation.Nullable + public List getFields() { + return fields; + } + + + public void setFields(List fields) { + this.fields = fields; + } + + + public SearchRecordsRequest rerank(SearchRecordsRequestRerank rerank) { + + this.rerank = rerank; + return this; + } + + /** + * Get rerank + * @return rerank + **/ + @javax.annotation.Nullable + public SearchRecordsRequestRerank getRerank() { + return rerank; + } + + + public void setRerank(SearchRecordsRequestRerank rerank) { + this.rerank = rerank; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SearchRecordsRequest instance itself + */ + public SearchRecordsRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchRecordsRequest searchRecordsRequest = (SearchRecordsRequest) o; + return Objects.equals(this.query, searchRecordsRequest.query) && + Objects.equals(this.fields, searchRecordsRequest.fields) && + Objects.equals(this.rerank, searchRecordsRequest.rerank)&& + Objects.equals(this.additionalProperties, searchRecordsRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(query, fields, rerank, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchRecordsRequest {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append(" rerank: ").append(toIndentedString(rerank)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("query"); + openapiFields.add("fields"); + openapiFields.add("rerank"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("query"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SearchRecordsRequest + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SearchRecordsRequest.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SearchRecordsRequest is not found in the empty JSON string", SearchRecordsRequest.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SearchRecordsRequest.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `query` + SearchRecordsRequestQuery.validateJsonElement(jsonObj.get("query")); + // ensure the optional json data is an array if present + if (jsonObj.get("fields") != null && !jsonObj.get("fields").isJsonNull() && !jsonObj.get("fields").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fields` to be an array in the JSON string but got `%s`", jsonObj.get("fields").toString())); + } + // validate the optional field `rerank` + if (jsonObj.get("rerank") != null && !jsonObj.get("rerank").isJsonNull()) { + SearchRecordsRequestRerank.validateJsonElement(jsonObj.get("rerank")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchRecordsRequest.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchRecordsRequest' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchRecordsRequest.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SearchRecordsRequest value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SearchRecordsRequest read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SearchRecordsRequest instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SearchRecordsRequest given an JSON string + * + * @param jsonString JSON string + * @return An instance of SearchRecordsRequest + * @throws IOException if the JSON string is invalid with respect to SearchRecordsRequest + */ + public static SearchRecordsRequest fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SearchRecordsRequest.class); + } + + /** + * Convert an instance of SearchRecordsRequest to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_data/client/model/SearchRecordsRequestQuery.java b/src/main/java/org/openapitools/db_data/client/model/SearchRecordsRequestQuery.java new file mode 100644 index 00000000..9c0e8407 --- /dev/null +++ b/src/main/java/org/openapitools/db_data/client/model/SearchRecordsRequestQuery.java @@ -0,0 +1,409 @@ +/* + * Pinecone Data Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_data.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.db_data.client.model.SearchRecordsVector; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_data.client.JSON; + +/** + * The query inputs to search with. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") +public class SearchRecordsRequestQuery { + public static final String SERIALIZED_NAME_TOP_K = "top_k"; + @SerializedName(SERIALIZED_NAME_TOP_K) + private Integer topK; + + public static final String SERIALIZED_NAME_FILTER = "filter"; + @SerializedName(SERIALIZED_NAME_FILTER) + private Object filter; + + public static final String SERIALIZED_NAME_INPUTS = "inputs"; + @SerializedName(SERIALIZED_NAME_INPUTS) + private Object inputs; + + public static final String SERIALIZED_NAME_VECTOR = "vector"; + @SerializedName(SERIALIZED_NAME_VECTOR) + private SearchRecordsVector vector; + + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public SearchRecordsRequestQuery() { + } + + public SearchRecordsRequestQuery topK(Integer topK) { + + this.topK = topK; + return this; + } + + /** + * The number of results to return for each search. + * @return topK + **/ + @javax.annotation.Nonnull + public Integer getTopK() { + return topK; + } + + + public void setTopK(Integer topK) { + this.topK = topK; + } + + + public SearchRecordsRequestQuery filter(Object filter) { + + this.filter = filter; + return this; + } + + /** + * The filter to apply. + * @return filter + **/ + @javax.annotation.Nullable + public Object getFilter() { + return filter; + } + + + public void setFilter(Object filter) { + this.filter = filter; + } + + + public SearchRecordsRequestQuery inputs(Object inputs) { + + this.inputs = inputs; + return this; + } + + /** + * Get inputs + * @return inputs + **/ + @javax.annotation.Nullable + public Object getInputs() { + return inputs; + } + + + public void setInputs(Object inputs) { + this.inputs = inputs; + } + + + public SearchRecordsRequestQuery vector(SearchRecordsVector vector) { + + this.vector = vector; + return this; + } + + /** + * Get vector + * @return vector + **/ + @javax.annotation.Nullable + public SearchRecordsVector getVector() { + return vector; + } + + + public void setVector(SearchRecordsVector vector) { + this.vector = vector; + } + + + public SearchRecordsRequestQuery id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the vector to be used as a query vector. + * @return id + **/ + @javax.annotation.Nullable + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SearchRecordsRequestQuery instance itself + */ + public SearchRecordsRequestQuery putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchRecordsRequestQuery searchRecordsRequestQuery = (SearchRecordsRequestQuery) o; + return Objects.equals(this.topK, searchRecordsRequestQuery.topK) && + Objects.equals(this.filter, searchRecordsRequestQuery.filter) && + Objects.equals(this.inputs, searchRecordsRequestQuery.inputs) && + Objects.equals(this.vector, searchRecordsRequestQuery.vector) && + Objects.equals(this.id, searchRecordsRequestQuery.id)&& + Objects.equals(this.additionalProperties, searchRecordsRequestQuery.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(topK, filter, inputs, vector, id, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchRecordsRequestQuery {\n"); + sb.append(" topK: ").append(toIndentedString(topK)).append("\n"); + sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); + sb.append(" inputs: ").append(toIndentedString(inputs)).append("\n"); + sb.append(" vector: ").append(toIndentedString(vector)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("top_k"); + openapiFields.add("filter"); + openapiFields.add("inputs"); + openapiFields.add("vector"); + openapiFields.add("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("top_k"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SearchRecordsRequestQuery + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SearchRecordsRequestQuery.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SearchRecordsRequestQuery is not found in the empty JSON string", SearchRecordsRequestQuery.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SearchRecordsRequestQuery.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `vector` + if (jsonObj.get("vector") != null && !jsonObj.get("vector").isJsonNull()) { + SearchRecordsVector.validateJsonElement(jsonObj.get("vector")); + } + if ((jsonObj.get("id") != null && !jsonObj.get("id").isJsonNull()) && !jsonObj.get("id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchRecordsRequestQuery.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchRecordsRequestQuery' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchRecordsRequestQuery.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SearchRecordsRequestQuery value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SearchRecordsRequestQuery read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SearchRecordsRequestQuery instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SearchRecordsRequestQuery given an JSON string + * + * @param jsonString JSON string + * @return An instance of SearchRecordsRequestQuery + * @throws IOException if the JSON string is invalid with respect to SearchRecordsRequestQuery + */ + public static SearchRecordsRequestQuery fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SearchRecordsRequestQuery.class); + } + + /** + * Convert an instance of SearchRecordsRequestQuery to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_data/client/model/SearchRecordsRequestRerank.java b/src/main/java/org/openapitools/db_data/client/model/SearchRecordsRequestRerank.java new file mode 100644 index 00000000..0c37a17a --- /dev/null +++ b/src/main/java/org/openapitools/db_data/client/model/SearchRecordsRequestRerank.java @@ -0,0 +1,434 @@ +/* + * Pinecone Data Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_data.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_data.client.JSON; + +/** + * Parameters for reranking the initial search results. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") +public class SearchRecordsRequestRerank { + public static final String SERIALIZED_NAME_MODEL = "model"; + @SerializedName(SERIALIZED_NAME_MODEL) + private String model; + + public static final String SERIALIZED_NAME_RANK_FIELDS = "rank_fields"; + @SerializedName(SERIALIZED_NAME_RANK_FIELDS) + private List rankFields = new ArrayList<>(); + + public static final String SERIALIZED_NAME_TOP_N = "top_n"; + @SerializedName(SERIALIZED_NAME_TOP_N) + private Integer topN; + + public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; + @SerializedName(SERIALIZED_NAME_PARAMETERS) + private Map parameters = new HashMap<>(); + + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + + public SearchRecordsRequestRerank() { + } + + public SearchRecordsRequestRerank model(String model) { + + this.model = model; + return this; + } + + /** + * The name of the [reranking model](https://docs.pinecone.io/guides/inference/understanding-inference#reranking-models) to use. + * @return model + **/ + @javax.annotation.Nonnull + public String getModel() { + return model; + } + + + public void setModel(String model) { + this.model = model; + } + + + public SearchRecordsRequestRerank rankFields(List rankFields) { + + this.rankFields = rankFields; + return this; + } + + public SearchRecordsRequestRerank addRankFieldsItem(String rankFieldsItem) { + if (this.rankFields == null) { + this.rankFields = new ArrayList<>(); + } + this.rankFields.add(rankFieldsItem); + return this; + } + + /** + * The fields to use for reranking. + * @return rankFields + **/ + @javax.annotation.Nonnull + public List getRankFields() { + return rankFields; + } + + + public void setRankFields(List rankFields) { + this.rankFields = rankFields; + } + + + public SearchRecordsRequestRerank topN(Integer topN) { + + this.topN = topN; + return this; + } + + /** + * The number of top results to return after reranking. Defaults to top_k. + * @return topN + **/ + @javax.annotation.Nullable + public Integer getTopN() { + return topN; + } + + + public void setTopN(Integer topN) { + this.topN = topN; + } + + + public SearchRecordsRequestRerank parameters(Map parameters) { + + this.parameters = parameters; + return this; + } + + public SearchRecordsRequestRerank putParametersItem(String key, Object parametersItem) { + if (this.parameters == null) { + this.parameters = new HashMap<>(); + } + this.parameters.put(key, parametersItem); + return this; + } + + /** + * Additional model-specific parameters. Refer to the [model guide](https://docs.pinecone.io/guides/inference/understanding-inference#reranking-models) for available model parameters. + * @return parameters + **/ + @javax.annotation.Nullable + public Map getParameters() { + return parameters; + } + + + public void setParameters(Map parameters) { + this.parameters = parameters; + } + + + public SearchRecordsRequestRerank query(String query) { + + this.query = query; + return this; + } + + /** + * The query to rerank documents against. If a specific rerank query is specified, it overwrites the query input that was provided at the top level. + * @return query + **/ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + + public void setQuery(String query) { + this.query = query; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SearchRecordsRequestRerank instance itself + */ + public SearchRecordsRequestRerank putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchRecordsRequestRerank searchRecordsRequestRerank = (SearchRecordsRequestRerank) o; + return Objects.equals(this.model, searchRecordsRequestRerank.model) && + Objects.equals(this.rankFields, searchRecordsRequestRerank.rankFields) && + Objects.equals(this.topN, searchRecordsRequestRerank.topN) && + Objects.equals(this.parameters, searchRecordsRequestRerank.parameters) && + Objects.equals(this.query, searchRecordsRequestRerank.query)&& + Objects.equals(this.additionalProperties, searchRecordsRequestRerank.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(model, rankFields, topN, parameters, query, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchRecordsRequestRerank {\n"); + sb.append(" model: ").append(toIndentedString(model)).append("\n"); + sb.append(" rankFields: ").append(toIndentedString(rankFields)).append("\n"); + sb.append(" topN: ").append(toIndentedString(topN)).append("\n"); + sb.append(" parameters: ").append(toIndentedString(parameters)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("model"); + openapiFields.add("rank_fields"); + openapiFields.add("top_n"); + openapiFields.add("parameters"); + openapiFields.add("query"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("model"); + openapiRequiredFields.add("rank_fields"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SearchRecordsRequestRerank + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SearchRecordsRequestRerank.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SearchRecordsRequestRerank is not found in the empty JSON string", SearchRecordsRequestRerank.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SearchRecordsRequestRerank.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("model").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `model` to be a primitive type in the JSON string but got `%s`", jsonObj.get("model").toString())); + } + // ensure the required json array is present + if (jsonObj.get("rank_fields") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("rank_fields").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `rank_fields` to be an array in the JSON string but got `%s`", jsonObj.get("rank_fields").toString())); + } + if ((jsonObj.get("query") != null && !jsonObj.get("query").isJsonNull()) && !jsonObj.get("query").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `query` to be a primitive type in the JSON string but got `%s`", jsonObj.get("query").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchRecordsRequestRerank.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchRecordsRequestRerank' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchRecordsRequestRerank.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SearchRecordsRequestRerank value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SearchRecordsRequestRerank read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SearchRecordsRequestRerank instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SearchRecordsRequestRerank given an JSON string + * + * @param jsonString JSON string + * @return An instance of SearchRecordsRequestRerank + * @throws IOException if the JSON string is invalid with respect to SearchRecordsRequestRerank + */ + public static SearchRecordsRequestRerank fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SearchRecordsRequestRerank.class); + } + + /** + * Convert an instance of SearchRecordsRequestRerank to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_data/client/model/SearchRecordsResponse.java b/src/main/java/org/openapitools/db_data/client/model/SearchRecordsResponse.java new file mode 100644 index 00000000..ece92142 --- /dev/null +++ b/src/main/java/org/openapitools/db_data/client/model/SearchRecordsResponse.java @@ -0,0 +1,324 @@ +/* + * Pinecone Data Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_data.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.db_data.client.model.SearchRecordsResponseResult; +import org.openapitools.db_data.client.model.SearchUsage; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_data.client.JSON; + +/** + * The records search response. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") +public class SearchRecordsResponse { + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + private SearchRecordsResponseResult result; + + public static final String SERIALIZED_NAME_USAGE = "usage"; + @SerializedName(SERIALIZED_NAME_USAGE) + private SearchUsage usage; + + public SearchRecordsResponse() { + } + + public SearchRecordsResponse result(SearchRecordsResponseResult result) { + + this.result = result; + return this; + } + + /** + * Get result + * @return result + **/ + @javax.annotation.Nonnull + public SearchRecordsResponseResult getResult() { + return result; + } + + + public void setResult(SearchRecordsResponseResult result) { + this.result = result; + } + + + public SearchRecordsResponse usage(SearchUsage usage) { + + this.usage = usage; + return this; + } + + /** + * Get usage + * @return usage + **/ + @javax.annotation.Nonnull + public SearchUsage getUsage() { + return usage; + } + + + public void setUsage(SearchUsage usage) { + this.usage = usage; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SearchRecordsResponse instance itself + */ + public SearchRecordsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchRecordsResponse searchRecordsResponse = (SearchRecordsResponse) o; + return Objects.equals(this.result, searchRecordsResponse.result) && + Objects.equals(this.usage, searchRecordsResponse.usage)&& + Objects.equals(this.additionalProperties, searchRecordsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(result, usage, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchRecordsResponse {\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append(" usage: ").append(toIndentedString(usage)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("result"); + openapiFields.add("usage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("result"); + openapiRequiredFields.add("usage"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SearchRecordsResponse + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SearchRecordsResponse.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SearchRecordsResponse is not found in the empty JSON string", SearchRecordsResponse.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SearchRecordsResponse.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the required field `result` + SearchRecordsResponseResult.validateJsonElement(jsonObj.get("result")); + // validate the required field `usage` + SearchUsage.validateJsonElement(jsonObj.get("usage")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchRecordsResponse.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchRecordsResponse' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchRecordsResponse.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SearchRecordsResponse value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SearchRecordsResponse read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SearchRecordsResponse instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SearchRecordsResponse given an JSON string + * + * @param jsonString JSON string + * @return An instance of SearchRecordsResponse + * @throws IOException if the JSON string is invalid with respect to SearchRecordsResponse + */ + public static SearchRecordsResponse fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SearchRecordsResponse.class); + } + + /** + * Convert an instance of SearchRecordsResponse to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_data/client/model/SearchRecordsResponseResult.java b/src/main/java/org/openapitools/db_data/client/model/SearchRecordsResponseResult.java new file mode 100644 index 00000000..75b40d21 --- /dev/null +++ b/src/main/java/org/openapitools/db_data/client/model/SearchRecordsResponseResult.java @@ -0,0 +1,310 @@ +/* + * Pinecone Data Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_data.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.db_data.client.model.Hit; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_data.client.JSON; + +/** + * SearchRecordsResponseResult + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") +public class SearchRecordsResponseResult { + public static final String SERIALIZED_NAME_HITS = "hits"; + @SerializedName(SERIALIZED_NAME_HITS) + private List hits = new ArrayList<>(); + + public SearchRecordsResponseResult() { + } + + public SearchRecordsResponseResult hits(List hits) { + + this.hits = hits; + return this; + } + + public SearchRecordsResponseResult addHitsItem(Hit hitsItem) { + if (this.hits == null) { + this.hits = new ArrayList<>(); + } + this.hits.add(hitsItem); + return this; + } + + /** + * The hits for the search document request. + * @return hits + **/ + @javax.annotation.Nonnull + public List getHits() { + return hits; + } + + + public void setHits(List hits) { + this.hits = hits; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SearchRecordsResponseResult instance itself + */ + public SearchRecordsResponseResult putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchRecordsResponseResult searchRecordsResponseResult = (SearchRecordsResponseResult) o; + return Objects.equals(this.hits, searchRecordsResponseResult.hits)&& + Objects.equals(this.additionalProperties, searchRecordsResponseResult.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(hits, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchRecordsResponseResult {\n"); + sb.append(" hits: ").append(toIndentedString(hits)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("hits"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("hits"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SearchRecordsResponseResult + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SearchRecordsResponseResult.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SearchRecordsResponseResult is not found in the empty JSON string", SearchRecordsResponseResult.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SearchRecordsResponseResult.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the json data is an array + if (!jsonObj.get("hits").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `hits` to be an array in the JSON string but got `%s`", jsonObj.get("hits").toString())); + } + + JsonArray jsonArrayhits = jsonObj.getAsJsonArray("hits"); + // validate the required field `hits` (array) + for (int i = 0; i < jsonArrayhits.size(); i++) { + Hit.validateJsonElement(jsonArrayhits.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchRecordsResponseResult.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchRecordsResponseResult' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchRecordsResponseResult.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SearchRecordsResponseResult value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SearchRecordsResponseResult read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SearchRecordsResponseResult instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SearchRecordsResponseResult given an JSON string + * + * @param jsonString JSON string + * @return An instance of SearchRecordsResponseResult + * @throws IOException if the JSON string is invalid with respect to SearchRecordsResponseResult + */ + public static SearchRecordsResponseResult fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SearchRecordsResponseResult.class); + } + + /** + * Convert an instance of SearchRecordsResponseResult to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_data/client/model/SearchRecordsVector.java b/src/main/java/org/openapitools/db_data/client/model/SearchRecordsVector.java new file mode 100644 index 00000000..f86bbdb6 --- /dev/null +++ b/src/main/java/org/openapitools/db_data/client/model/SearchRecordsVector.java @@ -0,0 +1,375 @@ +/* + * Pinecone Data Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_data.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_data.client.JSON; + +/** + * SearchRecordsVector + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") +public class SearchRecordsVector { + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + private List values; + + public static final String SERIALIZED_NAME_SPARSE_VALUES = "sparse_values"; + @SerializedName(SERIALIZED_NAME_SPARSE_VALUES) + private List sparseValues; + + public static final String SERIALIZED_NAME_SPARSE_INDICES = "sparse_indices"; + @SerializedName(SERIALIZED_NAME_SPARSE_INDICES) + private List sparseIndices; + + public SearchRecordsVector() { + } + + public SearchRecordsVector values(List values) { + + this.values = values; + return this; + } + + public SearchRecordsVector addValuesItem(Float valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * This is the vector data included in the request. + * @return values + **/ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + + public void setValues(List values) { + this.values = values; + } + + + public SearchRecordsVector sparseValues(List sparseValues) { + + this.sparseValues = sparseValues; + return this; + } + + public SearchRecordsVector addSparseValuesItem(Float sparseValuesItem) { + if (this.sparseValues == null) { + this.sparseValues = new ArrayList<>(); + } + this.sparseValues.add(sparseValuesItem); + return this; + } + + /** + * The sparse embedding values. + * @return sparseValues + **/ + @javax.annotation.Nullable + public List getSparseValues() { + return sparseValues; + } + + + public void setSparseValues(List sparseValues) { + this.sparseValues = sparseValues; + } + + + public SearchRecordsVector sparseIndices(List sparseIndices) { + + this.sparseIndices = sparseIndices; + return this; + } + + public SearchRecordsVector addSparseIndicesItem(Integer sparseIndicesItem) { + if (this.sparseIndices == null) { + this.sparseIndices = new ArrayList<>(); + } + this.sparseIndices.add(sparseIndicesItem); + return this; + } + + /** + * The sparse embedding indices. + * @return sparseIndices + **/ + @javax.annotation.Nullable + public List getSparseIndices() { + return sparseIndices; + } + + + public void setSparseIndices(List sparseIndices) { + this.sparseIndices = sparseIndices; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SearchRecordsVector instance itself + */ + public SearchRecordsVector putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchRecordsVector searchRecordsVector = (SearchRecordsVector) o; + return Objects.equals(this.values, searchRecordsVector.values) && + Objects.equals(this.sparseValues, searchRecordsVector.sparseValues) && + Objects.equals(this.sparseIndices, searchRecordsVector.sparseIndices)&& + Objects.equals(this.additionalProperties, searchRecordsVector.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(values, sparseValues, sparseIndices, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchRecordsVector {\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" sparseValues: ").append(toIndentedString(sparseValues)).append("\n"); + sb.append(" sparseIndices: ").append(toIndentedString(sparseIndices)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("values"); + openapiFields.add("sparse_values"); + openapiFields.add("sparse_indices"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SearchRecordsVector + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SearchRecordsVector.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SearchRecordsVector is not found in the empty JSON string", SearchRecordsVector.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("sparse_values") != null && !jsonObj.get("sparse_values").isJsonNull() && !jsonObj.get("sparse_values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `sparse_values` to be an array in the JSON string but got `%s`", jsonObj.get("sparse_values").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("sparse_indices") != null && !jsonObj.get("sparse_indices").isJsonNull() && !jsonObj.get("sparse_indices").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `sparse_indices` to be an array in the JSON string but got `%s`", jsonObj.get("sparse_indices").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchRecordsVector.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchRecordsVector' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchRecordsVector.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SearchRecordsVector value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SearchRecordsVector read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SearchRecordsVector instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SearchRecordsVector given an JSON string + * + * @param jsonString JSON string + * @return An instance of SearchRecordsVector + * @throws IOException if the JSON string is invalid with respect to SearchRecordsVector + */ + public static SearchRecordsVector fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SearchRecordsVector.class); + } + + /** + * Convert an instance of SearchRecordsVector to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_data/client/model/SearchUsage.java b/src/main/java/org/openapitools/db_data/client/model/SearchUsage.java new file mode 100644 index 00000000..c1284630 --- /dev/null +++ b/src/main/java/org/openapitools/db_data/client/model/SearchUsage.java @@ -0,0 +1,348 @@ +/* + * Pinecone Data Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_data.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_data.client.JSON; + +/** + * SearchUsage + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") +public class SearchUsage { + public static final String SERIALIZED_NAME_READ_UNITS = "read_units"; + @SerializedName(SERIALIZED_NAME_READ_UNITS) + private Integer readUnits; + + public static final String SERIALIZED_NAME_EMBED_TOTAL_TOKENS = "embed_total_tokens"; + @SerializedName(SERIALIZED_NAME_EMBED_TOTAL_TOKENS) + private Integer embedTotalTokens; + + public static final String SERIALIZED_NAME_RERANK_UNITS = "rerank_units"; + @SerializedName(SERIALIZED_NAME_RERANK_UNITS) + private Integer rerankUnits; + + public SearchUsage() { + } + + public SearchUsage readUnits(Integer readUnits) { + + this.readUnits = readUnits; + return this; + } + + /** + * The number of read units consumed by this operation. + * minimum: 0 + * @return readUnits + **/ + @javax.annotation.Nonnull + public Integer getReadUnits() { + return readUnits; + } + + + public void setReadUnits(Integer readUnits) { + this.readUnits = readUnits; + } + + + public SearchUsage embedTotalTokens(Integer embedTotalTokens) { + + this.embedTotalTokens = embedTotalTokens; + return this; + } + + /** + * The number of embedding tokens consumed by this operation. + * minimum: 0 + * @return embedTotalTokens + **/ + @javax.annotation.Nullable + public Integer getEmbedTotalTokens() { + return embedTotalTokens; + } + + + public void setEmbedTotalTokens(Integer embedTotalTokens) { + this.embedTotalTokens = embedTotalTokens; + } + + + public SearchUsage rerankUnits(Integer rerankUnits) { + + this.rerankUnits = rerankUnits; + return this; + } + + /** + * The number of rerank units consumed by this operation. + * minimum: 0 + * @return rerankUnits + **/ + @javax.annotation.Nullable + public Integer getRerankUnits() { + return rerankUnits; + } + + + public void setRerankUnits(Integer rerankUnits) { + this.rerankUnits = rerankUnits; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SearchUsage instance itself + */ + public SearchUsage putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchUsage searchUsage = (SearchUsage) o; + return Objects.equals(this.readUnits, searchUsage.readUnits) && + Objects.equals(this.embedTotalTokens, searchUsage.embedTotalTokens) && + Objects.equals(this.rerankUnits, searchUsage.rerankUnits)&& + Objects.equals(this.additionalProperties, searchUsage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(readUnits, embedTotalTokens, rerankUnits, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchUsage {\n"); + sb.append(" readUnits: ").append(toIndentedString(readUnits)).append("\n"); + sb.append(" embedTotalTokens: ").append(toIndentedString(embedTotalTokens)).append("\n"); + sb.append(" rerankUnits: ").append(toIndentedString(rerankUnits)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("read_units"); + openapiFields.add("embed_total_tokens"); + openapiFields.add("rerank_units"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("read_units"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SearchUsage + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SearchUsage.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SearchUsage is not found in the empty JSON string", SearchUsage.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SearchUsage.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchUsage.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchUsage' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchUsage.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SearchUsage value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SearchUsage read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SearchUsage instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SearchUsage given an JSON string + * + * @param jsonString JSON string + * @return An instance of SearchUsage + * @throws IOException if the JSON string is invalid with respect to SearchUsage + */ + public static SearchUsage fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SearchUsage.class); + } + + /** + * Convert an instance of SearchUsage to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_data/client/model/SearchVector.java b/src/main/java/org/openapitools/db_data/client/model/SearchVector.java new file mode 100644 index 00000000..622302a0 --- /dev/null +++ b/src/main/java/org/openapitools/db_data/client/model/SearchVector.java @@ -0,0 +1,295 @@ +/* + * Pinecone Data Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_data.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_data.client.JSON; + +/** + * SearchVector + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") +public class SearchVector { + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + private List values; + + public SearchVector() { + } + + public SearchVector values(List values) { + + this.values = values; + return this; + } + + public SearchVector addValuesItem(Float valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); + return this; + } + + /** + * This is the vector data included in the request. + * @return values + **/ + @javax.annotation.Nullable + public List getValues() { + return values; + } + + + public void setValues(List values) { + this.values = values; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SearchVector instance itself + */ + public SearchVector putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchVector searchVector = (SearchVector) o; + return Objects.equals(this.values, searchVector.values)&& + Objects.equals(this.additionalProperties, searchVector.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(values, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchVector {\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("values"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SearchVector + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SearchVector.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SearchVector is not found in the empty JSON string", SearchVector.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchVector.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchVector' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchVector.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SearchVector value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SearchVector read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SearchVector instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SearchVector given an JSON string + * + * @param jsonString JSON string + * @return An instance of SearchVector + * @throws IOException if the JSON string is invalid with respect to SearchVector + */ + public static SearchVector fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SearchVector.class); + } + + /** + * Convert an instance of SearchVector to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_data/client/model/SingleQueryResults.java b/src/main/java/org/openapitools/db_data/client/model/SingleQueryResults.java index a3aeb918..4356dfb5 100644 --- a/src/main/java/org/openapitools/db_data/client/model/SingleQueryResults.java +++ b/src/main/java/org/openapitools/db_data/client/model/SingleQueryResults.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -52,7 +52,7 @@ /** * SingleQueryResults */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class SingleQueryResults { public static final String SERIALIZED_NAME_MATCHES = "matches"; @SerializedName(SERIALIZED_NAME_MATCHES) diff --git a/src/main/java/org/openapitools/db_data/client/model/SparseValues.java b/src/main/java/org/openapitools/db_data/client/model/SparseValues.java index 21dba26d..2e9938c8 100644 --- a/src/main/java/org/openapitools/db_data/client/model/SparseValues.java +++ b/src/main/java/org/openapitools/db_data/client/model/SparseValues.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -51,7 +51,7 @@ /** * Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be with the same length. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class SparseValues { public static final String SERIALIZED_NAME_INDICES = "indices"; @SerializedName(SERIALIZED_NAME_INDICES) diff --git a/src/main/java/org/openapitools/db_data/client/model/StartImportRequest.java b/src/main/java/org/openapitools/db_data/client/model/StartImportRequest.java index 24f87f5e..ec41b91e 100644 --- a/src/main/java/org/openapitools/db_data/client/model/StartImportRequest.java +++ b/src/main/java/org/openapitools/db_data/client/model/StartImportRequest.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -50,7 +50,7 @@ /** * The request for the `start_import` operation. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class StartImportRequest { public static final String SERIALIZED_NAME_INTEGRATION_ID = "integrationId"; @SerializedName(SERIALIZED_NAME_INTEGRATION_ID) @@ -74,7 +74,7 @@ public StartImportRequest integrationId(String integrationId) { } /** - * The id of the storage integration that should be used to access the data. + * The id of the [storage integration](https://docs.pinecone.io/guides/operations/integrations/manage-storage-integrations) that should be used to access the data. * @return integrationId **/ @javax.annotation.Nullable @@ -95,7 +95,7 @@ public StartImportRequest uri(String uri) { } /** - * The URI prefix under which the data to import is available. All data within this prefix will be listed then imported into the target index. Currently only `s3://` URIs are supported. + * The [URI prefix](https://docs.pinecone.io/guides/data/understanding-imports#directory-structure) under which the data to import is available. All data within this prefix will be listed then imported into the target index. Currently only `s3://` URIs are supported. * @return uri **/ @javax.annotation.Nonnull diff --git a/src/main/java/org/openapitools/db_data/client/model/StartImportResponse.java b/src/main/java/org/openapitools/db_data/client/model/StartImportResponse.java index 78e4fc4f..2361c245 100644 --- a/src/main/java/org/openapitools/db_data/client/model/StartImportResponse.java +++ b/src/main/java/org/openapitools/db_data/client/model/StartImportResponse.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * The response for the `start_import` operation. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class StartImportResponse { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) @@ -65,7 +65,7 @@ public StartImportResponse id(String id) { } /** - * Unique identifier for the import operations. + * Unique identifier for the import operation. * @return id **/ @javax.annotation.Nullable diff --git a/src/main/java/org/openapitools/db_data/client/model/UpdateRequest.java b/src/main/java/org/openapitools/db_data/client/model/UpdateRequest.java index 189b6276..63662cfb 100644 --- a/src/main/java/org/openapitools/db_data/client/model/UpdateRequest.java +++ b/src/main/java/org/openapitools/db_data/client/model/UpdateRequest.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -52,7 +52,7 @@ /** * The request for the `update` operation. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class UpdateRequest { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/src/main/java/org/openapitools/db_data/client/model/UpsertRecord.java b/src/main/java/org/openapitools/db_data/client/model/UpsertRecord.java new file mode 100644 index 00000000..d544d241 --- /dev/null +++ b/src/main/java/org/openapitools/db_data/client/model/UpsertRecord.java @@ -0,0 +1,292 @@ +/* + * Pinecone Data Plane API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.db_data.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.db_data.client.JSON; + +/** + * The request for the `upsert` operation. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") +public class UpsertRecord { + public static final String SERIALIZED_NAME_ID = "_id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + + public UpsertRecord() { + } + + public UpsertRecord id(String id) { + + this.id = id; + return this; + } + + /** + * The unique ID of the record to upsert. Note that `id` can be used as an alias for `_id`. + * @return id + **/ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + + public void setId(String id) { + this.id = id; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the UpsertRecord instance itself + */ + public UpsertRecord putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpsertRecord upsertRecord = (UpsertRecord) o; + return Objects.equals(this.id, upsertRecord.id)&& + Objects.equals(this.additionalProperties, upsertRecord.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertRecord {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_id"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpsertRecord + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpsertRecord.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpsertRecord is not found in the empty JSON string", UpsertRecord.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpsertRecord.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (!jsonObj.get("_id").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `_id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("_id").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpsertRecord.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpsertRecord' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpsertRecord.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpsertRecord value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public UpsertRecord read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + UpsertRecord instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpsertRecord given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpsertRecord + * @throws IOException if the JSON string is invalid with respect to UpsertRecord + */ + public static UpsertRecord fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpsertRecord.class); + } + + /** + * Convert an instance of UpsertRecord to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/db_data/client/model/UpsertRequest.java b/src/main/java/org/openapitools/db_data/client/model/UpsertRequest.java index 18ead1c3..558312f2 100644 --- a/src/main/java/org/openapitools/db_data/client/model/UpsertRequest.java +++ b/src/main/java/org/openapitools/db_data/client/model/UpsertRequest.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -52,7 +52,7 @@ /** * The request for the `upsert` operation. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class UpsertRequest { public static final String SERIALIZED_NAME_VECTORS = "vectors"; @SerializedName(SERIALIZED_NAME_VECTORS) diff --git a/src/main/java/org/openapitools/db_data/client/model/UpsertResponse.java b/src/main/java/org/openapitools/db_data/client/model/UpsertResponse.java index e1896ce5..f5e5f095 100644 --- a/src/main/java/org/openapitools/db_data/client/model/UpsertResponse.java +++ b/src/main/java/org/openapitools/db_data/client/model/UpsertResponse.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * The response for the `upsert` operation. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class UpsertResponse { public static final String SERIALIZED_NAME_UPSERTED_COUNT = "upsertedCount"; @SerializedName(SERIALIZED_NAME_UPSERTED_COUNT) diff --git a/src/main/java/org/openapitools/db_data/client/model/Usage.java b/src/main/java/org/openapitools/db_data/client/model/Usage.java index bdcc7525..1adaeea9 100644 --- a/src/main/java/org/openapitools/db_data/client/model/Usage.java +++ b/src/main/java/org/openapitools/db_data/client/model/Usage.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * Usage */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class Usage { public static final String SERIALIZED_NAME_READ_UNITS = "readUnits"; @SerializedName(SERIALIZED_NAME_READ_UNITS) diff --git a/src/main/java/org/openapitools/db_data/client/model/Vector.java b/src/main/java/org/openapitools/db_data/client/model/Vector.java index 36e718c6..31a7b740 100644 --- a/src/main/java/org/openapitools/db_data/client/model/Vector.java +++ b/src/main/java/org/openapitools/db_data/client/model/Vector.java @@ -2,7 +2,7 @@ * Pinecone Data Plane API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -52,7 +52,7 @@ /** * Vector */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:12.659110Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:20.514422Z[Etc/UTC]") public class Vector { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) diff --git a/src/main/java/org/openapitools/inference/client/ApiCallback.java b/src/main/java/org/openapitools/inference/client/ApiCallback.java index 93b61a7f..080a3160 100644 --- a/src/main/java/org/openapitools/inference/client/ApiCallback.java +++ b/src/main/java/org/openapitools/inference/client/ApiCallback.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/inference/client/ApiClient.java b/src/main/java/org/openapitools/inference/client/ApiClient.java index 6f5ff5df..04ecd65e 100644 --- a/src/main/java/org/openapitools/inference/client/ApiClient.java +++ b/src/main/java/org/openapitools/inference/client/ApiClient.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -140,7 +140,7 @@ private void init() { json = new JSON(); // Set default User-Agent. - setUserAgent("OpenAPI-Generator/2024-10/java"); + setUserAgent("OpenAPI-Generator/2025-01/java"); authentications = new HashMap(); } diff --git a/src/main/java/org/openapitools/inference/client/ApiException.java b/src/main/java/org/openapitools/inference/client/ApiException.java index 3097e34e..3c64b892 100644 --- a/src/main/java/org/openapitools/inference/client/ApiException.java +++ b/src/main/java/org/openapitools/inference/client/ApiException.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -21,7 +21,7 @@ *

ApiException class.

*/ @SuppressWarnings("serial") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class ApiException extends Exception { private int code = 0; private Map> responseHeaders = null; diff --git a/src/main/java/org/openapitools/inference/client/ApiResponse.java b/src/main/java/org/openapitools/inference/client/ApiResponse.java index a4acf8c5..f244e60c 100644 --- a/src/main/java/org/openapitools/inference/client/ApiResponse.java +++ b/src/main/java/org/openapitools/inference/client/ApiResponse.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/inference/client/Configuration.java b/src/main/java/org/openapitools/inference/client/Configuration.java index 3eb50371..e02463bc 100644 --- a/src/main/java/org/openapitools/inference/client/Configuration.java +++ b/src/main/java/org/openapitools/inference/client/Configuration.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -13,9 +13,9 @@ package org.openapitools.inference.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class Configuration { - public static final String VERSION = "2024-10"; + public static final String VERSION = "2025-01"; private static ApiClient defaultApiClient = new ApiClient(); diff --git a/src/main/java/org/openapitools/inference/client/GzipRequestInterceptor.java b/src/main/java/org/openapitools/inference/client/GzipRequestInterceptor.java index a72ee6c1..202ae52e 100644 --- a/src/main/java/org/openapitools/inference/client/GzipRequestInterceptor.java +++ b/src/main/java/org/openapitools/inference/client/GzipRequestInterceptor.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/inference/client/JSON.java b/src/main/java/org/openapitools/inference/client/JSON.java index 15fdbc69..7b8a6c51 100644 --- a/src/main/java/org/openapitools/inference/client/JSON.java +++ b/src/main/java/org/openapitools/inference/client/JSON.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -58,6 +58,19 @@ public class JSON { @SuppressWarnings("unchecked") public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() + .registerTypeSelector(org.openapitools.inference.client.model.Embedding.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("DenseEmbedding", org.openapitools.inference.client.model.DenseEmbedding.class); + classByDiscriminatorValue.put("SparseEmbedding", org.openapitools.inference.client.model.SparseEmbedding.class); + classByDiscriminatorValue.put("dense", org.openapitools.inference.client.model.DenseEmbedding.class); + classByDiscriminatorValue.put("sparse", org.openapitools.inference.client.model.SparseEmbedding.class); + classByDiscriminatorValue.put("Embedding", org.openapitools.inference.client.model.Embedding.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "vector_type")); + } + }) ; GsonBuilder builder = fireBuilder.createGsonBuilder(); return builder; @@ -93,9 +106,9 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.inference.client.model.DenseEmbedding.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.inference.client.model.EmbedRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.inference.client.model.EmbedRequestInputsInner.CustomTypeAdapterFactory()); - gsonBuilder.registerTypeAdapterFactory(new org.openapitools.inference.client.model.EmbedRequestParameters.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.inference.client.model.Embedding.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.inference.client.model.EmbeddingsList.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.inference.client.model.EmbeddingsListUsage.CustomTypeAdapterFactory()); @@ -105,6 +118,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new org.openapitools.inference.client.model.RerankRequest.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.inference.client.model.RerankResult.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new org.openapitools.inference.client.model.RerankResultUsage.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new org.openapitools.inference.client.model.SparseEmbedding.CustomTypeAdapterFactory()); gson = gsonBuilder.create(); } diff --git a/src/main/java/org/openapitools/inference/client/Pair.java b/src/main/java/org/openapitools/inference/client/Pair.java index cadff10d..b0be8a72 100644 --- a/src/main/java/org/openapitools/inference/client/Pair.java +++ b/src/main/java/org/openapitools/inference/client/Pair.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -13,7 +13,7 @@ package org.openapitools.inference.client; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class Pair { private String name = ""; private String value = ""; diff --git a/src/main/java/org/openapitools/inference/client/ProgressRequestBody.java b/src/main/java/org/openapitools/inference/client/ProgressRequestBody.java index b74786bf..3e601627 100644 --- a/src/main/java/org/openapitools/inference/client/ProgressRequestBody.java +++ b/src/main/java/org/openapitools/inference/client/ProgressRequestBody.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/inference/client/ProgressResponseBody.java b/src/main/java/org/openapitools/inference/client/ProgressResponseBody.java index a0456d0d..d3b6b62a 100644 --- a/src/main/java/org/openapitools/inference/client/ProgressResponseBody.java +++ b/src/main/java/org/openapitools/inference/client/ProgressResponseBody.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/inference/client/StringUtil.java b/src/main/java/org/openapitools/inference/client/StringUtil.java index 29d252de..e9191e6a 100644 --- a/src/main/java/org/openapitools/inference/client/StringUtil.java +++ b/src/main/java/org/openapitools/inference/client/StringUtil.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -16,7 +16,7 @@ import java.util.Collection; import java.util.Iterator; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/src/main/java/org/openapitools/inference/client/api/InferenceApi.java b/src/main/java/org/openapitools/inference/client/api/InferenceApi.java index 22d796eb..03e37b6d 100644 --- a/src/main/java/org/openapitools/inference/client/api/InferenceApi.java +++ b/src/main/java/org/openapitools/inference/client/api/InferenceApi.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/inference/client/auth/ApiKeyAuth.java b/src/main/java/org/openapitools/inference/client/auth/ApiKeyAuth.java index 9aa87476..11e166b7 100644 --- a/src/main/java/org/openapitools/inference/client/auth/ApiKeyAuth.java +++ b/src/main/java/org/openapitools/inference/client/auth/ApiKeyAuth.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class ApiKeyAuth implements Authentication { private final String location; private final String paramName; diff --git a/src/main/java/org/openapitools/inference/client/auth/Authentication.java b/src/main/java/org/openapitools/inference/client/auth/Authentication.java index 684ecb51..2090a895 100644 --- a/src/main/java/org/openapitools/inference/client/auth/Authentication.java +++ b/src/main/java/org/openapitools/inference/client/auth/Authentication.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/inference/client/auth/HttpBasicAuth.java b/src/main/java/org/openapitools/inference/client/auth/HttpBasicAuth.java index e492e849..815b68f0 100644 --- a/src/main/java/org/openapitools/inference/client/auth/HttpBasicAuth.java +++ b/src/main/java/org/openapitools/inference/client/auth/HttpBasicAuth.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). diff --git a/src/main/java/org/openapitools/inference/client/auth/HttpBearerAuth.java b/src/main/java/org/openapitools/inference/client/auth/HttpBearerAuth.java index 6f63b7c1..b5c001f1 100644 --- a/src/main/java/org/openapitools/inference/client/auth/HttpBearerAuth.java +++ b/src/main/java/org/openapitools/inference/client/auth/HttpBearerAuth.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -20,7 +20,7 @@ import java.util.Map; import java.util.List; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class HttpBearerAuth implements Authentication { private final String scheme; private String bearerToken; diff --git a/src/main/java/org/openapitools/inference/client/model/AbstractOpenApiSchema.java b/src/main/java/org/openapitools/inference/client/model/AbstractOpenApiSchema.java index 936231f3..4affa012 100644 --- a/src/main/java/org/openapitools/inference/client/model/AbstractOpenApiSchema.java +++ b/src/main/java/org/openapitools/inference/client/model/AbstractOpenApiSchema.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -23,7 +23,7 @@ /** * Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public abstract class AbstractOpenApiSchema { // store the actual instance of the schema/object diff --git a/src/main/java/org/openapitools/inference/client/model/EmbedRequestParameters.java b/src/main/java/org/openapitools/inference/client/model/DenseEmbedding.java similarity index 65% rename from src/main/java/org/openapitools/inference/client/model/EmbedRequestParameters.java rename to src/main/java/org/openapitools/inference/client/model/DenseEmbedding.java index ac7fa1d1..946c46b0 100644 --- a/src/main/java/org/openapitools/inference/client/model/EmbedRequestParameters.java +++ b/src/main/java/org/openapitools/inference/client/model/DenseEmbedding.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -20,7 +20,10 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; +import java.util.List; +import org.openapitools.inference.client.model.VectorType; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -47,60 +50,68 @@ import org.openapitools.inference.client.JSON; /** - * Model-specific parameters. + * A dense embedding of a single input */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") -public class EmbedRequestParameters { - public static final String SERIALIZED_NAME_INPUT_TYPE = "input_type"; - @SerializedName(SERIALIZED_NAME_INPUT_TYPE) - private String inputType; +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") +public class DenseEmbedding { + public static final String SERIALIZED_NAME_VALUES = "values"; + @SerializedName(SERIALIZED_NAME_VALUES) + private List values = new ArrayList<>(); - public static final String SERIALIZED_NAME_TRUNCATE = "truncate"; - @SerializedName(SERIALIZED_NAME_TRUNCATE) - private String truncate = "END"; + public static final String SERIALIZED_NAME_VECTOR_TYPE = "vector_type"; + @SerializedName(SERIALIZED_NAME_VECTOR_TYPE) + private VectorType vectorType; - public EmbedRequestParameters() { + public DenseEmbedding() { } - public EmbedRequestParameters inputType(String inputType) { + public DenseEmbedding values(List values) { - this.inputType = inputType; + this.values = values; + return this; + } + + public DenseEmbedding addValuesItem(Float valuesItem) { + if (this.values == null) { + this.values = new ArrayList<>(); + } + this.values.add(valuesItem); return this; } /** - * Common property used to distinguish between types of data. - * @return inputType + * The dense embedding values. + * @return values **/ - @javax.annotation.Nullable - public String getInputType() { - return inputType; + @javax.annotation.Nonnull + public List getValues() { + return values; } - public void setInputType(String inputType) { - this.inputType = inputType; + public void setValues(List values) { + this.values = values; } - public EmbedRequestParameters truncate(String truncate) { + public DenseEmbedding vectorType(VectorType vectorType) { - this.truncate = truncate; + this.vectorType = vectorType; return this; } /** - * How to handle inputs longer than those supported by the model. If `\"END\"`, truncate the input sequence at the token limit. If `\"NONE\"`, return an error when the input exceeds the token limit. - * @return truncate + * Get vectorType + * @return vectorType **/ - @javax.annotation.Nullable - public String getTruncate() { - return truncate; + @javax.annotation.Nonnull + public VectorType getVectorType() { + return vectorType; } - public void setTruncate(String truncate) { - this.truncate = truncate; + public void setVectorType(VectorType vectorType) { + this.vectorType = vectorType; } /** @@ -116,9 +127,9 @@ public void setTruncate(String truncate) { * * @param key name of the property * @param value value of the property - * @return the EmbedRequestParameters instance itself + * @return the DenseEmbedding instance itself */ - public EmbedRequestParameters putAdditionalProperty(String key, Object value) { + public DenseEmbedding putAdditionalProperty(String key, Object value) { if (this.additionalProperties == null) { this.additionalProperties = new HashMap(); } @@ -157,23 +168,23 @@ public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } - EmbedRequestParameters embedRequestParameters = (EmbedRequestParameters) o; - return Objects.equals(this.inputType, embedRequestParameters.inputType) && - Objects.equals(this.truncate, embedRequestParameters.truncate)&& - Objects.equals(this.additionalProperties, embedRequestParameters.additionalProperties); + DenseEmbedding denseEmbedding = (DenseEmbedding) o; + return Objects.equals(this.values, denseEmbedding.values) && + Objects.equals(this.vectorType, denseEmbedding.vectorType)&& + Objects.equals(this.additionalProperties, denseEmbedding.additionalProperties); } @Override public int hashCode() { - return Objects.hash(inputType, truncate, additionalProperties); + return Objects.hash(values, vectorType, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("class EmbedRequestParameters {\n"); - sb.append(" inputType: ").append(toIndentedString(inputType)).append("\n"); - sb.append(" truncate: ").append(toIndentedString(truncate)).append("\n"); + sb.append("class DenseEmbedding {\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" vectorType: ").append(toIndentedString(vectorType)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -197,31 +208,40 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); - openapiFields.add("input_type"); - openapiFields.add("truncate"); + openapiFields.add("values"); + openapiFields.add("vector_type"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("values"); + openapiRequiredFields.add("vector_type"); } /** * Validates the JSON Element and throws an exception if issues found * * @param jsonElement JSON Element - * @throws IOException if the JSON Element is invalid with respect to EmbedRequestParameters + * @throws IOException if the JSON Element is invalid with respect to DenseEmbedding */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { if (jsonElement == null) { - if (!EmbedRequestParameters.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in EmbedRequestParameters is not found in the empty JSON string", EmbedRequestParameters.openapiRequiredFields.toString())); + if (!DenseEmbedding.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DenseEmbedding is not found in the empty JSON string", DenseEmbedding.openapiRequiredFields.toString())); } } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - if ((jsonObj.get("input_type") != null && !jsonObj.get("input_type").isJsonNull()) && !jsonObj.get("input_type").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `input_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("input_type").toString())); + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DenseEmbedding.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } } - if ((jsonObj.get("truncate") != null && !jsonObj.get("truncate").isJsonNull()) && !jsonObj.get("truncate").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `truncate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("truncate").toString())); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("values") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); } } @@ -229,16 +249,16 @@ public static class CustomTypeAdapterFactory implements TypeAdapterFactory { @SuppressWarnings("unchecked") @Override public TypeAdapter create(Gson gson, TypeToken type) { - if (!EmbedRequestParameters.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'EmbedRequestParameters' and its subtypes + if (!DenseEmbedding.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DenseEmbedding' and its subtypes } final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(EmbedRequestParameters.class)); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DenseEmbedding.class)); - return (TypeAdapter) new TypeAdapter() { + return (TypeAdapter) new TypeAdapter() { @Override - public void write(JsonWriter out, EmbedRequestParameters value) throws IOException { + public void write(JsonWriter out, DenseEmbedding value) throws IOException { JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); obj.remove("additionalProperties"); // serialize additional properties @@ -261,12 +281,12 @@ else if (entry.getValue() instanceof Character) } @Override - public EmbedRequestParameters read(JsonReader in) throws IOException { + public DenseEmbedding read(JsonReader in) throws IOException { JsonElement jsonElement = elementAdapter.read(in); validateJsonElement(jsonElement); JsonObject jsonObj = jsonElement.getAsJsonObject(); // store additional fields in the deserialized instance - EmbedRequestParameters instance = thisAdapter.fromJsonTree(jsonObj); + DenseEmbedding instance = thisAdapter.fromJsonTree(jsonObj); for (Map.Entry entry : jsonObj.entrySet()) { if (!openapiFields.contains(entry.getKey())) { if (entry.getValue().isJsonPrimitive()) { // primitive type @@ -293,18 +313,18 @@ else if (entry.getValue().getAsJsonPrimitive().isBoolean()) } /** - * Create an instance of EmbedRequestParameters given an JSON string + * Create an instance of DenseEmbedding given an JSON string * * @param jsonString JSON string - * @return An instance of EmbedRequestParameters - * @throws IOException if the JSON string is invalid with respect to EmbedRequestParameters + * @return An instance of DenseEmbedding + * @throws IOException if the JSON string is invalid with respect to DenseEmbedding */ - public static EmbedRequestParameters fromJson(String jsonString) throws IOException { - return JSON.getGson().fromJson(jsonString, EmbedRequestParameters.class); + public static DenseEmbedding fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DenseEmbedding.class); } /** - * Convert an instance of EmbedRequestParameters to an JSON string + * Convert an instance of DenseEmbedding to an JSON string * * @return JSON string */ diff --git a/src/main/java/org/openapitools/inference/client/model/EmbedRequest.java b/src/main/java/org/openapitools/inference/client/model/EmbedRequest.java index 65ef7a94..577b454b 100644 --- a/src/main/java/org/openapitools/inference/client/model/EmbedRequest.java +++ b/src/main/java/org/openapitools/inference/client/model/EmbedRequest.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -22,9 +22,10 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.openapitools.inference.client.model.EmbedRequestInputsInner; -import org.openapitools.inference.client.model.EmbedRequestParameters; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -53,7 +54,7 @@ /** * EmbedRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class EmbedRequest { public static final String SERIALIZED_NAME_MODEL = "model"; @SerializedName(SERIALIZED_NAME_MODEL) @@ -61,7 +62,7 @@ public class EmbedRequest { public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; @SerializedName(SERIALIZED_NAME_PARAMETERS) - private EmbedRequestParameters parameters; + private Map parameters = new HashMap<>(); public static final String SERIALIZED_NAME_INPUTS = "inputs"; @SerializedName(SERIALIZED_NAME_INPUTS) @@ -77,7 +78,7 @@ public EmbedRequest model(String model) { } /** - * The [model](https://docs.pinecone.io/guides/inference/understanding-inference#models) to use for embedding generation. + * The [model](https://docs.pinecone.io/guides/inference/understanding-inference#embedding-models) to use for embedding generation. * @return model **/ @javax.annotation.Nonnull @@ -91,23 +92,31 @@ public void setModel(String model) { } - public EmbedRequest parameters(EmbedRequestParameters parameters) { + public EmbedRequest parameters(Map parameters) { this.parameters = parameters; return this; } + public EmbedRequest putParametersItem(String key, Object parametersItem) { + if (this.parameters == null) { + this.parameters = new HashMap<>(); + } + this.parameters.put(key, parametersItem); + return this; + } + /** - * Get parameters + * Additional model-specific parameters. Refer to the [model guide](https://docs.pinecone.io/guides/inference/understanding-inference#embedding-models) for available model parameters. * @return parameters **/ @javax.annotation.Nullable - public EmbedRequestParameters getParameters() { + public Map getParameters() { return parameters; } - public void setParameters(EmbedRequestParameters parameters) { + public void setParameters(Map parameters) { this.parameters = parameters; } @@ -269,10 +278,6 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (!jsonObj.get("model").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `model` to be a primitive type in the JSON string but got `%s`", jsonObj.get("model").toString())); } - // validate the optional field `parameters` - if (jsonObj.get("parameters") != null && !jsonObj.get("parameters").isJsonNull()) { - EmbedRequestParameters.validateJsonElement(jsonObj.get("parameters")); - } // ensure the json data is an array if (!jsonObj.get("inputs").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `inputs` to be an array in the JSON string but got `%s`", jsonObj.get("inputs").toString())); diff --git a/src/main/java/org/openapitools/inference/client/model/EmbedRequestInputsInner.java b/src/main/java/org/openapitools/inference/client/model/EmbedRequestInputsInner.java index dbf75620..187b3437 100644 --- a/src/main/java/org/openapitools/inference/client/model/EmbedRequestInputsInner.java +++ b/src/main/java/org/openapitools/inference/client/model/EmbedRequestInputsInner.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * EmbedRequestInputsInner */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class EmbedRequestInputsInner { public static final String SERIALIZED_NAME_TEXT = "text"; @SerializedName(SERIALIZED_NAME_TEXT) diff --git a/src/main/java/org/openapitools/inference/client/model/Embedding.java b/src/main/java/org/openapitools/inference/client/model/Embedding.java index 1201f62a..6f2a6107 100644 --- a/src/main/java/org/openapitools/inference/client/model/Embedding.java +++ b/src/main/java/org/openapitools/inference/client/model/Embedding.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -20,172 +20,212 @@ import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import org.openapitools.inference.client.model.DenseEmbedding; +import org.openapitools.inference.client.model.SparseEmbedding; +import org.openapitools.inference.client.model.VectorType; + + + +import java.io.IOException; +import java.lang.reflect.Type; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; import com.google.gson.reflect.TypeToken; -import com.google.gson.TypeAdapter; +import com.google.gson.JsonPrimitive; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; -import java.io.IOException; - -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonArray; +import com.google.gson.JsonParseException; import org.openapitools.inference.client.JSON; -/** - * Embedding of a single input - */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") -public class Embedding { - public static final String SERIALIZED_NAME_VALUES = "values"; - @SerializedName(SERIALIZED_NAME_VALUES) - private List values; - - public Embedding() { - } - - public Embedding values(List values) { - - this.values = values; - return this; - } - - public Embedding addValuesItem(BigDecimal valuesItem) { - if (this.values == null) { - this.values = new ArrayList<>(); +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") +public class Embedding extends AbstractOpenApiSchema { + private static final Logger log = Logger.getLogger(Embedding.class.getName()); + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Embedding.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Embedding' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter adapterDenseEmbedding = gson.getDelegateAdapter(this, TypeToken.get(DenseEmbedding.class)); + final TypeAdapter adapterSparseEmbedding = gson.getDelegateAdapter(this, TypeToken.get(SparseEmbedding.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Embedding value) throws IOException { + if (value == null || value.getActualInstance() == null) { + elementAdapter.write(out, null); + return; + } + + // check if the actual instance is of the type `DenseEmbedding` + if (value.getActualInstance() instanceof DenseEmbedding) { + JsonElement element = adapterDenseEmbedding.toJsonTree((DenseEmbedding)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + // check if the actual instance is of the type `SparseEmbedding` + if (value.getActualInstance() instanceof SparseEmbedding) { + JsonElement element = adapterSparseEmbedding.toJsonTree((SparseEmbedding)value.getActualInstance()); + elementAdapter.write(out, element); + return; + } + throw new IOException("Failed to serialize as the type doesn't match oneOf schemas: DenseEmbedding, SparseEmbedding"); + } + + @Override + public Embedding read(JsonReader in) throws IOException { + Object deserialized = null; + JsonElement jsonElement = elementAdapter.read(in); + + int match = 0; + ArrayList errorMessages = new ArrayList<>(); + TypeAdapter actualAdapter = elementAdapter; + + // deserialize DenseEmbedding + try { + // validate the JSON object to see if any exception is thrown + DenseEmbedding.validateJsonElement(jsonElement); + actualAdapter = adapterDenseEmbedding; + match++; + log.log(Level.FINER, "Input data matches schema 'DenseEmbedding'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for DenseEmbedding failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'DenseEmbedding'", e); + } + // deserialize SparseEmbedding + try { + // validate the JSON object to see if any exception is thrown + SparseEmbedding.validateJsonElement(jsonElement); + actualAdapter = adapterSparseEmbedding; + match++; + log.log(Level.FINER, "Input data matches schema 'SparseEmbedding'"); + } catch (Exception e) { + // deserialization failed, continue + errorMessages.add(String.format("Deserialization for SparseEmbedding failed with `%s`.", e.getMessage())); + log.log(Level.FINER, "Input data does not match schema 'SparseEmbedding'", e); + } + + if (match == 1) { + Embedding ret = new Embedding(); + ret.setActualInstance(actualAdapter.fromJsonTree(jsonElement)); + return ret; + } + + throw new IOException(String.format("Failed deserialization for Embedding: %d classes match result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", match, errorMessages, jsonElement.toString())); + } + }.nullSafe(); + } } - this.values.add(valuesItem); - return this; - } - /** - * The embedding values. - * @return values - **/ - @javax.annotation.Nullable - public List getValues() { - return values; - } + // store a list of schema names defined in oneOf + public static final Map> schemas = new HashMap>(); - - public void setValues(List values) { - this.values = values; - } - - /** - * A container for additional, undeclared properties. - * This is a holder for any undeclared properties as specified with - * the 'additionalProperties' keyword in the OAS document. - */ - private Map additionalProperties; - - /** - * Set the additional (undeclared) property with the specified name and value. - * If the property does not already exist, create it otherwise replace it. - * - * @param key name of the property - * @param value value of the property - * @return the Embedding instance itself - */ - public Embedding putAdditionalProperty(String key, Object value) { - if (this.additionalProperties == null) { - this.additionalProperties = new HashMap(); + public Embedding() { + super("oneOf", Boolean.FALSE); } - this.additionalProperties.put(key, value); - return this; - } - /** - * Return the additional (undeclared) property. - * - * @return a map of objects - */ - public Map getAdditionalProperties() { - return additionalProperties; - } - - /** - * Return the additional (undeclared) property with the specified name. - * - * @param key name of the property - * @return an object - */ - public Object getAdditionalProperty(String key) { - if (this.additionalProperties == null) { - return null; + public Embedding(DenseEmbedding o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); } - return this.additionalProperties.get(key); - } + public Embedding(SparseEmbedding o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + static { + schemas.put("DenseEmbedding", DenseEmbedding.class); + schemas.put("SparseEmbedding", SparseEmbedding.class); } - if (o == null || getClass() != o.getClass()) { - return false; + + @Override + public Map> getSchemas() { + return Embedding.schemas; } - Embedding embedding = (Embedding) o; - return Objects.equals(this.values, embedding.values)&& - Objects.equals(this.additionalProperties, embedding.additionalProperties); - } - @Override - public int hashCode() { - return Objects.hash(values, additionalProperties); - } + /** + * Set the instance that matches the oneOf child schema, check + * the instance parameter is valid against the oneOf child schemas: + * DenseEmbedding, SparseEmbedding + * + * It could be an instance of the 'oneOf' schemas. + */ + @Override + public void setActualInstance(Object instance) { + if (instance instanceof DenseEmbedding) { + super.setActualInstance(instance); + return; + } - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class Embedding {\n"); - sb.append(" values: ").append(toIndentedString(values)).append("\n"); - sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); - sb.append("}"); - return sb.toString(); - } + if (instance instanceof SparseEmbedding) { + super.setActualInstance(instance); + return; + } - /** - * Convert the given object to string with each line indented by 4 spaces - * (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; + throw new RuntimeException("Invalid instance type. Must be DenseEmbedding, SparseEmbedding"); } - return o.toString().replace("\n", "\n "); - } - - public static HashSet openapiFields; - public static HashSet openapiRequiredFields; - - static { - // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(); - openapiFields.add("values"); + /** + * Get the actual instance, which can be the following: + * DenseEmbedding, SparseEmbedding + * + * @return The actual instance (DenseEmbedding, SparseEmbedding) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } - // a set of required properties/fields (JSON key names) - openapiRequiredFields = new HashSet(); - } + /** + * Get the actual instance of `DenseEmbedding`. If the actual instance is not `DenseEmbedding`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `DenseEmbedding` + * @throws ClassCastException if the instance is not `DenseEmbedding` + */ + public DenseEmbedding getDenseEmbedding() throws ClassCastException { + return (DenseEmbedding)super.getActualInstance(); + } + /** + * Get the actual instance of `SparseEmbedding`. If the actual instance is not `SparseEmbedding`, + * the ClassCastException will be thrown. + * + * @return The actual instance of `SparseEmbedding` + * @throws ClassCastException if the instance is not `SparseEmbedding` + */ + public SparseEmbedding getSparseEmbedding() throws ClassCastException { + return (SparseEmbedding)super.getActualInstance(); + } /** * Validates the JSON Element and throws an exception if issues found @@ -194,82 +234,27 @@ private String toIndentedString(Object o) { * @throws IOException if the JSON Element is invalid with respect to Embedding */ public static void validateJsonElement(JsonElement jsonElement) throws IOException { - if (jsonElement == null) { - if (!Embedding.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null - throw new IllegalArgumentException(String.format("The required field(s) %s in Embedding is not found in the empty JSON string", Embedding.openapiRequiredFields.toString())); - } - } - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // ensure the optional json data is an array if present - if (jsonObj.get("values") != null && !jsonObj.get("values").isJsonNull() && !jsonObj.get("values").isJsonArray()) { - throw new IllegalArgumentException(String.format("Expected the field `values` to be an array in the JSON string but got `%s`", jsonObj.get("values").toString())); - } - } - - public static class CustomTypeAdapterFactory implements TypeAdapterFactory { - @SuppressWarnings("unchecked") - @Override - public TypeAdapter create(Gson gson, TypeToken type) { - if (!Embedding.class.isAssignableFrom(type.getRawType())) { - return null; // this class only serializes 'Embedding' and its subtypes - } - final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); - final TypeAdapter thisAdapter - = gson.getDelegateAdapter(this, TypeToken.get(Embedding.class)); - - return (TypeAdapter) new TypeAdapter() { - @Override - public void write(JsonWriter out, Embedding value) throws IOException { - JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); - obj.remove("additionalProperties"); - // serialize additional properties - if (value.getAdditionalProperties() != null) { - for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { - if (entry.getValue() instanceof String) - obj.addProperty(entry.getKey(), (String) entry.getValue()); - else if (entry.getValue() instanceof Number) - obj.addProperty(entry.getKey(), (Number) entry.getValue()); - else if (entry.getValue() instanceof Boolean) - obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); - else if (entry.getValue() instanceof Character) - obj.addProperty(entry.getKey(), (Character) entry.getValue()); - else { - obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); - } - } - } - elementAdapter.write(out, obj); - } - - @Override - public Embedding read(JsonReader in) throws IOException { - JsonElement jsonElement = elementAdapter.read(in); - validateJsonElement(jsonElement); - JsonObject jsonObj = jsonElement.getAsJsonObject(); - // store additional fields in the deserialized instance - Embedding instance = thisAdapter.fromJsonTree(jsonObj); - for (Map.Entry entry : jsonObj.entrySet()) { - if (!openapiFields.contains(entry.getKey())) { - if (entry.getValue().isJsonPrimitive()) { // primitive type - if (entry.getValue().getAsJsonPrimitive().isString()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); - else if (entry.getValue().getAsJsonPrimitive().isNumber()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); - else if (entry.getValue().getAsJsonPrimitive().isBoolean()) - instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); - else - throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); - } else if (entry.getValue().isJsonArray()) { - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); - } else { // JSON object - instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); - } - } - } - return instance; - } - - }.nullSafe(); + // validate oneOf schemas one by one + int validCount = 0; + ArrayList errorMessages = new ArrayList<>(); + // validate the json string with DenseEmbedding + try { + DenseEmbedding.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for DenseEmbedding failed with `%s`.", e.getMessage())); + // continue to the next one + } + // validate the json string with SparseEmbedding + try { + SparseEmbedding.validateJsonElement(jsonElement); + validCount++; + } catch (Exception e) { + errorMessages.add(String.format("Deserialization for SparseEmbedding failed with `%s`.", e.getMessage())); + // continue to the next one + } + if (validCount != 1) { + throw new IOException(String.format("The JSON string is invalid for Embedding with oneOf schemas: DenseEmbedding, SparseEmbedding. %d class(es) match the result, expected 1. Detailed failure message for oneOf schemas: %s. JSON: %s", validCount, errorMessages, jsonElement.toString())); } } diff --git a/src/main/java/org/openapitools/inference/client/model/EmbeddingsList.java b/src/main/java/org/openapitools/inference/client/model/EmbeddingsList.java index 2f571706..bc861c0a 100644 --- a/src/main/java/org/openapitools/inference/client/model/EmbeddingsList.java +++ b/src/main/java/org/openapitools/inference/client/model/EmbeddingsList.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -51,14 +51,18 @@ import org.openapitools.inference.client.JSON; /** - * Embeddings generated for the input + * Embeddings generated for the input. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class EmbeddingsList { public static final String SERIALIZED_NAME_MODEL = "model"; @SerializedName(SERIALIZED_NAME_MODEL) private String model; + public static final String SERIALIZED_NAME_VECTOR_TYPE = "vector_type"; + @SerializedName(SERIALIZED_NAME_VECTOR_TYPE) + private String vectorType; + public static final String SERIALIZED_NAME_DATA = "data"; @SerializedName(SERIALIZED_NAME_DATA) private List data = new ArrayList<>(); @@ -91,6 +95,27 @@ public void setModel(String model) { } + public EmbeddingsList vectorType(String vectorType) { + + this.vectorType = vectorType; + return this; + } + + /** + * Indicates whether the response data contains 'dense' or 'sparse' embeddings. + * @return vectorType + **/ + @javax.annotation.Nonnull + public String getVectorType() { + return vectorType; + } + + + public void setVectorType(String vectorType) { + this.vectorType = vectorType; + } + + public EmbeddingsList data(List data) { this.data = data; @@ -196,6 +221,7 @@ public boolean equals(Object o) { } EmbeddingsList embeddingsList = (EmbeddingsList) o; return Objects.equals(this.model, embeddingsList.model) && + Objects.equals(this.vectorType, embeddingsList.vectorType) && Objects.equals(this.data, embeddingsList.data) && Objects.equals(this.usage, embeddingsList.usage)&& Objects.equals(this.additionalProperties, embeddingsList.additionalProperties); @@ -203,7 +229,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(model, data, usage, additionalProperties); + return Objects.hash(model, vectorType, data, usage, additionalProperties); } @Override @@ -211,6 +237,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class EmbeddingsList {\n"); sb.append(" model: ").append(toIndentedString(model)).append("\n"); + sb.append(" vectorType: ").append(toIndentedString(vectorType)).append("\n"); sb.append(" data: ").append(toIndentedString(data)).append("\n"); sb.append(" usage: ").append(toIndentedString(usage)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); @@ -237,12 +264,14 @@ private String toIndentedString(Object o) { // a set of all properties/fields (JSON key names) openapiFields = new HashSet(); openapiFields.add("model"); + openapiFields.add("vector_type"); openapiFields.add("data"); openapiFields.add("usage"); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); openapiRequiredFields.add("model"); + openapiRequiredFields.add("vector_type"); openapiRequiredFields.add("data"); openapiRequiredFields.add("usage"); } @@ -270,6 +299,9 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti if (!jsonObj.get("model").isJsonPrimitive()) { throw new IllegalArgumentException(String.format("Expected the field `model` to be a primitive type in the JSON string but got `%s`", jsonObj.get("model").toString())); } + if (!jsonObj.get("vector_type").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `vector_type` to be a primitive type in the JSON string but got `%s`", jsonObj.get("vector_type").toString())); + } // ensure the json data is an array if (!jsonObj.get("data").isJsonArray()) { throw new IllegalArgumentException(String.format("Expected the field `data` to be an array in the JSON string but got `%s`", jsonObj.get("data").toString())); diff --git a/src/main/java/org/openapitools/inference/client/model/EmbeddingsListUsage.java b/src/main/java/org/openapitools/inference/client/model/EmbeddingsListUsage.java index a103e0cb..54128e44 100644 --- a/src/main/java/org/openapitools/inference/client/model/EmbeddingsListUsage.java +++ b/src/main/java/org/openapitools/inference/client/model/EmbeddingsListUsage.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * Usage statistics for the model inference. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class EmbeddingsListUsage { public static final String SERIALIZED_NAME_TOTAL_TOKENS = "total_tokens"; @SerializedName(SERIALIZED_NAME_TOTAL_TOKENS) @@ -66,6 +66,7 @@ public EmbeddingsListUsage totalTokens(Integer totalTokens) { /** * Total number of tokens consumed across all inputs. + * minimum: 0 * @return totalTokens **/ @javax.annotation.Nullable diff --git a/src/main/java/org/openapitools/inference/client/model/ErrorResponse.java b/src/main/java/org/openapitools/inference/client/model/ErrorResponse.java index 89ed44df..5cd55da2 100644 --- a/src/main/java/org/openapitools/inference/client/model/ErrorResponse.java +++ b/src/main/java/org/openapitools/inference/client/model/ErrorResponse.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -50,7 +50,7 @@ /** * The response shape used for all error responses. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class ErrorResponse { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) diff --git a/src/main/java/org/openapitools/inference/client/model/ErrorResponseError.java b/src/main/java/org/openapitools/inference/client/model/ErrorResponseError.java index 096204ec..29c52f3b 100644 --- a/src/main/java/org/openapitools/inference/client/model/ErrorResponseError.java +++ b/src/main/java/org/openapitools/inference/client/model/ErrorResponseError.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * Detailed information about the error that occurred. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class ErrorResponseError { /** * Gets or Sets code diff --git a/src/main/java/org/openapitools/inference/client/model/RankedDocument.java b/src/main/java/org/openapitools/inference/client/model/RankedDocument.java index 3a34d348..8a7c463e 100644 --- a/src/main/java/org/openapitools/inference/client/model/RankedDocument.java +++ b/src/main/java/org/openapitools/inference/client/model/RankedDocument.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -52,7 +52,7 @@ /** * A ranked document with a relevance score and an index position. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class RankedDocument { public static final String SERIALIZED_NAME_INDEX = "index"; @SerializedName(SERIALIZED_NAME_INDEX) @@ -64,7 +64,7 @@ public class RankedDocument { public static final String SERIALIZED_NAME_DOCUMENT = "document"; @SerializedName(SERIALIZED_NAME_DOCUMENT) - private Map document = new HashMap<>(); + private Map document = new HashMap<>(); public RankedDocument() { } @@ -76,7 +76,7 @@ public RankedDocument index(Integer index) { } /** - * The index of the document + * The index position of the document from the original request. * @return index **/ @javax.annotation.Nonnull @@ -97,7 +97,7 @@ public RankedDocument score(BigDecimal score) { } /** - * The relevance score of the document normalized between 0 and 1. + * The relevance of the document to the query, normalized between 0 and 1, with scores closer to 1 indicating higher relevance. * @return score **/ @javax.annotation.Nonnull @@ -111,13 +111,13 @@ public void setScore(BigDecimal score) { } - public RankedDocument document(Map document) { + public RankedDocument document(Map document) { this.document = document; return this; } - public RankedDocument putDocumentItem(String key, String documentItem) { + public RankedDocument putDocumentItem(String key, Object documentItem) { if (this.document == null) { this.document = new HashMap<>(); } @@ -130,12 +130,12 @@ public RankedDocument putDocumentItem(String key, String documentItem) { * @return document **/ @javax.annotation.Nullable - public Map getDocument() { + public Map getDocument() { return document; } - public void setDocument(Map document) { + public void setDocument(Map document) { this.document = document; } diff --git a/src/main/java/org/openapitools/inference/client/model/RerankRequest.java b/src/main/java/org/openapitools/inference/client/model/RerankRequest.java index 2469d83e..f3ca4acc 100644 --- a/src/main/java/org/openapitools/inference/client/model/RerankRequest.java +++ b/src/main/java/org/openapitools/inference/client/model/RerankRequest.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -53,7 +53,7 @@ /** * RerankRequest */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class RerankRequest { public static final String SERIALIZED_NAME_MODEL = "model"; @SerializedName(SERIALIZED_NAME_MODEL) @@ -77,11 +77,11 @@ public class RerankRequest { public static final String SERIALIZED_NAME_DOCUMENTS = "documents"; @SerializedName(SERIALIZED_NAME_DOCUMENTS) - private List> documents = new ArrayList<>(); + private List> documents = new ArrayList<>(); public static final String SERIALIZED_NAME_PARAMETERS = "parameters"; @SerializedName(SERIALIZED_NAME_PARAMETERS) - private Map parameters = new HashMap<>(); + private Map parameters = new HashMap<>(); public RerankRequest() { } @@ -93,7 +93,7 @@ public RerankRequest model(String model) { } /** - * The [model](https://docs.pinecone.io/guides/inference/understanding-inference#models) to use for reranking. + * The [model](https://docs.pinecone.io/guides/inference/understanding-inference#reranking-models) to use for reranking. * @return model **/ @javax.annotation.Nonnull @@ -185,7 +185,7 @@ public RerankRequest addRankFieldsItem(String rankFieldsItem) { } /** - * The fields to rank the documents by. If not provided, the default is `\"text\"`. + * The fields to rank the documents by. If not provided, the default is `\"text\"`. * @return rankFields **/ @javax.annotation.Nullable @@ -199,13 +199,13 @@ public void setRankFields(List rankFields) { } - public RerankRequest documents(List> documents) { + public RerankRequest documents(List> documents) { this.documents = documents; return this; } - public RerankRequest addDocumentsItem(Map documentsItem) { + public RerankRequest addDocumentsItem(Map documentsItem) { if (this.documents == null) { this.documents = new ArrayList<>(); } @@ -218,23 +218,23 @@ public RerankRequest addDocumentsItem(Map documentsItem) { * @return documents **/ @javax.annotation.Nonnull - public List> getDocuments() { + public List> getDocuments() { return documents; } - public void setDocuments(List> documents) { + public void setDocuments(List> documents) { this.documents = documents; } - public RerankRequest parameters(Map parameters) { + public RerankRequest parameters(Map parameters) { this.parameters = parameters; return this; } - public RerankRequest putParametersItem(String key, String parametersItem) { + public RerankRequest putParametersItem(String key, Object parametersItem) { if (this.parameters == null) { this.parameters = new HashMap<>(); } @@ -243,16 +243,16 @@ public RerankRequest putParametersItem(String key, String parametersItem) { } /** - * Additional model-specific parameters for the reranker. + * Additional model-specific parameters. Refer to the [model guide](https://docs.pinecone.io/guides/inference/understanding-inference#reranking-models) for available model parameters. * @return parameters **/ @javax.annotation.Nullable - public Map getParameters() { + public Map getParameters() { return parameters; } - public void setParameters(Map parameters) { + public void setParameters(Map parameters) { this.parameters = parameters; } diff --git a/src/main/java/org/openapitools/inference/client/model/RerankResult.java b/src/main/java/org/openapitools/inference/client/model/RerankResult.java index da27053c..0d7398af 100644 --- a/src/main/java/org/openapitools/inference/client/model/RerankResult.java +++ b/src/main/java/org/openapitools/inference/client/model/RerankResult.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -53,7 +53,7 @@ /** * The result of a reranking request. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class RerankResult { public static final String SERIALIZED_NAME_MODEL = "model"; @SerializedName(SERIALIZED_NAME_MODEL) diff --git a/src/main/java/org/openapitools/inference/client/model/RerankResultUsage.java b/src/main/java/org/openapitools/inference/client/model/RerankResultUsage.java index df2e5f3e..462ca798 100644 --- a/src/main/java/org/openapitools/inference/client/model/RerankResultUsage.java +++ b/src/main/java/org/openapitools/inference/client/model/RerankResultUsage.java @@ -2,7 +2,7 @@ * Pinecone Inference API * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. * - * The version of the OpenAPI document: 2024-10 + * The version of the OpenAPI document: 2025-01 * Contact: support@pinecone.io * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). @@ -49,7 +49,7 @@ /** * Usage statistics for the model inference. */ -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-10-23T20:47:14.512003Z[Etc/UTC]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") public class RerankResultUsage { public static final String SERIALIZED_NAME_RERANK_UNITS = "rerank_units"; @SerializedName(SERIALIZED_NAME_RERANK_UNITS) @@ -65,7 +65,8 @@ public RerankResultUsage rerankUnits(Integer rerankUnits) { } /** - * Get rerankUnits + * The number of rerank units consumed by this operation. + * minimum: 0 * @return rerankUnits **/ @javax.annotation.Nullable diff --git a/src/main/java/org/openapitools/inference/client/model/SparseEmbedding.java b/src/main/java/org/openapitools/inference/client/model/SparseEmbedding.java new file mode 100644 index 00000000..b1252975 --- /dev/null +++ b/src/main/java/org/openapitools/inference/client/model/SparseEmbedding.java @@ -0,0 +1,418 @@ +/* + * Pinecone Inference API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.inference.client.model; + +import java.util.Objects; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.inference.client.model.VectorType; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.openapitools.inference.client.JSON; + +/** + * A sparse embedding of a single input + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2025-01-10T18:59:22.280429Z[Etc/UTC]") +public class SparseEmbedding { + public static final String SERIALIZED_NAME_SPARSE_VALUES = "sparse_values"; + @SerializedName(SERIALIZED_NAME_SPARSE_VALUES) + private List sparseValues = new ArrayList<>(); + + public static final String SERIALIZED_NAME_SPARSE_INDICES = "sparse_indices"; + @SerializedName(SERIALIZED_NAME_SPARSE_INDICES) + private List sparseIndices = new ArrayList<>(); + + public static final String SERIALIZED_NAME_SPARSE_TOKENS = "sparse_tokens"; + @SerializedName(SERIALIZED_NAME_SPARSE_TOKENS) + private List sparseTokens; + + public static final String SERIALIZED_NAME_VECTOR_TYPE = "vector_type"; + @SerializedName(SERIALIZED_NAME_VECTOR_TYPE) + private VectorType vectorType; + + public SparseEmbedding() { + } + + public SparseEmbedding sparseValues(List sparseValues) { + + this.sparseValues = sparseValues; + return this; + } + + public SparseEmbedding addSparseValuesItem(Float sparseValuesItem) { + if (this.sparseValues == null) { + this.sparseValues = new ArrayList<>(); + } + this.sparseValues.add(sparseValuesItem); + return this; + } + + /** + * The sparse embedding values. + * @return sparseValues + **/ + @javax.annotation.Nonnull + public List getSparseValues() { + return sparseValues; + } + + + public void setSparseValues(List sparseValues) { + this.sparseValues = sparseValues; + } + + + public SparseEmbedding sparseIndices(List sparseIndices) { + + this.sparseIndices = sparseIndices; + return this; + } + + public SparseEmbedding addSparseIndicesItem(Integer sparseIndicesItem) { + if (this.sparseIndices == null) { + this.sparseIndices = new ArrayList<>(); + } + this.sparseIndices.add(sparseIndicesItem); + return this; + } + + /** + * The sparse embedding indices. + * @return sparseIndices + **/ + @javax.annotation.Nonnull + public List getSparseIndices() { + return sparseIndices; + } + + + public void setSparseIndices(List sparseIndices) { + this.sparseIndices = sparseIndices; + } + + + public SparseEmbedding sparseTokens(List sparseTokens) { + + this.sparseTokens = sparseTokens; + return this; + } + + public SparseEmbedding addSparseTokensItem(String sparseTokensItem) { + if (this.sparseTokens == null) { + this.sparseTokens = new ArrayList<>(); + } + this.sparseTokens.add(sparseTokensItem); + return this; + } + + /** + * The normalized tokens used to create the sparse embedding. + * @return sparseTokens + **/ + @javax.annotation.Nullable + public List getSparseTokens() { + return sparseTokens; + } + + + public void setSparseTokens(List sparseTokens) { + this.sparseTokens = sparseTokens; + } + + + public SparseEmbedding vectorType(VectorType vectorType) { + + this.vectorType = vectorType; + return this; + } + + /** + * Get vectorType + * @return vectorType + **/ + @javax.annotation.Nonnull + public VectorType getVectorType() { + return vectorType; + } + + + public void setVectorType(VectorType vectorType) { + this.vectorType = vectorType; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the SparseEmbedding instance itself + */ + public SparseEmbedding putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SparseEmbedding sparseEmbedding = (SparseEmbedding) o; + return Objects.equals(this.sparseValues, sparseEmbedding.sparseValues) && + Objects.equals(this.sparseIndices, sparseEmbedding.sparseIndices) && + Objects.equals(this.sparseTokens, sparseEmbedding.sparseTokens) && + Objects.equals(this.vectorType, sparseEmbedding.vectorType)&& + Objects.equals(this.additionalProperties, sparseEmbedding.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(sparseValues, sparseIndices, sparseTokens, vectorType, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SparseEmbedding {\n"); + sb.append(" sparseValues: ").append(toIndentedString(sparseValues)).append("\n"); + sb.append(" sparseIndices: ").append(toIndentedString(sparseIndices)).append("\n"); + sb.append(" sparseTokens: ").append(toIndentedString(sparseTokens)).append("\n"); + sb.append(" vectorType: ").append(toIndentedString(vectorType)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).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(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("sparse_values"); + openapiFields.add("sparse_indices"); + openapiFields.add("sparse_tokens"); + openapiFields.add("vector_type"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("sparse_values"); + openapiRequiredFields.add("sparse_indices"); + openapiRequiredFields.add("vector_type"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SparseEmbedding + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SparseEmbedding.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SparseEmbedding is not found in the empty JSON string", SparseEmbedding.openapiRequiredFields.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SparseEmbedding.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the required json array is present + if (jsonObj.get("sparse_values") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("sparse_values").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `sparse_values` to be an array in the JSON string but got `%s`", jsonObj.get("sparse_values").toString())); + } + // ensure the required json array is present + if (jsonObj.get("sparse_indices") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("sparse_indices").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `sparse_indices` to be an array in the JSON string but got `%s`", jsonObj.get("sparse_indices").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("sparse_tokens") != null && !jsonObj.get("sparse_tokens").isJsonNull() && !jsonObj.get("sparse_tokens").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `sparse_tokens` to be an array in the JSON string but got `%s`", jsonObj.get("sparse_tokens").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SparseEmbedding.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SparseEmbedding' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SparseEmbedding.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SparseEmbedding value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + obj.add(entry.getKey(), gson.toJsonTree(entry.getValue()).getAsJsonObject()); + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public SparseEmbedding read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + SparseEmbedding instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SparseEmbedding given an JSON string + * + * @param jsonString JSON string + * @return An instance of SparseEmbedding + * @throws IOException if the JSON string is invalid with respect to SparseEmbedding + */ + public static SparseEmbedding fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SparseEmbedding.class); + } + + /** + * Convert an instance of SparseEmbedding to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/org/openapitools/inference/client/model/VectorType.java b/src/main/java/org/openapitools/inference/client/model/VectorType.java new file mode 100644 index 00000000..f0efa5c8 --- /dev/null +++ b/src/main/java/org/openapitools/inference/client/model/VectorType.java @@ -0,0 +1,72 @@ +/* + * Pinecone Inference API + * Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors. + * + * The version of the OpenAPI document: 2025-01 + * Contact: support@pinecone.io + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.inference.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; + +import java.io.IOException; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; + +/** + * Indicates whether this is a 'dense' or 'sparse' embedding. + */ +@JsonAdapter(VectorType.Adapter.class) +public enum VectorType { + + DENSE("dense"), + + SPARSE("sparse"); + + private String value; + + VectorType(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static VectorType fromValue(String value) { + for (VectorType b : VectorType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final VectorType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public VectorType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return VectorType.fromValue(value); + } + } +} + diff --git a/src/test/resources/createIndexResponse.valid.json b/src/test/resources/createIndexResponse.valid.json index c6693ac8..d61a83ae 100644 --- a/src/test/resources/createIndexResponse.valid.json +++ b/src/test/resources/createIndexResponse.valid.json @@ -12,5 +12,6 @@ "region": "us-west-2", "cloud": "aws" } - } + }, + "vector_type": "dense" } diff --git a/src/test/resources/createIndexResponse.withUnknownProperties.json b/src/test/resources/createIndexResponse.withUnknownProperties.json index 0b5c8723..a79d6f70 100644 --- a/src/test/resources/createIndexResponse.withUnknownProperties.json +++ b/src/test/resources/createIndexResponse.withUnknownProperties.json @@ -15,5 +15,6 @@ "cloud": "aws", "weather_forecast": "partly sunny" } - } + }, + "vector_type": "dense" } diff --git a/src/test/resources/describeCollection.witihUnknownProperties.json b/src/test/resources/describeCollection.witihUnknownProperties.json index 8a73e4f7..42d58ab0 100644 --- a/src/test/resources/describeCollection.witihUnknownProperties.json +++ b/src/test/resources/describeCollection.witihUnknownProperties.json @@ -6,5 +6,6 @@ "status": "Ready", "vector_count": 99, "extra": true, - "even_more": null + "even_more": null, + "vector_type": "dense" } \ No newline at end of file diff --git a/src/test/resources/describeIndexResponse.valid.json b/src/test/resources/describeIndexResponse.valid.json index 3125d1f7..b3d3868b 100644 --- a/src/test/resources/describeIndexResponse.valid.json +++ b/src/test/resources/describeIndexResponse.valid.json @@ -12,5 +12,6 @@ "cloud": "aws", "region": "us-east2-gcp" } - } + }, + "vector_type": "dense" } \ No newline at end of file diff --git a/src/test/resources/describeIndexResponse.withUnknownProperties.json b/src/test/resources/describeIndexResponse.withUnknownProperties.json index aaf74967..b9f745d1 100644 --- a/src/test/resources/describeIndexResponse.withUnknownProperties.json +++ b/src/test/resources/describeIndexResponse.withUnknownProperties.json @@ -20,5 +20,6 @@ "region": "us-east2-gcp", "hotness": "extra-spicy" } - } + }, + "vector_type": "dense" } \ No newline at end of file diff --git a/src/test/resources/indexListJsonString.json b/src/test/resources/indexListJsonString.json index 05f3c7be..3641b243 100644 --- a/src/test/resources/indexListJsonString.json +++ b/src/test/resources/indexListJsonString.json @@ -13,7 +13,8 @@ "status": { "state":"Ready", "ready":true - } + }, + "vector_type": "dense" },{ "name":"testPodIndex", "metric":"cosine", @@ -31,6 +32,7 @@ "status": { "state":"Ready", "ready":true - } + }, + "vector_type": "dense" }] } \ No newline at end of file diff --git a/src/test/resources/podIndexJsonString.json b/src/test/resources/podIndexJsonString.json index 193541f3..7356385e 100644 --- a/src/test/resources/podIndexJsonString.json +++ b/src/test/resources/podIndexJsonString.json @@ -15,5 +15,6 @@ "status": { "state":"Ready", "ready":true - } + }, + "vector_type": "dense" } \ No newline at end of file diff --git a/src/test/resources/serverlessIndexJsonString.json b/src/test/resources/serverlessIndexJsonString.json index 79b608ea..9fa8d8a6 100644 --- a/src/test/resources/serverlessIndexJsonString.json +++ b/src/test/resources/serverlessIndexJsonString.json @@ -12,5 +12,6 @@ "status": { "state":"Ready", "ready":true - } + }, + "vector_type": "dense" } \ No newline at end of file