1313import dreadnode as dn
1414import litellm
1515import rigging as rg
16+ from dotenv import load_dotenv
1617from loguru import logger
1718
1819from airtbench .container import build_container
4445class AIRTBenchArgs :
4546 model : str
4647 """Model to use for inference"""
47- platform_api_key : str
48+ platform_api_key : str | None = None
4849 """Platform API key"""
4950 include_thoughts : bool = False
5051 """Include thoughts in the reasoning"""
@@ -691,6 +692,17 @@ async def main(
691692 dn_args : DreadnodeArgs
692693 | None = None , # Has to be None even though not interior fields are required
693694) -> None :
695+ # Load environment variables from .env file
696+ load_dotenv ()
697+
698+ # Set platform_api_key from environment if not provided via command line
699+ if not args .platform_api_key :
700+ args .platform_api_key = os .environ .get ("PLATFORM_API_KEY" ) or os .environ .get ("DREADNODE_API_TOKEN" )
701+
702+ if not args .platform_api_key :
703+ logger .error ("Platform API key is required. Set it via --platform-api-key or PLATFORM_API_KEY environment variable." )
704+ return
705+
694706 dn_args = dn_args or DreadnodeArgs ()
695707 dn .configure (
696708 server = dn_args .server ,
@@ -709,12 +721,18 @@ async def main(
709721 logger .info ("API key validated successfully" )
710722
711723 # Build the container
712- image = build_container (
713- "airtbench" ,
714- g_container_dir / "Dockerfile" ,
715- g_container_dir ,
716- memory_limit = args .memory_limit ,
717- )
724+ try :
725+ image = build_container (
726+ "airtbench" ,
727+ g_container_dir / "Dockerfile" ,
728+ g_container_dir ,
729+ memory_limit = args .memory_limit ,
730+ )
731+ except RuntimeError as e :
732+ if "Docker connection failed" in str (e ):
733+ logger .error ("Cannot proceed without Docker. Please start Docker and try again." )
734+ return
735+ raise
718736
719737 challenges = load_challenges ()
720738
0 commit comments