Skip to content

Add support for list, describe, and delete namespace #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: rshah/release-candidate/2025-04
Choose a base branch
from

Conversation

rohanshah18
Copy link
Contributor

@rohanshah18 rohanshah18 commented May 5, 2025

Problem

Add support for list, describe, and delete namespaces.

Solution

Generated code using 2025-04 protos and added the following methods for namespaces for both index and asyncIndex:

  1. listNamespaces()
  2. listNamespaces(String paginationToken)
  3. listNamespaces(String paginationToken, int limit)
  4. describeNamespace(String namespace)
  5. deleteNamespace(String namespace)

Following example shows listNamespaces(), describeNamespace(), and deleteNamespace() methods for both index and asyncIndex.

import io.pinecone.clients.AsyncIndex;
import io.pinecone.clients.Index;
import io.pinecone.clients.Pinecone;
import io.pinecone.proto.ListNamespacesResponse;
import io.pinecone.proto.NamespaceDescription;

import java.util.concurrent.ExecutionException;
...

String indexName = "PINECONE_INDEX_NAME";
Pinecone pinecone = new Pinecone.Builder("PINECONE_API_KEY").build();

//// Sync index example
Index index = pinecone.getIndexConnection(indexName);

// list namespaces without pagination token and limit (if no limit is passed, it'll default to 100)
ListNamespacesResponse listNamespacesResponse = index.listNamespaces();

// list namespaces with pagination token
listNamespacesResponse = index.listNamespaces("some-pagination-token");

// list namespaces with pagination token and a custom limit of 5
listNamespacesResponse = index.listNamespaces("some-pagination-token", 5);

// describe a namespace
NamespaceDescription namespaceDescription = index.describeNamespace("namespace");

// delete a namespace
index.deleteNamespace("namespace");


//// AsyncIndex example
AsyncIndex asyncIndex = pinecone.getAsyncIndexConnection(indexName);

// list namespaces without pagination token and limit (if no limit is passed, it'll default to 100)
ListNamespacesResponse asyncListNamespacesResponse = index.listNamespaces();

// list namespaces with pagination token
asyncListNamespacesResponse = asyncIndex.listNamespaces("some-pagination-token").get();

// list namespaces with pagination token and a custom limit of 5
asyncListNamespacesResponse = asyncIndex.listNamespaces("some-pagination-token", 5).get();

// describe a namespace
NamespaceDescription asyncNamespaceDescription = asyncIndex.describeNamespace("some-namespace").get();

// delete a namespace
asyncIndex.deleteNamespace("some-namespace");

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

Added integration tests.

@rohanshah18 rohanshah18 changed the title generate code based on the 2025-04 protos Add support for list, describe, and delete namespace May 5, 2025
@rohanshah18 rohanshah18 marked this pull request as ready for review May 8, 2025 18:01
@@ -45,5 +45,8 @@ rm -rf "${dest}*.java"
# Copy the new generated files to dest directory
cp codegen/gen/java/io/pinecone/proto/*.java ${dest}

# Update version reference in PineconeConnection.java
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

automate api version update for grpc calls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant