USE CASE: RAG PIPELINES

SECURE YOUR
RAG PIPELINES

Your RAG system retrieves documents from various sources. PromptGuard ensures retrieved content doesn't contain hidden malicious instructions.

Key Capabilities

Document Scanning

Scan retrieved documents for hidden instructions, invisible text, and other indirect prompt injection techniques.

Source Validation

Validate document sources and flag content from untrusted or potentially compromised sources.

Content Sanitization

Clean retrieved content to remove potential threats while preserving useful information.

Embedding Protection

Protect your vector database from poisoning attacks that could inject malicious content.

Query Protection

Scan user queries for injection attempts before they reach your retrieval system.

Response Validation

Ensure LLM responses based on retrieved content don't leak sensitive information.

How It Works for RAG

1

Query

User query comes in. PromptGuard scans for injection attempts before retrieval.

2

Retrieve & Scan

Documents are retrieved from your vector DB. Each document is scanned for hidden threats.

3

Generate Safely

Clean, validated context is passed to the LLM. Response is validated before returning.

Secure RAG Pipeline

python
from promptguard import PromptGuard
from langchain.retrievers import VectorStoreRetriever

pg = PromptGuard(api_key="your-api-key")

# Retrieve documents
documents = retriever.get_relevant_documents(query)

# Scan each document for hidden threats
safe_documents = []
for doc in documents:
    scan_result = pg.scrape.scan(
        content=doc.page_content,
        content_type="text/plain"
    )

    if scan_result.is_safe:
        safe_documents.append(doc)
    else:
        print(f"⚠️ Blocked document: {scan_result.threats}")

# Use only safe documents for generation
response = llm.generate(context=safe_documents, query=query)

Why PromptGuard for RAG?

✓ PROMPTGUARD

  • Specialized indirect injection detection
  • Document-level threat scanning
  • Vector DB poisoning protection
  • Full pipeline security
  • Works with any RAG framework

✗ OTHER SOLUTIONS

  • No RAG-specific security
  • Query protection only
  • No document scanning
  • Blind to indirect injections
  • Framework-specific limitations

Secure Your RAG Pipeline

Stop indirect prompt injection attacks. Protect your knowledge base and your users.