response.source_nodes
? https://docs.llamaindex.ai/en/stable/understanding/querying/querying.htmlSimpleDirectoryReader
, It will add the file names by itself in case of PDF and doc files in metadata for each document. from llama_index import SimpleDirectoryReader filename_fn = lambda filename: {"file_name": filename} # automatically sets the metadata of each document according to filename_fn documents = SimpleDirectoryReader("./data", recursive=True, file_metadata=filename_fn, filename_as_id=True, ).load_data()