Experimenting with langchain document QA with a set of PDFs.
Code adapted from https://github.com/hwchase17/notion-qa
First install the requirements with pip install -r requeriments.txt
. Also set your OPENAI_API_KEY
environment variable or add openai_api_key='your API key here'
to the code just after temperature=0
in woolsey.py
.
- Place your PDFs in the docs folder.
- Run
python ingest_data.py
. - Run
python woolsey.py "Your question here"
- To minimize expenses, this code employs an embedding model from HuggingFace defined in the langchain code instead of OpenAI's ada embedding. Although this particular model is only compatible with English, the model available at this link should support multiple languages.
- I also decreased the chunk size to 1000 from 1500 in the original repo as it made sense for my use case.