Releases: pinecone-io/pinecone-java-client
v1.0.0 Release
- Existing users will want to checkout the v1.0.0 Migration Guide for a walkthrough of all the new features and changes.
- New users should start with the README
Serverless indexes are currently in public preview, so make sure to review the current limitations and test thoroughly before using in production.
Changes overview
- Renamed
PineconeControlPlaneClient
toPinecone
and added overloaded methods, so you are not required to
construct request objects. - Added data plane wrappers
Index
andAsyncIndex
, which will eliminate the need to create Java classes for request
objects. TheIndex
class is for blocking gRPC stub whileAsyncIndex
is an async gRPC class for data plane
operations. - Removed
PineconeClient
andPineconeConnectionConfig
, and renamedPineconeClientConfig
toPineconeConfig
.
PineconeConfig
supports setting custom gRPC-managed channels for data plane operations along with setting a source
tag. - Updated dependencies to address vulnerabilities:
- io.grpc:grpc-protobuf: from 1.57.0 to 1.61.0
- io.grpc:grpc-stub: from 1.57.0 to 1.61.0
- io.grpc:grpc-netty: from 1.57.0 to 1.61.0
- com.squareup.okhttp3:okhttp → from 4.10.0 to 4.12.0
- Added the following
model
classes to address the limitations of Java not having a native datatype forunsigned 32-bit integer
, which is the expected datatype of Pinecone's backend API. Sparse indices will now accept Javalong
(rather thanint
), with the input range of[0, 2^32 - 1]
. Everything outside of this range will throw aPineconeValidationException
:- QueryResponseWithUnsignedIndices.java
- ScoredVectorWithUnsignedIndices.java
- SparseValuesWithUnsignedIndices.java
- VectorWithUnsignedIndices
- Added read units as a part of
queryResponse
.
What's Changed
- Revert "Revert "Refactor dataplane "" by @rohanshah18 in #69
- Add data plane wrapper and accept sparse indices as unsigned 32-bit integer by @rohanshah18 in #70
- Refactor to improve user-experience and delete support for endpoint construction for data plane operations using projectId, env, and indexName by @rohanshah18 in #72
- Add Usage to QueryResponseWithUnsignedIndices by @austin-denoble in #74
- Regenerate gRPC classes after removing grpc-gateway / grpc -> OpenAPI spec metadata by @austin-denoble in #78
- Add PineconeDataPlaneClient Interface by @austin-denoble in #76
- Refactor configs and disable collections and configure tests by @rohanshah18 in #77
- Fix Collection and ConfigureIndex tests by @austin-denoble in #79
- Add upsert(List, String namespace), Rename clients, add createIndexConnection() and createAsyncIndexConnection() by @rohanshah18 in #80
- Refactor
CollectionTest
,ConfigureIndexTest
, andIndexManager
to improve integration test speed and reliability by @austin-denoble in #81 - Add Create Index Error + Optional-argument integration tests for Pod + Serverless by @austin-denoble in #82
- Add data plane tests for serverless index by @rohanshah18 in #83
- Add
user-agent
to control plane operations, addsourceTag
, re-enablePinecone
client unit tests by @austin-denoble in #84 - Update OkHttpClient dependency version to 4.12.0 to address vulnerability issues and clean up codebase by @rohanshah18 in #86
- Poll for Index ready during cleanup in
ConfigureIndexTest
by @austin-denoble in #87 - Update gRPC version to 1.60.2 to address vulnerability concerns and fix data plane integration tests by @rohanshah18 in #88
- Handle nulls for some creation and configure methods and provide alternative method for creating collections by @aulorbe in #91
- Add
TestIndexResourcesManager
andCleanupAllTestResourcesListener
by @austin-denoble in #89 - Abstract away Request objs in the ConfigureIndex method by @aulorbe in #93
- Add concurrent HashMap for storing indexNames and connection objects by @rohanshah18 in #92
- Add new CreateServerlessIndex method by @aulorbe in #94
- [Fix] Accept additional properties in API JSON responses by @jhamon in #95
- [Chore] Build output shows which tests are run by @jhamon in #96
- [Chore] Bump GHA gradle action by @jhamon in #97
- Add new createPodsIndex method by @aulorbe in #98
- Deprecate createIndex method by @aulorbe in #105
- Add new
queryByVectorId
andqueryByVector
functions toIndexInterface
by @austin-denoble in #106 - Add javadoc docstrings to
Pinecone
class by @austin-denoble in #104 - Add doc-strings for unsigned indices model classes by @rohanshah18 in #108
- Updated javadoc for Pinecone class by @ssmith-pc in #111
- Add javadoc docstrings to
IndexInterface
,Index
,AsyncIndex
classes by @austin-denoble in #109 - Add docstrings for configs by @rohanshah18 in #110
- Update README and examples to reflect v1 changes by @aulorbe in #107
New Contributors
- @aulorbe made their first contribution in #91
- @ssmith-pc made their first contribution in #111
Full Changelog: v0.8.1...v1.0.0
v0.8.1 Release
Updated: Class PodSpecMetadataConfig
is replaced with java class CreateIndexRequestSpecPodMetadataConfig
When new properties are added to API responses, it causes the Java client to error. The control plane java generated code was hence updated to ignore additional fields of the api response. As a result of this change, users who were relying on PodSpecMetadataConfig
will now have to replace it with CreateIndexRequestSpecPodMetadataConfig
class.
Example
Following example shows how to replace PodSpecMetadataConfig
with CreateIndexRequestSpecPodMetadataConfig
.
// v0.8.0
PodSpecMetadataConfig podSpecMetadataConfig = new PodSpecMetadataConfig();
List<String> indexedItems = Arrays.asList("A", "B", "C", "D");
podSpecMetadataConfig.setIndexed(indexedItems);
CreateIndexRequestSpecPod requestSpecPod = new CreateIndexRequestSpecPod()
.pods(2)
.podType("p1.x2")
.replicas(2)
.metadataConfig(podSpecMetadataConfig)
.sourceCollection("step");
// v0.8.1: replace the class name
CreateIndexRequestSpecPodMetadataConfig podSpecMetadataConfig = new CreateIndexRequestSpecPodMetadataConfig();
List<String> indexedItems = Arrays.asList("A", "B", "C", "D");
podSpecMetadataConfig.setIndexed(indexedItems);
CreateIndexRequestSpecPod requestSpecPod = new CreateIndexRequestSpecPod()
.pods(2)
.podType("p1.x2")
.replicas(2)
.metadataConfig(podSpecMetadataConfig)
.sourceCollection("step");
What's Changed
- Update changelogs, sdk version, and user-agent for v0.8.1 release by @rohanshah18 in #103
- [Fix] Accept additional properties in API JSON responses release by @jhamon #101
Full Changelog: v0.8.0...v0.8.1
v0.8.0 Release
Added: Control plane operations for serverless indexes
Java SDK now supports control plane operations for serverless indexes. Users can now create
, list
, describe
, and delete
serverless indexes. Note that the PineconeIndexOperationClient
has been renamed to PineconeControlPlaneClient
.
Example
The following example shows how to use the create
, list
, describe
, and delete
serverless indexes.
import io.pinecone.PineconeControlPlaneClient;
import io.pinecone.helpers.RandomStringBuilder;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openapitools.client.model.*;
import java.util.Objects;
import static io.pinecone.helpers.IndexManager.isIndexReady;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
public class ServerlessIndexOperations {
public void createAndDelete() throws InterruptedException {
String indexName = RandomStringBuilder.build("index-name", 8);
PineconeControlPlaneClient controlPlaneClient = new PineconeControlPlaneClient("PINECONE_API_KEY");
ServerlessSpec serverlessSpec = new ServerlessSpec().cloud(ServerlessSpec.CloudEnum.AWS).region("us-west-2");
CreateIndexRequestSpec createIndexRequestSpec = new CreateIndexRequestSpec().serverless(serverlessSpec);
// Create the index
CreateIndexRequest createIndexRequest = new CreateIndexRequest()
.name(indexName)
.metric(IndexMetric.COSINE)
.dimension(10)
.spec(createIndexRequestSpec);
controlPlaneClient.createIndex(createIndexRequest);
// Wait until index is ready
Thread.sleep(3500);
// Describe the index
IndexModel indexModel = controlPlaneClient.describeIndex(indexName);
assertNotNull(indexModel);
assertEquals(10, indexModel.getDimension());
assertEquals(indexName, indexModel.getName());
assertEquals(IndexMetric.COSINE, indexModel.getMetric());
// List the index
IndexList indexList = controlPlaneClient.listIndexes();
assert !Objects.requireNonNull(indexList.getIndexes()).isEmpty();
// Delete the index
controlPlaneClient.deleteIndex(indexName);
}
}
Updated: Control plane operations for pod indexes
We have updated the api's for create
, configure
, list
, describe
, and delete
operations for pod indexes.
Example
The following example how to create
, list
, describe
, and delete
pod indexes.
import io.pinecone.PineconeControlPlaneClient;
import io.pinecone.helpers.RandomStringBuilder;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openapitools.client.model.*;
import java.util.Objects;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
public class PodIndexOperations {
public void createAndDelete() throws InterruptedException {
String apiKey = System.getenv("PINECONE_API_KEY");
String environment = System.getenv("PINECONE_ENVIRONMENT");
String indexName = RandomStringBuilder.build("index-name", 8);
PineconeControlPlaneClient controlPlaneClient = new PineconeControlPlaneClient(apiKey);
CreateIndexRequestSpecPod podSpec = new CreateIndexRequestSpecPod().environment(environment).podType("p1.x1");
CreateIndexRequestSpec createIndexRequestSpec = new CreateIndexRequestSpec().pod(podSpec);
// Create the index
CreateIndexRequest createIndexRequest = new CreateIndexRequest()
.name(indexName)
.metric(IndexMetric.COSINE)
.dimension(10)
.spec(createIndexRequestSpec);
controlPlaneClient.createIndex(createIndexRequest);
// Wait until index is ready
Thread.sleep(3500);
// Describe the index
IndexModel indexModel = controlPlaneClient.describeIndex(indexName);
assertNotNull(indexModel);
assertEquals(10, indexModel.getDimension());
assertEquals(indexName, indexModel.getName());
assertEquals(IndexMetric.COSINE, indexModel.getMetric());
// List the index
IndexList indexList = controlPlaneClient.listIndexes();
assert !Objects.requireNonNull(indexList.getIndexes()).isEmpty();
// Delete the index
controlPlaneClient.deleteIndex(indexName);
}
}
The following example shows how to scale up and down a pod index
using configure index
operation.
public class PodIndexOperations {
public void scaleUpAndDownPodIndex() {
try {
String apiKey = System.getenv("PINECONE_API_KEY");
String environment = System.getenv("PINECONE_ENVIRONMENT");
String indexName = RandomStringBuilder.build("index-name", 8);
PineconeControlPlaneClient controlPlaneClient = new PineconeControlPlaneClient(apiKey);
// Scale up for the test
ConfigureIndexRequestSpecPod pod = new ConfigureIndexRequestSpecPod().replicas(3);
ConfigureIndexRequestSpec spec = new ConfigureIndexRequestSpec().pod(pod);
ConfigureIndexRequest configureIndexRequest = new ConfigureIndexRequest().spec(spec);
controlPlaneClient.configureIndex(indexName, configureIndexRequest);
// Verify the scaled up replicas
PodSpec podSpec = controlPlaneClient.describeIndex(indexName).getSpec().getPod();
assert (podSpec != null);
assertEquals(podSpec.getReplicas(), 3);
// Scaling down
pod = new ConfigureIndexRequestSpecPod().replicas(1);
spec = new ConfigureIndexRequestSpec().pod(pod);
configureIndexRequest = new ConfigureIndexRequest().spec(spec);
controlPlaneClient.configureIndex(indexName, configureIndexRequest);
// Verify replicas were scaled down
podSpec = controlPlaneClient.describeIndex(indexName).getSpec().getPod();
assert (podSpec != null);
assertEquals(podSpec.getReplicas(), 1);
} catch (Exception exception) {
throw new PineconeException("Test failed: " + exception.getLocalizedMessage());
}
}
}
Added: Support for collections in Java SDK
We have added the support to create
, list
, describe
, and delete
the collections in java sdk.
Example
The following example shows how to create
, list
, describe
, and delete
collections:
public class Collections {
public void testIndexToCollectionHappyPath() throws InterruptedException {
String apiKey = System.getenv("PINECONE_API_KEY");
String environment = System.getenv("PINECONE_ENVIRONMENT");
PineconeControlPlaneClient controlPlaneClient = new PineconeControlPlaneClient(apiKey);
String indexName = RandomStringBuilder.build("collection-test", 8);
ArrayList<String> indexes = new ArrayList<>();
ArrayList<String> collections = new ArrayList<>();
IndexMetric indexMetric = IndexMetric.COSINE;
List<String> upsertIds = Arrays.asList("v1", "v2", "v3");
String namespace = RandomStringBuilder.build("ns", 8);
int dimension = 4;
String collectionName = RandomStringBuilder.build("collection-test", 8);
// Create collection from index
CreateCollectionRequest createCollectionRequest = new CreateCollectionRequest().name(collectionName).source(indexName);
CollectionModel collection = controlPlaneClient.createCollection(createCollectionRequest);
assertEquals(collection.getStatus(), CollectionModel.StatusEnum.INITIALIZING);
// Wait until collection is ready
Thread.sleep(120000);
// List collections
List<CollectionModel> collectionList = controlPlaneClient.listCollections().getCollections();
// Verify collections is listed
boolean collectionFound = false;
if (collectionList != null && !collectionList.isEmpty()) {
for (CollectionModel col : collectionList) {
if (col.getName().equals(collectionName)) {
collectionFound = true;
break;
}
}
}
if (!collectionFound) {
fail("Collection " + collectionName + " was not found when listing collections");
}
// Describe collections
collection = controlPlaneClient.describeCollection(collectionName);
assertEquals(collection.getStatus(), CollectionModel.StatusEnum.READY);
assertEquals(collection.getDimension(), dimension);
assertEquals(collection.getVectorCount(), 3);
assertNotEquals(collection.getVectorCount(), null);
assertTrue(collection.getSize() > 0);
// Delete collections
controlPlaneClient.deleteCollection(collectionName);
collections.remove(collectionName);
Thread.sleep(2500);
}
}
What's Changed
- Add global control plane code by @rohanshah18 in #59
- Update index operations by @rohanshah18 in #62
- Update configure index test and clean up control plane client by @rohanshah18 in #63
- Add collections operations to
PineconeControlPlaneClient
with integration tests by @austin-denoble in #65 - Refactor dataplane by @rohanshah18 in #66
- Revert "Refactor dataplane " by ...
v0.7.4 Release
Fixed: Create and listIndexes calls for gcp-starter environment
Create
and listIndexes
calls for gcp-starter
environment were failing because the path was incorrectly setup. Users can now create and list indexes in gcp-starter
environment using Java SDK.
Added: Retry with assert mechanism
Integration test suite will often fail on the first try, so to make it more robust, I have added retry with assert mechanism.
Deprecated: queries parameter
Added deprecation warning for queries
parameter of QueryRequest
. Use vector
and its associated methods instead.
Example
The following example shows an example of how to use deprecated queries
parameter vs. how to use methods associated with vector
while querying:
package io.pinecone.integration.dataplane;
import io.pinecone.*;
import io.pinecone.helpers.RandomStringBuilder;
import io.pinecone.model.IndexMeta;
import io.pinecone.proto.QueryRequest;
import io.pinecone.proto.QueryResponse;
import io.pinecone.proto.VectorServiceGrpc;
import java.util.Arrays;
public class QueryVectors {
public static void main(String[] args) throws InterruptedException {
PineconeClientConfig config = new PineconeClientConfig()
.withApiKey("YOUR_API_KEY")
.withEnvironment("gcp-starter");
PineconeIndexOperationClient controlPlaneClient = new PineconeIndexOperationClient(config);
String indexName = "index-name";
PineconeClient dataPlaneClient = new PineconeClient(config);
IndexMeta indexMeta = controlPlaneClient.describeIndex(indexName);
String host = indexMeta.getStatus().getHost();
PineconeConnection connection = dataPlaneClient.connect(
new PineconeConnectionConfig()
.withConnectionUrl("https://" + host));
VectorServiceGrpc.VectorServiceBlockingStub blockingStub = connection.getBlockingStub();
String namespace = RandomStringBuilder.build("ns", 8);
// Commented code shows the example of using deprecated queries parameter, which is part of QueryRequest
/*
float[] rawVector = {1.0F, 2.0F, 3.0F};
QueryVector queryVector = QueryVector.newBuilder()
.addAllValues(Floats.asList(rawVector))
.setFilter(Struct.newBuilder()
.putFields("some_field", Value.newBuilder()
.setStructValue(Struct.newBuilder()
.putFields("$lt", Value.newBuilder()
.setNumberValue(3)
.build()))
.build())
.build())
.setNamespace(namespace)
.build();
QueryRequest batchQueryRequest = QueryRequest.newBuilder()
.addQueries(queryVector) // addQueries() is deprecated as it belongs to queries parameter
.setNamespace(namespace)
.setTopK(2)
.setIncludeMetadata(true)
.build();
QueryResponse deprecatedQueryResponse = blockingStub.query(batchQueryRequest);
*/
// Below example shows an example of using addAllVector() which is associated with vector parameter of QueryRequest
Iterable<Float> iterableVector = Arrays.asList(1.0F, 2.0F, 3.0F);
QueryRequest queryRequest = QueryRequest.newBuilder()
.addAllVector(iterableVector)
.setNamespace(namespace)
.setTopK(2)
.setIncludeMetadata(true)
.build();
QueryResponse queryResponse = blockingStub.query(queryRequest);
}
}
What's Changed
- Fix path for gcp-starter env, add assert with retry mechanism, and add deprecation warning in vector_service.proto by @rohanshah18 in #57
- Add source_collection to indexMetaDatabase object and ignore newly added fields by @rohanshah18 in #58
Full Changelog: v0.7.2...v0.7.4
v0.7.2 Release
Fixed: User-agent SDK version extraction bug
In this release, we have fixed the Unable to extract pinecone client version
.
What's Changed
- Fix SDK version extraction by @rohanshah18 in #55
Full Changelog: v0.7.1...v0.7.2
v0.7.1 Release
Added: List Indexes
Introduced the ability to list indexes in a project. It returns a list of string where each string represents an index name.
Example
The following example shows how to list indexes:
PineconeClientConfig configuration = new PineconeClientConfig()
.withApiKey("YOUR_API_KEY")
.withEnvironment("us-east1-gcp");
PineconeIndexOperationClient indexOperationClient = new PineconeIndexOperationClient(configuration);
List<String> indexList = indexOperationClient.listIndexes();
Added: Configure index
Introduced the ability to configure the number of replicas
or the podType
of an existing index.
Note:
- This is not supported by projects on the
gcp-starter
environment. - Scaling down the pod type is not supported i.e.
p1.x2
cannot be changed top1.x1
. - Updating the base pod type is not supported i.e.
p1.x1
cannot be changed top2.x1
.
Example:
The following example shows how to configure indexes:
PineconeClientConfig configuration = new PineconeClientConfig()
.withApiKey("YOUR_API_KEY")
.withEnvironment("us-east1-gcp");
PineconeIndexOperationClient indexOperationClient = new PineconeIndexOperationClient(configuration);
// Increasing the replicas: assuming the number of replicas was set to 1 or 2
ConfigureIndexRequest configureIndexRequest = new ConfigureIndexRequest()
.withReplicas(3);
indexOperationClient.configureIndex(indexName, configureIndexRequest);
// Decreasing the replicas from 3 to 1
configureIndexRequest = new ConfigureIndexRequest()
.withReplicas(1);
indexOperationClient.configureIndex(indexName, configureIndexRequest);
// Change the pod type to a larger one i.e. from p1.x1 to p1.x2
ConfigureIndexRequest configureIndexRequest = new ConfigureIndexRequest()
.withPodType("p1.x2");
indexOperationClient.configureIndex(indexName, configureIndexRequest);
Added: Integration tests for control and data plane operations
We have added integration tests for both control (index) and data plane (vector) operations under src/integration/java/io/pinecone/integration
which will help provide users with more examples.
What's Changed
- Add support to list indexes by @rohanshah18 in #40
- Add support to configure index by @rohanshah18 in #42
- Add user agent by @rohanshah18 in #43
- Add describeIndexStats integration test by @rohanshah18 in #47
- Add integration test for deleting vectors by @rohanshah18 in #48
- Refactor configure index test by @rohanshah18 in #50
- Add update, fetch, and query integration tests by @rohanshah18 in #51
- Update changelogs, examples, and readme by @rohanshah18 in #52
Full Changelog: v0.6.0...v0.7.1
v0.6.0 Release
Added: Asynchronous Stub
We have added the capability to expose a future stub, providing users with the ability to execute asynchronous gRPC requests. The future stub allows for concurrent requests, enhancing the efficiency of data plane operations.
Example
Below is a simple code example demonstrating how to utilize the future stub for making asynchronous gRPC request:
// Instantiate a Pinecone client configuration with the API key
PineconeClientConfig clientConfig = new PineconeClientConfig().withApiKey("PINECONE_API_KEY");
// Create a Pinecone client and establish a connection
PineconeClient client = new PineconeClient(clientConfig);
PineconeConnection connection = client.connectWithUrl("https://abcdefg-123-c01b9b5.svc.us-east1-gcp.pinecone.io/");
// Retrieve the future stub for asynchronous requests
VectorServiceGrpc.VectorServiceFutureStub futureStub = connection.getFutureStub();
// Prepare a DescribeIndexStatsRequest
DescribeIndexStatsRequest describeIndexStatsRequest = DescribeIndexStatsRequest.newBuilder().build();
// Execute the asynchronous request and handle the response
ListenableFuture<DescribeIndexStatsResponse> describeIndexStatsResponseFuture = futureStub.describeIndexStats(describeIndexStatsRequest);
try {
DescribeIndexStatsResponse response = describeIndexStatsResponseFuture.get();
logger.info("Received describe index stats response: " + response);
} catch (InterruptedException | ExecutionException e) {
logger.error("Failed to retrieve describe index stats: " + e.getMessage());
}
Added: Integration tests
We have also added integration tests that will run after every commit to enhance testing capability.
What's Changed
- Setup starter CI job by @jhamon in #33
- Expand CI coverage to Java 17, add integration tests by @jhamon in #34
- Clean up integration tests by @rohanshah18 in #36
- Expose future stub on Pinecone connection by @russcam in #32
- Update changelogs for v0.6.0 release by @rohanshah18 in #38
New Contributors
Full Changelog: v0.5.1...v0.6.0
v0.5.1 Release
Fixed: Dependency Cleanup and Compatibility Enhancement
In this release, we took steps to enhance compatibility and ensure optimal performance by addressing dependency-related concerns:
- Updated the dependency for
netty-tcnative-boringssl-static
to version2.0.61.Final
, ensuring compatibility with gRPCv1.58.0
. - Removed unnecessary dependencies.
- Updated deprecated gradle method.
These changes effectively resolve the dependency version conflict, contributing to a cleaner and more streamlined dependency structure.
What's Changed
- Update readme for outdated java-basic-mvn example by @rohanshah18 in #30
- Update build.gradle file to fix dependency issues and improve testing by @rohanshah18 in #31
Full Changelog: v0.5.0...v0.5.1
v0.5.0 Release
Updated: gRPC version 1.58.0
In this release, we have upgraded the gRPC version from v1.53.0
to v1.58.0
, implementing crucial adjustments. This update ensures that users can seamlessly utilize gRPC v1.58.0
without encountering the method not found
errors that were prevalent in the previous version v1.53.0
.
Updated: HTTP Client
Upgraded the HTTP client from AsyncHttpClient
to OkHttpClient
for control plane operations. Users can now make multiple client calls using a synchronous HTTP client, providing a better control and performance.
Added: Index Description
Introduced the ability to describe an index using the indexName
parameter, offering more flexibility in index operations.
Example
The following example shows how to utilize OkHttpClient and synchronously call describeIndex
and deleteIndex
functions using indexName
parameter.
// create a custom OkHttpClient
OkHttpClient.Builder builder = new OkHttpClient.Builder()
.connectTimeout(10, java.util.concurrent.TimeUnit.SECONDS)
.readTimeout(30, java.util.concurrent.TimeUnit.SECONDS)
.writeTimeout(30, java.util.concurrent.TimeUnit.SECONDS);
OkHttpClient httpClient = builder.build();
PineconeClientConfig pineconeClientConfig = new PineconeClientConfig()
.withApiKey("PINECONE_API_KEY")
.withEnvironment("TEST_ENVIRONMENT");
// pass the custom OkHttpClient
PineconeIndexOperationClient pineconeIndexOperationClient = new PineconeIndexOperationClient(pineconeClientConfig, httpClient);
// synchronous calls to describe and delete index
pineconeIndexOperationClient.describeIndex("TEST_INDEX_NAME");
pineconeIndexOperationClient.deleteIndex("TEST_INDEX_NAME");
// close the client
pineconeIndexOperationClient.close();
Added: Apache 2.0 License
Added Apache 2.0 license
, ensuring compliance with licensing standards.
What's Changed
- Update http client and improve error handling by @rohanshah18 in #23
- Add Apache 2.0 LICENSE by @gdj0nes in #25
- Add support for describeIndex functionality by @rohanshah18 in #24
- Update gRPC version to 1.58.0 by @rohanshah18 in #26
New Contributors
Full Changelog: v0.4.0...v0.5.0
Release 0.4.0
Changelog
This change simplifies configuration by allowing a PineconeConnection
object to be instantiated from an index url without the need to pass individual configuration fields for indexName
, projectId
, and environment
. This change should make interactions with Pinecone's data plane more robust as there is no longer a need to parse these values out of urls which could change format over time.
Example
The following example shows how to build a PineconeConnection
object from the index url. Then we show how to use the connection object to fetch a list of vectors.
PineconeClientConfig clientConfig = new PineconeClientConfig().withApiKey("PINECONE_API_KEY");
PineconeClient client = new PineconeClient(clientConfig);
PineconeConnection connection = client.connectWithUrl("https://abcdefg-123-c01b9b5.svc.us-east1-gcp.pinecone.io/");
List<String> ids = Arrays.asList("v1", "v2", "v3", "v4", "v5", "v6");
FetchRequest fetchRequest = FetchRequest.newBuilder().addAllIds(ids).setNamespace("TEST_NAMESPACE").build();
FetchResponse fetchResponse = connection.getBlockingStub().fetch(fetchRequest);