Find answers from the community

Updated 3 months ago

Hi is it possible to know which document

Hi, is it possible to know which document/link was used? Say, I have several documents, when the answer was found in a specific one, how to know which document was it? Thanks!
L
S
6 comments
Check response.source_nodes

each source node in the list should have the text used, as well as a reference to the source doc id and metadata

response.source_nodes[0].node.text
response.source_nodes[0].node.ref_doc_id
response.source_nodes[0].node.metadata
If the source document had any metadata (i.e. a file name), it gets inherited to the node metadata
Thanks, I will try it!
Before I merged multiple source documents (like web pages) in one, now if I want to get the information on original links, I will have to create a separate document for each web page. It's totally fine, I just wonder which approach (whole doc or multiple docs) is better from the performance and search quality point of view? (FYI: I'm using Qdrant for storing documents). Thanks!
I think performance will be basically the same either way. But search quality will probably be better if you have one document per web page πŸ€” at least that's my initial feeling
Great, thanks!
Add a reply
Sign up and join the conversation on Discord