diff --git a/pinecone/grpc/index_grpc.py b/pinecone/grpc/index_grpc.py index 64879078..eba611b7 100644 --- a/pinecone/grpc/index_grpc.py +++ b/pinecone/grpc/index_grpc.py @@ -35,7 +35,6 @@ SparseValues as GRPCSparseValues, ) from pinecone import Vector as NonGRPCVector -from pinecone.data.query_results_aggregator import QueryNamespacesResults, QueryResultsAggregator from pinecone.core.grpc.protos.vector_service_pb2_grpc import VectorServiceStub from .base import GRPCIndexBase from .future import PineconeGrpcFuture @@ -403,53 +402,6 @@ def query( json_response = json_format.MessageToDict(response) return parse_query_response(json_response, _check_type=False) - def query_namespaces( - self, - vector: List[float], - namespaces: List[str], - top_k: Optional[int] = None, - filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None, - include_values: Optional[bool] = None, - include_metadata: Optional[bool] = None, - sparse_vector: Optional[Union[GRPCSparseValues, SparseVectorTypedDict]] = None, - **kwargs, - ) -> QueryNamespacesResults: - if namespaces is None or len(namespaces) == 0: - raise ValueError("At least one namespace must be specified") - if len(vector) == 0: - raise ValueError("Query vector must not be empty") - - overall_topk = top_k if top_k is not None else 10 - aggregator = QueryResultsAggregator(top_k=overall_topk) - - target_namespaces = set(namespaces) # dedup namespaces - futures = [ - self.query( - vector=vector, - namespace=ns, - top_k=overall_topk, - filter=filter, - include_values=include_values, - include_metadata=include_metadata, - sparse_vector=sparse_vector, - async_req=True, - **kwargs, - ) - for ns in target_namespaces - ] - - from concurrent.futures import wait, ALL_COMPLETED - - done, _ = wait(futures, return_when=ALL_COMPLETED) - - for future in done: - response = future.result() - json_result = json_format.MessageToDict(response) - aggregator.add_results(json_result) - - final_results = aggregator.get_results() - return final_results - def update( self, id: str,