Metadata-Version: 2.4
Name: qdb-ai
Version: 1.7.5
Summary: QDB: Quantum-Inspired Deductive Database & Zero-API Local Reasoning Engine
Home-page: https://github.com/prannesshkva/qdb-quantum-studio
Author: Prannesshkva
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: numpy>=1.22.0
Requires-Dist: transformers>=4.38.0
Requires-Dist: torch>=2.0.0
Requires-Dist: dimod>=0.12.0
Requires-Dist: pydantic>=2.0.0
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# ⚛️ QDB (v1.6.0): Quantum-Inspired Deductive Database & Code Hypergraph Engine

[![PyPI version](https://img.shields.io/badge/pypi-v1.6.0-blue.svg)](https://pypi.org/project/qdb-ai/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![Hardware: CPU / CUDA GPU](https://img.shields.io/badge/Hardware-CUDA%20%7C%20MPS%20%7C%20CPU-purple.svg)]()

**QDB (`qdb-ai`)** is a self-contained, multi-hop combinatorial reasoning database, AST codebase dependency hypergraph engine, embedded SQL/OLAP analytics engine, and in-VRAM thermodynamic logit interceptor.

Unlike standard Vector RAG (which relies on shallow 1-hop similarity) or Graph DBs (which suffer from $O(d^k)$ path explosion), QDB formulates multi-hop relational deduction across knowledge graphs and codebases as a **Quadratic Unconstrained Binary Optimization (QUBO)** problem solved in $< 50	ext{ms}$ via Hamiltonian ground-state energy minimization.

---

## 🚀 What's New in v1.6.0

* **🧠 Adaptive Domain Model Selection**: Auto-detects task domain and dynamically loads the optimal HuggingFace model:
  - **Code**: `microsoft/codebert-base`
  - **Finance**: `ProsusAI/finbert`
  - **Science / Research**: `allenai/scibert_scivocab_uncased`
  - **Medical / Clinical**: `dmis-lab/biobert-base-cased-v1.2`
  - **Legal**: `nlpaueb/legal-bert-base-uncased`
  - **General QA**: `bert-base-uncased`
* **⚡ Automatic Hardware & CUDA Acceleration**: Automatically detects NVIDIA GPUs, Apple MPS, or CPU and places model tensors on optimal device.
* **📦 AST-Level Codebase Ingestion (`vault.ingest_codebase`)**: Recursively parses Python AST, JS/TS, package manifests, imports, class inheritance, decorators, and function call chains into k-ary QUBO Hyperedges.
* **🕸️ k-ary HyperEdges**: Multi-participant relational clusters with direct Hamiltonian matrix couplings.
* **🤫 Clean Output**: Suppressed all checkpoint warning clutter.

---

## 📦 Installation

```bash
pip install --upgrade qdb-ai
```

---

## ⚡ Quickstart

### 1. Ingest Full Codebase & Query Architecture via QUBO
```python
import qdb
from qdb import Vault

# Initialize Vault
vault = Vault("my_codebase")

# Ingest entire repository (Python AST, JS/TS, requirements.txt, package.json)
report = vault.ingest_codebase("./src/")
print(f"Parsed {report['files_parsed']} files into {report['nodes_created']} AST nodes and {report['edges_created']} hyperedges.")

# Multi-Hop Transitive Dependency Deduction (< 50ms)
res = vault.query("What modules depend on the database layer and what functions are called?")
print(res["answer_narrative"])
```

### 2. Multi-Hop Factual Knowledge Deduction
```python
vault.ingest("Alexander Holder received the royal Beryl Coronet as security for a loan of 50000 pounds.", value=50000.0)
vault.ingest("Sir George Burnwell was the secret lover of Mary Holder and masterminded the Beryl Coronet theft.")

result = vault.query("Who masterminded the theft and what was the value of the security?")
print(result["answer_narrative"])
```

### 3. In-Memory SQL & OLAP Analytics Over Knowledge/Code
```python
sql_res = vault.query("SELECT id, content FROM states_sql WHERE content LIKE '%FUNCTION%' LIMIT 5")
print(sql_res["sql_results"])
```

### 4. In-VRAM Thermodynamic Logit Shield (+50J)
```python
from qdb import Shield
import torch

shield = Shield()
shield.register_ground_truth(
    entity_name="JPMorgan",
    aliases=["JPMC", "$JPM"],
    truth_token_ids=[1042],
    statement="JPMorgan Chase acquired First Republic Bank on May 1, 2023."
)

raw_logits = torch.randn(1, 32000)
penalized_logits, intercepted, telemetry = shield.evaluate("Tell me about $JPM", raw_logits)
```

---

## 📄 License
MIT License. Developed by Prannesshkva.
