diff --git a/doc/getting_started/pyrit_conf.md b/doc/getting_started/pyrit_conf.md index 326a8151de..8e7acc75e7 100644 --- a/doc/getting_started/pyrit_conf.md +++ b/doc/getting_started/pyrit_conf.md @@ -244,6 +244,8 @@ A saved file never holds a credential: restore refuses a file that stores a valu - In identity mode, an OpenAI target file sets `"headers": "{}"` in its `params` so that the server's `OPENAI_ADDITIONAL_REQUEST_HEADERS` aren't added. The OpenAI SDK adds the headers in `OPENAI_CUSTOM_HEADERS` to every request, so while the server sets it, OpenAI targets can't be saved and saved ones aren't restored. The SDK's `OPENAI_ORG_ID` and `OPENAI_PROJECT_ID` still apply to every OpenAI target on this server. - GitHub Copilot, Hugging Face, HackAPrompt, LiteLLM, HTTP, and Copilot WebSocket targets can't be saved yet. +Converters and scorers follow the same rules. The Azure Speech converters, the Azure Content Safety scorer, and the audio scorers can't be saved yet, because they sign in with this server's key or Azure identity, and neither can the local refusal classifier scorer, whose model can come from this server. + ### `initialization_scripts` Local paths to custom Python scripts containing `PyRITInitializer` subclasses. Paths can be absolute or relative to the current working directory. diff --git a/pyrit/converter/azure_speech_audio_to_text_converter.py b/pyrit/converter/azure_speech_audio_to_text_converter.py index f4635809f5..49f805a3cd 100644 --- a/pyrit/converter/azure_speech_audio_to_text_converter.py +++ b/pyrit/converter/azure_speech_audio_to_text_converter.py @@ -4,7 +4,8 @@ import asyncio import logging import time -from collections.abc import Awaitable, Callable +from collections.abc import Awaitable, Callable, Mapping +from types import MappingProxyType from typing import TYPE_CHECKING, Any, ClassVar if TYPE_CHECKING: @@ -44,6 +45,9 @@ class AzureSpeechAudioToTextConverter(Converter): #: The resource ID for accessing the service when using Entra ID auth. AZURE_SPEECH_RESOURCE_ID_ENVIRONMENT_VARIABLE: str = "AZURE_SPEECH_RESOURCE_ID" + # An empty key reads AZURE_SPEECH_KEY, or else signs in with this server's Azure identity. + server_fallback_parameters: ClassVar[Mapping[str, str | None]] = MappingProxyType({"azure_speech_key": None}) + COPY_LOCKED_PARAMETER_NAMES: ClassVar[frozenset[str]] = frozenset( {"azure_speech_region", "azure_speech_key", "azure_speech_resource_id"} ) diff --git a/pyrit/converter/azure_speech_text_to_audio_converter.py b/pyrit/converter/azure_speech_text_to_audio_converter.py index 1bd6312fdb..b1a510d31b 100644 --- a/pyrit/converter/azure_speech_text_to_audio_converter.py +++ b/pyrit/converter/azure_speech_text_to_audio_converter.py @@ -2,7 +2,8 @@ # Licensed under the MIT license. import logging -from collections.abc import Awaitable, Callable +from collections.abc import Awaitable, Callable, Mapping +from types import MappingProxyType from typing import TYPE_CHECKING, ClassVar, Literal if TYPE_CHECKING: @@ -42,6 +43,9 @@ class AzureSpeechTextToAudioConverter(Converter): #: The resource ID for accessing the service when using Entra ID auth. AZURE_SPEECH_RESOURCE_ID_ENVIRONMENT_VARIABLE: str = "AZURE_SPEECH_RESOURCE_ID" + # An empty key reads AZURE_SPEECH_KEY, or else signs in with this server's Azure identity. + server_fallback_parameters: ClassVar[Mapping[str, str | None]] = MappingProxyType({"azure_speech_key": None}) + COPY_LOCKED_PARAMETER_NAMES: ClassVar[frozenset[str]] = frozenset( {"azure_speech_region", "azure_speech_key", "azure_speech_resource_id"} ) diff --git a/pyrit/converter/converter.py b/pyrit/converter/converter.py index e46b9fcf26..2719814d77 100644 --- a/pyrit/converter/converter.py +++ b/pyrit/converter/converter.py @@ -8,6 +8,7 @@ import inspect import re from dataclasses import dataclass +from types import MappingProxyType from typing import TYPE_CHECKING, Any, ClassVar, cast, get_args from pyrit import converter @@ -18,7 +19,7 @@ if TYPE_CHECKING: import random - from collections.abc import Awaitable, Callable + from collections.abc import Awaitable, Callable, Mapping from pyrit.prompt_target import PromptTarget @@ -73,6 +74,12 @@ class Converter(Identifiable): #: ``super().__init__(converter_target=...)`` so the base class can validate it. TARGET_REQUIREMENTS: ClassVar[TargetRequirements] = TargetRequirements() + # Credential parameters that, left empty, let the converter fall back to a credential from this + # server (an environment variable, or the server's Azure identity), each mapped to the value that + # turns that off, or None when no value does. A saved converter never falls back to this server's + # credentials, so a saved entry that would is refused. + server_fallback_parameters: ClassVar[Mapping[str, str | None]] = MappingProxyType({}) + _identifier: ComponentIdentifier | None = None _seed: int | None = None diff --git a/pyrit/registry/registry_recipe_restore.py b/pyrit/registry/registry_recipe_restore.py index 03acbc0189..c7dad7d968 100644 --- a/pyrit/registry/registry_recipe_restore.py +++ b/pyrit/registry/registry_recipe_restore.py @@ -75,12 +75,11 @@ class RegistryRecipeRestorer: way the caller's create builds one; the backend's builder calls the API's create for each kind. A file never chooses what gets imported: classes and attack types are looked up among the ones already registered. Server paths are refused as they are for API input, and ``check_saved_entry_params`` - refuses a recipe that stores a credential, or a target recipe that would let its target use one from - this server or send requests where this server's settings say. Entries that can't come back are + refuses a recipe that stores a credential, that would let its entry use one from this server, or, for + a target, that would send requests where this server's settings say. Entries that can't come back are reported with the reason instead of being skipped. - Stored files are otherwise trusted the way configuration is. Converters and scorers don't - declare the credentials they read from server settings yet, so those rules cover targets only. + Stored files are otherwise trusted the way configuration is. """ _KIND_BY_COMPONENT_TYPE: ClassVar[dict[ComponentType, RegistryRecipeKind]] = { diff --git a/pyrit/registry/registry_recipe_rules.py b/pyrit/registry/registry_recipe_rules.py index 7eaeaa21f0..628deb7bdc 100644 --- a/pyrit/registry/registry_recipe_rules.py +++ b/pyrit/registry/registry_recipe_rules.py @@ -168,11 +168,9 @@ def _check_server_fallbacks(*, cls: type, params: Mapping[str, Any], auth_mode: """ if auth_mode is None: auth_mode = "api_key" - supported_auth_modes = getattr(cls, "supported_auth_modes", None) - if supported_auth_modes is not None and not supported_auth_modes: - # A class that declares no auth modes, such as TextTarget, takes no credentials of its own. - supported_auth_modes = ("api_key",) - if supported_auth_modes is not None and auth_mode not in supported_auth_modes: + # A class that declares no auth modes takes none, as check_saveable_class assumes. + supported_auth_modes = getattr(cls, "supported_auth_modes", None) or ("api_key",) + if auth_mode not in supported_auth_modes: modes = ", ".join(f"'{mode}'" for mode in supported_auth_modes) raise SavedEntryRefusedError( reason=RestoreFailureReason.UNSUPPORTED_CREDENTIAL, diff --git a/pyrit/score/float_scale/audio_float_scale_scorer.py b/pyrit/score/float_scale/audio_float_scale_scorer.py index 866fb95bce..458fc12009 100644 --- a/pyrit/score/float_scale/audio_float_scale_scorer.py +++ b/pyrit/score/float_scale/audio_float_scale_scorer.py @@ -1,6 +1,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. +from typing import ClassVar from pyrit.models import ComponentIdentifier, MessagePiece, Score, ScoringExpectation from pyrit.score.audio_transcript_scorer import AudioTranscriptHelper @@ -17,6 +18,10 @@ class AudioFloatScaleScorer(MessageFloatScaleScorer): then scores the transcript using a FloatScaleScorer. """ + not_saveable_reason: ClassVar[str | None] = ( + "It transcribes audio with the Azure Speech key or Azure identity this server is set up with." + ) + _default_validator: ScorerPromptValidator = ScorerPromptValidator(supported_data_types=["audio_path"]) def __init__( diff --git a/pyrit/score/float_scale/azure_content_filter_scorer.py b/pyrit/score/float_scale/azure_content_filter_scorer.py index 9c5e6f1fd8..9e023b32b8 100644 --- a/pyrit/score/float_scale/azure_content_filter_scorer.py +++ b/pyrit/score/float_scale/azure_content_filter_scorer.py @@ -5,8 +5,9 @@ import base64 import logging -from collections.abc import Awaitable, Callable # noqa: TC003 - registry annotation resolution -from typing import TYPE_CHECKING +from collections.abc import Awaitable, Callable, Mapping # noqa: TC003 - registry annotation resolution +from types import MappingProxyType +from typing import TYPE_CHECKING, ClassVar from azure.ai.contentsafety.aio import ContentSafetyClient from azure.ai.contentsafety.models import ( @@ -57,6 +58,9 @@ class AzureContentFilterScorer(MessageFloatScaleScorer): API_KEY_ENVIRONMENT_VARIABLE: str = "AZURE_CONTENT_SAFETY_API_KEY" ENDPOINT_URI_ENVIRONMENT_VARIABLE: str = "AZURE_CONTENT_SAFETY_API_ENDPOINT" + # An empty key reads AZURE_CONTENT_SAFETY_API_KEY, or else signs in with this server's Azure identity. + server_fallback_parameters: ClassVar[Mapping[str, str | None]] = MappingProxyType({"api_key": None}) + # Mapping from Azure TextCategory to evaluation file configurations _CATEGORY_EVAL_FILES: dict[TextCategory, tuple[list[str], str, str]] = { TextCategory.HATE: (["harm/hate_speech.csv"], "harm/hate_speech_metrics.jsonl", "hate_speech"), diff --git a/pyrit/score/scorer.py b/pyrit/score/scorer.py index 55affa3b4b..d02cf82227 100644 --- a/pyrit/score/scorer.py +++ b/pyrit/score/scorer.py @@ -9,6 +9,7 @@ from abc import abstractmethod from dataclasses import replace from datetime import UTC, datetime +from types import MappingProxyType from typing import TYPE_CHECKING, Any, ClassVar, TypeVar, final, overload from pyrit.common import print_deprecation_message @@ -53,7 +54,7 @@ ) if TYPE_CHECKING: - from collections.abc import Awaitable, Callable, Sequence + from collections.abc import Awaitable, Callable, Mapping, Sequence from pyrit.exceptions import ComponentRole from pyrit.models import ChatMessageRole @@ -294,6 +295,15 @@ class Scorer(Identifiable, abc.ABC): CONDITION_TYPE: ClassVar[type[Condition] | None] = None SUPPORTED_SCORABLE_TYPES: ClassVar[tuple[type[Scorable], ...]] = () + # Credential parameters that, left empty, let the scorer fall back to a credential from this + # server (an environment variable, or the server's Azure identity), each mapped to the value that + # turns that off, or None when no value does. A saved scorer never falls back to this server's + # credentials, so a saved entry that would is refused. + server_fallback_parameters: ClassVar[Mapping[str, str | None]] = MappingProxyType({}) + + # Why this scorer type can't be saved even without a credential, or None when it can. + not_saveable_reason: ClassVar[str | None] = None + _identifier: ComponentIdentifier | None = None def __init_subclass__(cls, **kwargs: Any) -> None: diff --git a/pyrit/score/true_false/audio_true_false_scorer.py b/pyrit/score/true_false/audio_true_false_scorer.py index bbefecf66b..4feff13afb 100644 --- a/pyrit/score/true_false/audio_true_false_scorer.py +++ b/pyrit/score/true_false/audio_true_false_scorer.py @@ -1,6 +1,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT license. +from typing import ClassVar from pyrit.models import ComponentIdentifier, MessagePiece, Score, ScoringExpectation from pyrit.score.audio_transcript_scorer import AudioTranscriptHelper @@ -17,6 +18,10 @@ class AudioTrueFalseScorer(MessageTrueFalseScorer): then scores the transcript using a TrueFalseScorer. """ + not_saveable_reason: ClassVar[str | None] = ( + "It transcribes audio with the Azure Speech key or Azure identity this server is set up with." + ) + _DEFAULT_VALIDATOR: ScorerPromptValidator = ScorerPromptValidator(supported_data_types=["audio_path"]) def __init__( diff --git a/pyrit/score/true_false/local_refusal_classifier_scorer.py b/pyrit/score/true_false/local_refusal_classifier_scorer.py index 687ecb9a73..0c9436f05b 100644 --- a/pyrit/score/true_false/local_refusal_classifier_scorer.py +++ b/pyrit/score/true_false/local_refusal_classifier_scorer.py @@ -470,6 +470,9 @@ class LocalRefusalClassifierScorer(MessageTrueFalseScorer): _CATEGORY: ClassVar[str] = "refusal" _RECIPE_VERSION: ClassVar[int] = 4 _DEFAULT_VALIDATOR: ClassVar[ScorerPromptValidator] = ScorerPromptValidator(supported_data_types=["text"]) + not_saveable_reason: ClassVar[str | None] = ( + "Its model can come from a folder on this server, or be downloaded with this server's Hugging Face sign-in." + ) def __init__( self, diff --git a/tests/unit/registry/test_registry_recipe_restore.py b/tests/unit/registry/test_registry_recipe_restore.py index dfe8cacbeb..e65617c05a 100644 --- a/tests/unit/registry/test_registry_recipe_restore.py +++ b/tests/unit/registry/test_registry_recipe_restore.py @@ -516,6 +516,81 @@ async def test_refuses_a_target_that_signs_in_with_this_servers_account(self, tm assert (failure.name, failure.reason) == ("copilot", RestoreFailureReason.UNSUPPORTED_CLASS) assert "Copilot account" in failure.message + @pytest.mark.parametrize( + ("class_module", "class_name"), + [ + ("pyrit.converter.azure_speech_text_to_audio_converter", "AzureSpeechTextToAudioConverter"), + ("pyrit.converter.azure_speech_audio_to_text_converter", "AzureSpeechAudioToTextConverter"), + ], + ) + async def test_refuses_a_speech_converter_that_would_use_this_servers_key( + self, tmp_path: Path, class_module: str, class_name: str + ) -> None: + recipe = {"class_module": class_module, "class_name": class_name, "params": {"azure_speech_region": "eastus"}} + _save(tmp_path, RegistryRecipeKind.CONVERTERS, "speech", recipe) + + with patch.dict(os.environ, {"AZURE_SPEECH_KEY": "server-speech-key"}): + report = await _restore(tmp_path) + + (failure,) = report.failures + assert (failure.name, failure.reason) == ("speech", RestoreFailureReason.UNSUPPORTED_CREDENTIAL) + assert ( + failure.message + == f"'azure_speech_key' is empty, so '{class_name}' can use this server's credential instead." + ) + assert "speech" not in ConverterRegistry.get_registry_singleton().instances.get_names() + + async def test_refuses_a_content_filter_scorer_that_would_use_this_servers_key(self, tmp_path: Path) -> None: + recipe = { + "class_module": "pyrit.score.float_scale.azure_content_filter_scorer", + "class_name": "AzureContentFilterScorer", + "params": {"endpoint": "https://contoso.cognitiveservices.azure.com/"}, + } + _save(tmp_path, RegistryRecipeKind.SCORERS, "content_safety", recipe) + + with patch.dict(os.environ, {"AZURE_CONTENT_SAFETY_API_KEY": "server-safety-key"}): + report = await _restore(tmp_path) + + (failure,) = report.failures + assert (failure.name, failure.reason) == ("content_safety", RestoreFailureReason.UNSUPPORTED_CREDENTIAL) + assert failure.message == ( + "'api_key' is empty, so 'AzureContentFilterScorer' can use this server's credential instead." + ) + assert "content_safety" not in ScorerRegistry.get_registry_singleton().instances.get_names() + + async def test_refuses_an_audio_scorer_that_transcribes_with_this_servers_speech_settings( + self, tmp_path: Path + ) -> None: + _save( + tmp_path, + RegistryRecipeKind.SCORERS, + "leak_substring", + { + "class_module": "pyrit.score.true_false.substring_scorer", + "class_name": "SubStringScorer", + "params": {"substring": "secret", "categories": ["leak"]}, + }, + ) + _save( + tmp_path, + RegistryRecipeKind.SCORERS, + "audio_leak", + { + "class_module": "pyrit.score.true_false.audio_true_false_scorer", + "class_name": "AudioTrueFalseScorer", + "params": {"text_capable_scorer": "leak_substring"}, + }, + ) + + report = await _restore(tmp_path) + + (failure,) = report.failures + assert (failure.name, failure.reason) == ("audio_leak", RestoreFailureReason.UNSUPPORTED_CLASS) + assert failure.message == ( + "It transcribes audio with the Azure Speech key or Azure identity this server is set up with." + ) + assert [ref.name for ref in report.restored] == ["leak_substring"] + async def test_restores_a_class_whose_optional_credentials_are_left_empty(self, tmp_path: Path) -> None: TargetRegistry.get_registry_singleton().register_class(_OptionalKeyTarget) _save( diff --git a/tests/unit/registry/test_registry_recipe_rules.py b/tests/unit/registry/test_registry_recipe_rules.py index be82ad5704..f33950c6bc 100644 --- a/tests/unit/registry/test_registry_recipe_rules.py +++ b/tests/unit/registry/test_registry_recipe_rules.py @@ -8,7 +8,7 @@ import pytest from pyrit.models.catalog import RestoreFailureReason -from pyrit.registry import ConverterRegistry, TargetRegistry +from pyrit.registry import ConverterRegistry, ScorerRegistry, TargetRegistry from pyrit.registry.registry_recipe_rules import ( SavedEntryRefusedError, check_saveable_class, @@ -25,14 +25,17 @@ "OpenAIVideoTarget", "RealtimeTarget", ) +_SPEECH_CONVERTERS = ("AzureSpeechAudioToTextConverter", "AzureSpeechTextToAudioConverter") +_CONTENT_SAFETY_ENDPOINT = "https://contoso.cognitiveservices.azure.com/" +_REGISTRIES = (TargetRegistry, ConverterRegistry, ScorerRegistry) @pytest.fixture(autouse=True) def isolated_target_registry() -> Iterator[None]: - for registry in (TargetRegistry, ConverterRegistry): + for registry in _REGISTRIES: registry.reset_registry_singleton() yield - for registry in (TargetRegistry, ConverterRegistry): + for registry in _REGISTRIES: registry.reset_registry_singleton() @@ -463,3 +466,165 @@ def test_check_saveable_class_refuses_an_openai_class_while_the_server_sets_sdk_ assert refusal.value.reason is RestoreFailureReason.UNSUPPORTED_CREDENTIAL assert "server-secret" not in str(refusal.value) + + +def _component_refusal(registry_class: Any, class_name: str, params: dict[str, Any]) -> SavedEntryRefusedError: + registry = registry_class.get_registry_singleton() + cls = registry.get_class(class_name) + values = dict(params) + auth_mode = values.pop("auth_mode", None) + with pytest.raises(SavedEntryRefusedError) as refusal: + check_saved_entry_params( + cls=cls, parameters=registry.get_class_metadata(cls).parameters, params=values, auth_mode=auth_mode + ) + return refusal.value + + +@pytest.mark.parametrize("class_name", _SPEECH_CONVERTERS) +@pytest.mark.parametrize( + ("params", "message"), + [ + ( + {"azure_speech_region": "eastus"}, + "'azure_speech_key' is empty, so '{class_name}' can use this server's credential instead.", + ), + ( + {"azure_speech_region": "eastus", "azure_speech_resource_id": "/subscriptions/contoso/speech"}, + "'azure_speech_key' is empty, so '{class_name}' can use this server's credential instead.", + ), + ( + {"azure_speech_region": "eastus", "azure_speech_key": "typed-speech-key"}, + "Saved entries can't hold credentials ('azure_speech_key').", + ), + ( + {"azure_speech_region": "eastus", "auth_mode": "identity"}, + "'{class_name}' only supports auth_mode 'api_key'.", + ), + ], +) +def test_check_saved_entry_params_refuses_a_speech_converter_that_would_use_a_credential( + class_name: str, params: dict[str, Any], message: str +) -> None: + refusal = _component_refusal(ConverterRegistry, class_name, params) + + assert refusal.reason is RestoreFailureReason.UNSUPPORTED_CREDENTIAL + assert str(refusal) == message.format(class_name=class_name) + + +@pytest.mark.parametrize( + ("params", "message"), + [ + ({}, "'api_key' is empty, so 'AzureContentFilterScorer' can use this server's credential instead."), + ( + {"endpoint": _CONTENT_SAFETY_ENDPOINT}, + "'api_key' is empty, so 'AzureContentFilterScorer' can use this server's credential instead.", + ), + ( + {"endpoint": _CONTENT_SAFETY_ENDPOINT, "api_key": "typed-safety-key"}, + "Saved entries can't hold credentials ('api_key').", + ), + ({"auth_mode": "identity"}, "'AzureContentFilterScorer' only supports auth_mode 'api_key'."), + ({"auth_mode": "none"}, "'AzureContentFilterScorer' only supports auth_mode 'api_key'."), + ], +) +def test_check_saved_entry_params_refuses_a_content_filter_scorer_that_would_use_a_credential( + params: dict[str, Any], message: str +) -> None: + refusal = _component_refusal(ScorerRegistry, "AzureContentFilterScorer", params) + + assert refusal.reason is RestoreFailureReason.UNSUPPORTED_CREDENTIAL + assert str(refusal) == message + + +def test_check_saved_entry_params_refuses_an_auth_mode_on_a_class_that_declares_none() -> None: + refusal = _component_refusal(ConverterRegistry, "CaesarConverter", {"caesar_offset": 3, "auth_mode": "identity"}) + + assert refusal.reason is RestoreFailureReason.UNSUPPORTED_CREDENTIAL + assert str(refusal) == "'CaesarConverter' only supports auth_mode 'api_key'." + + +@pytest.mark.parametrize( + ("class_name", "params"), + [ + ("AudioTrueFalseScorer", {"text_capable_scorer": "leak_substring"}), + ("AudioFloatScaleScorer", {"text_capable_scorer": "harm_likert"}), + ("LocalRefusalClassifierScorer", {}), + ("LocalRefusalClassifierScorer", {"model_id": "/srv/models/laya"}), + ], +) +def test_check_saved_entry_params_refuses_a_scorer_type_that_cant_be_saved( + class_name: str, params: dict[str, Any] +) -> None: + refusal = _component_refusal(ScorerRegistry, class_name, params) + + assert refusal.reason is RestoreFailureReason.UNSUPPORTED_CLASS + assert str(refusal) == ScorerRegistry.get_registry_singleton().get_class(class_name).not_saveable_reason + + +@pytest.mark.parametrize( + ("registry_class", "class_name", "params"), + [ + (ConverterRegistry, "CaesarConverter", {"caesar_offset": 3}), + (ConverterRegistry, "TranslationConverter", {"converter_target": "contoso_gpt4o", "language": "French"}), + (ScorerRegistry, "SubStringScorer", {"substring": "secret", "categories": ["leak"]}), + (ScorerRegistry, "RobloxPiiScorer", {}), + (ScorerRegistry, "LocalViolenceClassifierScorer", {}), + ], +) +def test_check_saved_entry_params_accepts_converters_and_scorers_that_need_no_credential( + registry_class: Any, class_name: str, params: dict[str, Any] +) -> None: + registry = registry_class.get_registry_singleton() + cls = registry.get_class(class_name) + + check_saved_entry_params(cls=cls, parameters=registry.get_class_metadata(cls).parameters, params=params) + + +def test_check_saveable_class_refuses_only_the_converters_and_scorers_that_use_this_servers_credentials() -> None: + refused: dict[str, tuple[RestoreFailureReason, str]] = {} + for registry_class in (ConverterRegistry, ScorerRegistry): + registry = registry_class.get_registry_singleton() + for metadata in registry.get_all_registered_class_metadata(): + try: + check_saveable_class(registry.get_class(metadata.class_name)) + except SavedEntryRefusedError as error: + refused[metadata.class_name] = (error.reason, str(error)) + + assert refused == { + "AzureSpeechAudioToTextConverter": ( + RestoreFailureReason.UNSUPPORTED_CREDENTIAL, + ( + "'AzureSpeechAudioToTextConverter' needs a credential in 'azure_speech_key', which saved entries can't " + "hold or take from this server yet." + ), + ), + "AzureSpeechTextToAudioConverter": ( + RestoreFailureReason.UNSUPPORTED_CREDENTIAL, + ( + "'AzureSpeechTextToAudioConverter' needs a credential in 'azure_speech_key', which saved entries can't " + "hold or take from this server yet." + ), + ), + "AzureContentFilterScorer": ( + RestoreFailureReason.UNSUPPORTED_CREDENTIAL, + ( + "'AzureContentFilterScorer' needs a credential in 'api_key', which saved entries can't hold or take " + "from this server yet." + ), + ), + "AudioFloatScaleScorer": ( + RestoreFailureReason.UNSUPPORTED_CLASS, + ("It transcribes audio with the Azure Speech key or Azure identity this server is set up with."), + ), + "AudioTrueFalseScorer": ( + RestoreFailureReason.UNSUPPORTED_CLASS, + ("It transcribes audio with the Azure Speech key or Azure identity this server is set up with."), + ), + "LocalRefusalClassifierScorer": ( + RestoreFailureReason.UNSUPPORTED_CLASS, + ( + "Its model can come from a folder on this server, or be " + "downloaded with this server's Hugging Face sign-in." + ), + ), + }