Reputation: 168
When adding metadata via every method listed here, the query does not return the correct node. Without metadata everything works fine.
adding document.metadata = {'filename': '<doc_file_name>', 'id': '<doc_id>', 'subject': '<doc_subject>'}
, makes the query not working anymore.
Without passing metadata the retrieval from the query is fine and the result as expected.
Tried also to test via excluded_embed_metadata_keys
and/or excluded_llm_metadata_keys
, but nothing changed.
I'm using OpenAI completion_model="gpt-3.5-turbo" and embed_model="text-embedding-ada-002", and QdrantVectorStore
Upvotes: 0
Views: 3260
Reputation: 21
Solution: Change the syntax of Document following format. It will not send metadata to the llm for answering query
metadata_keys = list(metadata.keys()) # Your case ["filename", "id", "subject"]
doc = Document(id_=document_id, text=content, metadata=metadata, excluded_llm_metadata_keys=metadata_keys)
index.insert(doc)
Reference: https://gpt-index.readthedocs.io/en/v0.6.38/how_to/customization/custom_documents.html
Upvotes: 2