Find answers from the community

Updated 10 months ago

hi. When building a vector index from a

hi. When building a vector index from a vector store backed by pinecone, how do I specify the number of documents to be returned for a query?

pinecone_index = self.create_index("books") vector_store = PineconeVectorStore(pinecone_index=pinecone_index) self.vector_store = vector_store service_context = ServiceContext.from_defaults(llm=llm) storage_context = StorageContext.from_defaults(vector_store=vector_store) self.index = VectorStoreIndex.from_vector_store(vector_store) self.query_engine = self.index.as_query_engine() print(self.query_engine.query("foo"))

# query("foo") returns as if similarity_top_k is always 2. It's not clear where to change it since I'm not sure when the retriever is being created.
W
1 comment
Just do this:
Plain Text
self.query_engine = self.index.as_query_engine( similarity_top_k=5)
Add a reply
Sign up and join the conversation on Discord