Metadata-Version: 2.4
Name: nova-llm
Version: 0.5.0
Summary: NOVA AI: Unified Adaptive Computation (NOVA-UAC) Reference Engine and Developer SDK
Author: NOVA Research Team
License: Apache-2.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: torch>=2.0.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: scipy>=1.10.0
Requires-Dist: fastapi>=0.100.0
Requires-Dist: uvicorn>=0.22.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: safetensors>=0.4.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"

# NOVA AI: Unified Adaptive Computation (NOVA-UAC)
**Research Programme & Autonomous AI Engineering Platform · Version 0.1**

[![PyPI Version](https://img.shields.io/pypi/v/nova-llm.svg?color=blue)](https://pypi.org/project/nova-llm/0.4.4/)
[![npm package](https://img.shields.io/badge/npm-v0.4.4-red.svg)](https://www.npmjs.com/package/nova-llm)
[![Python Version](https://img.shields.io/badge/python-3.10%2B%20%7C%203.14-green.svg)](https://www.python.org/)
[![TypeScript](https://img.shields.io/badge/typescript-5.0%2B-blue.svg)](https://www.typescriptlang.org/)
[![License](https://img.shields.io/badge/license-MIT-purple.svg)](LICENSE)

> 📘 **Master Documentation**: For the complete unified research specification, mathematical derivations, empirical benchmark results, and full-stack SDK references, see [NOVA_MASTER_DOCUMENTATION.md](file:///c:/Users/VISHWANATH/Downloads/nova%20llm/NOVA_MASTER_DOCUMENTATION.md).

### Package Repositories & Quick Install:
- **Python Package (PyPI)**: [`nova-llm` on PyPI](https://pypi.org/project/nova-llm/0.2.0/)  
  ```bash
  pip install nova-llm
  ```
- **JavaScript/TypeScript SDK (npm)**: [`nova-llm` on npm](https://www.npmjs.com/package/nova-llm)  
  ```bash
  npm install nova-llm
  ```

---

NOVA is an independent AI engineering platform and scientific research architecture built around a **Unified Adaptive Computation (NOVA-UAC)** runtime. 

Unlike traditional LLM systems that require external model APIs or manually assembled RAG, CAG, MAG, and brittle agent pipelines, NOVA couples:
1. **Continuous State Evolution** (Unified State Field, USF with Lipschitz contraction dynamics)
2. **Universal Multimodal Ingestion** (Real-time streaming of images, videos, documents, and sensor telemetry)
3. **Dynamic Resonance Memory** (DRM with transactional confidence, utility decay, and knapsack capacity controls)
4. **Experience-Coupled Adaptive Learning** (ECAL with gradient conflict estimation and stability regularization)
5. **Adaptive Resource Allocation** (ARA value-of-compute policies)
6. **Mobile Edge Compression** (INT8 / INT4 symmetric quantization for on-device smartphone deployment)
7. **Native Agentic Workflows** (StateGraph and Pipeline SDKs comparable to LangGraph/LangChain)
8. **Local REST Serving API** (FastAPI model serving with telemetry trace inspection)

---

## Architecture Overview

```
                      +---------------------------------------+
                      |         NOVA Python SDK / CLI         |
                      +---------------------------------------+
                                          |
                                          v
                      +---------------------------------------+
                      |        NOVA Runtime & Context         |
                      +---------------------------------------+
                                          |
                                          v
                      +---------------------------------------+
                      |    Universal Multimodal Encoder       |
                      |  [Images | Video | Docs | Telemetry]  |
                      +---------------------------------------+
                                          |
                                          v
             +--------------------> Unified State Field (USF) <----------------+
             |                                  |                              |
             |       +--------------------------+--------------------------+   |
             |       |                          |                          |   |
             v       v                          v                          v   v
+-------------------------+        +-------------------------+       +-------------------+
|  Resonance Operator     |        |   Ensemble Task Head    |       | Innovation Head   |
|  Association / Retrieval|        |  Uncertainty Estimator  |       | Scale Novelty     |
+-------------------------+        +-------------------------+       +-------------------+
             |                                  |                              |
             v                                  v                              v
+-------------------------+        +-------------------------+       +-------------------+
| Dynamic Resonance Memory|        |      ECAL Controller    |       | ARA Compute Policy|
| DRM (Write Gate & Decay)|        |  Adaptive Gradient Step |       | Refinement Budget |
+-------------------------+        +-------------------------+       +-------------------+
                                                |
                                                v
                                   +-------------------------+
                                   |   Edge Mobile Exporter  |
                                   |  INT8 / INT4 PTQ Bundle |
                                   +-------------------------+
```

---

## Installation

Install directly from PyPI:
```bash
pip install nova-llm
```

Or install from source with dependencies:
```powershell
python -m pip install -r requirements.txt
```

### 2. Developer Model API
```python
import nova
import numpy as np

# 1. Initialize NOVA Engine
engine = nova.Engine(device="cpu", seed=42)

# 2. Instantiate Model
model = engine.create_model(
    name="my_intelligence",
    architecture="nova_uac_v0",
    input_dim=8,
    state_dim=32,
    output_dim=1,
    memory_dim=16
)

# 3. Create Dataset from real numeric dynamics
x = np.random.randn(200, 8).astype(np.float32)
y = (np.sin(x[:, :1]) + 0.5 * np.cos(x[:, 1:2])).astype(np.float32)
dataset = nova.Dataset.from_numpy(x, y)

# 4. Train with ECAL and DRM
model.fit(dataset, epochs=5, batch_size=16)

# 5. Evaluate and Save
metrics = model.evaluate(dataset)
model.save("./artifacts/my_model")

# 6. Load & Predict Deterministically
loaded = nova.load("./artifacts/my_model")
pred, trace = loaded.predict(x[:5], return_trace=True)
print(pred, trace.avg_novelty, trace.avg_uncertainty)
```

### 3. Streaming Multimodal Ingestion & Mobile Edge Export
```python
import nova
from nova.sdk.multimodal_dataset import MultimodalStreamingDataset
from nova.compression.mobile_export import EdgeMobileExporter

# 1. Ingest any folder of images, videos, documents, or data
dataset = MultimodalStreamingDataset.from_directory("./my_uploads", embed_dim=16)

# 2. Train and adapt in real time on the stream
engine = nova.Engine(seed=42)
model = engine.create_model(input_dim=16, state_dim=32, output_dim=1, memory_dim=16)
for batch_x, batch_y in dataset.stream_batches(batch_size=16):
    model.executor.training_step(batch_x, batch_y[:, :1], model.network.init_state(batch_x.shape[0]))

# 3. Export compressed INT8 bundle for smartphones (Android / iOS)
exporter = EdgeMobileExporter(model)
manifest = exporter.export_for_mobile("./artifacts/mobile_bundle", bits=8)
print(f"Compressed {manifest['compression_ratio']}x -> {manifest['quantized_size_mb']} MB")
```

### 4. Native Agentic StateGraph (LangGraph Alternative)
```python
from nova.workflow import Graph

graph = Graph("adaptive_pipeline")
graph.add_node("ingest", ingest_fn)
graph.add_node("assess", model_predict_fn)
graph.add_node("memory_node", consult_drm_fn)
graph.add_node("decision", finalize_fn)

graph.set_entry_point("ingest")
graph.add_edge("ingest", "assess")
# Dynamic conditional routing based on NOVA internal novelty & uncertainty
graph.add_conditional_edge("assess", lambda state: "memory_node" if state["novelty"] > 0.6 else "decision")
graph.add_edge("memory_node", "decision")
graph.add_terminal("decision")

result = graph.run({"raw_input": [0.5, 0.2, -0.9, 0.4]})
```

### 5. Local Model Serving API
```bash
python -m nova.serving.app
```
Endpoints:
- `GET /health`
- `GET /v1/model/info`
- `POST /v1/predict`
- `GET /v1/memory/inspect`
- `POST /v1/memory/write`
- `DELETE /v1/memory/{id}`

---

## Runnable Example Scripts

All examples run on real mathematical dynamics with zero mock data:

| Script | Purpose & Description |
| :--- | :--- |
| **[`test_external_data.py`](file:///c:/Users/VISHWANATH/Downloads/nova%20llm/test_external_data.py)** | **External Data Test Harness**: Drop any folder or CSV, get AI accuracy advice, and auto-fine-tune! |
| **[`01_quickstart_sdk.py`](file:///c:/Users/VISHWANATH/Downloads/nova%20llm/examples/01_quickstart_sdk.py)** | Basic SDK model creation, fitting, evaluating, saving, and deterministic prediction. |
| **[`02_continual_learning_stream.py`](file:///c:/Users/VISHWANATH/Downloads/nova%20llm/examples/02_continual_learning_stream.py)** | Streaming distribution shifts and ECAL catastrophic forgetting prevention. |
| **[`03_drm_memory_association.py`](file:///c:/Users/VISHWANATH/Downloads/nova%20llm/examples/03_drm_memory_association.py)** | Dynamic Resonance Memory association, write gating, utility decay, and knapsack budgeting. |
| **[`04_agentic_workflow_graph.py`](file:///c:/Users/VISHWANATH/Downloads/nova%20llm/examples/04_agentic_workflow_graph.py)** | Agentic StateGraph with dynamic conditional routing and cycle loop guards. |
| **[`05_multimodal_ingestion_and_edge_compression.py`](file:///c:/Users/VISHWANATH/Downloads/nova%20llm/examples/05_multimodal_ingestion_and_edge_compression.py)** | Universal image/document/data ingestion and INT8 mobile bundle export. |
| **[`06_realtime_multimodal_live_test.py`](file:///c:/Users/VISHWANATH/Downloads/nova%20llm/examples/06_realtime_multimodal_live_test.py)** | Live streaming latency benchmark across modalities (~259 FPS on CPU). |
| **[`07_upload_and_test_dataset.py`](file:///c:/Users/VISHWANATH/Downloads/nova%20llm/examples/07_upload_and_test_dataset.py)** | Interactive dataset upload CLI tool for any custom files. |
| **[`08_live_animated_dashboard.py`](file:///c:/Users/VISHWANATH/Downloads/nova%20llm/examples/08_live_animated_dashboard.py)** | **Live Animated Web Dashboard**: 60 FPS live graphs for Accuracy, Loss, Hamiltonian Energy, Novelty, Uncertainty! |
| **[`09_autonomous_advisor_and_autotuning.py`](file:///c:/Users/VISHWANATH/Downloads/nova%20llm/examples/09_autonomous_advisor_and_autotuning.py)** | **AI Accuracy Advisor & Auto-Tuner**: Automatically analyzes collinearity and fine-tunes to boost accuracy! |

---

## Running Benchmarks & Tests

```powershell
# Run the 27 automated unit and integration tests
python -m pytest tests/ -v

# Run the live animated web dashboard
python -m nova.dashboard
# or
python examples/08_live_animated_dashboard.py

# Run the AI accuracy advisor and auto-tuner demo
python examples/09_autonomous_advisor_and_autotuning.py
```
