Find answers from the community

Updated 4 months ago

hello guys how can i fetch documents

hello guys how can i fetch documents metadata stocked in faiss index using llama index
L
12 comments
faiss only stores the embedding vector and an ID

You need to maintain the docstore in order to link back to the original node with its metadata

This should already be happening automatically when you use faiss with llama-index
i have a probleñ when i embed multiple pdf documents it doesnt correctly but when i embed just on document it answer correctly
Maybe your documents are too similar to eachother to be putting in the same index? Faiss sadly doesn't support metadata filtering either
because when i try to query all the documents are retrieved instead of just the concerned documents
Hard to say without seeing what you are doing or what you mean by "all documents are retrieved"
def query(self, query_text, discussion_id=None):
# Load documents from MongoDB and embeddings from FAISS index
documents = list(chunks_collection.find({}))
if not documents:
logging.error("No documents found in the database.")
return {"response": "No documents found in the database.", "sources": []}

logging.info(f"Loaded {len(documents)} documents from the database")
I don't know what this is doing though 😅
documents = list(chunks_collection.find({}))
Im using Mongodb as the database to stock the different pdf chunks when the file is uploaded
i can have a logic problem i guess
Add a reply
Sign up and join the conversation on Discord