In order to set your environment up to run the code here, first install all requirements:
pip install -r requirements.txtThis repo uses a Constitution of USA as an example.
Put any and all of your .txt, .pdf, or .csv files into the SOURCE_DOCUMENTS directory in the load_documents() function, replace the docs_path with the absolute path of your source_documents directory.
Run the following command to ingest all the data.
python ingest.pyIt will create an index containing the local vectorstore. Will take time, depending on the size of your documents.
You can ingest as many documents as you want, and all will be accumulated in the local embeddings database.
If you want to start from an empty database, delete the index.
Note: When you run this for the first time, it will download take time as it has to download the embedding model. In the subseqeunt runs, no data will leave your local enviroment and can be run without internet connection.
In order to ask a question, run a command like:
python run_localLLM.pyAnd wait for the script to require your input.
> Enter a query:Hit enter. Wait while the LLM model consumes the prompt and prepares the answer. Once done, it will print the answer and the 4 sources it used as context from your documents; you can then ask another question without re-running the script, just wait for the prompt again.
Note: When you run this for the first time, it will need internet connection to download the vicuna-7B model. After that you can turn off your internet connection, and the script inference would still work. No data gets out of your local environment.
Type exit to finish the script.
To use this software, you must have Python 3.10 or later installed. Earlier versions of Python will not compile.