I am trying to build a chatbot where I need the bot to response to user query from the data that is stored in vector database like pinecone. Here I want to store pdf of different topic, like different car model of a particular brand. How can I get proper result from pinecone if user ask a particular question about a model?
Loaded the multiple pdf using SimpleDirectoryLoader to store in pinecone and used the query engine to get the similar vector data as response.
from llama_index.core import VectorStoreIndex,SimpleDirectoryReader, StorageContext
from llama_index.vector_stores.pinecone import PineconeVectorStore
documents=SimpleDirectoryReader("direcory_name").load_data()
vector_store = PineconeVectorStore(pinecone_index=pinecone_index)
storage_context = StorageContext.from_defaults(vector_store=vector_store)
index = VectorStoreIndex.from_documents(documents=documents, storage_context=storage_context)
from llama_index.core.retrievers import VectorIndexRetriever
from llama_index.core.query_engine import RetrieverQueryEngine
from llama_index.core.indices.postprocessor import SimilarityPostprocessor
retriever=VectorIndexRetriever(index=index,similarity_top_k=4)
postprocessor=SimilarityPostprocessor(similarity_cutoff=0.80)
query_engine=RetrieverQueryEngine(retriever=retriever,
node_postprocessors=[postprocessor])