Skip to content

This repository is intended to provide a collection of detectors that are supported by the TrustyAI team in the context of the FMS Guardrails Orchestrator project

License

Notifications You must be signed in to change notification settings

opendatahub-io/guardrails-detectors

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Detector Algorithms for the FMS Guardrails Orchestrator

FMS Guardrails Orchestrator is an open source project led by IBM which provides a server for invocation of detectors on text generation input and output, and standalone detections.

This repository is intended to provide a collection of detector algorithms and microservices that are supported by the TrustyAI team.

Detectors

At the moment, the following detectors are supported:

  • huggingface -- a generic detector class that is intended to be compatible with any AutoModelForSequenceClassification or a specific kind of AutoModelForCausalLM, namely GraniteForCausalLM; this detector exposes /api/v1/text/contents and thus, could be configured to be a detector of type: text_contents within the FMS Guardrails Orchestrator framework. This detector is also intended to be deployed as a KServe inference service.
  • llm_judge -- Integrates the vLLM Judge library to use LLM-as-a-judge based guardrailing architecture
  • builtIn -- Small, lightweight detection functions that are deployed out-of-the-box alongside the Guardrails Orchestrator. The built-in detectors provide a number of heuristic or algorithmic detection functions, such as:
    • Regex-based detections, with pre-written regexes for flagging various Personally Identifiable Information items like emails or phone numbers, as well as the ability to provide custom regexes
    • File-type validations, for verifying if model input/output is valid JSON, XML, or YAML

Building

  • huggingface: podman build -f detectors/Dockerfile.hf detectors
  • llm_judge: podman build -f detectors/Dockerfile.llm_judge detectors
  • builtIn: podman build -f detectors/Dockerfile.builtIn detectors

Running locally

  • builtIn: podman run -p 8080:8080 $BUILT_IN_IMAGE

Examples

  • Check out built-in detector examples to see how to use the built-in detectors for file type validation and personally identifiable information (PII) detection
  • Check out Hugging Face detector examples to see how to use the Hugging Face detectors for detecting toxic content and prompt injection

API

See IBM Detector API

License

This project is licensed under the Apache License Version 2.0 - see the LICENSE file for details.

About

This repository is intended to provide a collection of detectors that are supported by the TrustyAI team in the context of the FMS Guardrails Orchestrator project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%