Nitish commited on
Commit
9e52d37
Β·
1 Parent(s): 309c392

fix(inference): handle empty env vars gracefully to prevent httpx crashes

Browse files
Files changed (1) hide show
  1. inference.py +4 -4
inference.py CHANGED
@@ -22,10 +22,10 @@ from openai import OpenAI
22
  load_dotenv()
23
 
24
  # ── Config ────────────────────────────────────────────────────────────────────
25
- API_BASE_URL = os.getenv("API_BASE_URL", "https://api.openai.com/v1")
26
- MODEL_NAME = os.getenv("MODEL_NAME", "gpt-4o-mini")
27
- HF_TOKEN = os.getenv("HF_TOKEN")
28
- ENV_URL = os.getenv("ENV_URL", "http://localhost:7860")
29
  BENCHMARK = "code-security-review"
30
 
31
  if not HF_TOKEN:
 
22
  load_dotenv()
23
 
24
  # ── Config ────────────────────────────────────────────────────────────────────
25
+ API_BASE_URL = os.getenv("API_BASE_URL") or "https://api.openai.com/v1"
26
+ MODEL_NAME = os.getenv("MODEL_NAME") or "gpt-4o-mini"
27
+ HF_TOKEN = os.getenv("HF_TOKEN") or os.getenv("API_KEY")
28
+ ENV_URL = os.getenv("ENV_URL") or "http://localhost:7860"
29
  BENCHMARK = "code-security-review"
30
 
31
  if not HF_TOKEN: