vet

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit cbb654119607a3bd4b8bdbb4b0b7022ef44d88e6
parent eeaf2b9d026a67e70e42e44ff7a857e73506be9c
Author: Andrew Laack <andrew@laack.co>
Date:   Tue,  3 Mar 2026 20:33:27 +0000

Merge pull request #171 from imbue-ai/andrew/additional-registry

Additional registry for improved availability
Diffstat:
Mvet/cli/config/loader.py | 26+++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/vet/cli/config/loader.py b/vet/cli/config/loader.py @@ -21,7 +21,10 @@ class ConfigLoadError(Exception): pass -_DEFAULT_REGISTRY_URL = "https://raw.githubusercontent.com/imbue-ai/vet/main/registry/models.json" +_REGISTRY_URLS = [ + "https://vet-registry.vet.host.imbue.com/models", + "https://raw.githubusercontent.com/imbue-ai/vet/main/registry/models.json", +] _REGISTRY_FETCH_TIMEOUT_SECONDS = 5 @@ -43,8 +46,7 @@ def _get_registry_cache_path() -> Path: return _get_xdg_cache_home() / "vet" / "remote_models.json" -def update_remote_registry_cache() -> tuple[Path, ModelsConfig]: - url = os.environ.get("VET_REGISTRY_URL", _DEFAULT_REGISTRY_URL) +def _fetch_registry(url: str) -> tuple[bytes, ModelsConfig]: req = urllib.request.Request(url, headers={"User-Agent": "vet"}) with urllib.request.urlopen(req, timeout=_REGISTRY_FETCH_TIMEOUT_SECONDS) as resp: data = resp.read() @@ -52,6 +54,24 @@ def update_remote_registry_cache() -> tuple[Path, ModelsConfig]: config = ModelsConfig.model_validate_json(data) except ValidationError as e: raise ConfigLoadError(f"Remote registry at {url} returned invalid data: {e}") from e + return data, config + + +def update_remote_registry_cache() -> tuple[Path, ModelsConfig]: + custom_url = os.environ.get("VET_REGISTRY_URL") + urls = [custom_url] if custom_url else _REGISTRY_URLS + + last_exc: Exception | None = None + for url in urls: + try: + data, config = _fetch_registry(url) + break + except Exception as exc: + last_exc = exc + else: + assert last_exc is not None + raise last_exc + cache_path = _get_registry_cache_path() cache_path.parent.mkdir(parents=True, exist_ok=True) cache_path.write_bytes(data)