private-gpt icon indicating copy to clipboard operation
private-gpt copied to clipboard

[Question] How to ask about the documents' themselves (eg. Number of docs)

Open nb-programmer opened this issue 1 year ago • 1 comments

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?

nb-programmer avatar Jun 13 '23 17:06 nb-programmer

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.

CarmichaelAJ avatar Jun 20 '23 01:06 CarmichaelAJ

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.

nb-programmer avatar Jul 01 '23 15:07 nb-programmer