mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-18 15:27:16 +00:00
Kill the notion of shield_type
This commit is contained in:
parent
09269e2a44
commit
b1c3a95485
20 changed files with 87 additions and 161 deletions
|
@ -182,13 +182,13 @@
|
|||
" pass\n",
|
||||
"\n",
|
||||
" async def run_shield(\n",
|
||||
" self, shield_type: str, messages: List[dict]\n",
|
||||
" self, shield_id: str, messages: List[dict]\n",
|
||||
" ) -> RunShieldResponse:\n",
|
||||
" async with httpx.AsyncClient() as client:\n",
|
||||
" response = await client.post(\n",
|
||||
" f\"{self.base_url}/safety/run_shield\",\n",
|
||||
" json=dict(\n",
|
||||
" shield_type=shield_type,\n",
|
||||
" shield_id=shield_id,\n",
|
||||
" messages=[encodable_dict(m) for m in messages],\n",
|
||||
" ),\n",
|
||||
" headers={\n",
|
||||
|
@ -216,7 +216,7 @@
|
|||
" ]:\n",
|
||||
" cprint(f\"User>{message['content']}\", \"green\")\n",
|
||||
" response = await client.run_shield(\n",
|
||||
" shield_type=\"llama_guard\",\n",
|
||||
" shield_id=\"Llama-Guard-3-1B\",\n",
|
||||
" messages=[message],\n",
|
||||
" )\n",
|
||||
" print(response)\n",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue