savetrees commited on
Commit
6d27db5
·
verified ·
1 Parent(s): 97ce507

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. inference.py +7 -4
inference.py CHANGED
@@ -20,7 +20,10 @@ from openai import OpenAI
20
  # ----- Required Hackathon Variables -----
21
  API_BASE_URL = os.getenv("API_BASE_URL", "https://api.openai.com/v1")
22
  MODEL_NAME = os.getenv("MODEL_NAME", "gpt-4o-mini")
23
- API_KEY = os.getenv("HF_TOKEN") or os.getenv("API_KEY") or os.getenv("OPENAI_API_KEY")
 
 
 
24
 
25
  ENV_URL = os.getenv("BUG_TRIAGE_ENV_URL", "http://localhost:8000")
26
  BENCHMARK = "bug_triage_openenv"
@@ -131,11 +134,11 @@ def get_model_action(client: OpenAI, user_prompt: str, task_id: str) -> str:
131
  # ----- Main Entry Point -----
132
 
133
  def main() -> None:
134
- if not API_KEY:
135
- print("ERROR: HF_TOKEN / API_KEY environment variable is not set.", file=sys.stderr)
136
  sys.exit(1)
137
 
138
- client = OpenAI(base_url=API_BASE_URL, api_key=API_KEY)
139
 
140
  # Verify the environment server is reachable
141
  try:
 
20
  # ----- Required Hackathon Variables -----
21
  API_BASE_URL = os.getenv("API_BASE_URL", "https://api.openai.com/v1")
22
  MODEL_NAME = os.getenv("MODEL_NAME", "gpt-4o-mini")
23
+ HF_TOKEN = os.getenv("HF_TOKEN")
24
+
25
+ # Optional - if you use from_docker_image():
26
+ LOCAL_IMAGE_NAME = os.getenv("LOCAL_IMAGE_NAME")
27
 
28
  ENV_URL = os.getenv("BUG_TRIAGE_ENV_URL", "http://localhost:8000")
29
  BENCHMARK = "bug_triage_openenv"
 
134
  # ----- Main Entry Point -----
135
 
136
  def main() -> None:
137
+ if not HF_TOKEN:
138
+ print("ERROR: HF_TOKEN environment variable is not set.", file=sys.stderr)
139
  sys.exit(1)
140
 
141
+ client = OpenAI(base_url=API_BASE_URL, api_key=HF_TOKEN)
142
 
143
  # Verify the environment server is reachable
144
  try: