add .env/.gitignore, fix logprobs test (pair with top_logprobs), load .env in test_devstral

This commit is contained in:
Jinx
2026-04-12 20:33:33 +00:00
parent b285ffc2d5
commit 808ad48d38
2 changed files with 13 additions and 2 deletions

View File

@@ -14,8 +14,18 @@ import time
import json
import httpx
from datetime import datetime
from pathlib import Path
# Load .env if present (don't hardcode keys)
_env_file = Path(__file__).parent / ".env"
if _env_file.exists():
for line in _env_file.read_text().splitlines():
line = line.strip()
if not line or line.startswith("#") or "=" not in line:
continue
k, v = line.split("=", 1)
os.environ.setdefault(k.strip(), v.strip())
# Point at the middleware, NOT SGLang directly
API_BASE = os.environ.get("DEVSTRAL_API_BASE", "http://127.0.0.1:8002/v1")
API_KEY = os.environ.get("DEVSTRAL_API_KEY", "whatever")
MODEL = os.environ.get("DEVSTRAL_MODEL", "mistralai/Devstral-2-123B-Instruct-2512")
@@ -325,7 +335,7 @@ def test_param_sweep():
("temperature", 0.7),
("seed", 42),
("stop", ["\n"]),
("logprobs", True),
("logprobs+top_logprobs", {"logprobs": True, "top_logprobs": 5}),
("top_logprobs", 5),
]