Ask PDX is an implementation of retrieval-augmented generation (RAG) applied to Portland Oregon's Charter, City Code, and Policy documents.
To scrape the documents, run the following command:
python scrape_documents.py --sitemap 'pdx_charter_code_policies_urls.xml'
This will create a docs.pkl
and metadatas.pkl
in the current directory which we will be used to create embeddings in the next step.
We are using Open AI to create embeddings for the documents. Before we do we must first export our OpenAI API key as an environment variable.
export OPENAI_API_KEY=<your key here>
Then we can run the following command to create embeddings for the documents:
python create_embeddings.py
This will create a faiss_store.pkl
in the current directory which is used for retrieval when we ask questions.
To ask questions, run the following command:
python ask_question.py "Who becomes mayor if the mayor dies in office?"