Skip to content

dlgforge.config

Public exports for configuration helpers.

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(...)

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_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_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_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_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_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_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_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_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_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_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_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_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(...)