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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
matrix:
os: [ubuntu-latest]
versions: [
{ java: 8, gradle: 6.8 },
{ java: 11, gradle: 6.8 },
{ java: 16, gradle: 7.3.1 },
{ java: 17, gradle: 7.3.1 }
{ java: 8, gradle: 8.5 },
{ java: 11, gradle: 8.5 },
{ java: 16, gradle: 8.5 },
{ java: 17, gradle: 8.5 }
]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -55,8 +55,8 @@ jobs:
matrix:
os: [ubuntu-latest]
versions: [
{ java: 8, gradle: 6.8 },
{ java: 17, gradle: 7.3.1 }
{ java: 8, gradle: 8.5 },
{ java: 17, gradle: 8.5 }
]
steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
java-version: '8'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5

- name: Bump version
run: |
# Read current version
Expand Down
26 changes: 13 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'java-library'
id 'maven-publish'
id 'signing'
Expand Down Expand Up @@ -150,21 +150,21 @@ task integrationTest(type: Test) {
outputs.upToDateWhen { false }
}

// Configure Auto Relocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation

task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = "io.pinecone.shadow" // Default value is "shadow"

}

tasks.shadowJar.dependsOn tasks.relocateShadowJar

// Shadow META-INF directory
// Configure Shadow JAR with relocations and transformers
import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer

shadowJar {
relocate 'io.grpc', 'io.pinecone.shadow.io.grpc'
relocate 'com.google', 'io.pinecone.shadow.com.google'
relocate 'org.slf4j', 'io.pinecone.shadow.org.slf4j'
relocate 'okhttp3', 'io.pinecone.shadow.okhttp3'
relocate 'okio', 'io.pinecone.shadow.okio'
relocate 'com.fasterxml', 'io.pinecone.shadow.com.fasterxml'
relocate 'com.google.gson', 'io.pinecone.shadow.com.google.gson'
relocate 'io.gsonfire', 'io.pinecone.shadow.io.gsonfire'
relocate 'org.openapitools', 'io.pinecone.shadow.org.openapitools'
relocate 'com.google.protobuf', 'io.pinecone.shadow.com.google.protobuf'
relocate 'org.apache.tomcat', 'io.pinecone.shadow.org.apache.tomcat'
transform(ServiceFileTransformer)
}

Expand Down
2 changes: 1 addition & 1 deletion codegen/apis
Submodule apis updated from a91585 to 060b57
2 changes: 1 addition & 1 deletion codegen/build-oas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -eux -o pipefail

version=$1 # e.g. 2024-07
modules=("db_control" "db_data" "inference")
modules=("db_control" "db_data" "inference" "admin")

destination="src/main/java/org/openapitools"
build_dir="gen"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,44 @@ public class DeletionProtectionTest {
.build();

@Test
public void createPodIndexWithDeletionProtectionEnabled() {
public void createPodIndexWithDeletionProtectionEnabled() throws InterruptedException {
String indexName = RandomStringBuilder.build("create-pod", 8);
// Create pod index with deletion protection enabled
controlPlaneClient.createPodsIndex(indexName, 3, "us-east-1-aws", "p1.x1", DeletionProtection.ENABLED);
// Wait for index to be created
Thread.sleep(5000);
IndexModel indexModel = controlPlaneClient.describeIndex(indexName);
DeletionProtection deletionProtection = indexModel.getDeletionProtection();
Assertions.assertEquals(deletionProtection, DeletionProtection.ENABLED);
// Configure index to disable deletionProtection
controlPlaneClient.configurePodsIndex(indexName, DeletionProtection.DISABLED);
// Wait for index to be configured
Thread.sleep(5000);
// Delete index
controlPlaneClient.deleteIndex(indexName);
}

@Test
public void createPodIndexWithDeletionProtectionDisabled() {
public void createPodIndexWithDeletionProtectionDisabled() throws InterruptedException {
String indexName = RandomStringBuilder.build("create-pod", 8);
// Create pod index with deletion protection disabled
controlPlaneClient.createPodsIndex(indexName, 3, "us-east-1-aws", "p1.x1");
// Wait for index to be created
Thread.sleep(5000);
IndexModel indexModel = controlPlaneClient.describeIndex(indexName);
DeletionProtection deletionProtection = indexModel.getDeletionProtection();
Assertions.assertEquals(deletionProtection, DeletionProtection.DISABLED);
// Configure index to enable deletionProtection
controlPlaneClient.configurePodsIndex(indexName, DeletionProtection.ENABLED);
// Wait for index to be configured
Thread.sleep(5000);
indexModel = controlPlaneClient.describeIndex(indexName);
deletionProtection = indexModel.getDeletionProtection();
Assertions.assertEquals(deletionProtection, DeletionProtection.ENABLED);
// Configure index to disable deletionProtection
controlPlaneClient.configurePodsIndex(indexName, DeletionProtection.DISABLED);
// Wait for index to be configured
Thread.sleep(5000);
// Delete index
controlPlaneClient.deleteIndex(indexName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,47 @@ public class DeletionProtectionTest {
.build();

@Test
public void createIndexWithDeletionProtectionEnabled() {
public void createIndexWithDeletionProtectionEnabled() throws InterruptedException {
String indexName = RandomStringBuilder.build("create-serv", 8);
HashMap<String, String> expectedTags = new HashMap<>();
expectedTags.put("test", "deletion-protection-enabled");
// Create serverless index with deletion protection enabled
controlPlaneClient.createServerlessIndex(indexName, "cosine", 3, "aws", "us-west-2", DeletionProtection.ENABLED, expectedTags);
// Wait for index to be created
Thread.sleep(5000);
// Describe index to verify deletion protection is enabled
IndexModel indexModel = controlPlaneClient.describeIndex(indexName);
DeletionProtection deletionProtection = indexModel.getDeletionProtection();
Assertions.assertEquals(deletionProtection, DeletionProtection.ENABLED);
Assertions.assertEquals(DeletionProtection.ENABLED, deletionProtection);
Map<String, String> actualTags = indexModel.getTags();
Assertions.assertEquals(expectedTags, actualTags);
}

@Test
public void createPodIndexWithDeletionProtectionDisabled() {
public void createIndexWithDeletionProtectionDisabled() throws InterruptedException {
String indexName = RandomStringBuilder.build("create-pod", 8);
HashMap<String, String> expectedTags = new HashMap<>();
expectedTags.put("test", "deletion-protection-disabled");
// Create serverless index with deletion protection disabled
controlPlaneClient.createServerlessIndex(indexName, "cosine", 3, "aws", "us-west-2", DeletionProtection.DISABLED, expectedTags);
// Wait for index to be created
Thread.sleep(5000);
IndexModel indexModel = controlPlaneClient.describeIndex(indexName);
DeletionProtection deletionProtection = indexModel.getDeletionProtection();
Assertions.assertEquals(deletionProtection, DeletionProtection.DISABLED);
Assertions.assertEquals(DeletionProtection.DISABLED, deletionProtection);
Map<String, String> actualTags = indexModel.getTags();
Assertions.assertEquals(expectedTags, actualTags);
// Configure index to enable deletionProtection
controlPlaneClient.configureServerlessIndex(indexName, DeletionProtection.ENABLED, expectedTags, null);
// Wait for index to be configured
Thread.sleep(5000);
indexModel = controlPlaneClient.describeIndex(indexName);
deletionProtection = indexModel.getDeletionProtection();
Assertions.assertEquals(deletionProtection, DeletionProtection.ENABLED);
Assertions.assertEquals(DeletionProtection.ENABLED, deletionProtection);
// Configure index to disable deletionProtection
controlPlaneClient.configureServerlessIndex(indexName, DeletionProtection.DISABLED, expectedTags, null);
// Wait for index to be configured
Thread.sleep(5000);
// Delete index
controlPlaneClient.deleteIndex(indexName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ public static void cleanUp() {
public void testSyncListEndpoint() throws InterruptedException {
// Confirm default vector IDs are returned when no namespace is specified
ListResponse listResponseNoArgs = indexConnection.list();
assertEquals(listResponseNoArgs.getVectorsList().size(), 4);
assertEquals(4, listResponseNoArgs.getVectorsList().size());
assertTrue(listResponseNoArgs.getVectorsList().toString().contains("def-id1"));
assertTrue(listResponseNoArgs.getVectorsList().toString().contains("def-id2"));
assertTrue(listResponseNoArgs.getVectorsList().toString().contains("def-prefix-id3"));
assertTrue(listResponseNoArgs.getVectorsList().toString().contains("def-prefix-id4"));

// Confirm all vector IDs from custom namespace are returned when pass customNamespace
ListResponse listResponseCustomNamespace = indexConnection.list(customNamespace);
assertEquals(listResponseCustomNamespace.getVectorsList().size(), 4);
assertEquals(4, listResponseCustomNamespace.getVectorsList().size());
assertTrue(listResponseCustomNamespace.getVectorsList().toString().contains("cus-id1"));
assertTrue(listResponseCustomNamespace.getVectorsList().toString().contains("cus-id2"));
assertTrue(listResponseCustomNamespace.getVectorsList().toString().contains("cus-prefix-id3"));
assertTrue(listResponseCustomNamespace.getVectorsList().toString().contains("cus-prefix-id4"));

// Confirm all vector IDs from custom namespace are returned, filtered by given prefix
ListResponse listResponseCustomNamespaceWithPrefix = indexConnection.list(customNamespace, "cus-prefix-");
assertEquals(listResponseCustomNamespaceWithPrefix.getVectorsList().size(), 2);
assertEquals(2, listResponseCustomNamespaceWithPrefix.getVectorsList().size());
assertTrue(listResponseCustomNamespaceWithPrefix.getVectorsList().toString().contains("cus-prefix-id3"));
assertTrue(listResponseCustomNamespaceWithPrefix.getVectorsList().toString().contains("cus-prefix-id4"));

Expand All @@ -62,21 +62,21 @@ public void testSyncListEndpoint() throws InterruptedException {

// Confirm all vector IDs from custom namespace are returned using pagination
ListResponse listResponseWithPaginationNoPrefix1 = indexConnection.list(customNamespace, 2);
assertEquals(listResponseWithPaginationNoPrefix1.getVectorsList().size(), 2);
assertEquals(2, listResponseWithPaginationNoPrefix1.getVectorsList().size());
ListResponse listResponseWithPaginationNoPrefix2 = indexConnection.list(
customNamespace,
2,
listResponseWithPaginationNoPrefix1.getPagination().getNext()
);
assertEquals(listResponseWithPaginationNoPrefix2.getVectorsList().size(), 2);
assertEquals(2, listResponseWithPaginationNoPrefix2.getVectorsList().size());
}

@Test
public void testAsyncListEndpoint() throws InterruptedException {
// Confirm default vector IDs are returned when no namespace is specified
ListenableFuture<ListResponse> futureResponseNoArgs = asyncIndexConnection.list();
ListResponse asyncListResponseNoArgs = Futures.getUnchecked(futureResponseNoArgs);
assertEquals(asyncListResponseNoArgs.getVectorsList().size(), 4);
assertEquals(4, asyncListResponseNoArgs.getVectorsList().size());
assertTrue(asyncListResponseNoArgs.getVectorsList().toString().contains("def-id1"));
assertTrue(asyncListResponseNoArgs.getVectorsList().toString().contains("def-id2"));
assertTrue(asyncListResponseNoArgs.getVectorsList().toString().contains("def-prefix-id3"));
Expand All @@ -94,7 +94,7 @@ public void testAsyncListEndpoint() throws InterruptedException {
ListenableFuture<ListResponse> futureResponseCustomNamespaceWithPrefix =
asyncIndexConnection.list(customNamespace, "cus-prefix-");
ListResponse asyncListResponseCustomNamespaceWithPrefix = Futures.getUnchecked(futureResponseCustomNamespaceWithPrefix);
assertEquals(asyncListResponseCustomNamespaceWithPrefix.getVectorsList().size(), 2);
assertEquals(2, asyncListResponseCustomNamespaceWithPrefix.getVectorsList().size());
assertTrue(asyncListResponseCustomNamespaceWithPrefix.getVectorsList().toString().contains("cus-prefix-id3"));
assertTrue(asyncListResponseCustomNamespaceWithPrefix.getVectorsList().toString().contains("cus-prefix-id4"));

Expand All @@ -106,13 +106,13 @@ public void testAsyncListEndpoint() throws InterruptedException {
// Confirm all vector IDs from custom namespace are returned using pagination
ListenableFuture<ListResponse> futureResponseWithPaginationNoPrefix1 = asyncIndexConnection.list(customNamespace, 2);
ListResponse asyncListResponseWithPaginationNoPrefix1 = Futures.getUnchecked(futureResponseWithPaginationNoPrefix1);
assertEquals(asyncListResponseWithPaginationNoPrefix1.getVectorsList().size(), 2);
assertEquals(2, asyncListResponseWithPaginationNoPrefix1.getVectorsList().size());
ListenableFuture<ListResponse> futureResponseWithPaginationNoPrefix2 = asyncIndexConnection.list(
customNamespace,
2,
asyncListResponseWithPaginationNoPrefix1.getPagination().getNext()
);
ListResponse asyncListResponseWithPaginationNoPrefix2 = Futures.getUnchecked(futureResponseWithPaginationNoPrefix2);
assertEquals(asyncListResponseWithPaginationNoPrefix2.getVectorsList().size(), 2);
assertEquals(2, asyncListResponseWithPaginationNoPrefix2.getVectorsList().size());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void upsertAndSearchRecordsTest() throws ApiException, org.openapitools.d
fields.add("chunk_text");

// Wait for vectors to be upserted
Thread.sleep(5000);
Thread.sleep(7500);

SearchRecordsResponse recordsResponse = index.searchRecords(namespace, query, fields, null);
Assertions.assertEquals(upsertRecords.size(), recordsResponse.getResult().getHits().size());
Expand Down
62 changes: 62 additions & 0 deletions src/main/java/org/openapitools/admin/client/ApiCallback.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Pinecone Admin API
* Provides an API for managing a Pinecone organization and its resources.
*
* The version of the OpenAPI document: 2025-04
* Contact: [email protected]
*
* 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.admin.client;

import java.io.IOException;

import java.util.Map;
import java.util.List;

/**
* Callback for asynchronous API call.
*
* @param <T> The return type
*/
public interface ApiCallback<T> {
/**
* This is called when the API call fails.
*
* @param e The exception causing the failure
* @param statusCode Status code of the response if available, otherwise it would be 0
* @param responseHeaders Headers of the response if available, otherwise it would be null
*/
void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders);

/**
* This is called when the API call succeeded.
*
* @param result The result deserialized from response
* @param statusCode Status code of the response
* @param responseHeaders Headers of the response
*/
void onSuccess(T result, int statusCode, Map<String, List<String>> responseHeaders);

/**
* This is called when the API upload processing.
*
* @param bytesWritten bytes Written
* @param contentLength content length of request body
* @param done write end
*/
void onUploadProgress(long bytesWritten, long contentLength, boolean done);

/**
* This is called when the API download processing.
*
* @param bytesRead bytes Read
* @param contentLength content length of the response
* @param done Read end
*/
void onDownloadProgress(long bytesRead, long contentLength, boolean done);
}
Loading
Loading