proprioceptive-swarm 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- proprioceptive_swarm-0.1.3/PKG-INFO +46 -0
- proprioceptive_swarm-0.1.3/README.md +37 -0
- proprioceptive_swarm-0.1.3/proprioceptive_swarm/__init__.py +10 -0
- proprioceptive_swarm-0.1.3/proprioceptive_swarm/cli.py +23 -0
- proprioceptive_swarm-0.1.3/proprioceptive_swarm/client.py +99 -0
- proprioceptive_swarm-0.1.3/proprioceptive_swarm.egg-info/PKG-INFO +46 -0
- proprioceptive_swarm-0.1.3/proprioceptive_swarm.egg-info/SOURCES.txt +10 -0
- proprioceptive_swarm-0.1.3/proprioceptive_swarm.egg-info/dependency_links.txt +1 -0
- proprioceptive_swarm-0.1.3/proprioceptive_swarm.egg-info/entry_points.txt +2 -0
- proprioceptive_swarm-0.1.3/proprioceptive_swarm.egg-info/top_level.txt +1 -0
- proprioceptive_swarm-0.1.3/pyproject.toml +14 -0
- proprioceptive_swarm-0.1.3/setup.cfg +4 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: proprioceptive-swarm
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Client SDK for the Proprioceptive AI lens-swarm: CPU consensus answering with confidence gates and receipted audit trail. Requires account signup; inert without an API key.
|
|
5
|
+
Author: Proprioceptive AI
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# proprioceptive-swarm
|
|
11
|
+
Client SDK for the **lens-swarm**: a CPU-native consensus answer service with plurality
|
|
12
|
+
confidence gates and a hash-chained receipt for every response.
|
|
13
|
+
|
|
14
|
+
- All inference is server-side. The package is **inert without an account** — no local model, no offline mode.
|
|
15
|
+
- Free trial tier: 50 answers/day per account.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
pip install proprioceptive-swarm
|
|
19
|
+
python -c "from proprioceptive_swarm import Swarm; s=Swarm.signup('you@example.com'); print(s.client_id)"
|
|
20
|
+
palswarm answer "Where is the Eiffel Tower?" "Paris" "London" --k 5
|
|
21
|
+
```
|
|
22
|
+
Evidence basis: verification-economics routing (23.5x), per-model uncertainty certification,
|
|
23
|
+
custody receipts (500+, zero escapes). Claims are graded; see provider disclosures.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Supported models (U4v2 certification, 2026-11-18)
|
|
27
|
+
|
|
28
|
+
Balanced 100-item TruthfulQA-MC panel (gold position uniformized; supersedes the unbalanced
|
|
29
|
+
v1 sweep — v1 numbers do not transfer). AUROC = entropy-detects-wrong; thr = model-normalized
|
|
30
|
+
null p70 bits; precision = flagged-on-wrong rate at thr. Live matrix: `GET /v1/swarm/models`.
|
|
31
|
+
|
|
32
|
+
| model | class | AUROC | flag precision | thr (bits) |
|
|
33
|
+
|---|---|---|---|---|
|
|
34
|
+
| qwen2.5-0.5b-inst | serving | 0.781 | 1.000 | 1.914 |
|
|
35
|
+
| qwen2.5-3b-inst | cert-only | 0.746 | 0.806 | 0.292 |
|
|
36
|
+
| pythia-1.4b | cert-only | 0.666 | 0.893 | 1.751 |
|
|
37
|
+
| tinyllama-1.1b-chat | serving | 0.661 | 0.963 | 2.258 |
|
|
38
|
+
| mamba-1.4b | cert-only | 0.638 | 0.846 | 2.250 |
|
|
39
|
+
| qwen2.5-1.5b-inst | cert-only | 0.600 | 0.850 | 2.223 |
|
|
40
|
+
| hermes-3-8b | cert-only | 0.597 | 0.941 | 2.288 |
|
|
41
|
+
| zephyr-7b-beta | cert-only | 0.552 | 0.743 | 2.286 |
|
|
42
|
+
| phi-2 | cert-only | 0.550 | 0.875 | 2.267 |
|
|
43
|
+
| opt-1.3b | not supported | — | — | — |
|
|
44
|
+
|
|
45
|
+
Certification != deployment entitlement: entropy flags fire only where the admin enables the
|
|
46
|
+
feature; `serving` rows are the CPU tier live today. No model's raw logits leave the boundary.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# proprioceptive-swarm
|
|
2
|
+
Client SDK for the **lens-swarm**: a CPU-native consensus answer service with plurality
|
|
3
|
+
confidence gates and a hash-chained receipt for every response.
|
|
4
|
+
|
|
5
|
+
- All inference is server-side. The package is **inert without an account** — no local model, no offline mode.
|
|
6
|
+
- Free trial tier: 50 answers/day per account.
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
pip install proprioceptive-swarm
|
|
10
|
+
python -c "from proprioceptive_swarm import Swarm; s=Swarm.signup('you@example.com'); print(s.client_id)"
|
|
11
|
+
palswarm answer "Where is the Eiffel Tower?" "Paris" "London" --k 5
|
|
12
|
+
```
|
|
13
|
+
Evidence basis: verification-economics routing (23.5x), per-model uncertainty certification,
|
|
14
|
+
custody receipts (500+, zero escapes). Claims are graded; see provider disclosures.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Supported models (U4v2 certification, 2026-11-18)
|
|
18
|
+
|
|
19
|
+
Balanced 100-item TruthfulQA-MC panel (gold position uniformized; supersedes the unbalanced
|
|
20
|
+
v1 sweep — v1 numbers do not transfer). AUROC = entropy-detects-wrong; thr = model-normalized
|
|
21
|
+
null p70 bits; precision = flagged-on-wrong rate at thr. Live matrix: `GET /v1/swarm/models`.
|
|
22
|
+
|
|
23
|
+
| model | class | AUROC | flag precision | thr (bits) |
|
|
24
|
+
|---|---|---|---|---|
|
|
25
|
+
| qwen2.5-0.5b-inst | serving | 0.781 | 1.000 | 1.914 |
|
|
26
|
+
| qwen2.5-3b-inst | cert-only | 0.746 | 0.806 | 0.292 |
|
|
27
|
+
| pythia-1.4b | cert-only | 0.666 | 0.893 | 1.751 |
|
|
28
|
+
| tinyllama-1.1b-chat | serving | 0.661 | 0.963 | 2.258 |
|
|
29
|
+
| mamba-1.4b | cert-only | 0.638 | 0.846 | 2.250 |
|
|
30
|
+
| qwen2.5-1.5b-inst | cert-only | 0.600 | 0.850 | 2.223 |
|
|
31
|
+
| hermes-3-8b | cert-only | 0.597 | 0.941 | 2.288 |
|
|
32
|
+
| zephyr-7b-beta | cert-only | 0.552 | 0.743 | 2.286 |
|
|
33
|
+
| phi-2 | cert-only | 0.550 | 0.875 | 2.267 |
|
|
34
|
+
| opt-1.3b | not supported | — | — | — |
|
|
35
|
+
|
|
36
|
+
Certification != deployment entitlement: entropy flags fire only where the admin enables the
|
|
37
|
+
feature; `serving` rows are the CPU tier live today. No model's raw logits leave the boundary.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""proprioceptive_swarm — client SDK for the lens-swarm consensus API.
|
|
2
|
+
|
|
3
|
+
The package contains NO inference logic by design: all computation is
|
|
4
|
+
server-side. Without a valid API key obtained via signup(), the client
|
|
5
|
+
raises SwarmNotAuthorized on every call. Nothing works offline.
|
|
6
|
+
"""
|
|
7
|
+
from .client import Swarm, SwarmNotAuthorized, SwarmError
|
|
8
|
+
|
|
9
|
+
__version__ = "0.1.3"
|
|
10
|
+
__all__ = ["Swarm", "SwarmNotAuthorized", "SwarmError"]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import argparse, json, sys
|
|
2
|
+
from .client import Swarm, SwarmError
|
|
3
|
+
def main():
|
|
4
|
+
p = argparse.ArgumentParser(prog="palswarm", description="lens-swarm client (server-computed; signup required)")
|
|
5
|
+
sub = p.add_subparsers(dest="cmd", required=True)
|
|
6
|
+
s = sub.add_parser("signup"); s.add_argument("email")
|
|
7
|
+
a = sub.add_parser("answer"); a.add_argument("question"); a.add_argument("choices", nargs="+"); a.add_argument("--k", type=int, default=5)
|
|
8
|
+
h = sub.add_parser("health")
|
|
9
|
+
args = p.parse_args()
|
|
10
|
+
try:
|
|
11
|
+
if args.cmd == "signup":
|
|
12
|
+
sw = Swarm.signup(args.email)
|
|
13
|
+
print("client_id:", sw.client_id); print("tier:", getattr(sw, "note", "trial"))
|
|
14
|
+
elif args.cmd == "health":
|
|
15
|
+
print(json.dumps(Swarm().health(), indent=1))
|
|
16
|
+
else:
|
|
17
|
+
sw = Swarm()
|
|
18
|
+
r = sw.answer(args.question, args.choices, k=args.k)
|
|
19
|
+
print("selected:", r["selected"], "| agreement:", r["agreement"], "| flag:", r["confidence_flag"])
|
|
20
|
+
print("receipt:", r["receipt"], "| quota:", f"{r['quota_used_today']}/{r['quota_limit']}")
|
|
21
|
+
except SwarmError as e:
|
|
22
|
+
print(str(e), file=sys.stderr); sys.exit(2)
|
|
23
|
+
if __name__ == "__main__": main()
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import json, os, time, urllib.request, urllib.error
|
|
2
|
+
|
|
3
|
+
API = os.environ.get("PALSWARM_API", "https://api.proprioceptiveai.com")
|
|
4
|
+
CFG = os.path.join(os.path.expanduser("~"), ".palswarm.json")
|
|
5
|
+
|
|
6
|
+
class SwarmError(Exception): pass
|
|
7
|
+
class SwarmNotAuthorized(SwarmError):
|
|
8
|
+
def __init__(self):
|
|
9
|
+
super().__init__("No API key. Run Swarm.signup('you@example.com') first. "
|
|
10
|
+
"The service is server-computed and does not work offline.")
|
|
11
|
+
|
|
12
|
+
def _post(path, obj=None, key=None, timeout=120):
|
|
13
|
+
data = json.dumps(obj).encode() if obj is not None else b"{}"
|
|
14
|
+
h = {"Content-Type": "application/json"}
|
|
15
|
+
if key: h["X-API-Key"] = key
|
|
16
|
+
req = urllib.request.Request(API + path, data=data, headers=h)
|
|
17
|
+
try:
|
|
18
|
+
with urllib.request.urlopen(req, timeout=timeout) as r:
|
|
19
|
+
return json.loads(r.read())
|
|
20
|
+
except urllib.error.HTTPError as e:
|
|
21
|
+
try: body = json.loads(e.read())
|
|
22
|
+
except Exception: body = {"error": str(e)}
|
|
23
|
+
if e.code in (401, 403): raise SwarmNotAuthorized()
|
|
24
|
+
if e.code == 429: raise SwarmError("daily limit reached: %s" % body.get("limit"))
|
|
25
|
+
raise SwarmError("HTTP %s: %s" % (e.code, body.get("error", "?")))
|
|
26
|
+
except Exception as e:
|
|
27
|
+
raise SwarmError("network: %r" % e)
|
|
28
|
+
|
|
29
|
+
class Swarm:
|
|
30
|
+
"""Gated consensus client. answer() returns selected option, agreement,
|
|
31
|
+
confidence flag, quota state, and a hash-chained receipt id."""
|
|
32
|
+
def __init__(self, api_key=None, client_id=None):
|
|
33
|
+
cfg = {}
|
|
34
|
+
if os.path.exists(CFG):
|
|
35
|
+
try: cfg = json.load(open(CFG))
|
|
36
|
+
except Exception: cfg = {}
|
|
37
|
+
self.key = api_key or os.environ.get("PALSWARM_KEY") or cfg.get("api_key")
|
|
38
|
+
self.client_id = client_id or cfg.get("client_id")
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def signup(cls, email):
|
|
42
|
+
r = _post("/v1/swarm/signup", {"email": email})
|
|
43
|
+
if "api_key" not in r: raise SwarmError("signup failed: %s" % r)
|
|
44
|
+
try:
|
|
45
|
+
json.dump({"api_key": r["api_key"], "client_id": r["client_id"],
|
|
46
|
+
"email": email, "tier": r.get("tier"), "created": int(time.time())},
|
|
47
|
+
open(CFG, "w"))
|
|
48
|
+
os.chmod(CFG, 0o600)
|
|
49
|
+
except Exception: pass
|
|
50
|
+
s = cls()
|
|
51
|
+
s.note = r.get("note", "new trial account")
|
|
52
|
+
return s
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def authorized(self): return bool(self.key)
|
|
56
|
+
|
|
57
|
+
def answer(self, question, choices, k=5, model=None):
|
|
58
|
+
if not self.key: raise SwarmNotAuthorized()
|
|
59
|
+
obj = {"question": question, "choices": list(choices), "k": k}
|
|
60
|
+
if model: obj["model"] = model
|
|
61
|
+
return _post("/v1/swarm/answer", obj, key=self.key)
|
|
62
|
+
|
|
63
|
+
def select(self, question, choices, model="qwen2.5-0.5b-inst"):
|
|
64
|
+
"""Server-side truth-selection head (gated). Returns selected_index/letter/text,
|
|
65
|
+
low_confidence flag, quota state, receipt. Head weights never leave the server."""
|
|
66
|
+
if not self.key: raise SwarmNotAuthorized()
|
|
67
|
+
return _post("/v1/swarm/select", {"question": question, "choices": list(choices),
|
|
68
|
+
"model": model}, key=self.key)
|
|
69
|
+
|
|
70
|
+
def status(self):
|
|
71
|
+
"""Quota/tier for this key: {'client_id','tier','used_today','limit'}."""
|
|
72
|
+
if not self.key: raise SwarmNotAuthorized()
|
|
73
|
+
req = urllib.request.Request(API + "/v1/swarm/status", headers={"X-API-Key": self.key})
|
|
74
|
+
try:
|
|
75
|
+
return json.loads(urllib.request.urlopen(req, timeout=30).read())
|
|
76
|
+
except urllib.error.HTTPError as e:
|
|
77
|
+
if e.code in (401, 403): raise SwarmNotAuthorized()
|
|
78
|
+
raise SwarmError("HTTP %s" % e.code)
|
|
79
|
+
|
|
80
|
+
def verify(self, receipt_id):
|
|
81
|
+
"""Fetch + chain-verify a receipt by id (prefix ok)."""
|
|
82
|
+
r = urllib.request.urlopen(API + "/v1/swarm/verify/" + receipt_id, timeout=30).read()
|
|
83
|
+
return json.loads(r)
|
|
84
|
+
|
|
85
|
+
def order_stub(self, model="qwen2.5-0.5b-inst", note=""):
|
|
86
|
+
"""Draft a DISTILL-ORDER ticket locally (SKU intake only).
|
|
87
|
+
Fulfillment is an offline GPU job run by Proprioceptive AI; weights
|
|
88
|
+
are NEVER shipped, downloaded, or exposed by this client. No server
|
|
89
|
+
route exists yet, so nothing is billed and no network call is made."""
|
|
90
|
+
return {"sku": "distill-order", "model": model,
|
|
91
|
+
"client_id": self.client_id,
|
|
92
|
+
"requested_at": int(time.time()),
|
|
93
|
+
"status": "draft-not-billed",
|
|
94
|
+
"note": note or ("Order intake opens with the storefront; "
|
|
95
|
+
"fulfillment is offline; weights never ship.")}
|
|
96
|
+
|
|
97
|
+
def health(self):
|
|
98
|
+
return _post("/v1/swarm/health", {}) if False else json.loads(
|
|
99
|
+
urllib.request.urlopen(API + "/v1/swarm/health", timeout=15).read())
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: proprioceptive-swarm
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Client SDK for the Proprioceptive AI lens-swarm: CPU consensus answering with confidence gates and receipted audit trail. Requires account signup; inert without an API key.
|
|
5
|
+
Author: Proprioceptive AI
|
|
6
|
+
License: Proprietary
|
|
7
|
+
Requires-Python: >=3.8
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# proprioceptive-swarm
|
|
11
|
+
Client SDK for the **lens-swarm**: a CPU-native consensus answer service with plurality
|
|
12
|
+
confidence gates and a hash-chained receipt for every response.
|
|
13
|
+
|
|
14
|
+
- All inference is server-side. The package is **inert without an account** — no local model, no offline mode.
|
|
15
|
+
- Free trial tier: 50 answers/day per account.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
pip install proprioceptive-swarm
|
|
19
|
+
python -c "from proprioceptive_swarm import Swarm; s=Swarm.signup('you@example.com'); print(s.client_id)"
|
|
20
|
+
palswarm answer "Where is the Eiffel Tower?" "Paris" "London" --k 5
|
|
21
|
+
```
|
|
22
|
+
Evidence basis: verification-economics routing (23.5x), per-model uncertainty certification,
|
|
23
|
+
custody receipts (500+, zero escapes). Claims are graded; see provider disclosures.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Supported models (U4v2 certification, 2026-11-18)
|
|
27
|
+
|
|
28
|
+
Balanced 100-item TruthfulQA-MC panel (gold position uniformized; supersedes the unbalanced
|
|
29
|
+
v1 sweep — v1 numbers do not transfer). AUROC = entropy-detects-wrong; thr = model-normalized
|
|
30
|
+
null p70 bits; precision = flagged-on-wrong rate at thr. Live matrix: `GET /v1/swarm/models`.
|
|
31
|
+
|
|
32
|
+
| model | class | AUROC | flag precision | thr (bits) |
|
|
33
|
+
|---|---|---|---|---|
|
|
34
|
+
| qwen2.5-0.5b-inst | serving | 0.781 | 1.000 | 1.914 |
|
|
35
|
+
| qwen2.5-3b-inst | cert-only | 0.746 | 0.806 | 0.292 |
|
|
36
|
+
| pythia-1.4b | cert-only | 0.666 | 0.893 | 1.751 |
|
|
37
|
+
| tinyllama-1.1b-chat | serving | 0.661 | 0.963 | 2.258 |
|
|
38
|
+
| mamba-1.4b | cert-only | 0.638 | 0.846 | 2.250 |
|
|
39
|
+
| qwen2.5-1.5b-inst | cert-only | 0.600 | 0.850 | 2.223 |
|
|
40
|
+
| hermes-3-8b | cert-only | 0.597 | 0.941 | 2.288 |
|
|
41
|
+
| zephyr-7b-beta | cert-only | 0.552 | 0.743 | 2.286 |
|
|
42
|
+
| phi-2 | cert-only | 0.550 | 0.875 | 2.267 |
|
|
43
|
+
| opt-1.3b | not supported | — | — | — |
|
|
44
|
+
|
|
45
|
+
Certification != deployment entitlement: entropy flags fire only where the admin enables the
|
|
46
|
+
feature; `serving` rows are the CPU tier live today. No model's raw logits leave the boundary.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
proprioceptive_swarm/__init__.py
|
|
4
|
+
proprioceptive_swarm/cli.py
|
|
5
|
+
proprioceptive_swarm/client.py
|
|
6
|
+
proprioceptive_swarm.egg-info/PKG-INFO
|
|
7
|
+
proprioceptive_swarm.egg-info/SOURCES.txt
|
|
8
|
+
proprioceptive_swarm.egg-info/dependency_links.txt
|
|
9
|
+
proprioceptive_swarm.egg-info/entry_points.txt
|
|
10
|
+
proprioceptive_swarm.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
proprioceptive_swarm
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
[project]
|
|
5
|
+
name = "proprioceptive-swarm"
|
|
6
|
+
version = "0.1.3"
|
|
7
|
+
description = "Client SDK for the Proprioceptive AI lens-swarm: CPU consensus answering with confidence gates and receipted audit trail. Requires account signup; inert without an API key."
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.8"
|
|
10
|
+
license = {text = "Proprietary"}
|
|
11
|
+
authors = [{name = "Proprioceptive AI"}]
|
|
12
|
+
dependencies = []
|
|
13
|
+
[project.scripts]
|
|
14
|
+
palswarm = "proprioceptive_swarm.cli:main"
|