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