Skip to content

[Bug] The 'queries' parameter has been deprecated in VectorServiceBlockingStub #21

Closed

Description

@AriJordan

Current Behavior

This line:
QueryResponse queryResponse = conn.getBlockingStub().query(batchQueryRequest);

causes an exception, see below.

Expected Behavior

The Java client shouldn't use deprecated field.

Steps To Reproduce

I guess your example should also fail.
Maybe need to create a new starter Pinecone project first, which is what I did.

Relevant log output

exception [Request processing failed: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: The 'queries' parameter has been deprecated.] with root cause

io.grpc.StatusRuntimeException: INVALID_ARGUMENT: The 'queries' parameter has been deprecated.
        at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:271) ~[grpc-stub-1.53.0.jar:1.53.0]     
        at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:252) ~[grpc-stub-1.53.0.jar:1.53.0]
        at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:165) ~[grpc-stub-1.53.0.jar:1.53.0]
        at io.pinecone.proto.VectorServiceGrpc$VectorServiceBlockingStub.query(VectorServiceGrpc.java:541) ~[pinecone-client-0.2.3.jar:0.2.3]

Environment

- **OS**:
Windows 11
- **Language**
Java
- **Pinecone client version**:
0.2.3

Additional Context

No response

Activity

  1. added
    bug
    on Sep 4, 2023
  2. rohanshah18 commented on Sep 14, 2023

    @rohanshah18
    Contributor

    Hi @AriJordan,
    Thanks for opening this issue. Let me do some research and get back to you. Also I'm able to successfully run a batch query call as described in the example. I'm curious to know what version of java are you using and how does the setup look like for your batch query call.
    Rohan

  3. AriJordan commented on Sep 14, 2023

    @AriJordan
    Author

    I created a new Pinecone project on a different server and now it's fine. So it only seems to happen for some Pinecone projects/servers. Seems to have nothing to do with the Java version.

  4. rohanshah18 commented on Sep 15, 2023

    @rohanshah18
    Contributor

    I'm glad you were able to run the project. I'll close this but feel free to open a new issue if you face similar problems in future.

  5. rohanshah18 commented on Dec 13, 2023

    @rohanshah18
    Contributor

    @AriJordan Just to confirm, addQueries() and addAllQueries() are deprecated, please use addVector() or addAllVector() instead.

  6. rohanshah18 commented on Dec 13, 2023

    @rohanshah18
    Contributor

    @AriJordan For your reference, please find below the examples:

    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()
            // DEPRECATED: Please use addVector() or addAllVector() instead
            .addQueries(queryVector)
            .setNamespace(namespace)
            .setTopK(2)
            .setIncludeMetadata(true)
            .build();
    
    // Following should result in invalidArgument error
    QueryResponse queryResponse = conn.getBlockingStub().query(batchQueryRequest); 
    
    // AddAllVector() example for 3 dimensional vector
    Iterable<Float> iterable = Arrays.asList(1.0F, 2.0F, 3.0F);
    QueryRequest queryRequest = QueryRequest.newBuilder()
            .addAllVector(iterable)
            .setNamespace(namespace)
            .setTopK(2)
            .setIncludeMetadata(true)
            .build();
    
    queryResponse = conn.getBlockingStub().query(queryRequest);
    assertThat(queryResponse, notNullValue());
    assertThat(queryResponse.getMatchesList(), notNullValue());
    assertThat(queryResponse.getMatchesCount(), equalTo(2));
    // AddVector() example for a 3 dimensional vector:
    QueryRequest queryRequest = QueryRequest.newBuilder()
            .addVector(101F) 
            .addVector(102F)
            .addVector(103F)
            .setNamespace(namespace)
            .setTopK(2)
            .setIncludeMetadata(true)
            .build();
    
    queryResponse = conn.getBlockingStub().query(queryRequest);
    assertThat(queryResponse, notNullValue());
  7. AriJordan commented on Dec 13, 2023

    @AriJordan
    Author

    Thanks for the help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions