Skip to content

Conversation

@skrthomas
Copy link
Contributor

@skrthomas skrthomas commented Nov 7, 2025

Description

How Has This Been Tested?

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Summary by CodeRabbit

  • Documentation
    • Streamlined HAP detector deployment documentation for Guardrails Orchestrator by eliminating manual storage configuration
    • Updated deployment guidance to support coordinated setup of HAP and Prompt Injection detectors
    • Enhanced configuration examples and updated supporting resource references
    • Simplified overall workflow with improved deployment approach

@coderabbitai
Copy link

coderabbitai bot commented Nov 7, 2025

Walkthrough

Documentation updates refactor detector deployment approach by removing separate model storage manifest and replacing with pre-published detectors accessed via storageUri. Changes include updating Prompt Injection detector configuration to use Red Hat registry images and introducing new HAP detector deployment alongside simplified instructions.

Changes

Cohort / File(s) Summary
Removed storage configuration
modules/using-a-hugging-face-prompt-injection-detector-with-the-guardrails-orchestrator.adoc
Removed detector_model_storage.yaml manifest, associated PVClaim, Deployment, and AWS Minio secrets; removed corresponding deployment step.
Updated Prompt Injection detector
modules/using-a-hugging-face-prompt-injection-detector-with-the-guardrails-orchestrator.adoc
Updated Prompt Injection detector configuration: changed display-name to guardrails-detector-runtime-prompt-injection, model format to guardrails-detector-hf-runtime, container image to Red Hat registry, storage from separate keys to storageUri, and Route to prompt-injection-detector-route.
Added HAP detector configuration
modules/using-a-hugging-face-prompt-injection-detector-with-the-guardrails-orchestrator.adoc
Introduced hap_detector.yaml defining ServingRuntime for HAP, InferenceService hap-detector, and Route hap-detector-route; added deployment steps and configuration blocks for HAP detector.
Updated detector configuration and narrative
modules/using-a-hugging-face-prompt-injection-detector-with-the-guardrails-orchestrator.adoc
Added ConfigMap snippet for configuring both HAP and Prompt Injection detectors; updated narrative guidance to reference unified deployment approach and TrustyAI LLM demo links.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Verify consistency of detector configuration references between old and new YAML examples
  • Confirm storage migration from separate model storage to storageUri is correctly documented
  • Ensure narrative flow logically guides readers through the simplified deployment process

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Updating HF docs to use ModelCars' is vague and does not clearly reflect the actual substantive changes in the documentation. The PR involves significant restructuring of detector deployment (removing detector_model_storage.yaml, introducing hap_detector.yaml, updating storage references, and adding new configuration blocks), but the title only vaguely references 'ModelCars' without clarifying what changes are being made or why. Use a more specific and descriptive title that captures the main changes, such as 'Refactor HuggingFace detector deployment to use pre-published models with HAP and Prompt Injection detectors' or 'Update HuggingFace detector configuration to use ModelCars storage approach'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
modules/using-a-hugging-face-prompt-injection-detector-with-the-guardrails-orchestrator.adoc (2)

304-317: HAP detector hostname in ConfigMap does not match deployment.

Line 307 references ibm-hap-38m-detector-predictor as the HAP detector hostname, but the HAP detector InferenceService is named hap-detector (line 236), which produces the service name hap-detector-predictor. This mismatch will cause the Orchestrator to fail service discovery.

Update line 307 to use the correct hostname:

      hap:
        type: text_contents
        service:
-         hostname: ibm-hap-38m-detector-predictor
+         hostname: hap-detector-predictor
          port: 8000

Alternatively, if you intend to use a pre-existing ibm-hap-38m-detector service, ensure it is deployed separately and update the documentation accordingly.


364-369: Fix typo on line 367.

Line 367 contains a typo: "lvel" should be "level".

-.. Carry out content filtering for a text generation LLM at the input lvel, output level, or both.
+.. Carry out content filtering for a text generation LLM at the input level, output level, or both.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7dc427 and bb524ac.

📒 Files selected for processing (1)
  • modules/using-a-hugging-face-prompt-injection-detector-with-the-guardrails-orchestrator.adoc (4 hunks)
🔇 Additional comments (1)
modules/using-a-hugging-face-prompt-injection-detector-with-the-guardrails-orchestrator.adoc (1)

99-176: Prompt Injection detector configuration looks good overall.

The updates to the Prompt Injection detector—including the new display-name and template-name annotations, model format name, and Red Hat registry image—align well with the migration to pre-published detectors. The storageUri correctly references a remote OCI-based detector image.

Comment on lines +185 to +282
. Create `hap_detector.yaml`:
+
[source,yaml]
----
apiVersion: serving.kserve.io/v1alpha1
kind: ServingRuntime
metadata:
name: guardrails-detector-runtime-hap
annotations:
openshift.io/display-name: guardrails-detector-runtime-hap
opendatahub.io/recommended-accelerators: '["nvidia.com/gpu"]'
opendatahub.io/template-name: guardrails-detector-huggingface-runtime
labels:
opendatahub.io/dashboard: 'true'

spec:
annotations:
prometheus.io/port: '8080'
prometheus.io/path: '/metrics'
multiModel: false
supportedModelFormats:
- autoSelect: true
name: guardrails-detector-hf-runtime
containers:
- name: kserve-container
image: registry.redhat.io/rhoai/odh-guardrails-detector-huggingface-runtime-rhel9:v2.25
command:
- uvicorn
- app:app
args:
- "--workers"
- "4"
- "--host"
- "0.0.0.0"
- "--port"
- "8000"
- "--log-config"
- "/common/log_conf.yaml"
env:
- name: MODEL_DIR
value: /mnt/models
- name: HF_HOME
value: /tmp/hf_home
ports:
- containerPort: 8000
protocol: TCP

---
apiVersion: serving.kserve.io/v1beta1
kind: InferenceService
metadata:
name: hap-detector
labels:
opendatahub.io/dashboard: 'true'
annotations:
openshift.io/display-name: hap-detector
serving.knative.openshift.io/enablePassthrough: 'true'
sidecar.istio.io/inject: 'true'
sidecar.istio.io/rewriteAppHTTPProbers: 'true'
serving.kserve.io/deploymentMode: RawDeployment

spec:
predictor:
maxReplicas: 1
minReplicas: 1
model:
modelFormat:
name: guardrails-detector-hf-runtime
name: ''
runtime: guardrails-detector-runtime-hap
storageUri: 'oci://quay.io/trustyai_testing/detectors/deberta-v3-base-prompt-injection-v2@sha256:8737d6c7c09edf4c16dc87426624fd8ed7d118a12527a36b670be60f089da215'
resources:
limits:
cpu: '1'
memory: 2Gi
nvidia.com/gpu: '0'
requests:
cpu: '1'
memory: 2Gi
nvidia.com/gpu: '0'

---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: hap-detector-route
spec:
to:
kind: Service
name: hap-detector-predictor
----
. Apply `hap_detector.yaml` to configure a serving runtime, inference service, and route for the HAP detector:
+
[source,bash]
----
oc apply -f hap_detector.yaml
----
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

HAP detector storageUri references wrong model.

The HAP detector configuration at line 255 references the same Prompt Injection model (deberta-v3-base-prompt-injection-v2), which will cause HAP detection to fail. The storageUri should point to a HAP-specific model instead.

Update the storageUri on line 255 to reference the correct HAP model. For example, it might be something like oci://quay.io/trustyai_testing/detectors/deberta-v3-base-hap-v2@sha256:... or similar, depending on your registry.

If you're unsure of the correct HAP model reference, please verify with the TrustyAI project documentation or team.



---

🏁 Script executed:

```shell
#!/bin/bash
# Search for all storageUri occurrences in the document to compare HAP vs Prompt Injection
rg -n "storageUri" modules/using-a-hugging-face-prompt-injection-detector-with-the-guardrails-orchestrator.adoc -A1 -B1

Length of output: 503


🏁 Script executed:

#!/bin/bash
# Search for Prompt Injection detector configuration and related model references
rg -n "prompt-injection\|prompt.injection\|Prompt Injection" modules/using-a-hugging-face-prompt-injection-detector-with-the-guardrails-orchestrator.adoc -i -C3

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Get the full content around the lines to understand the complete picture
sed -n '1,300p' modules/using-a-hugging-face-prompt-injection-detector-with-the-guardrails-orchestrator.adoc | tail -200

Length of output: 5199


HAP detector storageUri references wrong model (line 255).

The HAP detector is configured with the identical storageUri as the Prompt Injection detector (deberta-v3-base-prompt-injection-v2). This will deploy the wrong model, causing HAP detection to fail. Use a HAP-specific model instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant