Getting this strange error while calling Index.query() Following is the code:
def get_context(question, t):
# generate embeddings for the question
xq = retriever.encode([question]).tolist()
# search pinecone index for context passage with the answer #print(xq)
xc = index.query(xq, top_k=t, include_metadata=True)
# extract the context passage from pinecone search result
c = [x["metadata"]['context'] for x in xc["matches"]]
return c
from langchain.vectorstores import Pinecone
text_field = "context"
# switch back to normal index for langchain
vectorstore = Pinecone(
demo_index, embeddings.embed_query, text_field
)
vectorstore.similarity_search("black boxes")
Error:
TypeError: Index.query() got multiple values for argument 'top_k'