diff --git a/src/provider_capability_schemas.py b/src/provider_capability_schemas.py index 3fb679c28..1ef701fdd 100644 --- a/src/provider_capability_schemas.py +++ b/src/provider_capability_schemas.py @@ -363,7 +363,7 @@ HUGGINGFACE_MODEL_SHAPE = ProviderCatalogShape( identity_paths=("modelId", "id"), required_item_paths=("pipeline_tag",), item_types=(("pipeline_tag", (str,)),), - detection_priority=80, + detection_priority=0, ) COHERE_MODELS_SHAPE = ProviderCatalogShape( shape_id="cohere.models.rich.v1", diff --git a/tests/test_provider_capability_schemas.py b/tests/test_provider_capability_schemas.py index 4a533155c..39663795b 100644 --- a/tests/test_provider_capability_schemas.py +++ b/tests/test_provider_capability_schemas.py @@ -243,6 +243,7 @@ def test_native_catalog_shapes_resolve_with_required_provider_context(): explicit_context_providers = { "chatgpt_subscription", "cohere", + "huggingface", "lmstudio", "mistral", } @@ -313,6 +314,20 @@ def test_payload_matching_multiple_providers_degrades_to_fallback(): assert record.fallback is True +def test_generic_pipeline_tag_does_not_select_huggingface_without_provider_context(): + payload = {"id": "generic-model", "pipeline_tag": "image-text-to-text"} + inferred = pcs.resolve_provider(payload) + contextual = pcs.resolve_provider(payload, provider="huggingface") + + assert inferred.provider_id == pcs.PROVIDER_UNKNOWN + assert inferred.shape_id == "" + assert inferred.fallback is False + assert records_from_payload(payload) == () + assert contextual.provider_id == "huggingface" + assert contextual.shape_id == "huggingface.hub.model-info.v1" + assert contextual.fallback is False + + def test_openrouter_payload_detection_requires_the_compound_official_shape(): complete = _openrouter_payload() assert pcs.resolve_provider(complete).shape_id == "openrouter.models.rich.v1"