Skip to content

Commit ad1ee4a

Browse files
committed
addres comments
1 parent 310fb85 commit ad1ee4a

19 files changed

+38
-68
lines changed

.env.example

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# Fireworks AI Credentials (for interacting with the Fireworks platform)
66
# These are used by eval protocol to deploy evaluators to Fireworks, preview, etc.
77
FIREWORKS_API_KEY="your_fireworks_api_key_here"
8-
FIREWORKS_ACCOUNT_ID="your_fireworks_account_id_here" # e.g., "fireworks" or your specific account
98

109
# Optional: If targeting a non-production Fireworks API endpoint
1110
# FIREWORKS_API_BASE="https://dev.api.fireworks.ai"

development/CONTRIBUTING.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,11 @@ For a streamlined local development experience, especially when managing multipl
6666
cp .env.example .env.dev
6767
```
6868
2. **Populate `.env.dev`:**
69-
Open `.env.dev` and fill in the necessary environment variables, such as `FIREWORKS_API_KEY`, `FIREWORKS_ACCOUNT_ID`, and any other variables required for your development tasks (e.g., `E2B_API_KEY`).
69+
Open `.env.dev` and fill in the necessary environment variables, such as `FIREWORKS_API_KEY` and any other variables required for your development tasks (e.g., `E2B_API_KEY`).
7070

7171
Example content for `.env.dev`:
7272
```
7373
FIREWORKS_API_KEY="your_dev_fireworks_api_key"
74-
FIREWORKS_ACCOUNT_ID="abc"
7574
FIREWORKS_API_BASE="https://api.fireworks.ai"
7675
E2B_API_KEY="your_e2b_api_key"
7776
```
@@ -92,15 +91,12 @@ Set the following environment variables. For development, you might use specific
9291

9392
* `FIREWORKS_API_KEY`: Your Fireworks AI API key.
9493
* For development, you might use a specific dev key: `export FIREWORKS_API_KEY="your_dev_fireworks_api_key"`
95-
* `FIREWORKS_ACCOUNT_ID`: Your Fireworks AI Account ID. This is used to scope operations to your account.
96-
* For development against a shared dev environment, this might be a common ID like `pyroworks-dev`: `export FIREWORKS_ACCOUNT_ID="pyroworks-dev"`
9794
* `FIREWORKS_API_BASE`: (Optional) If you need to target a non-production Fireworks API endpoint.
9895
* For development: `export FIREWORKS_API_BASE="https://dev.api.fireworks.ai"`
9996

10097
Example for a typical development setup:
10198
```bash
10299
export FIREWORKS_API_KEY="your_development_api_key"
103-
export FIREWORKS_ACCOUNT_ID="pyroworks-dev" # Or your specific dev account ID
104100
export FIREWORKS_API_BASE="https://dev.api.fireworks.ai" # If targeting dev API
105101
```
106102

@@ -110,11 +106,10 @@ Eval Protocol does not read `~/.fireworks/auth.ini` (or any firectl profiles). U
110106

111107
**Credential Sourcing Order:**
112108
Eval Protocol prioritizes credentials as follows:
113-
1. Environment Variables (`FIREWORKS_API_KEY`, optional `FIREWORKS_ACCOUNT_ID`)
109+
1. Environment Variables (`FIREWORKS_API_KEY`)
114110

115111
**Purpose of Credentials:**
116112
* `FIREWORKS_API_KEY`: Authenticates your requests to the Fireworks AI service.
117-
* `FIREWORKS_ACCOUNT_ID`: Identifies your account for operations like managing evaluators. Typically this is derived automatically from `FIREWORKS_API_KEY` via the `verifyApiKey` endpoint.
118113
* `FIREWORKS_API_BASE`: Allows targeting different API environments (e.g., development, staging).
119114

120115
**Other Environment Variables:**
@@ -490,11 +485,8 @@ This is perfect for development, webhook testing, or making your reward function
490485
If you encounter authentication issues:
491486
492487
1. **Check Credential Sources**:
493-
* Verify that `FIREWORKS_API_KEY` and `FIREWORKS_ACCOUNT_ID` are correctly set as environment variables.
494-
* If not using environment variables, ensure `~/.fireworks/auth.ini` exists, is correctly formatted, and contains the right `api_key` and `account_id` under the `[fireworks]` section.
495-
* Remember the priority: environment variables override the `auth.ini` file.
488+
* Verify that `FIREWORKS_API_KEY` is correctly set as an environment variable.
496489
2. **Verify API Key Permissions**: Ensure the API key has the necessary permissions for the operations you are attempting.
497-
3. **Check Account ID**: Confirm that the `FIREWORKS_ACCOUNT_ID` is correct for the environment you are targeting (e.g., `pyroworks-dev` for the dev API, or your personal account ID).
498490
4. **API Base URL**: If using `FIREWORKS_API_BASE`, ensure it points to the correct API endpoint (e.g., `https://dev.api.fireworks.ai` for development).
499491
500492
You can use the following snippet to check what credentials Eval Protocol is resolving:

development/CORE_STRATEGY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ This roadmap outlines the development priorities. Tasks within each phase can be
5252
* [ ] **Docstring Checking:** Enable and enforce docstring checking.
5353
* **P1.5: Authentication System Refactor:**
5454
* [ ] **Centralize Logic:** Create `eval_protocol/auth.py`.
55-
* [ ] **Configuration Methods:** Support environment variables and `auth.ini`.
56-
* [ ] **Documentation:** Clearly document `FIREWORKS_ACCOUNT_ID` usage and auth setup.
55+
* [ ] **Configuration Methods:** Support `FIREWORKS_API_KEY` (environment variable) as the single source of truth.
56+
* [ ] **Documentation:** Clearly document API-key-based auth and account id derivation.
5757
* [ ] **Codebase Update:** Refactor `eval_protocol/evaluation.py` etc. to use new auth module.
5858
* **P1.6: Build, Packaging, and Basic CI:**
5959
* [ ] **`setup.py` Review:** Evaluate `openai` pinning, clean `extras_require`, populate `long_description`.

development/record_replay_testing_handoff.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ PORT=8001 python simulation_server.py --port 8001
101101
### Environment Variables
102102
```bash
103103
export FIREWORKS_API_KEY="your_dev_fireworks_api_key"
104-
export FIREWORKS_ACCOUNT_ID="your_account_id"
105104
export EP_PLAYBACK_FILE="/path/to/recording.jsonl" # For playback mode
106105
```
107106

docs/cli_reference/cli_overview.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ The CLI recognizes the following environment variables:
329329

330330
- `FIREWORKS_API_KEY`: Your Fireworks API key (required for deployment operations)
331331
- `FIREWORKS_API_BASE`: Base URL for the Fireworks API (defaults to `https://api.fireworks.ai`)
332-
- `FIREWORKS_ACCOUNT_ID`: Your Fireworks account ID (optional; typically derived automatically from `FIREWORKS_API_KEY`)
333332
- `MODEL_AGENT`: Default agent model to use (e.g., "openai/gpt-4o-mini")
334333
- `MODEL_SIM`: Default simulation model to use (e.g., "openai/gpt-3.5-turbo")
335334

eval_protocol/auth.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,21 @@ def get_fireworks_account_id() -> Optional[str]:
2626
"""
2727
Retrieves the Fireworks Account ID.
2828
29-
The Account ID is sourced in the following order:
30-
1. FIREWORKS_ACCOUNT_ID environment variable.
31-
2. If an API key is available (env), resolve via verifyApiKey.
32-
3329
Returns:
3430
The Account ID if found, otherwise None.
3531
"""
36-
account_id = os.environ.get("FIREWORKS_ACCOUNT_ID")
37-
if account_id and account_id.strip():
38-
logger.debug("Using FIREWORKS_ACCOUNT_ID from environment variable.")
39-
return account_id.strip()
40-
41-
# Fallback: if API key is present, attempt to resolve via verifyApiKey (env)
32+
# Account id is derived from the API key (single source of truth).
4233
try:
4334
api_key_for_verify = get_fireworks_api_key()
4435
if api_key_for_verify:
4536
resolved = verify_api_key_and_get_account_id(api_key=api_key_for_verify, api_base=get_fireworks_api_base())
4637
if resolved:
47-
logger.debug("Using FIREWORKS_ACCOUNT_ID resolved via verifyApiKey: %s", resolved)
38+
logger.debug("Resolved account id via verifyApiKey: %s", resolved)
4839
return resolved
4940
except Exception as e:
50-
logger.debug("Failed to resolve FIREWORKS_ACCOUNT_ID via verifyApiKey: %s", e)
41+
logger.debug("Failed to resolve account id via verifyApiKey: %s", e)
5142

52-
logger.debug("Fireworks Account ID not found in environment variables or via verifyApiKey.")
43+
logger.debug("Fireworks Account ID not found via verifyApiKey.")
5344
return None
5445

5546

@@ -107,7 +98,7 @@ def verify_api_key_and_get_account_id(
10798
# Header keys could vary in case; requests provides case-insensitive dict
10899
account_id = resp.headers.get("x-fireworks-account-id") or resp.headers.get("X-Fireworks-Account-Id")
109100
if account_id and account_id.strip():
110-
logger.debug("Resolved FIREWORKS_ACCOUNT_ID via verifyApiKey: %s", account_id)
101+
logger.debug("Resolved account id via verifyApiKey: %s", account_id)
111102
return account_id.strip()
112103
return None
113104
except Exception as e:

eval_protocol/cli_commands/create_rft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ def create_rft_command(args) -> int:
753753

754754
account_id = _ensure_account_id()
755755
if not account_id:
756-
print("Error: FIREWORKS_ACCOUNT_ID not set and could not be resolved.")
756+
print("Error: Could not resolve Fireworks account id from FIREWORKS_API_KEY.")
757757
return 1
758758

759759
api_base = get_fireworks_api_base()

eval_protocol/cli_commands/utils.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -396,20 +396,11 @@ def _normalize_evaluator_id(evaluator_id: str) -> str:
396396

397397

398398
def _ensure_account_id() -> Optional[str]:
399-
"""Resolve and cache FIREWORKS_ACCOUNT_ID if possible."""
400-
account_id = os.environ.get("FIREWORKS_ACCOUNT_ID")
401-
if account_id and account_id.strip():
402-
return account_id.strip()
403-
399+
"""Resolve Fireworks account id from FIREWORKS_API_KEY via verifyApiKey."""
404400
api_key = get_fireworks_api_key()
405401
if not api_key:
406402
return None
407-
408-
resolved = verify_api_key_and_get_account_id(api_key=api_key, api_base=get_fireworks_api_base())
409-
if resolved:
410-
os.environ["FIREWORKS_ACCOUNT_ID"] = resolved
411-
return resolved
412-
return None
403+
return verify_api_key_and_get_account_id(api_key=api_key, api_base=get_fireworks_api_base())
413404

414405

415406
def _extract_terminal_segment(resource_name: str) -> str:

eval_protocol/platform_api.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,23 +302,22 @@ def delete_fireworks_secret(
302302

303303
# These should be set in your .env.dev, .env file (or shell environment) for this test to run
304304
# FIREWORKS_API_KEY="your_fireworks_api_key"
305-
# FIREWORKS_ACCOUNT_ID="your_fireworks_account_id"
306305
# FIREWORKS_API_BASE="https://api.fireworks.ai" # or your dev/staging endpoint
307306

308307
test_account_id = get_fireworks_account_id()
309308
test_api_key = get_fireworks_api_key() # Not passed directly, functions will resolve
310309
test_api_base = get_fireworks_api_base()
311310

312311
logger.info("Attempting to use the following configuration for testing Fireworks secrets API:")
313-
logger.info(f" Resolved FIREWORKS_ACCOUNT_ID: {test_account_id}")
312+
logger.info(f" Resolved account id (derived from API key): {test_account_id}")
314313
logger.info(f" Resolved FIREWORKS_API_BASE: {test_api_base}")
315314
logger.info(
316315
f" Resolved FIREWORKS_API_KEY: {'********' + test_api_key[-4:] if test_api_key and len(test_api_key) > 4 else 'Not set or too short'}"
317316
)
318317

319318
if not test_account_id or not test_api_key or not test_api_base:
320319
logger.error(
321-
"CRITICAL: FIREWORKS_ACCOUNT_ID, FIREWORKS_API_KEY, and FIREWORKS_API_BASE must be correctly set in environment or .env file to run this test."
320+
"CRITICAL: FIREWORKS_API_KEY and FIREWORKS_API_BASE must be correctly set in environment or .env file to run this test."
322321
)
323322
import sys # Make sure sys is imported if using sys.exit
324323

examples/metrics/llm_resource_example/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ This example demonstrates how to use an LLM as a judge within the reward functio
2121
```bash
2222
# Set your Fireworks API key
2323
export FIREWORKS_API_KEY=your_api_key_here
24-
export FIREWORKS_ACCOUNT_ID=pyroworks
2524
```
2625

2726
## Running the Example
2827

2928
```bash
3029
# Run evaluation using the configuration file
31-
FIREWORKS_ACCOUNT_ID=pyroworks eval-protocol run --config-path conf --config-name simple_llm_judge_eval
30+
eval-protocol run --config-path conf --config-name simple_llm_judge_eval
3231
```
3332

3433
## Configuration

0 commit comments

Comments
 (0)