mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-16 06:53:47 +00:00
working bedrock tests
This commit is contained in:
parent
d960f9b60f
commit
e0f227f23c
4 changed files with 64 additions and 15 deletions
|
@ -41,7 +41,17 @@ class BedrockSafetyAdapter(Safety, ShieldsProtocolPrivate):
|
|||
pass
|
||||
|
||||
async def register_shield(self, shield: Shield) -> None:
|
||||
raise ValueError("Registering dynamic shields is not supported")
|
||||
response = self.bedrock_client.list_guardrails(
|
||||
guardrailIdentifier=shield.identifier,
|
||||
)
|
||||
if (
|
||||
not response["guardrails"]
|
||||
or len(response["guardrails"]) == 0
|
||||
or response["guardrails"][0]["version"] != shield.params["guardrailVersion"]
|
||||
):
|
||||
raise ValueError(
|
||||
f"Shield {shield.identifier} with version {shield.params['guardrailVersion']} not found in Bedrock"
|
||||
)
|
||||
|
||||
async def run_shield(
|
||||
self, shield: Shield, messages: List[Message], params: Dict[str, Any] = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue