Skip to main content

Production-ready AI components framework with security and resilience

Project description

AI_Catalyst Framework

PyPI version Python 3.9+ License: MIT

A production-ready AI components framework with enterprise-grade security, resilience, and async performance optimizations.

🚀 Features

Core Components

  • 🤖 Three-Tier LLM System - Local/Network/OpenAI with concurrent failover (3x faster)
  • 🔒 PII Detection & Scrubbing - Enterprise-grade data protection with audit logging
  • 📁 Multi-Format File Processing - Async streaming for JSON, JSONL, CSV, TXT
  • 🗄️ Database Patterns - Async PostgreSQL with connection pooling
  • ⚙️ Configuration Management - Encrypted config with key rotation
  • 📊 System Monitoring - Health checks and performance metrics

Security & Resilience

  • 🔐 Secure Configuration - AES-256 encryption for sensitive data
  • 🔑 API Key Vault - Secure storage with automatic rotation
  • 🚦 Rate Limiting - Token bucket algorithm with configurable limits
  • 📋 Audit Logging - Comprehensive compliance tracking
  • 🔄 Retry Logic - Exponential backoff with circuit breakers
  • 💚 Health Monitoring - Continuous service availability checks

📦 Installation

pip install ai-catalyst

⚡ Quick Start

Basic Usage

import asyncio
from ai_catalyst import LLMProvider, PIIProcessor, FileProcessor

async def main():
    # LLM with automatic failover
    llm = LLMProvider()
    response = await llm.generate_async("Explain quantum computing")
    print(f"Response: {response['content']}")
    
    # PII scrubbing with audit logging
    pii = PIIProcessor()
    clean_text = await pii.scrub_text_async("Call John at 555-1234")
    print(f"Scrubbed: {clean_text}")  # "Call <NAME> at <PHONE>"
    
    # Async file processing
    processor = FileProcessor()
    async for item in processor.process_file_async("data.json"):
        print(f"Processed: {item['data']}")

asyncio.run(main())

Production Setup with Security

from ai_catalyst import (
    LLMProvider, APIKeyVault, RateLimiter, 
    AuditLogger, SecureConfigManager
)

# Setup secure environment
key_vault = APIKeyVault()
key_vault.store_key('openai', 'your-api-key')

rate_limiter = RateLimiter()
audit_logger = AuditLogger(log_file='audit.log')

# Initialize with security components
llm = LLMProvider(
    key_vault=key_vault,
    rate_limiter=rate_limiter,
    audit_logger=audit_logger
)

🏗️ Architecture

Async-First Design

  • Non-blocking I/O - All operations are async by default
  • Concurrent Processing - Parallel execution with semaphore control
  • Backward Compatibility - Sync wrappers for existing code
  • Resource Management - Proper cleanup and session handling

Security Model

  • Zero-Trust - All operations are logged and rate-limited
  • Encryption - Sensitive data encrypted at rest
  • Audit Trail - Complete compliance logging
  • Access Control - API key management with rotation

Resilience Patterns

  • Circuit Breakers - Automatic failure detection and recovery
  • Retry Logic - Exponential backoff with jitter
  • Health Checks - Continuous service monitoring
  • Graceful Degradation - Fallback strategies for all components

📊 Performance

Operation Before After Improvement
LLM Failover 45s 15s 3x faster
Batch PII Processing 60s 12s 5x faster
File Processing Blocking Streaming Non-blocking
Rate Limiting N/A <1ms Sub-millisecond

🔧 Configuration

Environment Variables

# API Keys
export OPENAI_API_KEY="your-openai-key"
export ANTHROPIC_API_KEY="your-anthropic-key"

# Security
export AI_CATALYST_MASTER_KEY="your-encryption-key"

Configuration File

# config.yaml
llm:
  timeout: 30
  model: "gpt-4"
  
security:
  rate_limits:
    openai: "paid"  # or "free"
  audit_log: "audit.log"
  
processing:
  batch_size: 100
  max_concurrency: 10

🧪 Testing

# Install with dev dependencies
pip install ai-catalyst[dev]

# Run tests
pytest

# Run with coverage
pytest --cov=ai_catalyst

📚 Documentation

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

📄 License

MIT License - see LICENSE file for details.

🆘 Support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_catalyst-0.1.0.tar.gz (40.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_catalyst-0.1.0-py3-none-any.whl (43.1 kB view details)

Uploaded Python 3

File details

Details for the file ai_catalyst-0.1.0.tar.gz.

File metadata

  • Download URL: ai_catalyst-0.1.0.tar.gz
  • Upload date:
  • Size: 40.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for ai_catalyst-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eb99c7ae263ba0a854381d0e4d40a7743b77a43ca22eb39179da030f61066e8b
MD5 6fb2f4e0d2896eb2e7e63d659583779d
BLAKE2b-256 a6f9a26b87117e0c06fa77108ec5be36f77ac967602fc75fe94601d463155ac5

See more details on using hashes here.

File details

Details for the file ai_catalyst-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ai_catalyst-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 43.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for ai_catalyst-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 622939e0e301e3c4df673bac88ebdc998b09b5decb9d42b8d703ca7644076a12
MD5 58a7fe5f19467269af6e3da15ce157c3
BLAKE2b-256 4fbb38915ab50897e05ff23787d2fbd860b259e28be11da57637c84cb46b0c57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page