Spaces:
Running
Running
feat: add baseline scores JSON and update inference.py for hackathon spec compliance
Browse filesFiles changed (3)
- baseline_scores_heuristic.jsonAdded+58
- go.sumAdded
- python/inference.py+12-3
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758{ "model": "meta-llama/llama-3.3-70b-instruct:free", "api_base": "https://openrouter.ai/api/v1", "episodes_per_task": 1, "seed_base": 1000, "fast_mode": true, "llm_every": 4, "max_steps": null, "task_averages": { "1": 0.708, "2": 0.6328, "3": 0.5983 }, "overall_average": 0.6463666666666666, "all_results": [ { "task_id": 1, "seed": 1100, "total_reward": 246.42219784256966, "total_steps": 94, "elapsed_sec": 1.5613129138946533, "score": 0.708, "sub_scores": { "cost": 0.7079636116620143 }, "exploit_detected": false }, { "task_id": 2, "seed": 1200, "total_reward": 242.81120610868118, "total_steps": 95, "elapsed_sec": 1.594855785369873, "score": 0.6328, "sub_scores": { "cost": 0.7005224090103834, "temperature": 0.53125 }, "exploit_detected": false }, { "task_id": 3, "seed": 1300, "total_reward": 251.7133773862143, "total_steps": 94, "elapsed_sec": 1.6321852207183838, "score": 0.5983, "sub_scores": { "batch_deadline": 1, "carbon": 0.6563888726735232, "cost": 0.6695079035324871, "grid_response": 0.21428571428571427, "temperature": 0.5833333333333334 }, "exploit_detected": false } ]}46 unmodified lines47484950505152535455565257585960616287 unmodified lines15015115215315415515614815715815916046 unmodified linesENV_URL = os.getenv("ENV_URL", "http://localhost:7860")MODEL_NAME = os.getenv("MODEL_NAME", "meta-llama/llama-3.3-70b-instruct:free")API_BASE_URL = os.getenv("API_BASE_URL", "https://openrouter.ai/api/v1")# Hackathon spec: HF_TOKEN is mandatory. Accept OPENAI_API_KEY as secondary fallback for dev.
# ── Hackathon Spec Compliance: HF_TOKEN → OpenAI API Key ──────────────────# Per hackathon spec, the LLM API credential is read from HF_TOKEN environment variable# and passed directly to the OpenAI client for initialization.# Primary: HF_TOKEN (hackathon spec requirement)# Fallback: OPENAI_API_KEY (for local testing/development)HF_TOKEN = os.getenv("HF_TOKEN")OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "") or HF_TOKEN or ""OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") or HF_TOKENif not OPENAI_API_KEY: raise ValueError("HF_TOKEN or OPENAI_API_KEY environment variable is required")DEFAULT_EPISODES = 1DEFAULT_SEED_BASE = 1000MAX_RETRIES = 387 unmodified lines """OpenAI-compatible LLM agent that chooses actions given observations."""
def __init__(self): # Initialize OpenAI client with credentials from HF_TOKEN (per hackathon spec) # The OPENAI_API_KEY variable contains the HF_TOKEN value passed by evaluators self.client = OpenAI( base_url=API_BASE_URL, api_key=OPENAI_API_KEY if OPENAI_API_KEY else "none", api_key=OPENAI_API_KEY, ) self.model = MODEL_NAME self.fallback_mode = Falsebaseline_scores_heuristic.jsonAdded+58
go.sumAdded
python/inference.py+12-3