mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
chore: format Bedrock guardrail
This commit is contained in:
parent
34ae769590
commit
336003cc3b
1 changed files with 7 additions and 10 deletions
|
|
@ -782,8 +782,7 @@ class BedrockGuardrail(CustomGuardrail, BaseAWSLLM):
|
|||
if matched_deployments:
|
||||
return matched_deployments
|
||||
if any(
|
||||
isinstance(deployment, Mapping)
|
||||
and (deployment.get("model_info") or {}).get("allow_fail_open") is True
|
||||
isinstance(deployment, Mapping) and (deployment.get("model_info") or {}).get("allow_fail_open") is True
|
||||
for deployment in allowed_deployments
|
||||
):
|
||||
return candidate_deployments or allowed_deployments
|
||||
|
|
@ -825,11 +824,7 @@ class BedrockGuardrail(CustomGuardrail, BaseAWSLLM):
|
|||
deployment_model: Final[object] = (
|
||||
params.get("model") if isinstance(params, Mapping) else getattr(params, "model", None)
|
||||
)
|
||||
return (
|
||||
BedrockGuardrail._resolve_model_provider(deployment_model)
|
||||
if isinstance(deployment_model, str)
|
||||
else None
|
||||
)
|
||||
return BedrockGuardrail._resolve_model_provider(deployment_model) if isinstance(deployment_model, str) else None
|
||||
|
||||
@staticmethod
|
||||
def _router_allows_bedrock(
|
||||
|
|
@ -1251,9 +1246,11 @@ class BedrockGuardrail(CustomGuardrail, BaseAWSLLM):
|
|||
)
|
||||
if router_allows_bedrock is not None:
|
||||
return api_key if router_allows_bedrock else None
|
||||
return api_key if all(
|
||||
provider in ("bedrock", "bedrock_converse") for provider in providers
|
||||
) else None
|
||||
return (
|
||||
api_key
|
||||
if all(provider in ("bedrock", "bedrock_converse") for provider in providers)
|
||||
else None
|
||||
)
|
||||
except Exception: # noqa: BLE001 # fall back to the sync compatibility path
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue