Skip to main content

SDK Components

RAXE provides a comprehensive Python SDK with the following components:

Quick Import Reference

# Core clients
from raxe import Raxe, AsyncRaxe

# LLM wrappers
from raxe import RaxeOpenAI, RaxeAnthropic

# Types and models
from raxe import Detection, Severity, ScanResult

# Exceptions
from raxe import (
    RaxeException,
    RaxeBlockedError,
    ValidationError,
    AuthenticationError,
    ConfigurationError,
)

# LangChain integration
from raxe import RaxeCallbackHandler

Basic Usage Pattern

from raxe import Raxe

# Initialize client
raxe = Raxe()

# Scan a prompt
result = raxe.scan("user input here")

# Check result
if not result.has_threats:
    # Proceed with LLM call
    pass
else:
    # Handle threat
    print(f"Threat: {result.severity}")
    for detection in result.detections:
        print(f"  - {detection.rule_id}: {detection.severity}")

Type Annotations

RAXE is fully typed for IDE support:
from raxe import Raxe
from raxe import ScanResult, Detection

def process_input(user_input: str) -> bool:
    raxe: Raxe = Raxe()
    result: ScanResult = raxe.scan(user_input)
    detections: list[Detection] = result.detections
    return not result.has_threats

API Stability

ComponentStabilityNotes
RaxeStableCore API
AsyncRaxeStableAsync API
ScanResultStableResult model
DetectionStableDetection model
RaxeOpenAIStableOpenAI wrapper
RaxeAnthropicStableAnthropic wrapper
RaxeCallbackHandlerBetaLangChain integration