Skip to content

Commit 8855415

Browse files
committed
add embed to configure request
1 parent d79f288 commit 8855415

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

src/integration/java/io/pinecone/integration/controlPlane/serverless/DeletionProtectionTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ public void createPodIndexWithDeletionProtectionDisabled() {
4444
Map<String, String> actualTags = indexModel.getTags();
4545
Assertions.assertEquals(expectedTags, actualTags);
4646
// Configure index to enable deletionProtection
47-
controlPlaneClient.configureServerlessIndex(indexName, DeletionProtection.ENABLED, expectedTags);
47+
controlPlaneClient.configureServerlessIndex(indexName, DeletionProtection.ENABLED, expectedTags, null);
4848
indexModel = controlPlaneClient.describeIndex(indexName);
4949
deletionProtection = indexModel.getDeletionProtection();
5050
Assertions.assertEquals(deletionProtection, DeletionProtection.ENABLED);
5151
// Configure index to disable deletionProtection
52-
controlPlaneClient.configureServerlessIndex(indexName, DeletionProtection.DISABLED, expectedTags);
52+
controlPlaneClient.configureServerlessIndex(indexName, DeletionProtection.DISABLED, expectedTags, null);
5353
// Delete index
5454
controlPlaneClient.deleteIndex(indexName);
5555
}

src/integration/java/io/pinecone/integration/controlPlane/serverless/SparseIndexTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public void configureSparseIndex() throws InterruptedException {
6363
waitUntilIndexIsReady(pinecone, indexName, 200000);
6464

6565
// Disable deletion protection and add more index tags
66-
pinecone.configureServerlessIndex(indexName, DeletionProtection.DISABLED, tags);
66+
pinecone.configureServerlessIndex(indexName, DeletionProtection.DISABLED, tags, null);
6767
Thread.sleep(7000);
6868

6969
// Describe index to confirm deletion protection is disabled

src/main/java/io/pinecone/clients/Pinecone.java

+21-2
Original file line numberDiff line numberDiff line change
@@ -760,8 +760,17 @@ public IndexModel configurePodsIndex(String indexName, DeletionProtection deleti
760760
* import org.openapitools.control.client.model.IndexModel;
761761
* ...
762762
*
763+
* HashMap<String, String> tags = new HashMap<>();
764+
* tags.put("env", "test);
765+
*
766+
* ConfigureIndexRequestEmbed embed = new ConfigureIndexRequestEmbed();
767+
* embed.model("multilingual-e5-large");
768+
* HashMap<String, String> fieldMap = new HashMap<>();
769+
* fieldMap.put("text", "your-text-field");
770+
* embed.fieldMap(fieldMap);
771+
*
763772
* // Make a configuration change
764-
* IndexModel indexModel = client.configureServerlessIndex("YOUR-INDEX", DeletionProtection.ENABLED);
773+
* IndexModel indexModel = client.configureServerlessIndex("YOUR-INDEX", DeletionProtection.ENABLED, tags, embed);
765774
*
766775
* // Call describeIndex to see the index status as the change is applied.
767776
* indexModel = client.describeIndex("YOUR-INDEX");
@@ -770,10 +779,16 @@ public IndexModel configurePodsIndex(String indexName, DeletionProtection deleti
770779
* @param indexName The name of the index to configure.
771780
* @param deletionProtection Enable or disable deletion protection for the index.
772781
* @param tags A map of tags to associate with the Index.
782+
* @param embed Convert an existing index to an integrated index by specifying the embedding model and field_map.
783+
* The index vector type and dimension must match the model vector type and dimension, and the index
784+
* similarity metric must be supported by the model
773785
* @return {@link IndexModel} representing the configured index.
774786
* @throws PineconeException if an error occurs during the operation, the index does not exist, or if any of the arguments are invalid.
775787
*/
776-
public IndexModel configureServerlessIndex(String indexName, DeletionProtection deletionProtection, Map<String, String> tags) throws PineconeException {
788+
public IndexModel configureServerlessIndex(String indexName,
789+
DeletionProtection deletionProtection,
790+
Map<String, String> tags,
791+
ConfigureIndexRequestEmbed embed) throws PineconeException {
777792
if (indexName == null || indexName.isEmpty()) {
778793
throw new PineconeValidationException("indexName cannot be null or empty");
779794
}
@@ -786,6 +801,10 @@ public IndexModel configureServerlessIndex(String indexName, DeletionProtection
786801
configureIndexRequest.tags(tags);
787802
}
788803

804+
if(embed != null) {
805+
configureIndexRequest.embed(embed);
806+
}
807+
789808
IndexModel indexModel = null;
790809
try {
791810
indexModel = manageIndexesApi.configureIndex(indexName, configureIndexRequest);

0 commit comments

Comments
 (0)