From 8bf0d70fecb78c5c9b6577daac744cfa4c0db3e7 Mon Sep 17 00:00:00 2001 From: Lavish Saluja Date: Sun, 17 Nov 2024 21:49:42 +0530 Subject: [PATCH 1/5] docs: improve env config and clarify OpenAI dependency --- .env.example | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..e33e9130 --- /dev/null +++ b/.env.example @@ -0,0 +1,29 @@ +# 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=/path/to/cache/directory + +# Viewer Configuration +# Settings for the Curator Dataset Viewer +# Note: These are primarily set via command-line arguments: +# curator-viewer --host xxx --port xxx +# These environment variables are used as fallbacks if not specified via CLI +HOST=127.0.0.1 +PORT=3000 From 9a9605cad8024650149b7fb8859db9659801a522 Mon Sep 17 00:00:00 2001 From: Lavish Saluja Date: Mon, 18 Nov 2024 23:18:28 +0530 Subject: [PATCH 2/5] removed viewer configs to avoid confusion and removed curator default path to avoid over-riding --- .env.example | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.env.example b/.env.example index e33e9130..e16b7f25 100644 --- a/.env.example +++ b/.env.example @@ -18,12 +18,4 @@ OPENAI_API_KEY=sk-your-key-here # 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=/path/to/cache/directory - -# Viewer Configuration -# Settings for the Curator Dataset Viewer -# Note: These are primarily set via command-line arguments: -# curator-viewer --host xxx --port xxx -# These environment variables are used as fallbacks if not specified via CLI -HOST=127.0.0.1 -PORT=3000 +CURATOR_CACHE_DIR= From 266cfc12b1e1d292582e8271f8beee38537319a7 Mon Sep 17 00:00:00 2001 From: Lavish Saluja Date: Mon, 18 Nov 2024 23:52:20 +0530 Subject: [PATCH 3/5] handling set values for env variable in prompter file --- src/bespokelabs/curator/prompter/prompter.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 From 0c892e60d74ed57fcb6bdac34ec8985280d1e858 Mon Sep 17 00:00:00 2001 From: Lavish Saluja Date: Tue, 19 Nov 2024 04:42:26 +0530 Subject: [PATCH 4/5] docs: add collapsible development section with env config details --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 92c080df..5d1d24cb 100644 --- a/README.md +++ b/README.md @@ -133,4 +133,20 @@ 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 +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. + +
From a27c14c835314d6e2e377aafe2c6d93a8d49511b Mon Sep 17 00:00:00 2001 From: Lavish Saluja Date: Tue, 19 Nov 2024 16:02:16 +0530 Subject: [PATCH 5/5] docs: improve README Development section formatting with collapsible env setup --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5d1d24cb..3fdfd9fd 100644 --- a/README.md +++ b/README.md @@ -136,10 +136,11 @@ npm -v # should print `10.9.0` ``` +## Development +
-

Development

+

Environment Setup with .env file

-### Environment Setup Copy `.env.example` to create your `.env` file: ```bash cp .env.example .env