feat!: breaking change - OpenRouter models are now read from conf/openrouter_models.json while Custom / Self-hosted models are read from conf/custom_models.json
feat: Azure OpenAI / Azure AI Foundry support. Models should be defined in conf/azure_models.json (or a custom path). See .env.example for environment variables or see readme. https://github.com/BeehiveInnovations/zen-mcp-server/issues/265 feat: OpenRouter / Custom Models / Azure can separately also use custom config paths now (see .env.example ) refactor: Model registry class made abstract, OpenRouter / Custom Provider / Azure OpenAI now subclass these refactor: breaking change: `is_custom` property has been removed from model_capabilities.py (and thus custom_models.json) given each models are now read from separate configuration files
This commit is contained in:
23
utils/env.py
23
utils/env.py
@@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
|
||||
import os
|
||||
from collections.abc import Mapping
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
|
||||
try:
|
||||
@@ -86,3 +87,25 @@ def get_all_env() -> dict[str, str | None]:
|
||||
"""Expose the loaded .env mapping for diagnostics/logging."""
|
||||
|
||||
return dict(_DOTENV_VALUES)
|
||||
|
||||
|
||||
@contextmanager
|
||||
def suppress_env_vars(*names: str):
|
||||
"""Temporarily remove environment variables during the context.
|
||||
|
||||
Args:
|
||||
names: Environment variable names to remove. Empty or falsy names are ignored.
|
||||
"""
|
||||
|
||||
removed: dict[str, str] = {}
|
||||
try:
|
||||
for name in names:
|
||||
if not name:
|
||||
continue
|
||||
if name in os.environ:
|
||||
removed[name] = os.environ[name]
|
||||
del os.environ[name]
|
||||
yield
|
||||
finally:
|
||||
for name, value in removed.items():
|
||||
os.environ[name] = value
|
||||
|
||||
Reference in New Issue
Block a user