This directory contains the code for our paper. Content of different files:
api_keys.json
: API keys for OpenAI, Together.ai, and Googleutils.py
: Utility functionsapi_factory.py
: Code to create API objectsprompt_factory.py
: Prompts for the experimentsquery_llm.py
: Script to query the LLMparse_results.py
: Script to parse the results
To run the code, you need to set up API keys from OpenAI, Together.ai, and Google and put them in api_keys.json
.
You can then run the code with the following command:
python query_llm.py /path/to/domain_list.csv openai "gpt-4o-mini-2024-07-18" dem /path/to/output_dir
This will query the gpt-4o-mini-2024-07-18
model identified as a Democrat on the domains in domain_list.csv
and save the results in output_dir
.
together
openai
google-generativeai
tqdm
pandas
pydantic
json_repair
The code has been tested on Python 3.10.