Skip to content
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

Add support for passing base path for control plane operations #168

Merged
merged 3 commits into from
Nov 27, 2024

Conversation

rohanshah18
Copy link
Contributor

@rohanshah18 rohanshah18 commented Nov 25, 2024

Problem

Currently users don't have an option to pass in the base path for control plane operations.

Solution

Add host and enableTls fields to Pinecone's inner class called Builder and further set the same values for PineconeConfig. This allows the same configuration to be used for data plane operations, eliminating the need for users to manually instantiate PineconeConfig and pass it to the Pinecone class, as was required in the previous approach..

Existing approach for data plane operations:

// Instantiate ManageIndexesApi class
ManageIndexesApi manageIndexesApi = new ManageIndexesApi();

// Instantiate PineconeConfig class
PineconeConfig config = new PineconeConfig("apiKey");
// Disable tls for gRPC calls
config.setTLSEnabled(false);
// Set host for gRPC calls
config.setHost(host);

// Instantiate Pinecone class using PineconeConfig and ManageIndexesApi
Pinecone pinecone = new Pinecone(config, manageIndexesApi);

// Get index connection object for the index
Index index = pinecone.getIndexConnection("index");

// Upsert records into the index
index.upsert("v1", Arrays.asList(1f, 2f, 3f));

New approach for control and data plane operations:

// Sets the host for both control and data plane operations
Pinecone pinecone = new Pinecone.Builder("apiKey")
       .withHost(host)
       .withTlsEnabled(false)
       .build();

// Create index (control plane operation)
pinecone.createServerlessIndex("index", "cosine", 3, "aws","us-east-1", DeletionProtection.DISABLED);

// Get index connection object for the index
Index index = pinecone.getIndexConnection("index");

// Upsert records into the index (data plane operation)
index.upsert("v1", Arrays.asList(1f, 2f, 3f));

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

Existing integration tests should work as it and tested locally using the emulator.

@rohanshah18 rohanshah18 changed the title Improve ux for passing base path for control plane ops Add support for passing base path for control plane operations Nov 25, 2024
@rohanshah18 rohanshah18 marked this pull request as ready for review November 25, 2024 22:06
Copy link
Contributor

@austin-denoble austin-denoble left a comment

Choose a reason for hiding this comment

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

This looks ok to me, but I had a couple questions since it's been a while since I've looked at this codebase.

src/main/java/io/pinecone/clients/Pinecone.java Outdated Show resolved Hide resolved
@rohanshah18 rohanshah18 merged commit 1597b00 into main Nov 27, 2024
7 of 9 checks passed
@rohanshah18 rohanshah18 deleted the rshah/pinecone-local branch November 27, 2024 00:21
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.

2 participants