Metadata-Version: 2.4
Name: reversible-lla
Version: 0.1.0
Summary: ReLLA — Reversible LLM Adapter
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: pydantic>=2.0
Requires-Dist: typer>=0.9
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Provides-Extra: langchain
Requires-Dist: langchain; extra == "langchain"
Provides-Extra: llamaindex
Requires-Dist: llama-index; extra == "llamaindex"

# ReLLA — Reversible LLM Adapter

ReLLA is a **lightweight, offline‑first, provider‑agnostic LLM adapter** designed for developers who need reliability, reproducibility, and control over LLM execution.

It records every LLM call as a deterministic artifact in SQLite, enabling **replay, caching, migration, and benchmarking** across providers and frameworks — without rewriting application code.

ReLLA is intentionally minimal. It is infrastructure tooling, not a framework.

---

## Core Capabilities

* Deterministic request hashing and artifact storage
* SQLite‑backed replay and cache layer
* Provider‑agnostic execution (local and cloud)
* Framework‑independent core engine
* Fully offline‑testable and reproducible
* Designed to run on low‑resource machines

---

## Installation

### Core Engine

```bash
pip install reversible-lla
```

This installs the ReLLA core only. No framework dependencies are included by default.

### Optional Framework Bridges

Framework integrations are opt‑in and installed explicitly:

```bash
pip install reversible-lla[langchain]
pip install reversible-lla[llamaindex]
pip install reversible-lla[langchain,llamaindex]
```

The core engine remains unchanged regardless of framework usage.

---

## Command Line Interface

The CLI provides a direct, human‑friendly interface to the ReLLA engine.

### Execute and Record

```bash
rella run "hello world" --db rella.db
```

This executes the request and stores the result as an immutable artifact.

### Replay from Cache

```bash
rella replay "hello world" --db rella.db
```

If a matching artifact exists, the stored output is returned without invoking any provider.

---

## Artifact Storage

All executions are stored in a local SQLite database.

```bash
sqlite3 rella.db
.tables
SELECT * FROM artifacts;
```

Each artifact contains:

* Deterministic input hash
* Provider identifier
* Model identifier
* Output payload

---

## LangChain Integration

ReLLA can be used as a drop‑in LLM within LangChain applications.

```python
from rella.bridges.langchain import ReLLALLM

llm = ReLLALLM(provider="mock", db="rella.db")
print(llm.invoke("hello from langchain"))
```

Artifacts generated via LangChain are immediately available for replay via the CLI.

---

## LlamaIndex Integration

ReLLA integrates with LlamaIndex by implementing the full LLM interface.

```python
from rella.bridges.llamaindex import ReLLALLM

llm = ReLLALLM(provider="mock", db="rella.db")
response = llm.complete("hello from llamaindex")
print(response.text)
```

Execution and replay semantics remain identical across all entry points.

---

## Design Principles

* Reproducibility over convenience
* Determinism over heuristics
* Minimal surface area
* Explicit dependency control
* Offline‑first execution

---

## Non‑Goals

* Agent orchestration
* Prompt chaining frameworks
* Workflow automation
* Hosted services or dashboards

---

## Release Status

**v0.1.0** — Core engine and framework bridges are stable.

---

## License

MIT
