deeperthawt 1.0.0__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.
- deeperthawt-1.0.0/LICENSE.commercial.md +53 -0
- deeperthawt-1.0.0/PKG-INFO +120 -0
- deeperthawt-1.0.0/README.md +94 -0
- deeperthawt-1.0.0/deeperthawt/__init__.py +140 -0
- deeperthawt-1.0.0/deeperthawt/_backends.py +46 -0
- deeperthawt-1.0.0/deeperthawt/_backends_core.py +38 -0
- deeperthawt-1.0.0/deeperthawt/_vendored/__init__.py +0 -0
- deeperthawt-1.0.0/deeperthawt/_vendored/known_theorems.py +294 -0
- deeperthawt-1.0.0/deeperthawt/_vendored/logic_engine.py +340 -0
- deeperthawt-1.0.0/deeperthawt/_vendored/math_solver_oracle.py +580 -0
- deeperthawt-1.0.0/deeperthawt/_vendored/nl_math_parser.py +246 -0
- deeperthawt-1.0.0/deeperthawt/_vendored/python_knowledge.py +194 -0
- deeperthawt-1.0.0/deeperthawt/_vendored/scientific_knowledge.py +151 -0
- deeperthawt-1.0.0/deeperthawt/cli.py +111 -0
- deeperthawt-1.0.0/deeperthawt.egg-info/PKG-INFO +120 -0
- deeperthawt-1.0.0/deeperthawt.egg-info/SOURCES.txt +20 -0
- deeperthawt-1.0.0/deeperthawt.egg-info/dependency_links.txt +1 -0
- deeperthawt-1.0.0/deeperthawt.egg-info/entry_points.txt +2 -0
- deeperthawt-1.0.0/deeperthawt.egg-info/requires.txt +8 -0
- deeperthawt-1.0.0/deeperthawt.egg-info/top_level.txt +1 -0
- deeperthawt-1.0.0/pyproject.toml +39 -0
- deeperthawt-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# DeeperThawt — Dual-License Terms
|
|
2
|
+
|
|
3
|
+
DeeperThawt is distributed under a **dual-license** model so it can serve both
|
|
4
|
+
the open-source community and commercial embedders of proprietary products.
|
|
5
|
+
|
|
6
|
+
## 1. Open core — AGPL-3.0
|
|
7
|
+
|
|
8
|
+
The DeeperThawt open core (the reasoning, math, logic, verification, and
|
|
9
|
+
knowledge engine source) is licensed under the **GNU Affero General Public
|
|
10
|
+
License v3.0 (AGPL-3.0)**. You may copy, modify, and distribute it under the
|
|
11
|
+
terms of AGPL-3.0, including the requirement that any network service running a
|
|
12
|
+
modified version must offer its source to its users.
|
|
13
|
+
|
|
14
|
+
- This makes the open core free to use, study, and improve.
|
|
15
|
+
- Any project that *redistributes or hosts a modified version of the open core*
|
|
16
|
+
must do so under AGPL-3.0.
|
|
17
|
+
|
|
18
|
+
## 2. Commercial license — paid
|
|
19
|
+
|
|
20
|
+
If you want to use DeeperThawt in a way the AGPL does not permit — for example,
|
|
21
|
+
embedding the engine inside a **closed-source product, plugin, or SaaS**, where
|
|
22
|
+
you do **not** want to release your modifications under AGPL — you may purchase
|
|
23
|
+
a **commercial license** from the DeeperThawt maintainer.
|
|
24
|
+
|
|
25
|
+
The commercial license grants you, for a one-time or recurring fee:
|
|
26
|
+
|
|
27
|
+
- A non-exclusive, worldwide, royalty-bearing right to **embed and redistribute**
|
|
28
|
+
DeeperThawt within your proprietary product **without** triggering the AGPL's
|
|
29
|
+
copyleft obligations.
|
|
30
|
+
- The freedom to **obfuscate or keep your modifications proprietary**.
|
|
31
|
+
- **Commercial support** for deployment, integration, and tuning.
|
|
32
|
+
|
|
33
|
+
It does **not** transfer ownership of the DeeperThawt code. All code remains
|
|
34
|
+
copyright of the DeeperThawt maintainer.
|
|
35
|
+
|
|
36
|
+
## 3. Which do you need?
|
|
37
|
+
|
|
38
|
+
| Use case | License |
|
|
39
|
+
|----------|---------|
|
|
40
|
+
| Use the engine as a library inside your open-source (AGPL-compatible) project | AGPL-3.0 |
|
|
41
|
+
| Run the engine for your own research / internal tooling, not redistributed | AGPL-3.0 |
|
|
42
|
+
| Host the engine as a service and offer its source to users | AGPL-3.0 |
|
|
43
|
+
| Embed the engine inside a **closed-source product / SaaS** without open-sourcing your code | **Commercial license** |
|
|
44
|
+
| Resell or sublicense the engine as a proprietary component | **Commercial license** |
|
|
45
|
+
|
|
46
|
+
## 4. Contact
|
|
47
|
+
|
|
48
|
+
To obtain a commercial license, contact the DeeperThawt maintainer (repo owner
|
|
49
|
+
of `sudo-ai-git/deeperthawt`, sales via the DeeperThawt landing page).
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
© 2026 DeeperThawt maintainer. All rights reserved under the applicable license.
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deeperthawt
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: DeeperThawt — deterministic verifiable reasoning engine: symbolic math solver, logic inference, knowledge retrieval, FSS verification, and semantic token intelligence. Dual-licensed (AGPL-3.0 open core + commercial license for embedding).
|
|
5
|
+
Author: DeeperThawt maintainer
|
|
6
|
+
License: AGPL-3.0-only (open core); commercial license available for embedding
|
|
7
|
+
Project-URL: Homepage, https://sudo-ai-git.github.io/deeperthawt/
|
|
8
|
+
Project-URL: Repository, https://github.com/sudo-ai-git/deeperthawt
|
|
9
|
+
Keywords: verifiable-reasoning,deterministic,math-solver,logic,no-hallucination,token-intelligence
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE.commercial.md
|
|
19
|
+
Requires-Dist: numpy>=1.24
|
|
20
|
+
Requires-Dist: sympy>=1.10
|
|
21
|
+
Provides-Extra: payments
|
|
22
|
+
Requires-Dist: requests>=2.31; extra == "payments"
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# DeeperThawt
|
|
28
|
+
|
|
29
|
+
**Deterministic verifiable reasoning engine** — solves hard math, verifies logic, retrieves cited knowledge, and detects semantically-near token waste — with **zero hallucination**, because the answers are computed, not guessed.
|
|
30
|
+
|
|
31
|
+
- **Symbolic math oracle** — deterministic SymPy solver: integrals, systems, Fibonacci, primes, modular arithmetic, inequality. Verifies true claims (`2 + 2 = 4` → **TRUE**), refutes false ones (`2 + 2 = 5` → **REFUTED**, with witnesses), and honestly abstains on what it can't prove.
|
|
32
|
+
- **Logic engine** — modus ponens/tollens, syllogism, conjunction, double-negation. `verified / invalid / insufficient` — never guesses.
|
|
33
|
+
- **Cited knowledge** — known theorems (Euclid, Fermat, etc.), science facts, Python knowledge. Retrieval with citations, *not* generation.
|
|
34
|
+
- **Semantic token intelligence** — the secret engine (gematria projection + fixed-parameter attention + trained latent adapter) runs **server-side** and returns only numbers. It finds the near-duplicate token waste exact-dedupe misses.
|
|
35
|
+
|
|
36
|
+
## Architecture: secret ingredients stay remote
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
┌────────────────────────────────────────────────────────────┐
|
|
40
|
+
│ DeeperThawt (pip package, local) │
|
|
41
|
+
│ │
|
|
42
|
+
│ · math oracle (deterministic, SHIPPED) │
|
|
43
|
+
│ · logic engine (deterministic, SHIPPED) │
|
|
44
|
+
│ · cited knowledge (deterministic, SHIPPED) │
|
|
45
|
+
│ · semantic RPC client (numeric-only, SHIPPED) │
|
|
46
|
+
│ ╭───────────────────╮ │
|
|
47
|
+
└────────────────────────┤ POST /assess │───────────────┘
|
|
48
|
+
│ (de-identified) │
|
|
49
|
+
│ ▼ │
|
|
50
|
+
│ REMOTE server │
|
|
51
|
+
│ · gematria proj. │ ══ THE SECRET ══
|
|
52
|
+
│ · attention │ engine + tuned
|
|
53
|
+
│ · trained adapter│ weights live
|
|
54
|
+
│ · tuned weights │ ONLY HERE
|
|
55
|
+
╰───────────────────╯
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The **secret ingredients** — the semantic projection method, the fixed-parameter attention, the trained latent adapter, and the tuned weights — are **never shipped locally**. A local buyer gets a pip package with the deterministic solvers and a thin RPC client; the secret engine runs only on the remote DeeperThawt server behind a paid entitlement gate, returning **numbers only**.
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install deeperthawt
|
|
64
|
+
# or from source:
|
|
65
|
+
git clone https://github.com/sudo-ai-git/deeperthawt.git
|
|
66
|
+
cd deeperthawt && pip install -e .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Quick start
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from deeperthawt import DeeperThawt
|
|
73
|
+
|
|
74
|
+
engine = DeeperThawt()
|
|
75
|
+
|
|
76
|
+
# Hard math — deterministic, no LLM guessing
|
|
77
|
+
engine.solve_math("integral of x^2 from 0 to 1") # solved, 1/3
|
|
78
|
+
engine.solve_math("2 + 2 = 5") # refuted, with witness
|
|
79
|
+
engine.solve_math("2 + 2 = 4") # verified True
|
|
80
|
+
|
|
81
|
+
# Logic
|
|
82
|
+
engine.verify_logic(
|
|
83
|
+
["if it rains then the ground is wet", "it rains"],
|
|
84
|
+
"the ground is wet") # {"status": "valid"}
|
|
85
|
+
|
|
86
|
+
# Cited knowledge
|
|
87
|
+
engine.knowledge_math_theorem("infinitely many primes") # Euclid, cited
|
|
88
|
+
engine.knowledge_science("why is the sky blue") # fact + reference
|
|
89
|
+
|
|
90
|
+
# Semantic token intelligence — runs on the REMOTE server
|
|
91
|
+
engine = DeeperThawt(api_base="https://mcp-token-saver-pro.fly.dev")
|
|
92
|
+
engine.semantic_assess([...messages...]) # returns numbers only
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## CLI
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
deeperthawt math "integral of x^2 from 0 to 1"
|
|
99
|
+
deeperthawt logic "if it rains then the ground is wet; it rains" "the ground is wet"
|
|
100
|
+
deeperthawt theorem "infinitely many primes"
|
|
101
|
+
deeperthawt science "why is the sky blue"
|
|
102
|
+
deeperthawt python "list comprehension"
|
|
103
|
+
deeperthawt selfcheck # 8/8 capability smoke test
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## The honesty contract
|
|
107
|
+
|
|
108
|
+
1. **Deterministic** — same input → same answer, every time. No stochastic LLM in the scoring path. You can re-run and reproduce.
|
|
109
|
+
2. **No hallucination** — the engine solves/verifies/refutes what it can *prove*, and **abstains** (says "not verifiable") on what it can't. It never invents an answer.
|
|
110
|
+
3. **Opaque but auditable** — the deterministic solvers are open (AGPL). The semantic engine is server-side; you see the **contract and the number**, not the method.
|
|
111
|
+
4. **What it doesn't claim** — DeeperThawt does not generate prose, write code, or "reason" generally. It *computes* and *verifies*. The claims on this page are about provable operations.
|
|
112
|
+
|
|
113
|
+
## License: dual-license
|
|
114
|
+
|
|
115
|
+
- **Open core (AGPL-3.0)**: the deterministic solvers (math, logic, knowledge) are open source under AGPL.
|
|
116
|
+
- **Commercial license**: available for embedding DeeperThawt inside a **closed-source product or SaaS** without AGPL obligations. See [`LICENSE.commercial.md`](LICENSE.commercial.md).
|
|
117
|
+
|
|
118
|
+
For a commercial license, contact the maintainer via the [landing page](https://sudo-ai-git.github.io/deeperthawt/).
|
|
119
|
+
|
|
120
|
+
© 2026 DeeperThawt maintainer.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# DeeperThawt
|
|
2
|
+
|
|
3
|
+
**Deterministic verifiable reasoning engine** — solves hard math, verifies logic, retrieves cited knowledge, and detects semantically-near token waste — with **zero hallucination**, because the answers are computed, not guessed.
|
|
4
|
+
|
|
5
|
+
- **Symbolic math oracle** — deterministic SymPy solver: integrals, systems, Fibonacci, primes, modular arithmetic, inequality. Verifies true claims (`2 + 2 = 4` → **TRUE**), refutes false ones (`2 + 2 = 5` → **REFUTED**, with witnesses), and honestly abstains on what it can't prove.
|
|
6
|
+
- **Logic engine** — modus ponens/tollens, syllogism, conjunction, double-negation. `verified / invalid / insufficient` — never guesses.
|
|
7
|
+
- **Cited knowledge** — known theorems (Euclid, Fermat, etc.), science facts, Python knowledge. Retrieval with citations, *not* generation.
|
|
8
|
+
- **Semantic token intelligence** — the secret engine (gematria projection + fixed-parameter attention + trained latent adapter) runs **server-side** and returns only numbers. It finds the near-duplicate token waste exact-dedupe misses.
|
|
9
|
+
|
|
10
|
+
## Architecture: secret ingredients stay remote
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
┌────────────────────────────────────────────────────────────┐
|
|
14
|
+
│ DeeperThawt (pip package, local) │
|
|
15
|
+
│ │
|
|
16
|
+
│ · math oracle (deterministic, SHIPPED) │
|
|
17
|
+
│ · logic engine (deterministic, SHIPPED) │
|
|
18
|
+
│ · cited knowledge (deterministic, SHIPPED) │
|
|
19
|
+
│ · semantic RPC client (numeric-only, SHIPPED) │
|
|
20
|
+
│ ╭───────────────────╮ │
|
|
21
|
+
└────────────────────────┤ POST /assess │───────────────┘
|
|
22
|
+
│ (de-identified) │
|
|
23
|
+
│ ▼ │
|
|
24
|
+
│ REMOTE server │
|
|
25
|
+
│ · gematria proj. │ ══ THE SECRET ══
|
|
26
|
+
│ · attention │ engine + tuned
|
|
27
|
+
│ · trained adapter│ weights live
|
|
28
|
+
│ · tuned weights │ ONLY HERE
|
|
29
|
+
╰───────────────────╯
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The **secret ingredients** — the semantic projection method, the fixed-parameter attention, the trained latent adapter, and the tuned weights — are **never shipped locally**. A local buyer gets a pip package with the deterministic solvers and a thin RPC client; the secret engine runs only on the remote DeeperThawt server behind a paid entitlement gate, returning **numbers only**.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install deeperthawt
|
|
38
|
+
# or from source:
|
|
39
|
+
git clone https://github.com/sudo-ai-git/deeperthawt.git
|
|
40
|
+
cd deeperthawt && pip install -e .
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick start
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from deeperthawt import DeeperThawt
|
|
47
|
+
|
|
48
|
+
engine = DeeperThawt()
|
|
49
|
+
|
|
50
|
+
# Hard math — deterministic, no LLM guessing
|
|
51
|
+
engine.solve_math("integral of x^2 from 0 to 1") # solved, 1/3
|
|
52
|
+
engine.solve_math("2 + 2 = 5") # refuted, with witness
|
|
53
|
+
engine.solve_math("2 + 2 = 4") # verified True
|
|
54
|
+
|
|
55
|
+
# Logic
|
|
56
|
+
engine.verify_logic(
|
|
57
|
+
["if it rains then the ground is wet", "it rains"],
|
|
58
|
+
"the ground is wet") # {"status": "valid"}
|
|
59
|
+
|
|
60
|
+
# Cited knowledge
|
|
61
|
+
engine.knowledge_math_theorem("infinitely many primes") # Euclid, cited
|
|
62
|
+
engine.knowledge_science("why is the sky blue") # fact + reference
|
|
63
|
+
|
|
64
|
+
# Semantic token intelligence — runs on the REMOTE server
|
|
65
|
+
engine = DeeperThawt(api_base="https://mcp-token-saver-pro.fly.dev")
|
|
66
|
+
engine.semantic_assess([...messages...]) # returns numbers only
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## CLI
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
deeperthawt math "integral of x^2 from 0 to 1"
|
|
73
|
+
deeperthawt logic "if it rains then the ground is wet; it rains" "the ground is wet"
|
|
74
|
+
deeperthawt theorem "infinitely many primes"
|
|
75
|
+
deeperthawt science "why is the sky blue"
|
|
76
|
+
deeperthawt python "list comprehension"
|
|
77
|
+
deeperthawt selfcheck # 8/8 capability smoke test
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## The honesty contract
|
|
81
|
+
|
|
82
|
+
1. **Deterministic** — same input → same answer, every time. No stochastic LLM in the scoring path. You can re-run and reproduce.
|
|
83
|
+
2. **No hallucination** — the engine solves/verifies/refutes what it can *prove*, and **abstains** (says "not verifiable") on what it can't. It never invents an answer.
|
|
84
|
+
3. **Opaque but auditable** — the deterministic solvers are open (AGPL). The semantic engine is server-side; you see the **contract and the number**, not the method.
|
|
85
|
+
4. **What it doesn't claim** — DeeperThawt does not generate prose, write code, or "reason" generally. It *computes* and *verifies*. The claims on this page are about provable operations.
|
|
86
|
+
|
|
87
|
+
## License: dual-license
|
|
88
|
+
|
|
89
|
+
- **Open core (AGPL-3.0)**: the deterministic solvers (math, logic, knowledge) are open source under AGPL.
|
|
90
|
+
- **Commercial license**: available for embedding DeeperThawt inside a **closed-source product or SaaS** without AGPL obligations. See [`LICENSE.commercial.md`](LICENSE.commercial.md).
|
|
91
|
+
|
|
92
|
+
For a commercial license, contact the maintainer via the [landing page](https://sudo-ai-git.github.io/deeperthawt/).
|
|
93
|
+
|
|
94
|
+
© 2026 DeeperThawt maintainer.
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"""
|
|
2
|
+
DeeperThawt — deterministic verifiable reasoning engine.
|
|
3
|
+
|
|
4
|
+
A packaged product exposing the VRE/hybrid-agi harness as one clean API.
|
|
5
|
+
|
|
6
|
+
CAPABILITY ARCHITECTURE (secret-ingredients stay remote):
|
|
7
|
+
- LOCAL, deterministic, non-secret solvers (shipped with the package):
|
|
8
|
+
* Symbolic math oracle (deterministic SymPy solver, no LLM guessing)
|
|
9
|
+
* Logic + syllogism inference
|
|
10
|
+
* Known-theorem / science / python knowledge retrieval (cited)
|
|
11
|
+
- REMOTE, secret-engine (never shipped locally): the semantic engine
|
|
12
|
+
(gematria projection + fixed-parameter attention + trained latent adapter
|
|
13
|
+
+ tuned weights). Exposed to the local client ONLY through a thin,
|
|
14
|
+
numeric-only RPC to the remote server (/assess). The method and weights
|
|
15
|
+
never leave the remote server — a local buyer sees the contract, not the
|
|
16
|
+
pearl.
|
|
17
|
+
|
|
18
|
+
Dual-licensed: AGPL-3.0 open core + commercial license for proprietary embedding.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
from __future__ import annotations
|
|
22
|
+
|
|
23
|
+
import os as _os
|
|
24
|
+
import sys as _sys
|
|
25
|
+
import urllib.request as _urlreq
|
|
26
|
+
import urllib.error as _urlerr
|
|
27
|
+
import json as _json
|
|
28
|
+
from typing import Any, Dict
|
|
29
|
+
|
|
30
|
+
# --------------------------------------------------------------------------- #
|
|
31
|
+
# LOCAL capability solvers (deterministic, non-secret) — vendored from the
|
|
32
|
+
# hybrid-agi core. These are the cited/bounded solvers, safe to ship.
|
|
33
|
+
# --------------------------------------------------------------------------- #
|
|
34
|
+
try:
|
|
35
|
+
from ._backends import ( # type: ignore
|
|
36
|
+
MathematicalOracle,
|
|
37
|
+
evaluate_inference,
|
|
38
|
+
verify_logic_argument,
|
|
39
|
+
parse_known_theorem,
|
|
40
|
+
lookup_science_fact_combined,
|
|
41
|
+
lookup_python_knowledge_combined,
|
|
42
|
+
)
|
|
43
|
+
_HAS_LOCAL = True
|
|
44
|
+
except Exception as _e: # pragma: no cover
|
|
45
|
+
_HAS_LOCAL = False
|
|
46
|
+
_LOCAL_ERR = str(_e)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
_DEFAULT_API = "https://mcp-token-saver-pro.fly.dev"
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class _SemanticRemote:
|
|
53
|
+
"""Thin numeric-only client to the remote semantic engine.
|
|
54
|
+
|
|
55
|
+
The secret method (gematria projection, attention, adapter weights) lives
|
|
56
|
+
ONLY on the remote server. This client sends de-identified rows and
|
|
57
|
+
receives a number back — it never carries the engine, the method, or the
|
|
58
|
+
weights. If `requests` is unavailable we fall back to urllib.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
def __init__(self, base: str = "", api_key: str = ""):
|
|
62
|
+
self.base = (base or _os.environ.get("DEEPER_THAWT_API", _DEFAULT_API)).rstrip("/")
|
|
63
|
+
self.api_key = api_key or _os.environ.get("DEEPER_THAWT_API_KEY", "")
|
|
64
|
+
|
|
65
|
+
def assess(self, rows: list, tier: str = "content") -> Dict[str, Any]:
|
|
66
|
+
"""POST de-identified rows to the remote engine; return numeric result."""
|
|
67
|
+
body = _json.dumps({"tier": tier, "messages": rows}).encode()
|
|
68
|
+
headers = {"Content-Type": "application/json"}
|
|
69
|
+
if self.api_key:
|
|
70
|
+
headers["Authorization"] = f"Bearer {self.api_key}"
|
|
71
|
+
req = _urlreq.Request(self.base + "/assess", data=body, headers=headers, method="POST")
|
|
72
|
+
try:
|
|
73
|
+
with _urlreq.urlopen(req, timeout=60) as r:
|
|
74
|
+
return _json.loads(r.read().decode()) # {"result": {...}}
|
|
75
|
+
except _urlerr.HTTPError as e:
|
|
76
|
+
return {"error": f"http_{e.code}", "detail": e.read().decode()[:200]}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# --------------------------------------------------------------------------- #
|
|
80
|
+
# Public product surface
|
|
81
|
+
# --------------------------------------------------------------------------- #
|
|
82
|
+
|
|
83
|
+
class DeeperThawt:
|
|
84
|
+
"""The DeeperThawt engine: local deterministic solvers + remote semantic UI."""
|
|
85
|
+
|
|
86
|
+
def __init__(self, api_base: str = "", api_key: str = ""):
|
|
87
|
+
self.math = MathematicalOracle()
|
|
88
|
+
self._remote = _SemanticRemote(api_base, api_key)
|
|
89
|
+
|
|
90
|
+
# -- math (local, deterministic) -----------------------------------------
|
|
91
|
+
def solve_math(self, text: str) -> dict:
|
|
92
|
+
return self.math.evaluate(text)
|
|
93
|
+
|
|
94
|
+
# -- logic (local, deterministic) ----------------------------------------
|
|
95
|
+
def verify_logic(self, premises, conclusion) -> dict:
|
|
96
|
+
return verify_logic_argument(list(premises), conclusion)
|
|
97
|
+
|
|
98
|
+
# -- knowledge (local, cited retrieval) ----------------------------------
|
|
99
|
+
def knowledge_math_theorem(self, text: str) -> dict:
|
|
100
|
+
return parse_known_theorem(text) or {"known": False, "reason": "no known theorem matched"}
|
|
101
|
+
|
|
102
|
+
def knowledge_science(self, text: str) -> dict:
|
|
103
|
+
return lookup_science_fact_combined(text)
|
|
104
|
+
|
|
105
|
+
def knowledge_python(self, text: str) -> dict:
|
|
106
|
+
return lookup_python_knowledge_combined(text)
|
|
107
|
+
|
|
108
|
+
# -- semantic token intelligence (REMOTE, numeric-only) ------------------
|
|
109
|
+
def semantic_assess(self, messages: list, tier: str = "content") -> dict:
|
|
110
|
+
"""Ask the remote semantic engine to assess token redundancy.
|
|
111
|
+
|
|
112
|
+
Returns ONLY numbers (baseline, exact dedupe, semantic additional
|
|
113
|
+
savings). The engine + weights stay on the remote server; this ships
|
|
114
|
+
nothing secret.
|
|
115
|
+
"""
|
|
116
|
+
return self._remote.assess(messages, tier=tier)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def version() -> str:
|
|
120
|
+
return "1.0.0"
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def api_status() -> str:
|
|
124
|
+
"""Remote semantic engine health (numeric/opaque)."""
|
|
125
|
+
try:
|
|
126
|
+
with _urlreq.urlopen(_DEFAULT_API + "/healthz", timeout=15) as r:
|
|
127
|
+
return r.read().decode()
|
|
128
|
+
except Exception as e: # pragma: no cover
|
|
129
|
+
return f"unreachable: {e}"
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
_has_remote = _HAS_LOCAL
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
__all__ = [
|
|
136
|
+
"DeeperThawt", "version", "api_status",
|
|
137
|
+
"MathematicalOracle", "evaluate_inference", "verify_logic_argument",
|
|
138
|
+
"parse_known_theorem", "lookup_science_fact_combined",
|
|
139
|
+
"lookup_python_knowledge_combined",
|
|
140
|
+
]
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""
|
|
2
|
+
DeeperThawt vendored capability backends — LOCAL, deterministic, NON-SECRET.
|
|
3
|
+
|
|
4
|
+
This module bundles the minimal, self-contained deterministic solvers from the
|
|
5
|
+
VRE/hybrid-agi harness so the pip package stands alone:
|
|
6
|
+
|
|
7
|
+
- MathematicalOracle + fib helper (deterministic SymPy math solver)
|
|
8
|
+
- logic_engine inference + syllogism (propositional + category logic)
|
|
9
|
+
- known_theorems / science / python knowledge retrieval (cited)
|
|
10
|
+
|
|
11
|
+
SECRET-INGREDIENT POLICY: the semantic engine (gematria projection +
|
|
12
|
+
fixed-parameter attention + trained latent adapter + tuned weights) lives ONLY
|
|
13
|
+
on the remote DeeperThawt server and is intentionally NOT vendored here. The
|
|
14
|
+
local package ships only a numeric-only RPC client to that server.
|
|
15
|
+
|
|
16
|
+
AGPL-3.0 open core; commercial license for proprietary embedding.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import os as _os
|
|
22
|
+
import sys as _sys
|
|
23
|
+
|
|
24
|
+
# Make the vendored deterministic core importable by absolute module names.
|
|
25
|
+
_HARNESS = _os.path.join(_os.path.dirname(_os.path.abspath(__file__)), "_vendored")
|
|
26
|
+
if _HARNESS not in _sys.path:
|
|
27
|
+
_sys.path.insert(0, _HARNESS)
|
|
28
|
+
|
|
29
|
+
# Re-export the real local solvers (NO semantic engine — it stays remote).
|
|
30
|
+
from ._backends_core import ( # noqa: E402
|
|
31
|
+
MathematicalOracle,
|
|
32
|
+
evaluate_inference,
|
|
33
|
+
verify_logic_argument,
|
|
34
|
+
parse_known_theorem,
|
|
35
|
+
lookup_science_fact_combined,
|
|
36
|
+
lookup_python_knowledge_combined,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Safety: if anyone tries to vendored-import the semantic engine here it must
|
|
40
|
+
# not be present. GematriaTokenizer / SemanticSpace / adapter are NOT exported.
|
|
41
|
+
|
|
42
|
+
__all__ = [
|
|
43
|
+
"MathematicalOracle", "evaluate_inference", "verify_logic_argument",
|
|
44
|
+
"parse_known_theorem", "lookup_science_fact_combined",
|
|
45
|
+
"lookup_python_knowledge_combined",
|
|
46
|
+
]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""
|
|
2
|
+
DeeperThawt vendored core — re-exports the real LOCAL deterministic solvers.
|
|
3
|
+
|
|
4
|
+
The `_vendored` directory holds vendored copies of the hybrid-agi/VRE core
|
|
5
|
+
modules (AGPL-3.0 open core) — but ONLY the deterministic, non-secret solvers.
|
|
6
|
+
The semantic engine (gematria projection / attention / adapter / weights) is
|
|
7
|
+
deliberately NOT vendored: it lives on the remote DeeperThawt server and is
|
|
8
|
+
reached through a numeric-only RPC client.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
import os as _os
|
|
14
|
+
import sys as _sys
|
|
15
|
+
|
|
16
|
+
_V = _os.path.join(_os.path.dirname(_os.path.abspath(__file__)), "_vendored")
|
|
17
|
+
if _V not in _sys.path:
|
|
18
|
+
_sys.path.insert(0, _V)
|
|
19
|
+
|
|
20
|
+
# --- math solver (local, deterministic) ---
|
|
21
|
+
from math_solver_oracle import MathematicalOracle # noqa: E402
|
|
22
|
+
|
|
23
|
+
# --- logic engine (local, deterministic) ---
|
|
24
|
+
from logic_engine import ( # noqa: E402
|
|
25
|
+
evaluate_inference,
|
|
26
|
+
verify_logic_argument,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# --- knowledge (local, cited retrieval) ---
|
|
30
|
+
from known_theorems import parse_known_theorem # noqa: E402
|
|
31
|
+
from scientific_knowledge import lookup_science_fact_combined # noqa: E402
|
|
32
|
+
from python_knowledge import lookup_python_knowledge_combined # noqa: E402
|
|
33
|
+
|
|
34
|
+
__all__ = [
|
|
35
|
+
"MathematicalOracle", "evaluate_inference", "verify_logic_argument",
|
|
36
|
+
"parse_known_theorem", "lookup_science_fact_combined",
|
|
37
|
+
"lookup_python_knowledge_combined",
|
|
38
|
+
]
|
|
File without changes
|