Skip to content

Releases: pinecone-io/pinecone-java-client

v0.7.4 Release

19 Jan 18:20
931134b
Compare
Choose a tag to compare

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

02 Jan 18:48
3a0de7b
Compare
Choose a tag to compare

Fixed: User-agent SDK version extraction bug

In this release, we have fixed the Unable to extract pinecone client version.

What's Changed

Full Changelog: v0.7.1...v0.7.2

v0.7.1 Release

19 Dec 00:14
231657c
Compare
Choose a tag to compare

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:

  1. This is not supported by projects on the gcp-starter environment.
  2. Scaling down the pod type is not supported i.e. p1.x2 cannot be changed to p1.x1.
  3. Updating the base pod type is not supported i.e. p1.x1 cannot be changed to p2.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

Full Changelog: v0.6.0...v0.7.1

v0.6.0 Release

09 Oct 21:15
eef17f8
Compare
Choose a tag to compare

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

New Contributors

Full Changelog: v0.5.1...v0.6.0

v0.5.1 Release

02 Oct 18:35
1547a8a
Compare
Choose a tag to compare

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 version 2.0.61.Final, ensuring compatibility with gRPC v1.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

28 Sep 20:00
dcd85fc
Compare
Choose a tag to compare

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

New Contributors

Full Changelog: v0.4.0...v0.5.0

Release 0.4.0

30 Aug 18:34
96fe1d1
Compare
Choose a tag to compare

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);

Release 0.3.0

23 Aug 15:40
4875867
Compare
Choose a tag to compare

Changelog

We have introduced the following two index operations:

  1. Creating an index is now possible using the required fields index_name and dimension, along with optional fields such as metric, pods, replicas, pod_type, metadata_config, and source_collection.
  2. Additionally, you can now delete an index using the index_name parameter.

Examples:

  1. Create Index:
// The following example creates an index without a metadata configuration. By default, Pinecone indexes all metadata.
PineconeClientConfig configuration = new PineconeClientConfig()
        .withApiKey("YOUR_API_KEY")
        .withEnvironment("us-east1-gcp");
PineconeIndexOperationClient pineconeIndexOperationClient = new PineconeIndexOperationClient(configuration);
CreateIndexRequest createIndexRequest = new CreateIndexRequest()
        .withIndexName("example-index")
        .withDimension(128);
pineconeIndexOperationClient.createIndex(createIndexRequest);

// The following example creates an index that only indexes the "color" metadata field.
IndexMetadataConfig metadataConfig = new IndexMetadataConfig();
metadataConfig.addIndexedItem("color");
CreateIndexRequest createIndexRequest2 = new CreateIndexRequest()
        .withIndexName("example-index-2")
        .withDimension(1024)
        .withMetadataConfig(metadataConfig);

pineconeIndexOperationClient.createIndex(createIndexRequest2);
  1. Delete Index:
// The following example deletes an index
PineconeClientConfig configuration = new PineconeClientConfig()
        .withApiKey("YOUR_API_KEY")
        .withEnvironment("us-east1-gcp");
PineconeIndexOperationClient pineconeIndexOperationClient = new PineconeIndexOperationClient(configuration);
pineconeIndexOperationClient.deleteIndex("example-index");

v0.2.3

14 Apr 19:57
Compare
Choose a tag to compare

This release updates some old dependencies across the board.
Additionally, introduces ability to add SparseValues to vectors for hybrid search capabilities

v0.2.2

15 Jun 13:23
Compare
Choose a tag to compare

Adds abiltiy to:

  • query by id and unary query
  • delete by metadata
  • partial metadata updates