private-gpt
private-gpt copied to clipboard
[Question] How to ask about the documents' themselves (eg. Number of docs)
I need the bot to be able to know how many, and filenames of the documents when asking. For example a prompt could be:
For each document, find the most common word and print it along with the filename.
This doesn't work and the bot replies I don't know
(not literally, but just tells it needs more context to answer). What do I change in the ingest.py
file to make this metadata available to the bot?
Hello,
I believe you'd need to make a separate python function, like this:
`import os
count = 0 for root_dir, cur_dir, files in os.walk(r'E:\account'): count += len(files)`
Now, instead of printing "count" you're gonna want to write that data into a separate txt file that is saved in your source documents so that your bot will read that value and out put it!
Remember, this is simply regurgitating information, from many documents, in an easy to read manner. It is not reasoning with the user.
So I discovered RetrievalQAWithSourcesChain
that does what I want. It has a different output_key ('answer' instead of 'result') but the usage is same. I was able to ask for document name, and it worked.