Metadata-Version: 2.4
Name: nlproxy
Version: 1.0.0
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
License-File: LICENSE.md
Summary: High-performance prompt compression and LLM proxy SDK by IntelliDeep
Home-Page: https://github.com/intellideep/nlproxy
Author-email: Intellideep <intellideeplabs@gmail.com>
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# nlproxy-python: High-Performance Python SDK (v1.0.0)

This branch contains the high-performance Python SDK bindings for **nlproxy**, compiled from our Rust core engine using Maturin and PyO3. 

It provides the speed of native Rust execution (sub-3ms latency, 5000+ rps) wrapped in an easy-to-use Python interface.

[![License: BSL-1.1](https://img.shields.io/badge/License-BSL--1.1-red.svg)](LICENSE.md)

---

## 📦 Installation

To install this high-performance version of the SDK directly from GitHub:

```bash
# Install directly from the sdk-python branch
pip install git+https://github.com/intellideep/nlproxy.git@sdk-python
```

*Note: This will automatically build and compile the Rust core on your local system. Ensure you have the Rust toolchain (`rustc` and `cargo`) installed.*

---

## 💻 Code Example

```python
from nlproxy import init_engine, ensure_models_ready, compress_prompt, run_unified_pipeline, CompressRequest, CompressUnifiedRequest

# 1. Download models automatically if needed
ensure_models_ready("models")

# 2. Initialize the Candle embedding engine with local models
init_engine(
    "models/all-MiniLM-L6-v2/model.safetensors",
    "models/all-MiniLM-L6-v2/config.json",
    "models/all-MiniLM-L6-v2/tokenizer.json"
)

# 3. Compress prompt and redact PII
req = CompressRequest(
    text="The database server is located at 192.168.1.150.",
    mode="general",
    aggressiveness=0.5
)
res = compress_prompt(req)

print("Shielded Prompt:", res.processed_text)
# "The database server is located at __PROT_82736284__."

print("PII Placeholders:", res.placeholders)
# { "__PROT_82736284__": "192.168.1.150" }
```

### Run Unified Orchestrated Pipeline
Execute a complete secure LLM pipeline including firewall checks, Redis semantic cache lookup, prompt compression, upstream LLM execution, and post-LLM verification:

```python
# Create pipeline request
pipeline_req = CompressUnifiedRequest(
    prompt="Connect to database and extract tables",
    domain="general",
    aggressiveness=0.0,
    provider="gemini",
    model="gemini-1.5-pro",
    bypass_cache=False,
    check_firewall=True
)

# Run pipeline
pipeline_res = run_unified_pipeline(pipeline_req)

print("Allowed:", pipeline_res.allowed)
print("Response:", pipeline_res.final_response)
print("Latency:", pipeline_res.latency_ms, "ms")
```

---

## 🏢 Authors & Cofounders

This SDK is developed and maintained exclusively by **IntelliDeep Labs**.

* **B-GUST** (Co-founder / Lead Developer): [github.com/B-GUST](https://github.com/B-GUST)
* **luiserb** (Co-founder / Architect): [github.com/luiserb](https://github.com/luiserb)

For attributions and licenses of integrated open-source components, see [credits.md](credits.md).

---
© 2026 IntelliDeep Labs. All rights reserved.

