diff --git a/atroposlib/envs/base.py b/atroposlib/envs/base.py index 38b5965f..99a8c4e9 100644 --- a/atroposlib/envs/base.py +++ b/atroposlib/envs/base.py @@ -211,6 +211,8 @@ class BaseEnvConfig(BaseModel): "no thinking prompt is injected. Use HERMES_REASONING_PROMPT from " "eval_helpers for the standard Hermes reasoning prompt.", ) + + class BaseEnv(ABC): name: Optional[str] = None env_config_cls: BaseEnvConfig = BaseEnvConfig @@ -1436,13 +1438,13 @@ class BaseEnv(ABC): cli_passed_flags, openai_full_prefix ) # CLI args yaml_oai_config = yaml_config.get(OPENAI_NAMESPACE, {}) - + # Debug logging for CLI args print(f"[CLI DEBUG] cli_passed_flags = {cli_passed_flags}") print(f"[CLI DEBUG] openai_full_prefix = {openai_full_prefix}") print(f"[CLI DEBUG] oai_cli_passed_args = {oai_cli_passed_args}") print(f"[CLI DEBUG] yaml_oai_config = {yaml_oai_config}") - + # Auto-convert ServerBaseline to APIServerConfig when CLI/YAML overrides are provided # This allows any environment to use --openai.* CLI args without modifying config_init # Use a new variable to avoid UnboundLocalError from closure scoping @@ -1456,7 +1458,7 @@ class BaseEnv(ABC): logger.info( "Auto-converted ServerBaseline to APIServerConfig for CLI/YAML overrides" ) - + if ( isinstance(effective_server_configs, list) and len(effective_server_configs) == 1 @@ -1470,13 +1472,17 @@ class BaseEnv(ABC): if isinstance(default_openai_config_, APIServerConfig) and isinstance( yaml_oai_config, dict ): - print(f"[CLI DEBUG] default_openai_config_.model_dump() = {default_openai_config_.model_dump()}") + print( + f"[CLI DEBUG] default_openai_config_.model_dump() = {default_openai_config_.model_dump()}" + ) openai_config_dict = merge_dicts( default_openai_config_.model_dump(), # Default APIServerConfig (or from class init) yaml_oai_config, oai_cli_passed_args, ) - print(f"[CLI DEBUG] openai_config_dict after merge = {openai_config_dict}") + print( + f"[CLI DEBUG] openai_config_dict after merge = {openai_config_dict}" + ) else: print( "[CLI DEBUG] Not merging: default_openai_config_ " diff --git a/atroposlib/envs/server_handling/openai_server.py b/atroposlib/envs/server_handling/openai_server.py index 24582273..fecc5828 100644 --- a/atroposlib/envs/server_handling/openai_server.py +++ b/atroposlib/envs/server_handling/openai_server.py @@ -200,7 +200,9 @@ def resolve_openai_configs( ) from e elif isinstance(default_server_configs, APIServerConfig): # Check APIServerConfig BEFORE ServerBaseline since APIServerConfig inherits from ServerBaseline - logger.info("Using single OpenAI server configuration based on merged settings (default/YAML/CLI).") + logger.info( + "Using single OpenAI server configuration based on merged settings (default/YAML/CLI)." + ) try: final_openai_config = APIServerConfig(**openai_config_dict) except Exception as e: