Check if the output message is allowed based on guardrail rules.
If it does it returns None, otherwise it returns an AgentChatResponse
containing a message indicating the output is not allowed.
Parameters: |
-
message
(str )
–
User input message to validate
-
is_stream
(bool )
–
Flag indicating if the response is a stream
|
Returns: |
-
bool ( Optional[AgentChatResponse]
) –
None if the output is allowed, otherwise an AgentChatResponse
-
Optional[AgentChatResponse]
–
containing a message indicating the output is not allowed.
|
Source code in src/augmentation/components/guardrails/base_guardrails.py
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45 | @abstractmethod
def output_guard(
self, message: str, is_stream: bool
) -> Optional[AgentChatResponse]:
"""
Check if the output message is allowed based on guardrail rules.
If it does it returns None, otherwise it returns an AgentChatResponse
containing a message indicating the output is not allowed.
Args:
message: User input message to validate
is_stream: Flag indicating if the response is a stream
Returns:
bool: None if the output is allowed, otherwise an AgentChatResponse
containing a message indicating the output is not allowed.
"""
pass
|