#23285·llama_index

docs: add promptfirewall callback integration to integrations listing

Author: TimurRakhmatullin86Created Sep 28, 2026Updated Sep 28, 2026

Description

Request to add promptfirewall to the callbacks integration listing.

llama-index-callbacks-promptfirewall is an independently published PyPI package that provides PII detection and prompt injection blocking as both a LlamaIndex callback handler (legacy) and an instrumentation event handler (new).

This is a listing request only — no code is being added to the monorepo.

Package Details

Field Value
PyPI Package llama-index-callbacks-promptfirewall
GitHub Repository TimurRakhmatullin86/llama-index-callbacks-promptfirewall
Core Library TimurRakhmatullin86/promptfirewall
License MIT

What It Does

Sub-millisecond PII detection and prompt injection firewall for LlamaIndex applications. Written in Rust, exposed to Python via PyO3.

Two handler modes:

  1. Legacy: PromptFirewallHandler(BaseCallbackHandler) — hooks CBEventType.LLM and CBEventType.QUERY
  2. New: PromptFirewallEventHandler(BaseEventHandler) — handles LLMChatStartEvent, LLMCompletionStartEvent, LLMPredictStartEvent

Supported PII types: SSN, credit card (Luhn-validated), IBAN (ISO 7064), email, phone, IP address, AWS keys, API keys

Quick Start

python
from llama_index_callbacks_promptfirewall import PromptFirewallHandler
from llama_index.core.callbacks import CallbackManager
from llama_index.core import Settings

handler = PromptFirewallHandler()
Settings.callback_manager = CallbackManager([handler])
# All LLM calls and queries are now scanned

Performance

Library Latency Approach
promptfirewall 12μs Heuristic + TF-IDF (Rust)
Presidio ~180ms Regex + NER
LLM Guard ~300ms ML models

The only comparable integration is llama-index-postprocessor-presidio (PII only, ~180ms, no injection detection).