dlgforge.config.loader¶
Configuration loading and resolver helpers.
load_config(config_path)
¶
Load config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
str | Path
|
Path to a configuration file. |
required |
Returns:
| Type | Description |
|---|---|
Tuple[Dict[str, Any], Path, Path]
|
Tuple[Dict[str, Any], Path, Path]: Loaded value parsed from upstream sources. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
Raised when validation or runtime requirements are not met. |
ValueError
|
Raised when validation or runtime requirements are not met. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import load_config
>>> load_config(...)
resolve_output_dir(cfg, project_root)
¶
Resolve output dir from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
project_root
|
Path
|
Resolved project directory context. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Path |
Path
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_output_dir
>>> resolve_output_dir(...)
resolve_output_columns(cfg)
¶
Resolve output columns from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, str]
|
Dict[str, str]: Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_output_columns
>>> resolve_output_columns(...)
resolve_question(cfg)
¶
Resolve question from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_question
>>> resolve_question(...)
resolve_target_languages(cfg)
¶
Resolve target languages from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_target_languages
>>> resolve_target_languages(...)
resolve_question_seed(cfg)
¶
Resolve question seed from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_question_seed
>>> resolve_question_seed(...)
resolve_run_id(cfg)
¶
Resolve run id from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_run_id
>>> resolve_run_id(...)
resolve_resume_run_id(cfg)
¶
Resolve resume run id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_resume_run_id
>>> resolve_resume_run_id(...)
resolve_n_turns(cfg, fallback=1)
¶
Resolve n turns from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
fallback
|
int
|
int value used by this operation. |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_n_turns
>>> resolve_n_turns(...)
resolve_batch_size(cfg, fallback=1)
¶
Resolve batch size from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
fallback
|
int
|
int value used by this operation. |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_batch_size
>>> resolve_batch_size(...)
resolve_total_samples(cfg, fallback=0)
¶
Resolve total samples from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
fallback
|
int
|
int value used by this operation. |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_total_samples
>>> resolve_total_samples(...)
resolve_distributed_enabled(cfg)
¶
Resolve distributed enabled from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
Boolean indicator describing the evaluated condition. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_distributed_enabled
>>> resolve_distributed_enabled(...)
resolve_turn_range(cfg, fallback=1)
¶
Resolve turn range from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
fallback
|
int
|
int value used by this operation. |
1
|
Returns:
| Type | Description |
|---|---|
Tuple[int, int]
|
Tuple[int, int]: Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Raised when validation or runtime requirements are not met. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_turn_range
>>> resolve_turn_range(...)
resolve_turn_count_distribution(cfg, fallback='poisson')
¶
Resolve turn count distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
fallback
|
str
|
str value used by this operation. |
'poisson'
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_turn_count_distribution
>>> resolve_turn_count_distribution(...)
resolve_turn_count_mean(cfg, fallback=0.0)
¶
Resolve turn count mean.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
fallback
|
float
|
float value used by this operation. |
0.0
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_turn_count_mean
>>> resolve_turn_count_mean(...)
resolve_retrieval_default_k(cfg, fallback=4)
¶
Resolve retrieval default k.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
fallback
|
int
|
int value used by this operation. |
4
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_retrieval_default_k
>>> resolve_retrieval_default_k(...)
resolve_seed_topics_path(cfg)
¶
Resolve seed topics path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_seed_topics_path
>>> resolve_seed_topics_path(...)
resolve_seed_topics_variant(cfg)
¶
Resolve seed topics variant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_seed_topics_variant
>>> resolve_seed_topics_variant(...)
resolve_seed_topics_probability(cfg)
¶
Resolve seed topics probability.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_seed_topics_probability
>>> resolve_seed_topics_probability(...)
resolve_seed_topics_enabled(cfg)
¶
Resolve seed topics enabled.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
Boolean indicator describing the evaluated condition. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_seed_topics_enabled
>>> resolve_seed_topics_enabled(...)
resolve_judge_mode(cfg)
¶
Resolve judge mode from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_judge_mode
>>> resolve_judge_mode(...)
resolve_judge_enabled(cfg)
¶
Resolve judge enabled from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
Boolean indicator describing the evaluated condition. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_judge_enabled
>>> resolve_judge_enabled(...)
resolve_judge_granularity(cfg, fallback='turn')
¶
Resolve judge granularity from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
fallback
|
str
|
str value used by this operation. |
'turn'
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_judge_granularity
>>> resolve_judge_granularity(...)
resolve_judge_reasons(cfg)
¶
Resolve judge reasons from configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: Resolved value after applying defaults and normalization rules. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import resolve_judge_reasons
>>> resolve_judge_reasons(...)
build_base_inputs(cfg, project_root, config_path)
¶
Build base inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
Dict[str, Any]
|
Configuration mapping that controls runtime behavior. |
required |
project_root
|
Path
|
Resolved project directory context. |
required |
config_path
|
Path
|
Path to a configuration file. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dict[str, Any]: Constructed value derived from the provided inputs. |
Raises:
| Type | Description |
|---|---|
Exception
|
Propagates unexpected runtime errors from downstream calls. |
Side Effects / I/O: - May read from or write to local filesystem artifacts. - May read environment variables or mutate process-level runtime state.
Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.
Examples:
>>> from dlgforge.config.loader import build_base_inputs
>>> build_base_inputs(...)