1111from eval_protocol .directory_utils import find_eval_protocol_dir
1212from eval_protocol .models import EvaluationRow
1313from eval_protocol .pytest .store_experiment_link import store_experiment_link
14+ from eval_protocol .auth import (
15+ get_fireworks_api_key ,
16+ get_fireworks_account_id ,
17+ verify_api_key_and_get_account_id ,
18+ get_fireworks_api_base ,
19+ )
1420
1521import requests
1622
@@ -90,22 +96,16 @@ def handle_persist_flow(all_results: list[list[EvaluationRow]], test_func_name:
9096 if not should_upload :
9197 continue
9298
93- def get_auth_value (key : str ) -> str | None :
94- """Get auth value from config file or environment."""
99+ # Resolve credentials using centralized auth helpers with verification fallback
100+ fireworks_api_key = get_fireworks_api_key ()
101+ fireworks_account_id = get_fireworks_account_id ()
102+ if not fireworks_account_id and fireworks_api_key :
95103 try :
96- config_path = Path .home () / ".fireworks" / "auth.ini"
97- if config_path .exists ():
98- config = configparser .ConfigParser () # noqa: F821
99- config .read (config_path )
100- for section in ["DEFAULT" , "auth" ]:
101- if config .has_section (section ) and config .has_option (section , key ):
102- return config .get (section , key )
104+ fireworks_account_id = verify_api_key_and_get_account_id (
105+ api_key = fireworks_api_key , api_base = get_fireworks_api_base ()
106+ )
103107 except Exception :
104- pass
105- return os .getenv (key )
106-
107- fireworks_api_key = get_auth_value ("FIREWORKS_API_KEY" )
108- fireworks_account_id = get_auth_value ("FIREWORKS_ACCOUNT_ID" )
108+ fireworks_account_id = None
109109
110110 if not fireworks_api_key and not fireworks_account_id :
111111 store_experiment_link (
@@ -129,7 +129,7 @@ def get_auth_value(key: str) -> str | None:
129129 )
130130 continue
131131
132- api_base = "https://api.fireworks.ai"
132+ api_base = get_fireworks_api_base ()
133133 headers = {
134134 "Authorization" : f"Bearer { fireworks_api_key } " ,
135135 "Content-Type" : "application/json" ,
0 commit comments