config: read load_settings after Settings
Keeps the module's reading order top-down: constants, the settings model, then the front-door construction helper that builds it.
This commit is contained in:
1 parent
5bd2b610da
commit
4946343700
1 file changed
+13
-13
+13
-13
@@ -37,19 +37,6 @@ LOCAL_VLM_MODEL = "local:Qwen3-VL-4B-Instruct"
|
||||
HOSTED_VLM_MODEL = "deepseek:deepseek-flash"
|
||||
|
||||
|
||||
def load_settings(**profile_overrides: Any) -> Settings:
|
||||
"""Construct the runtime settings once, at a front door's entry point.
|
||||
|
||||
``profile_overrides`` are the *profile* fields an explicit command/tool flag names
|
||||
(``stt_backend``, ``diarize_backend``, ``vlm_model``); ``None`` means the flag was
|
||||
omitted, so the environment/TOML value is kept. Behavioural flags (diarize,
|
||||
language, shot caps, cache policy) are ``AnalysisOptions`` fields and never come
|
||||
through here, so a run can never rewrite the profile by accident.
|
||||
"""
|
||||
explicit = {name: value for name, value in profile_overrides.items() if value is not None}
|
||||
return Settings(**explicit)
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""Runtime settings; every field is overridable via a ``VA_``-prefixed env var."""
|
||||
|
||||
@@ -255,3 +242,16 @@ class Settings(BaseSettings):
|
||||
)
|
||||
supported = ", ".join(("stt", "diarize", "shots", "describe", "report"))
|
||||
raise ValueError(f"unknown stage {stage!r}; stage options exist for: {supported}")
|
||||
|
||||
|
||||
def load_settings(**profile_overrides: Any) -> Settings:
|
||||
"""Construct the runtime settings once, at a front door's entry point.
|
||||
|
||||
``profile_overrides`` are the *profile* fields an explicit command/tool flag names
|
||||
(``stt_backend``, ``diarize_backend``, ``vlm_model``); ``None`` means the flag was
|
||||
omitted, so the environment/TOML value is kept. Behavioural flags (diarize,
|
||||
language, shot caps, cache policy) are ``AnalysisOptions`` fields and never come
|
||||
through here, so a run can never rewrite the profile by accident.
|
||||
"""
|
||||
explicit = {name: value for name, value in profile_overrides.items() if value is not None}
|
||||
return Settings(**explicit)
|
||||
Reference in new issue
Block a user