Embedding metadata in ConversationalRetrievalChain answer

654 Views Asked by At

I am relatively new to Langchain.

I am using ConversationalRetrievalChain to 'chat' with data in PDFs. I got to a point where I ask a question and get a good answer. However, this is not enough in my case. I would like the answer to embed pdfs identifier/name (which is stored in the metadata of the docs) in the answer itself.

For example: question: what are the top 3 trending aluminum profiles? answer: the top 3 aluminum trending aluminum profiles are Brook with thickness of 3 milimiters and green-metal color (metadata: doc01), Ispahan with thickness of 2 milimiter and dark blue color (metadata: doc02) and Jordalish with 1 milimiter thickness and black color (metadata: doc03).

I can loop through the retrieved docs and create a list, however, this will not allow me to point the correct doc to its part in the returned answer.

Would highly appreciate any help. Thanks!

The closest I got is looping through the metadata of the retrieved docs, however this does not solve my problem.

0

There are 0 best solutions below