Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Path to the Google_Application_Credentials file
# Required to run the simulation API
GOOGLE_APPLICATION_CREDENTIALS=/path/to/policyengine_gcp_credentials.json

# Password for connecting to the PolicyEngine database
POLICYENGINE_DB_PASSWORD=policyengine_db_password

# Github Microdata Token
POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN=policyengine_github_token

# API key for Anthropic
ANTHROPIC_API_KEY=policyengine_anthropic_api_key

# API Key for OpenAI
OPENAI_API_KEY=policyengine_openai_api_key
Comment on lines +14 to +15

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Could you confirm if this is still used? I thought we had removed the code that needed this key.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the codebase, and OPENAI_API_KEY is still actively used in several files, including gpt4_api_user.py, export.py, Dockerfile, __init__.py, client.py, azure.py, METADATA, pr.yml, and push.yml.
For example, in gpt4_api_user.py it’s used like this:

# Point OpenAI to the API key
openai.api_key = os.environ["OPENAI_API_KEY"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. It does appear that it isn't used for the most part in prod, only in some old code that isn't run, but I can see value in including.


# Token for Hugging Face models
HUGGING_FACE_TOKEN=policyengine_huggingface_token
6 changes: 6 additions & 0 deletions .github/setup_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /usr/bin/env bash

if [ ! -f .env ];
then
cp .env.example .env
fi
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
install:
pip install -e ".[dev]" --config-settings editable_mode=compat
bash .github/setup_env.sh

debug:
FLASK_APP=policyengine_api.api FLASK_DEBUG=1 flask run --without-threads
Expand Down
5 changes: 5 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- bump: patch
changes:
added:
- Added `.env.example` file with all relevant environment variables and example values for local setup.
- Modified Makefile `install` target to auto-copy `.env.example` to `.env` if `.env` does not exist.
Loading