Skip to content

Commit eadaef5

Browse files
committed
Fix experiment env loading and GLM model list
1 parent 557e613 commit eadaef5

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

scripts/experiment_multi_model_extraction.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,26 +103,31 @@
103103
"openai/gpt-4o-mini": {"provider": "openrouter", "in": 0.15, "out": 0.60, "label": "GPT-4o-mini"},
104104
"meta-llama/llama-3.3-70b-instruct": {"provider": "openrouter", "in": 0.13, "out": 0.40, "label": "Llama 3.3 70B"},
105105
# Elysiver-hosted GLM — user-paid endpoint, quota-limited, treat cost as $0 to us
106+
"glm-5.1": {"provider": "elysiver", "in": 0.0, "out": 0.0, "label": "GLM-5.1 (elysiver)"},
106107
"glm-5": {"provider": "elysiver", "in": 0.0, "out": 0.0, "label": "GLM-5 (elysiver)"},
107108
"glm-4.6": {"provider": "elysiver", "in": 0.0, "out": 0.0, "label": "GLM-4.6 (elysiver)"},
108109
}
109110

110111

111112
def load_env_file(path: Path = None) -> None:
112-
"""Minimal .env loader — only sets env vars not already present."""
113-
if path is None:
114-
path = REPO_ROOT / ".env"
115-
if not path.exists():
116-
return
117-
for line in path.read_text(encoding="utf-8").splitlines():
118-
line = line.strip()
119-
if not line or line.startswith("#") or "=" not in line:
113+
"""Minimal env loader — only sets vars not already present.
114+
115+
Repo convention uses `.env.local` for local secrets, so load that first
116+
and fall back to `.env` if present.
117+
"""
118+
paths = [path] if path is not None else [REPO_ROOT / ".env.local", REPO_ROOT / ".env"]
119+
for candidate in paths:
120+
if not candidate.exists():
120121
continue
121-
k, _, v = line.partition("=")
122-
k = k.strip()
123-
v = v.strip().strip('"').strip("'")
124-
if k and k not in os.environ:
125-
os.environ[k] = v
122+
for line in candidate.read_text(encoding="utf-8").splitlines():
123+
line = line.strip()
124+
if not line or line.startswith("#") or "=" not in line:
125+
continue
126+
k, _, v = line.partition("=")
127+
k = k.strip()
128+
v = v.strip().strip('"').strip("'")
129+
if k and k not in os.environ:
130+
os.environ[k] = v
126131

127132

128133
def load_api_key_for(provider: str) -> str:

0 commit comments

Comments
 (0)