Skip to main content

High-performance prompt compression and LLM proxy SDK by IntelliDeep

Project description

nlproxy (Python SDK)

A high-performance, native Python library for semantic prompt compression, prompt firewalling (jailbreak protection), and secure LLM orchestration. Developed and owned by IntelliDeep.

Compiled using PyO3 and Maturin directly from Rust, nlproxy offers sub-millisecond execution times and ~1500x higher throughput than pure Python-based middleware solutions.

PyPI Version License: Proprietary / Open Core


🚀 Key Features

  • PII Shielding & Masking: Redact sensitive data (IPs, emails, API keys, credentials) before they reach cloud LLMs.
  • Semantic Prompt Compression: Locally segment and compress long prompts using KMeans semantic clustering on quantized weights.
  • Candle Inference Integration: Utilizes Hugging Face Candle to run Sentence-Transformers locally and offline with zero network calls.
  • Unified Pipeline Orchestration: Combine cache checks, local prompt firewalls, prompt compression, LLM generation (Gemini, OpenAI, Claude), and post-LLM validation.

📦 Installation

Ensure you have Python 3.8+ installed, then run:

pip install nlproxy

Maturin will link the precompiled binary (.so on Linux/macOS or .pyd on Windows) directly into your virtual environment.


🐍 Python API Quickstart

1. Initialize the Offline Model Engine

Before processing prompts, load your local quantized Sentence-Transformers model weights (e.g. all-MiniLM-L6-v2) offline:

import nlproxy

success = nlproxy.init_engine(
    "models/model.onnx",
    "models/config.json",
    "models/tokenizer.json"
)

if success:
    print("IntelliDeep semantic engine successfully loaded offline!")

2. Shield and Compress Prompts

import nlproxy

# Create the request payload
request = nlproxy.CompressRequest(
    text="The database server is located at 192.168.50.22. Please run checkup.",
    mode="general",
    aggressiveness=0.5
)

# Run the native compression
response = nlproxy.compress_prompt(request)

print("Processed text:", response.processed_text)
# Output: "The database server is located at __PROT_82736284__. Please run checkup."

print("Extracted Placeholders:", response.placeholders)
# { "__PROT_82736284__": "192.168.50.22" }

3. Unified Async Orchestration Pipeline

import nlproxy

request = nlproxy.CompressUnifiedRequest(
    prompt="Generate status report for 192.168.1.1",
    domain="general",
    aggressiveness=0.0,
    provider="gemini",
    model="gemini-1.5-pro",
    bypass_cache=False,
    check_firewall=True,
    semantic_drift_threshold=0.75
)

try:
    response = nlproxy.run_unified_pipeline(request)
    if response.allowed:
        print("Raw response from LLM:", response.raw_response)
        print("Final response with PII restored:", response.final_response)
        print("Execution overhead:", response.latency_ms, "ms")
    else:
        print("Blocked by Prompt Firewall:", response.violations)
except Exception as e:
    print("Execution failed:", str(e))

🛠️ Architectural Open Core Model

This Python SDK is built on top of nlproxy-core using a hybrid commercial model:

  • Open Core (Default): Single-threaded limit, artificial 150 ms delay per unified execution. Recommended for local developer evaluation.
  • Enterprise Basic: Up to 4 high-speed parallel threads, 0 ms artificial delays.
  • Enterprise Unlimited: Uses all CPU cores, 0 ms artificial overhead.

To upgrade, load a valid license key into your environment variables:

export NLPROXY_LICENSE_KEY="your_base64_or_jwt_license_key"

🏢 Authors & Attribution

Developed and maintained exclusively by IntelliDeep Solutions.

  • B-GUST (Co-founder / Lead Developer)
  • luiserb (Co-founder / Architect)

© 2026 IntelliDeep Solutions. All rights reserved.

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

nlproxy-0.1.0.tar.gz (49.3 kB view details)

Uploaded Source

Built Distribution

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

nlproxy-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.39+ x86-64

File details

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

File metadata

  • Download URL: nlproxy-0.1.0.tar.gz
  • Upload date:
  • Size: 49.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.13.3

File hashes

Hashes for nlproxy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 31efae966e5640bee389a8308e125bb12b1470203e0f6aafb90079bbc540a2c4
MD5 d7c2638c37fee72c6849862cd6ac7f78
BLAKE2b-256 820b63d220c0ab919dcb8dff351e57a317cbe4932591088e5688608f2e1e160e

See more details on using hashes here.

File details

Details for the file nlproxy-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for nlproxy-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 7d56d57f4c7a5218fe160a11109d45817792c74e240f2c2cbba75a8695a84ac8
MD5 096b2ddb8c78088a014047aadfbb9b80
BLAKE2b-256 0726bb5b306acd89e9c2bed393aee8d6cfb6e25b0b9f3155f27563d563146c72

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