querying in pinecone vector database

270 views Asked by At

I am trying to fetch top 3 related vector from pine cone which are similar to the query_vector

answer=index.query(
  vector=query_vector,
  top_k=3,
  include_values=True
)
st.write(answer)

query_vector is a list of 1536-dimensional embedding of a query which looks like as follows [0.02088431, 0.007455872, -0.016556364, -0.011433648, -0.047843482, -0.016949814, -0.05335178, 0.012023823, -0.021985969, .........] my database is also storing embeddings of 1536 dimensions. When I am executing this it is giving error

TypeError: 'NoneType' object is not callable 

what should I do ...

1

There are 1 answers

0
Mit Shah On
from pinecone import Pinecone

pc = Pinecone(api_key="API_KEY_PINECONE")
index = pc.Index("hb-demo")

ans = index.query(
  vector=[0.99,0.59,0.36,...],//1536 total dimensions
  top_k=3,
  include_metadata=True,
    include_values=True,
    namespace='demo'
)
print(ans)

I have used this kind of query in my Jupyter-notebook it works fine.Please check your index-name and namespace.

You haven't provided namespace here so it will take response from default namespace. so, check that default namespace in your pinecone account contains records.