Loads and holds Magika's model configuration and the content-types knowledge base.
This mirrors ModelConfig and the content_types_kb loading logic from the
reference Python implementation. The data is read from the JSON files vendored
under priv/ and is intended to be loaded once and reused.
Summary
Functions
Returns the ContentTypeInfo for a label, raising if it is unknown.
Path to the default vendored content-types knowledge base JSON.
Path to the default vendored model config JSON.
Path to the default vendored model directory.
Path to the default vendored ONNX model.
Loads the configuration for the given model directory and content-types KB.
Types
@type t() :: %Magika.Config{ beg_size: non_neg_integer(), block_size: non_neg_integer(), content_types: %{required(String.t()) => Magika.ContentTypeInfo.t()}, end_size: non_neg_integer(), medium_confidence_threshold: float(), mid_size: non_neg_integer(), min_file_size_for_dl: non_neg_integer(), overwrite_map: %{required(String.t()) => String.t()}, padding_token: non_neg_integer(), target_labels_space: [String.t()], thresholds: %{required(String.t()) => float()}, use_inputs_at_offsets: boolean() }
Functions
@spec content_type_info(t(), String.t()) :: Magika.ContentTypeInfo.t()
Returns the ContentTypeInfo for a label, raising if it is unknown.
@spec default_kb_path() :: Path.t()
Path to the default vendored content-types knowledge base JSON.
@spec default_model_config_path() :: Path.t()
Path to the default vendored model config JSON.
@spec default_model_dir() :: Path.t()
Path to the default vendored model directory.
@spec default_model_path() :: Path.t()
Path to the default vendored ONNX model.
Loads the configuration for the given model directory and content-types KB.
Both arguments default to the files vendored in this package's priv/.