The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(telemetry): Azure deployment names leave only when they are a public model id
teknium117630663342e
diff --git a/hermes_cli/observability/shared_metrics_catalog.py b/hermes_cli/observability/shared_metrics_catalog.pyindex 546d5ddf18c..d6b2d15d608 100644--- a/hermes_cli/observability/shared_metrics_catalog.py+++ b/hermes_cli/observability/shared_metrics_catalog.py@@ -291,9 +291,27 @@ def model_metric_name(raw: object, provider: str, *, max_length: int) -> str:return modelif provider == "unknown" or _LOCATION_MODEL.match(model):return CUSTOM+ # Azure calls a deployment by the name its owner chose (``acme-legal-prod``): only a public model id passes.+ if provider.startswith("azure") and model not in _safe(public_model_ids):+ return CUSTOMreturn model+def public_model_ids() -> frozenset[str]:+ """Model ids Hermes ships in its static catalogs plus every id in the local models.dev cache+ (never a network call), with and without a ``vendor/`` prefix."""+ from agent.models_dev import fetch_models_dev+ from hermes_cli.models_catalog_static import _PROVIDER_MODELS++ ids = {model for models in _PROVIDER_MODELS.values() for model in models}+ for entry in fetch_models_dev(allow_network=False).values():+ if isinstance(entry, dict) and isinstance(entry.get("models"), dict):+ ids.update(entry["models"])+ return frozenset(form.lower() for model in ids if isinstance(model, str)+ for form in (model, model.rsplit("/", 1)[-1]))++# The user's own server or account, never a public model id: a URL or path (``:/``), a weight file,# a loopback or IPv4 host, ``host:port`` (a 2-5 digit port, so Bedrock's ``...-v1:0`` stays readable),# or an AWS ARN (it carries the account id).diff --git a/tests/hermes_cli/test_shared_metrics_model_attribution.py b/tests/hermes_cli/test_shared_metrics_model_attribution.pyindex 832ad25c9a7..84f5d4ea8c9 100644--- a/tests/hermes_cli/test_shared_metrics_model_attribution.py+++ b/tests/hermes_cli/test_shared_metrics_model_attribution.py@@ -168,6 +168,10 @@ def test_network_address_model_ids_and_raw_injected_marks_never_reach_counters(dfor provider, model in (("bedrock", "arn:aws:bedrock:us-east-1:123456789012:inference-profile/x"),("lm-studio", "my-model-x"), ("lm_studio", "my-model-x")):assert model_route(provider, model)["model"] == "custom", (provider, model)+ # Azure deployment names are chosen by their owner: only a public model id passes.+ for provider in ("azure-foundry", "azure"):+ assert model_route(provider, "acme-legal-prod-eastus")["model"] == "custom"+ assert model_route(provider, "GPT-4o")["model"] == "gpt-4o"for provider, model in (("bedrock", "anthropic.claude-3-5-sonnet-20241022-v2:0"),("openrouter", "openai/gpt-4o:free"), ("ollama-cloud", "gpt-oss:120b")):assert model_route(provider, model)["model"] == modeldiff --git a/website/docs/developer-guide/relay-shared-metrics.md b/website/docs/developer-guide/relay-shared-metrics.mdindex e1687f505e0..302ef85d782 100644--- a/website/docs/developer-guide/relay-shared-metrics.md+++ b/website/docs/developer-guide/relay-shared-metrics.md@@ -364,7 +364,9 @@ the local-server aliases of `custom` (`ollama`, `local`, `vllm`, `llamacpp`,whose endpoint is a loopback server (`lmstudio`, under any of its aliases) keeps itsname, but its model reads `custom`. A model whose provider is unknown, or whose id is a URL, a file path or anetwork address (`host:port`, an IP address, `localhost`) or an AWS ARN (it carries the account-id), reads `custom`. The local+id), reads `custom`. On Azure providers the model id is a deployment name its owner+chose, so it passes only when it is a public model id (Hermes' model catalogs or+the local models.dev cache, e.g. `gpt-4o`); `acme-legal-prod` reads `custom`. The localsubscriber re-runs these rules on the provider/model fields of every mark and drops arow they would rewrite.