Skip to content

dlgforge.io.output

Output path definitions and artifact persistence helpers.

OutputPaths(project_root, output_dir) dataclass

Resolved filesystem paths for all generated output artifacts.

Parameters:

Name Type Description Default
project_root Path

Resolved project directory context.

required
output_dir Path

Path value used by this operation.

required

Raises:

Type Description
Exception

Construction may raise when required dependencies or inputs are invalid.

Side Effects / I/O: - May read from or write to local filesystem artifacts.

Preconditions / Invariants: - Instantiate and use through documented public methods.

Examples:

>>> from dlgforge.io.output import OutputPaths
>>> OutputPaths(...)

configure_output_columns(columns)

Configure output columns.

Parameters:

Name Type Description Default
columns Optional[Dict[str, Any]]

Optional[Dict[str, Any]] value used by this operation.

required

Returns:

Name Type Description
None None

No value is returned.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May read from or write to local filesystem artifacts.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.io.output import configure_output_columns
>>> configure_output_columns(...)

ensure_output_layout(paths)

Ensure output layout.

Parameters:

Name Type Description Default
paths OutputPaths

Filesystem path used by this operation.

required

Returns:

Name Type Description
None None

No value is returned.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May read from or write to local filesystem artifacts.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.io.output import ensure_output_layout
>>> ensure_output_layout(...)

load_coverage_ledger(paths, max_entries=2000)

Load coverage ledger.

Parameters:

Name Type Description Default
paths OutputPaths

Filesystem path used by this operation.

required
max_entries int

Numeric control value for processing behavior.

2000

Returns:

Type Description
List[Dict[str, Any]]

List[Dict[str, Any]]: Loaded value parsed from upstream sources.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May read from or write to local filesystem artifacts.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.io.output import load_coverage_ledger
>>> load_coverage_ledger(...)

append_coverage_ledger(paths, entry)

Append coverage ledger.

Parameters:

Name Type Description Default
paths OutputPaths

Filesystem path used by this operation.

required
entry Dict[str, Any]

Mapping payload for this operation.

required

Returns:

Name Type Description
None None

No value is returned.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May read from or write to local filesystem artifacts.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.io.output import append_coverage_ledger
>>> append_coverage_ledger(...)

save_run_state(paths, run_id, payload)

Save run state.

Parameters:

Name Type Description Default
paths OutputPaths

Filesystem path used by this operation.

required
run_id str

Identifier for run state tracking.

required
payload Dict[str, Any]

Mapping payload for this operation.

required

Returns:

Name Type Description
Path Path

Value produced by this API.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May read from or write to local filesystem artifacts.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.io.output import save_run_state
>>> save_run_state(...)

load_run_state(paths, run_id)

Load run state.

Parameters:

Name Type Description Default
paths OutputPaths

Filesystem path used by this operation.

required
run_id str

Identifier for run state tracking.

required

Returns:

Type Description
Optional[Dict[str, Any]]

Optional[Dict[str, Any]]: Loaded value parsed from upstream sources.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May read from or write to local filesystem artifacts.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.io.output import load_run_state
>>> load_run_state(...)

save_training_sample(paths, question, inputs, result, turns=None, conversation_history=None, public_history=None, raw_results=None, conversation_id=None)

Save training sample.

Parameters:

Name Type Description Default
paths OutputPaths

Filesystem path used by this operation.

required
question str

str value used by this operation.

required
inputs Dict[str, Any]

Mapping payload for this operation.

required
result Any

Input value for this operation.

required
turns Optional[List[Dict[str, Any]]]

Conversation or message data used during processing.

None
conversation_history Optional[List[Dict[str, Any]]]

Optional[List[Dict[str, Any]]] value used by this operation.

None
public_history Optional[List[Dict[str, Any]]]

Conversation or message data used during processing.

None
raw_results Optional[List[Dict[str, Any]]]

Conversation or message data used during processing.

None
conversation_id Optional[str]

Identifier for a conversation artifact.

None

Returns:

Name Type Description
Path Path

Value produced by this API.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May read from or write to local filesystem artifacts.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.io.output import save_training_sample
>>> save_training_sample(...)

append_sharegpt_judged_record(paths, conversation_id, timestamp, inputs, turns, messages=None, conversation_judge=None)

Append sharegpt judged record.

Parameters:

Name Type Description Default
paths OutputPaths

Filesystem path used by this operation.

required
conversation_id str

Identifier for a conversation artifact.

required
timestamp str

str value used by this operation.

required
inputs Dict[str, Any]

Mapping payload for this operation.

required
turns List[Dict[str, Any]]

Conversation or message data used during processing.

required
messages Optional[List[Dict[str, Any]]]

Conversation or message data used during processing.

None
conversation_judge Optional[Dict[str, Any]]

Optional[Dict[str, Any]] value used by this operation.

None

Returns:

Name Type Description
None None

No value is returned.

Raises:

Type Description
Exception

Propagates unexpected runtime errors from downstream calls.

Side Effects / I/O: - May read from or write to local filesystem artifacts.

Preconditions / Invariants: - Callers should provide arguments matching annotated types and expected data contracts.

Examples:

>>> from dlgforge.io.output import append_sharegpt_judged_record
>>> append_sharegpt_judged_record(...)