Today, I was making some Unit tests for my application that uses Pinecone, because I wanted to use Pinecone Local to make it predictable and return what I expect it to. The problem that I found was that when I used query_namespaces, I got an error that AttributeError: ‘NoneType’ object has no attribute ‘read_units’ in .\Lib\site-packages\pinecone\db_data\query_results_aggregator.py", line 150, self.usage_read_units += results.usage.read_units. This error doesn’t happen when I use the normal query function, but that isn’t the one that is used in code; we use multiple namespaces.
Local setup
The Pinecone local version is running on Docker and was pulled with this. docker pull ``ghcr.io/pinecone-io/pinecone-index:latest
and activated with this:
docker run -d --name pinecone-local -e PORT=5080 -e PINECONE_HOST=localhost -p 5080-5090:5080-5090 --platform linux/amd64 ``ghcr.io/pinecone-io/pinecone-local:latest
Python code
pinecone grpc version: 7.3.0
calling pinecone local:
from pinecone.grpc import PineconeGRPC, GRPCClientConfig
host = “http://localhost:5080”
Pinecone_Key =“test-index”
self.pc = PineconeGRPC(host=host, api_key=Pinecone_Key, grpc_config=GRPCClientConfig(secure=False))
index_host = self.pc.describe_index(name=pinecone_Index_Name).host
index = self.pc.Index(host=index_host, grpc_config=GRPCClientConfig(secure=False))
namespace = “namespace1”
text = “doing good today”
index.upsert(vectors=[{“id”: “id1”,“values”: [0.1, 0.1], “metadata”: {“text”: self.text}}], namespace=self.namespace)
quary (works without problems in unit tests):
results = index.query(namespace=namespace, vector=[0.1, 0.1], metric=“cosine”, top_k=5, include_values=False, include_metadata=True, show_progress=False)
quary_namespaces (this gives the AttributeError: ‘NoneType’ object has no attribute ‘read_units’ error):
results = index.query_namespaces(namespaces=[namespace], vector=[0.1, 0.1], metric=“cosine”, top_k=5, include_values=False, include_metadata=True, show_progress=False)
Is this expected behavior, or should it have been that I could call on multiple namespaces inside the local Pinecone?