Skip to main content

JWT-gated LLM controller that routes messages over a PostgreSQL + Apache AGE graph and forwards to downstream HTTP endpoints

Project description

string_therapy

JWT-gated LLM controller that routes messages over PostgreSQL + Apache AGE and forwards to downstream HTTP endpoints

string_therapy is a FastHTML service: Lisette picks a category/endpoint from an AGE routing graph (ACL-filtered by JWT), then forward_tool calls your downstream HTTP APIs.

Quickstart

Install

pip install -e .
# or: pip install git+https://github.com/alix559/string_therapy.git

Configure

Copy .env.example to .env and set at least:

  • ROUTER_DATABASE_URL — Postgres DSN with Apache AGE available
  • LISETTE_MODEL + LISETTE_API_KEY (or OPENAI_API_KEY)
  • JWT_SECRET (or JWT_AUTH_DISABLED=true for local dev)

Schema → seed → serve

string-therapy-ensure-schema
string-therapy-seed --graph examples/router_graph.json
string-therapy-serve

Or in Python:

from string_therapy import ensure_schema, seed_router_db, create_app, serve_controller

ensure_schema()
seed_router_db('examples/router_graph.json')
serve_controller()  # or: app = create_app()

Call the API

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

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

JWT claims: sub (required), optional roles / groups. Those map to ACL principals like role:analyst.

Router graph JSON

See examples/router_graph.json (also packaged under string_therapy/examples/). Nodes are categories or endpoints; edges are SERVES; optional acl rows set (node_id, principal, permission).

Example notebook

Walk through the library interactively:

jupyter notebook examples/getting_started.ipynb

Developer Guide

This project uses nbdev. Edit notebooks under nbs/, then:

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

Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

string_therapy-0.0.1.tar.gz (29.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

string_therapy-0.0.1-py3-none-any.whl (29.7 kB view details)

Uploaded Python 3

File details

Details for the file string_therapy-0.0.1.tar.gz.

File metadata

  • Download URL: string_therapy-0.0.1.tar.gz
  • Upload date:
  • Size: 29.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for string_therapy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b550b98c79bb7604d645a8acf4debfce6eddf749faa9d7610bd19d99946b488a
MD5 e7cd417f255386d3a6713bca4357a4cc
BLAKE2b-256 8d16d3ef8b1bdc30b52c690e679d69aa7524ea52265daaf40fe0f1361df64e2b

See more details on using hashes here.

File details

Details for the file string_therapy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: string_therapy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 29.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for string_therapy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 528eaebbc57f08c23eeba5c336fb799384f2c6fc3198e793b063d63e12a447c4
MD5 faaaf01cfafeab0d0fe806186cf75bba
BLAKE2b-256 39e524de25f8d3c2ea7ae70c15de07172bbf7324fac7b5e9bedaa9d294a0f9fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page