veil.metric_store

Classes

MetricStore(config)

File-system backed metric store initialization.

class veil.metric_store.MetricStore(config)[source]

Bases: object

File-system backed metric store initialization.

Creates a unique run directory under the configured output directory to store all metric files for a single run, e.g.:

<output_dir>/run-20250814T102234-ab12cd/

Parameters:

config (MetricStoreConfig)

end_document()[source]
Return type:

None

finalize()[source]

Write final metrics and plots to the run directory.

Return type:

None

mean_docs_per_second()[source]
Return type:

float

overall_duration_seconds()[source]
Return type:

float

path_in_run_dir(*relative)[source]

Return a path within the current run directory.

Example: metric_store.path_in_run_dir(“component_times.jsonl”)

Parameters:

relative (str)

Return type:

Path

record_component_step(*, component, component_type, duration_seconds, detected_spans=None, masked_spans=None, supported_entity_types=None)[source]
Parameters:
  • component (str)

  • component_type (str)

  • duration_seconds (float)

  • detected_spans (Iterable[Span] | None)

  • masked_spans (Iterable[Span] | None)

  • supported_entity_types (Iterable[str] | None)

Return type:

None

record_error(*, component, component_type, error_type)[source]
Parameters:
  • component (str)

  • component_type (str)

  • error_type (str)

Return type:

None

record_evaluation_variant(*, variant, per_component_by_type, per_component_all_types, global_by_type, global_all_types)[source]

Record evaluation counts for a named variant (e.g., ‘exact’, ‘iou@0.50’).

Parameters:
  • variant (str)

  • per_component_by_type (Dict[str, Dict[str, Dict[str, int]]])

  • per_component_all_types (Dict[str, Dict[str, int]])

  • global_by_type (Dict[str, Dict[str, int]])

  • global_all_types (Dict[str, int])

Return type:

None

save_config(config_obj, filename='config.json')[source]

Save a JSON-serialisable view of the pipeline config into the run dir.

Parameters:
  • config_obj (Any)

  • filename (str)

Return type:

Path

start_document(doc_length_chars)[source]
Parameters:

doc_length_chars (int)

Return type:

None