asuriq 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.
- asuriq-1.0.0/PKG-INFO +54 -0
- asuriq-1.0.0/README.md +36 -0
- asuriq-1.0.0/asuriq.egg-info/PKG-INFO +54 -0
- asuriq-1.0.0/asuriq.egg-info/SOURCES.txt +7 -0
- asuriq-1.0.0/asuriq.egg-info/dependency_links.txt +1 -0
- asuriq-1.0.0/asuriq.egg-info/top_level.txt +1 -0
- asuriq-1.0.0/asuriq.py +157 -0
- asuriq-1.0.0/pyproject.toml +25 -0
- asuriq-1.0.0/setup.cfg +4 -0
asuriq-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: asuriq
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: ASURIQ Python SDK — verify AI answers against 21 databases
|
|
5
|
+
Author: Silent Ampersand LLC
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://asuriq.dev
|
|
8
|
+
Project-URL: Documentation, https://asuriq.dev/api-docs
|
|
9
|
+
Project-URL: Repository, https://github.com/duke-of-beans/ASURIQ
|
|
10
|
+
Keywords: ai,verification,hallucination,fact-checking,llm
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# asuriq
|
|
20
|
+
|
|
21
|
+
Verify AI answers against 21 databases. Hallucination detection. Entity verification.
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from asuriq import Asuriq
|
|
25
|
+
|
|
26
|
+
client = Asuriq()
|
|
27
|
+
result = client.check("Your AI response text here", query="The original question")
|
|
28
|
+
|
|
29
|
+
print(f"Confidence: {result.confidence.score}")
|
|
30
|
+
print(f"Hallucination risk: {result.hallucination.risk}")
|
|
31
|
+
|
|
32
|
+
for entity in result.entities:
|
|
33
|
+
print(f" {entity.entity} ({entity.type}): {entity.status}")
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Install
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install asuriq
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Methods
|
|
43
|
+
|
|
44
|
+
- `client.check(text, query=None, tier="protocol")` — Full verification analysis
|
|
45
|
+
- `client.deliberate(text, query=None)` — Multi-model deliberation
|
|
46
|
+
- `client.health()` — Engine status
|
|
47
|
+
- `client.ghost()` — Self-model metrics
|
|
48
|
+
- `client.metabolism()` — Token usage stats
|
|
49
|
+
|
|
50
|
+
## Links
|
|
51
|
+
|
|
52
|
+
- [asuriq.dev](https://asuriq.dev)
|
|
53
|
+
- [API docs](https://asuriq.dev/api-docs)
|
|
54
|
+
- [All integrations](https://asuriq.dev/integrations)
|
asuriq-1.0.0/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# asuriq
|
|
2
|
+
|
|
3
|
+
Verify AI answers against 21 databases. Hallucination detection. Entity verification.
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from asuriq import Asuriq
|
|
7
|
+
|
|
8
|
+
client = Asuriq()
|
|
9
|
+
result = client.check("Your AI response text here", query="The original question")
|
|
10
|
+
|
|
11
|
+
print(f"Confidence: {result.confidence.score}")
|
|
12
|
+
print(f"Hallucination risk: {result.hallucination.risk}")
|
|
13
|
+
|
|
14
|
+
for entity in result.entities:
|
|
15
|
+
print(f" {entity.entity} ({entity.type}): {entity.status}")
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install asuriq
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Methods
|
|
25
|
+
|
|
26
|
+
- `client.check(text, query=None, tier="protocol")` — Full verification analysis
|
|
27
|
+
- `client.deliberate(text, query=None)` — Multi-model deliberation
|
|
28
|
+
- `client.health()` — Engine status
|
|
29
|
+
- `client.ghost()` — Self-model metrics
|
|
30
|
+
- `client.metabolism()` — Token usage stats
|
|
31
|
+
|
|
32
|
+
## Links
|
|
33
|
+
|
|
34
|
+
- [asuriq.dev](https://asuriq.dev)
|
|
35
|
+
- [API docs](https://asuriq.dev/api-docs)
|
|
36
|
+
- [All integrations](https://asuriq.dev/integrations)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: asuriq
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: ASURIQ Python SDK — verify AI answers against 21 databases
|
|
5
|
+
Author: Silent Ampersand LLC
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://asuriq.dev
|
|
8
|
+
Project-URL: Documentation, https://asuriq.dev/api-docs
|
|
9
|
+
Project-URL: Repository, https://github.com/duke-of-beans/ASURIQ
|
|
10
|
+
Keywords: ai,verification,hallucination,fact-checking,llm
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# asuriq
|
|
20
|
+
|
|
21
|
+
Verify AI answers against 21 databases. Hallucination detection. Entity verification.
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from asuriq import Asuriq
|
|
25
|
+
|
|
26
|
+
client = Asuriq()
|
|
27
|
+
result = client.check("Your AI response text here", query="The original question")
|
|
28
|
+
|
|
29
|
+
print(f"Confidence: {result.confidence.score}")
|
|
30
|
+
print(f"Hallucination risk: {result.hallucination.risk}")
|
|
31
|
+
|
|
32
|
+
for entity in result.entities:
|
|
33
|
+
print(f" {entity.entity} ({entity.type}): {entity.status}")
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Install
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install asuriq
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Methods
|
|
43
|
+
|
|
44
|
+
- `client.check(text, query=None, tier="protocol")` — Full verification analysis
|
|
45
|
+
- `client.deliberate(text, query=None)` — Multi-model deliberation
|
|
46
|
+
- `client.health()` — Engine status
|
|
47
|
+
- `client.ghost()` — Self-model metrics
|
|
48
|
+
- `client.metabolism()` — Token usage stats
|
|
49
|
+
|
|
50
|
+
## Links
|
|
51
|
+
|
|
52
|
+
- [asuriq.dev](https://asuriq.dev)
|
|
53
|
+
- [API docs](https://asuriq.dev/api-docs)
|
|
54
|
+
- [All integrations](https://asuriq.dev/integrations)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
asuriq
|
asuriq-1.0.0/asuriq.py
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ASURIQ Python SDK
|
|
3
|
+
Verify AI answers against 21 databases. Hallucination detection. Entity verification.
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
from asuriq import Asuriq
|
|
7
|
+
|
|
8
|
+
client = Asuriq()
|
|
9
|
+
result = client.check("Your AI response text here", query="The original question")
|
|
10
|
+
print(result.confidence.score)
|
|
11
|
+
print(result.hallucination.risk)
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import urllib.request
|
|
15
|
+
import urllib.error
|
|
16
|
+
import json
|
|
17
|
+
from dataclasses import dataclass, field
|
|
18
|
+
from typing import Optional, Any
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
DEFAULT_API = "https://consensus-production-6eeb.up.railway.app"
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass
|
|
25
|
+
class Axis:
|
|
26
|
+
axis: str
|
|
27
|
+
score: float
|
|
28
|
+
label: str
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass
|
|
32
|
+
class Confidence:
|
|
33
|
+
score: float
|
|
34
|
+
axes: list[Axis] = field(default_factory=list)
|
|
35
|
+
bottleneck: Optional[str] = None
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass
|
|
39
|
+
class Hallucination:
|
|
40
|
+
risk: float
|
|
41
|
+
assessment: str = ""
|
|
42
|
+
signals: list[str] = field(default_factory=list)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass
|
|
46
|
+
class Entity:
|
|
47
|
+
entity: str
|
|
48
|
+
type: str
|
|
49
|
+
status: str = "unverified"
|
|
50
|
+
sources: list[dict] = field(default_factory=list)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@dataclass
|
|
54
|
+
class CheckResult:
|
|
55
|
+
confidence: Confidence
|
|
56
|
+
hallucination: Optional[Hallucination] = None
|
|
57
|
+
entities: list[Entity] = field(default_factory=list)
|
|
58
|
+
hedging: Optional[dict] = None
|
|
59
|
+
tone: Optional[dict] = None
|
|
60
|
+
fmea: Optional[dict] = None
|
|
61
|
+
citations: Optional[dict] = None
|
|
62
|
+
contradictions: list[dict] = field(default_factory=list)
|
|
63
|
+
improvement_hints: Optional[dict] = None
|
|
64
|
+
stress_questions: list[dict] = field(default_factory=list)
|
|
65
|
+
classification: Optional[dict] = None
|
|
66
|
+
raw: dict = field(default_factory=dict)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class AsuriqError(Exception):
|
|
70
|
+
def __init__(self, status: int, message: str):
|
|
71
|
+
self.status = status
|
|
72
|
+
super().__init__(f"ASURIQ API error {status}: {message}")
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class Asuriq:
|
|
76
|
+
"""ASURIQ verification client."""
|
|
77
|
+
|
|
78
|
+
def __init__(self, api_base: str = DEFAULT_API, api_key: Optional[str] = None):
|
|
79
|
+
self.api_base = api_base.rstrip("/")
|
|
80
|
+
self.api_key = api_key
|
|
81
|
+
|
|
82
|
+
def check(self, text: str, query: Optional[str] = None, tier: str = "protocol") -> CheckResult:
|
|
83
|
+
"""Run the full ASURIQ check on AI-generated text."""
|
|
84
|
+
body = {"text": text, "tier": tier}
|
|
85
|
+
if query:
|
|
86
|
+
body["query"] = query
|
|
87
|
+
data = self._post("/api/v1/check", body)
|
|
88
|
+
return self._parse_check(data)
|
|
89
|
+
|
|
90
|
+
def deliberate(self, text: str, query: Optional[str] = None) -> dict:
|
|
91
|
+
"""Run multi-model deliberation with voting and audit trail."""
|
|
92
|
+
body = {"text": text, "tier": "t3"}
|
|
93
|
+
if query:
|
|
94
|
+
body["query"] = query
|
|
95
|
+
return self._post("/api/v1/deliberate", body)
|
|
96
|
+
|
|
97
|
+
def health(self) -> dict:
|
|
98
|
+
"""Check engine health and available providers."""
|
|
99
|
+
return self._get("/health")
|
|
100
|
+
|
|
101
|
+
def ghost(self) -> dict:
|
|
102
|
+
"""Get Ghost self-model metrics (calibration, domain accuracy)."""
|
|
103
|
+
return self._get("/api/v1/ghost")
|
|
104
|
+
|
|
105
|
+
def metabolism(self) -> dict:
|
|
106
|
+
"""Get token metabolism and session state."""
|
|
107
|
+
return self._get("/api/v1/metabolism")
|
|
108
|
+
|
|
109
|
+
def _post(self, path: str, body: dict) -> dict:
|
|
110
|
+
url = self.api_base + path
|
|
111
|
+
data = json.dumps(body).encode("utf-8")
|
|
112
|
+
headers = {"Content-Type": "application/json"}
|
|
113
|
+
if self.api_key:
|
|
114
|
+
headers["Authorization"] = f"Bearer {self.api_key}"
|
|
115
|
+
req = urllib.request.Request(url, data=data, headers=headers, method="POST")
|
|
116
|
+
try:
|
|
117
|
+
with urllib.request.urlopen(req, timeout=30) as resp:
|
|
118
|
+
return json.loads(resp.read().decode("utf-8"))
|
|
119
|
+
except urllib.error.HTTPError as e:
|
|
120
|
+
raise AsuriqError(e.code, e.read().decode("utf-8", errors="replace"))
|
|
121
|
+
|
|
122
|
+
def _get(self, path: str) -> dict:
|
|
123
|
+
url = self.api_base + path
|
|
124
|
+
headers = {}
|
|
125
|
+
if self.api_key:
|
|
126
|
+
headers["Authorization"] = f"Bearer {self.api_key}"
|
|
127
|
+
req = urllib.request.Request(url, headers=headers)
|
|
128
|
+
try:
|
|
129
|
+
with urllib.request.urlopen(req, timeout=15) as resp:
|
|
130
|
+
return json.loads(resp.read().decode("utf-8"))
|
|
131
|
+
except urllib.error.HTTPError as e:
|
|
132
|
+
raise AsuriqError(e.code, e.read().decode("utf-8", errors="replace"))
|
|
133
|
+
|
|
134
|
+
def _parse_check(self, data: dict) -> CheckResult:
|
|
135
|
+
conf = data.get("confidence", {})
|
|
136
|
+
axes = [Axis(**a) for a in conf.get("axes", [])] if conf.get("axes") else []
|
|
137
|
+
hall = data.get("hallucination")
|
|
138
|
+
entities = [Entity(
|
|
139
|
+
entity=e.get("entity", e.get("name", "")),
|
|
140
|
+
type=e.get("type", "unknown"),
|
|
141
|
+
status=e.get("status", "unverified"),
|
|
142
|
+
sources=e.get("sources", []),
|
|
143
|
+
) for e in data.get("entities", [])]
|
|
144
|
+
return CheckResult(
|
|
145
|
+
confidence=Confidence(score=conf.get("score", 0), axes=axes, bottleneck=conf.get("bottleneck")),
|
|
146
|
+
hallucination=Hallucination(risk=hall.get("risk", 0), assessment=hall.get("assessment", ""), signals=hall.get("signals", [])) if hall else None,
|
|
147
|
+
entities=entities,
|
|
148
|
+
hedging=data.get("hedging"),
|
|
149
|
+
tone=data.get("tone"),
|
|
150
|
+
fmea=data.get("fmea"),
|
|
151
|
+
citations=data.get("citations"),
|
|
152
|
+
contradictions=data.get("contradictions", []),
|
|
153
|
+
improvement_hints=data.get("improvementHints"),
|
|
154
|
+
stress_questions=data.get("stressQuestions", []),
|
|
155
|
+
classification=data.get("classification"),
|
|
156
|
+
raw=data,
|
|
157
|
+
)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "asuriq"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "ASURIQ Python SDK — verify AI answers against 21 databases"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
authors = [{name = "Silent Ampersand LLC"}]
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Topic :: Software Development :: Libraries",
|
|
19
|
+
]
|
|
20
|
+
keywords = ["ai", "verification", "hallucination", "fact-checking", "llm"]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://asuriq.dev"
|
|
24
|
+
Documentation = "https://asuriq.dev/api-docs"
|
|
25
|
+
Repository = "https://github.com/duke-of-beans/ASURIQ"
|
asuriq-1.0.0/setup.cfg
ADDED