nlpmed_engine.utils package

Submodules

nlpmed_engine.utils.utils module

class nlpmed_engine.utils.utils.ModelSpec

Bases: TypedDict

device: str
max_length: int
model_path: str
tokenizer_path: str
nlpmed_engine.utils.utils.build_initial_config() dict[str, Any]

Build the full pipeline config dict, including ml_inference models block. The first model name in API_ML_MODEL_NAMES will be treated as the default at runtime.

Returns:

dict[str, Any]: The configuration dictionary for the engine.

nlpmed_engine.utils.utils.get_effective_param(instance_value: Any, provided_value: Any, *, required: bool = True) Any
nlpmed_engine.utils.utils.read_models_from_env() dict[str, ModelSpec]

Read API_ML_MODEL_NAMES and per-model env vars into a dictionary.

Raises:

RuntimeError: No model/tokenizer provided.

Returns:
dict[str, ModelSpec]: {

“modelA”: {“device”: …, “model_path”: …, “tokenizer_path”: …, “max_length”: …}, “modelB”: {“device”: …, “model_path”: …, “tokenizer_path”: …, “max_length”: …},

}

Module contents