Documentation
¶
Overview ¶
Package guardian provides a deterministic content-safety model for the guardrail policies that ask an OpenAI-compatible chat model for a verdict: NeMo Guard Content Safety and Granite Guardian.
The verdict is driven by keywords in the text under review, so a scenario chooses the outcome by what it sends:
UNSAFE_USER the user turn is unsafe (NeMo Guard "User Safety") UNSAFE_RESPONSE the agent turn is unsafe (NeMo Guard "Response Safety") UNSAFE Granite Guardian detects the configured risk GUARDIAN_DOWN the model fails (503), as an unavailable safety service does
NeMo Guard sends both turns in one prompt, so its two keywords are distinct: each check reads only its own verdict.
Index ¶
Constants ¶
View Source
const ( UnsafeUser = "UNSAFE_USER" UnsafeResponse = "UNSAFE_RESPONSE" Unsafe = "UNSAFE" // Down makes the request fail, so a scenario reaches a guardrail's // service-unavailable path without a gateway configured to point elsewhere. Down = "GUARDIAN_DOWN" )
Keywords that select an unsafe verdict.
View Source
const ChatPath = "/v1/chat/completions"
ChatPath is the OpenAI-compatible route both guardrails call.
View Source
const Port = 3016
Port is the container port used by the testbench.
View Source
const UnsafeCategory = "Violence"
UnsafeCategory is the NeMo Guard safety category an unsafe verdict names.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.