diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..e16b7f25 --- /dev/null +++ b/.env.example @@ -0,0 +1,21 @@ +# Bespoke Labs Curator Environment Configuration + +####################### +# Required Settings +####################### + +# OpenAI API Key +# Currently required as OpenAI is the only supported LLM provider +# Support for other providers (Claude, etc.) may be added in the future +# Get your key from: https://platform.openai.com/api-keys +OPENAI_API_KEY=sk-your-key-here + +####################### +# Optional Settings +####################### + +# Cache Directory +# Location where Curator stores its cache files +# Default: ~/.curator +# Note: This can also be set via the working_dir parameter in code +CURATOR_CACHE_DIR= diff --git a/README.md b/README.md index 92c080df..3fdfd9fd 100644 --- a/README.md +++ b/README.md @@ -133,4 +133,21 @@ nvm install 22 node -v # should print `v22.11.0` # verifies the right npm version is in the environment npm -v # should print `10.9.0` + +``` + +## Development + +
+

Environment Setup with .env file

+ +Copy `.env.example` to create your `.env` file: +```bash +cp .env.example .env ``` + +Available environment variables: +- `OPENAI_API_KEY`: (Required) Your OpenAI API key for language model requests +- `CURATOR_CACHE_DIR`: (Optional) Custom cache directory, defaults to `~/.cache/curator`. Used to store datasets, model responses, and metadata for caching and viewer functionality. + +
diff --git a/src/bespokelabs/curator/prompter/prompter.py b/src/bespokelabs/curator/prompter/prompter.py index 63710b28..d88ca555 100644 --- a/src/bespokelabs/curator/prompter/prompter.py +++ b/src/bespokelabs/curator/prompter/prompter.py @@ -140,12 +140,12 @@ def _completions( if self is None: raise ValueError("Prompter must be provided") - + if working_dir is None: - curator_cache_dir = os.environ.get( - "CURATOR_CACHE_DIR", - os.path.expanduser(_CURATOR_DEFAULT_CACHE_DIR), - ) + # First check if CURATOR_CACHE_DIR is set and non-empty + curator_cache_dir = os.environ.get("CURATOR_CACHE_DIR", "") + if not curator_cache_dir: # If empty or not set + curator_cache_dir = os.path.expanduser(_CURATOR_DEFAULT_CACHE_DIR) else: curator_cache_dir = working_dir