Report Abuse

Basic Information

Pegasi Shield is a lightweight safety and reliability layer designed to sit between your application and any large language model provider. It inspects every prompt and response to detect and block unsafe content, edit outputs that violate policy, and log decisions for auditing while aiming for minimal latency and no data egress. The repository includes middleware and examples to wrap LLM calls (example shows Shield.chat_completion wrapping an OpenAI client), a research module called FRED for hallucination detection and editing, demo notebooks, and deployment artifacts such as a pure‚ÄëPython package, Docker image and Helm chart. Configuration is supported via YAML or Python, and the library emits structured traces and metrics for observability.

Links

Categorization

App Details

Features
Prompt firewall that applies lightweight rules (regex, AST, ML) with an optional LLM check to catch prompt injections and role hijacking. Output sanitisation that removes or edits personal data, hate speech, defamation and other policy violations. Hallucination controls powered by the FRED research module which scores and rewrites ungrounded text using a 4B parameter model and accompanying code and evaluation harness in fred/. Observability features that emit structured JSON traces and OpenTelemetry metrics. Flexible deployment options including pure‚ÄëPython middleware, Docker image and Helm chart for Kubernetes and VPC installs. Fully configurable pipelines (heuristics, vector similarity, policy LLM, optional Hallucination Lens rewrites).
Use Cases
Shield helps developers add safety, compliance and reliability to LLM applications by preventing prompt injections and system override attempts, sanitising outputs that violate policies, and reducing hallucinations through scoring and automated rewrites. It provides auditable decisions and risk scores via structured traces and OpenTelemetry metrics for monitoring and alerting. The middleware integrates by wrapping normal LLM calls and returns the original response object or raises a ShieldError when a request is blocked, simplifying integration. Deployment options support on‚Äëpremises and VPC use cases to avoid data egress. Research components, demo notebooks and an ICML‚Äëaccepted FRED method provide evaluation and reproducible tooling for factuality checks.

Please fill the required fields*