MCPcopy Index your code
hub / github.com/microsoft/SkillOpt / build_training_env

Function build_training_env

skillopt_webui/app.py:72–96  ·  view source on GitHub ↗

Build the environment shared by preflight and the training subprocess.

()

Source from the content-addressed store, hash-verified

70
71
72def build_training_env() -> dict[str, str]:
73 """Build the environment shared by preflight and the training subprocess."""
74 env = os.environ.copy()
75 env["PYTHONUNBUFFERED"] = "1"
76
77 dot_env = PROJECT_ROOT / ".env"
78 if dot_env.is_file():
79 _load_env_file(dot_env, env)
80
81 secrets_dir = PROJECT_ROOT / ".secrets"
82 if secrets_dir.is_dir():
83 for env_file in sorted(secrets_dir.glob("*.env")):
84 _load_env_file(env_file, env)
85
86 # Propagate OPTIMIZER_* to base AZURE_OPENAI_* when base is missing,
87 # so target/default endpoints inherit from optimizer config.
88 for suffix in (
89 "ENDPOINT", "API_VERSION", "AUTH_MODE", "MANAGED_IDENTITY_CLIENT_ID",
90 "AD_SCOPE", "API_KEY",
91 ):
92 base_key = f"AZURE_OPENAI_{suffix}"
93 optimizer_key = f"OPTIMIZER_AZURE_OPENAI_{suffix}"
94 if not env.get(base_key) and env.get(optimizer_key):
95 env[base_key] = env[optimizer_key]
96 return env
97
98
99def validate_training_config(

Callers 1

startMethod · 0.85

Calls 2

_load_env_fileFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected