mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-07 12:47:37 +00:00
Add toolchain from agentic system here
This commit is contained in:
parent
f6b2b2fb39
commit
95781ec85d
71 changed files with 11899 additions and 0 deletions
28
toolchain/safety/shields/contrib/third_party_shield.py
Normal file
28
toolchain/safety/shields/contrib/third_party_shield.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
import sys
|
||||
from typing import List
|
||||
|
||||
from models.llama3.datatypes import Message
|
||||
|
||||
parent_dir = "../.."
|
||||
sys.path.append(parent_dir)
|
||||
from toolchain.safety.shields.base import OnViolationAction, ShieldBase, ShieldResponse
|
||||
|
||||
_INSTANCE = None
|
||||
|
||||
|
||||
class ThirdPartyShield(ShieldBase):
|
||||
@staticmethod
|
||||
def instance(on_violation_action=OnViolationAction.RAISE) -> "ThirdPartyShield":
|
||||
global _INSTANCE
|
||||
if _INSTANCE is None:
|
||||
_INSTANCE = ThirdPartyShield(on_violation_action)
|
||||
return _INSTANCE
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
on_violation_action: OnViolationAction = OnViolationAction.RAISE,
|
||||
):
|
||||
super().__init__(on_violation_action)
|
||||
|
||||
async def run(self, messages: List[Message]) -> ShieldResponse:
|
||||
super.run() # will raise NotImplementedError
|
Loading…
Add table
Add a link
Reference in a new issue