Metadata-Version: 2.4
Name: string_therapy
Version: 0.1.0
Summary: Lean LLM controller that routes messages over a NetworkX graph and forwards to downstream HTTP endpoints
Author-email: Alex <alixjcob559@gmail.com>
License-Expression: Apache-2.0
Project-URL: Repository, https://github.com/alix559/string_therapy
Project-URL: Documentation, https://alix559.github.io/string_therapy/
Keywords: nbdev,router,fasthtml,networkx,lisette
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: python-fasthtml<0.15,>=0.14.6
Requires-Dist: httpx<0.29,>=0.28.1
Requires-Dist: python-dotenv<2,>=1.2.2
Requires-Dist: networkx
Requires-Dist: lisette<0.2,>=0.1.35
Requires-Dist: toolslm<0.3.44,>=0.3.29
Provides-Extra: dev
Requires-Dist: pytest<9,>=8; extra == "dev"
Requires-Dist: nbdev<4,>=3.2.2; extra == "dev"
Dynamic: license-file

# string_therapy

> Lean LLM controller that routes messages over a NetworkX graph and forwards to downstream HTTP endpoints

`string_therapy` runs as an HTTP routing service. Lisette picks a category and endpoint from a JSON-backed NetworkX graph, then forwards the request to the configured downstream API.

## Quickstart

### Install

```sh
pip install git+https://github.com/alix559/string_therapy.git
```

### Configure

Set the model and API key:

```sh
export LISETTE_MODEL="your-model"
export LISETTE_API_KEY="your-key"
# Optional; omit this to use the packaged graph:
export ROUTER_GRAPH_PATH="/path/to/router_graph.json"
```

### Start the service

```sh
string-therapy-serve
```

The service listens on port `5011` by default. Set `CONTROLLER_PORT` to change it.

### Call the API

```sh
curl -s http://127.0.0.1:5011/health

curl -s http://127.0.0.1:5011/controller \
  -H 'Content-Type: application/json' \
  -d '{"message": "run a sales report"}'
```

Successful responses have this shape:

```json
{
  "status": "ok",
  "request_id": "a1b2c3d4",
  "response": "downstream response",
  "parsed": {}
}
```

`parsed` is included only when the downstream service returns valid JSON.

### Router graph JSON

See `examples/router_graph.json` (also packaged under `string_therapy/examples/`). Nodes are categories or endpoints; directed `serves` edges connect each category to its endpoints. The graph is loaded once at startup.

### Deployment

The controller does not provide authentication. Put it behind an authenticated API gateway or private network when deploying it outside a trusted environment.

## Developer Guide

This project uses [nbdev](https://nbdev.fast.ai). Edit notebooks under `nbs/`, then:

```sh
pip install -e ".[dev]"
nbdev_prepare
pytest -q
```

## Documentation

- Docs: https://alix559.github.io/string_therapy/
- Repo: https://github.com/alix559/string_therapy
