Module cache

Module cache 

Source
Expand description

Model and weight cache directory resolution.

Local providers download model weights to a per-provider, per-model directory. This module determines where that directory lives based on (in priority order):

  1. A per-model cache_dir option in the spec’s JSON options.
  2. The UNI_CACHE_DIR environment variable (global root override).
  3. A default .uni_cache/ directory relative to the working directory.

Constants§

CACHE_ROOT_ENV
The environment variable used to override the root cache directory.

Functions§

resolve_cache_dir
Resolve the cache directory for a given provider and model.
resolve_provider_cache_root
Resolve the root cache directory for a provider (no model sub-directory).
sanitize_model_name
Replace / with -- and strip characters that are unsafe in directory names.