Metadata-Version: 2.4
Name: nova-llm
Version: 0.1.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**

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 |
                                   +-------------------------+
```

---

## Quickstart

### 1. Installation
Install project dependencies with pip:
```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}`

---

## Running Benchmarks & Tests

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

# Run the live multimodal streaming test
python examples/06_realtime_multimodal_live_test.py

# Run empirical benchmark suite (continual learning, memory, ARA)
python -m benchmarks.run_all_benchmarks
```
