| """ | |
| ONNX Core — centralized ONNX Runtime model management. | |
| This is the SINGLE place where ONNX models are loaded. Every provider | |
| that needs ONNX inference calls `get_session()` or `get_model()` here. | |
| Design guarantees: | |
| 1. Each model loads exactly ONCE per process (via EmbeddingCache). | |
| 2. Models are lazy — only loaded when first requested. | |
| 3. CPU thread count is capped (configurable, default 2) for low-RAM. | |
| 4. Models are auto-downloaded on first use (if enabled in settings). | |
| 5. No provider imports onnxruntime directly — they go through here. | |
| This keeps onnxruntime as an OPTIONAL dependency: if it's not installed, | |
| providers that need it gracefully report `is_available() -> False`. | |
| """ | |
| from cores.onnx.session import ( | |
| is_onnx_available, | |
| get_session, | |
| run_inference, | |
| ONNXModel, | |
| ) | |
| from cores.onnx.downloader import download_model, ensure_model, model_path | |
| __all__ = [ | |
| "is_onnx_available", | |
| "get_session", | |
| "run_inference", | |
| "ONNXModel", | |
| "download_model", | |
| "ensure_model", | |
| "model_path", | |
| ] | |