Skip to content

Commit c694fa9

Browse files
committed
RHOAIENG-37346:Refactor Guardrails for Safety JTBD
1 parent a544b5d commit c694fa9

4 files changed

+38
-22
lines changed
Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,61 @@
11
:_module-type: ASSEMBLY
22

33
ifdef::context[:parent-context: {context}]
4-
[id="configuring-the-guardrails-orchestrator-service_{context}"]
5-
= Configuring the Guardrails Orchestrator service
4+
[id="enable-ai-safety-with-guardrails_{context}"]
5+
= Enabling AI safety with Guardrails
66

77
The TrustyAI Guardrails Orchestrator service is a tool to invoke detections on text generation inputs and outputs, as well as standalone detections.
88

99
It is underpinned by the open-source project link:https://github.com/foundation-model-stack/fms-guardrails-orchestrator[FMS-Guardrails Orchestrator] from IBM. You can deploy the Guardrails Orchestrator service through a Custom Resource Definition (CRD) that is managed by the TrustyAI Operator.
1010

11-
You can use the following detectors with trustyai_fms:
11+
The following sections describe the Guardrails components, how to deploy them and provide example use cases of how to protect your AI applications using these tools:
1212

13+
Deploy a Guardrails Orchestrator instance::
14+
The guardrails orchestrator is the main networking layer of the guardrails ecosystem, and “orchestrates” the network requests between the user, generative models, and detector servers.
15+
16+
Configure and use the built-in detectors::
17+
The Guardrails framework provides a set of “built-in” detectors out-of-the-box, that provides a number of simple detection algorithms. You can use the following detector with trustyai_fms:
18+
+
1319
* *Regex Detectors*: Pattern-based content detection for structured rule enforcement. These are the built-in detectors in the Guardrails Orchestrator service. Learn more about the link:https://github.com/trustyai-explainability/guardrails-regex-detector[guardrails-regex-detector].
1420

15-
* *Hugging Face Detectors*: Compatible with most Hugging Face `AutoModelForSequenceClassification` models, such as `granite-guardian-hap-38m` or `deberta-v3-base-prompt-injection-v2`. Learn more about the detector algorithms for the link:https://github.com/trustyai-explainability/guardrails-detectors[FMS Guardrails Orchestrator].
1621

22+
Use Hugging Face models as detectors in Guardrails Orchestrator::
23+
Any text classification model from link:https://huggingface.co/ibm-granite/granite-guardian-hap-38m[Huggingface] can be used as a detector model within the Guardrails ecosystem.
24+
+
25+
* *Hugging Face Detectors*: Compatible with most Hugging Face `AutoModelForSequenceClassification` models, such as `granite-guardian-hap-38m` or `deberta-v3-base-prompt-injection-v2`. Learn more about the detector algorithms for the link:https://github.com/trustyai-explainability/guardrails-detectors[FMS Guardrails Orchestrator].
1726
* *vLLM Detector Adapter*: Content detection compatible with Hugging Face `AutoModelForCausalLM` models, for example `ibm-granite/granite-guardian-3.1-2b`. Learn more about link:https://github.com/foundation-model-stack/vllm-detector-adapter[vllm-detector-adapter].
1827

19-
The following sections describe how to deploy Guardrails Orchestrator and provide example use cases:
28+
Configure and use the guardrails gateway::
29+
The optional Guardrails Gateway lets you create preset guardrailing pipelines that can be interacted with via /chat/completions endpoints.
2030

21-
* Deploy a Guardrails Orchestrator instance
22-
* Monitor user-inputs to your LLM
23-
* Configure and use the built-in detectors
24-
* Configure and use the guardrails gateway
25-
* Enable the OpenTelemetry exporter for metrics and tracing
26-
* Use Hugging Face models as detectors in Guardrails Orchestrator
31+
*Monitor user-inputs to your LLM*
32+
Enable a safer LLM by filtering hateful, profane, or toxic inputs.
2733

34+
*Enable the OpenTelemetry exporter for metrics and tracing*
35+
Provide observability for the security and governance mechanisms of AI applications.
2836

37+
== Deploying and Configuring Guardrails components
38+
Set up the Orchestrator, Detectors, and Gateway.
2939

3040
include::modules/deploying-the-guardrails-orchestrator-service.adoc[leveloffset=+1]
3141
include::modules/auto-configuring-guardrails.adoc[leveloffset=+1]
3242
include::modules/guardrails-orchestrator-parameters.adoc[leveloffset=+1]
33-
include::modules/guardrails-orchestrator-hap-scenario.adoc[leveloffset=+1]
3443
include::modules/guardrails-detectors.adoc[leveloffset=+1]
44+
include::modules/configuring-the-built-in-detector-and-guardrails-gateway.adoc[leveloffset=+2]
3545
include::modules/configuring-the-guardrails-detector-hugging-face-serving-runtime.adoc[leveloffset=+2]
36-
include::modules/using-a-hugging-face-prompt-injection-detector-with-the-guardrails-orchestrator.adoc[leveloffset=+2]
3746
include::modules/using-hugging-face-models-with-guardrails-orchestrator.adoc[leveloffset=+2]
38-
include::modules/configuring-the-built-in-detector-and-guardrails-gateway.adoc[leveloffset=+2]
39-
include::modules/sending-requests-to-the-regex-detector.adoc[leveloffset=+2]
40-
include::modules/guardrails-orchestrator-querying-using-guardrails-gateway.adoc[leveloffset=+2]
4147
include::modules/configuring-the-opentelemetry-exporter.adoc[leveloffset=+1]
4248

49+
== Using Guardrails for AI Safety
50+
Use the Guardrails tools to ensure the safety and security of your generative AI applications in production.
51+
52+
include::modules/guardrails-orchestrator-hap-scenario.adoc[leveloffset=+1]
53+
include::modules/using-a-hugging-face-prompt-injection-detector-with-the-guardrails-orchestrator.adoc[leveloffset=+1]
54+
include::modules/filtering-flagged-content-by-sending-requests-to-the-regex-detector.adoc[leveloffset=+2]
55+
include::modules/enforcing-configured-safety-pipelines-for-llm-inference-using-guardrails-gateway.adoc[leveloffset=+1]
56+
57+
58+
4359

4460
ifdef::parent-context[:context: {parent-context}]
4561
ifndef::parent-context[:!context:]

modules/guardrails-orchestrator-querying-using-guardrails-gateway.adoc renamed to modules/enforcing-configured-safety-pipelines-for-llm-inference-using-guardrails-gateway.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
:_module-type: PROCEDURE
22

33
ifdef::context[:parent-context: {context}]
4-
[id="querying-using-guardrails-gateway_{context}"]
5-
= Querying using guardrails gateway
4+
[id="enforcing-configured-safety-pipelines-for-LLM-inference-using-guardrails-gateway_{context}"]
5+
= Enforcing configured safety pipelines for LLM inference by using Guardrails Gateway
66
[role='_abstract']
77

8-
Guardrails gateway is a sidecar image that you can use with the `GuardrailsOrchestrator` service. It provides the OpenAI `v1/chat/completions` API and allows you to specify which detectors and endpoints you want to use to access the service.
8+
The Guardrails Gateway is a sidecar image that you can use with the `GuardrailsOrchestrator` service. When running your AI application in production, you can use the Guardrails Gateway to enforce a consistent, custom set of safety policies using a preset guardrail pipeline. For example, you can create a preset guardrail pipeline for PII detection and language moderation. You can then send chat completions requests to the preset pipeline endpoints without needing to alter my existing inference API calls. It provides the OpenAI `v1/chat/completions` API and allows you to specify which detectors and endpoints you want to use to access the service.
99

1010
.Prerequisites
1111
* You have configured the guardrails gateway image.

modules/sending-requests-to-the-regex-detector.adoc renamed to modules/filtering-flagged-content-by-sending-requests-to-the-regex-detector.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
:_module-type: PROCEDURE
22

33
ifdef::context[:parent-context: {context}]
4-
[id="sending-requests-to-the-regex-detector_{context}"]
5-
= Sending requests to the regex detector
4+
[id="filtering-flagged-content-by-sending-requests-to-the-regex-detector_{context}"]
5+
= Filtering flagged content by sending requests to the regex detector
66
[role='_abstract']
77

88
You can use the Guardrails Orchestrator API to send requests to the regex detector. The regex detector filters conversations by flagging content that matches specified regular expression patterns.

modules/using-a-hugging-face-prompt-injection-detector-with-the-guardrails-orchestrator.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
ifdef::context[:parent-context: {context}]
44
[id="using-a-hugging-face-prompt-injection-detector-with-guardrails-orchestrator_{context}"]
5-
= Using a Hugging Face Prompt Injection detector with the Guardrails Orchestrator
5+
= Preventing Prompt Injection by using a Hugging Face Prompt Injection detector
66

77
[role='_abstract']
88

0 commit comments

Comments
 (0)