Kill the notion of shield_type

This commit is contained in:
Ashwin Bharambe 2024-11-12 11:41:23 -08:00
parent 09269e2a44
commit b1c3a95485
20 changed files with 87 additions and 161 deletions

View file

@ -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",