amanmurari commited on
Commit
c0598e8
·
verified ·
1 Parent(s): 2b08fb5

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. inference.py +6 -5
inference.py CHANGED
@@ -9,11 +9,12 @@ Mandatory env variables (injected by validator):
9
  Optional:
10
  SERVER_URL Running env server (default: http://localhost:8000)
11
 
12
- Run:
13
  API_BASE_URL=<url> API_KEY=<key> python inference.py
14
 
15
- IMPORTANT: Do not use fallback values for API_BASE_URL or API_KEY.
16
- The validator requires all API calls go through the LiteLLM proxy.
 
17
  """
18
 
19
  import os
@@ -50,9 +51,9 @@ except ImportError:
50
  # Configuration — read from env at import time (matches sample script pattern)
51
  # ---------------------------------------------------------------------------
52
 
53
- API_BASE_URL = os.environ.get("API_BASE_URL") or "https://router.huggingface.co/v1"
54
  MODEL_NAME = os.environ.get("MODEL_NAME") or "gpt-4.1-mini"
55
- API_KEY = os.environ.get("HF_TOKEN") or os.environ.get("API_KEY", "")
56
  SERVER_URL = os.environ.get("SERVER_URL", "http://localhost:8000")
57
 
58
  SEED = 42
 
9
  Optional:
10
  SERVER_URL Running env server (default: http://localhost:8000)
11
 
12
+ Usage:
13
  API_BASE_URL=<url> API_KEY=<key> python inference.py
14
 
15
+ CRITICAL: This script REQUIRES API_BASE_URL and API_KEY from environment.
16
+ No fallbacks or hardcoded values are used.
17
+ The validator injects these to route calls through LiteLLM proxy.
18
  """
19
 
20
  import os
 
51
  # Configuration — read from env at import time (matches sample script pattern)
52
  # ---------------------------------------------------------------------------
53
 
54
+ API_BASE_URL = os.environ["API_BASE_URL"]
55
  MODEL_NAME = os.environ.get("MODEL_NAME") or "gpt-4.1-mini"
56
+ API_KEY = os.environ["API_KEY"]
57
  SERVER_URL = os.environ.get("SERVER_URL", "http://localhost:8000")
58
 
59
  SEED = 42