Work done during the DMI project on LLM classifiers for conflict and dialogue monitoring
To get started with the project, please follow the steps below:
Install pyenv by following the instructions provided in the official pyenv installation guide. Once pyenv is installed, open a new terminal session or restart your current session.
You will then need to install the current version of python for the project. Open a terminal and navigate to the root directory of the project.
pyenv install
Once this is complete check the version:
cat .python-version
python --version
You should see the same python version printed twice.
Open a terminal and navigate to the root directory of the project.
Run the following command to create a new Python virtual environment:
python -m venv .venv
This command will create a new directory named .venv in the project's root directory, which will contain all the necessary files for the virtual environment.
Activate the virtual environment:
On macOS and Linux:
source .venv/bin/activate
On Windows:
.venv\Scripts\activate
After activation, you should see (.venv) prefix in your terminal, indicating that the virtual environment is active.
Ensure that you have activated the virtual environment as instructed in Step 2.
Install the project dependencies by running the following command in your terminal:
pip install -r requirements.txt
pip install -e .
This command will install all the required Python packages specified in the requirements.txt file located in the project's root directory. As well as the source code.
API keys. You will need an account.
With a code editor add you key to .env
file so that the file looks like:
export OPENAI_API_KEY="<YOUR_API_KEY>"
In your terminal source the environment variables:
source .env
Congratulations! You have successfully set up the Python environment, created a virtual environment, and installed the project dependencies.
Additional Resources Python Virtual Environments pip - The Python Package Installer pyenv - Simple Python version management
Once you have done the "Getting Started" instructions you can start a new session in your terminal with the commands:
source .venv/bin/activate
source .env
jupyter-lab
The example notebook: notebooks/chat_completion_for_each_row.ipynb
can be found using the
left menu. If you run the notebook it will output a new file called
workspace/buildup_christianity_usa/output.csv
.
Change the parameters and workspace files as needed.