eigenscope-sdk 0.2.16__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.
- eigenscope_sdk-0.2.16/PKG-INFO +97 -0
- eigenscope_sdk-0.2.16/README.md +69 -0
- eigenscope_sdk-0.2.16/pyproject.toml +39 -0
- eigenscope_sdk-0.2.16/src/eigenscope_sdk/__init__.py +121 -0
- eigenscope_sdk-0.2.16/src/eigenscope_sdk/__main__.py +9 -0
- eigenscope_sdk-0.2.16/src/eigenscope_sdk/adapters.py +1393 -0
- eigenscope_sdk-0.2.16/src/eigenscope_sdk/cli.py +798 -0
- eigenscope_sdk-0.2.16/src/eigenscope_sdk/client.py +3627 -0
- eigenscope_sdk-0.2.16/src/eigenscope_sdk/hooks.py +148 -0
- eigenscope_sdk-0.2.16/src/eigenscope_sdk/lab_connector.py +70 -0
- eigenscope_sdk-0.2.16/src/eigenscope_sdk/model_connection.py +318 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: eigenscope-sdk
|
|
3
|
+
Version: 0.2.16
|
|
4
|
+
Summary: EigenScope Open-Core Python SDK (decompose/rehydrate), RAG/tool quarantine adapters, multimodal helpers, and TransformerLens/pyvene subspace hooks
|
|
5
|
+
Requires-Python: >=3.9
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Author: Aikhomu L F Okoedion, Guardian AI Inc.
|
|
8
|
+
Project-URL: Documentation, https://eigenscope.guardianai.network/integrations
|
|
9
|
+
Project-URL: Homepage, https://eigenscope.guardianai.network
|
|
10
|
+
Project-URL: Repository, https://github.com/LuckyOkoedion/eigenscope-integration-lab
|
|
11
|
+
Project-URL: Security, https://eigenscope.guardianai.network/security
|
|
12
|
+
Keywords: eigenscope, ai-security, privacy, prompt-injection, rag-security, mechanistic-interpretability
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Security
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Provides-Extra: model
|
|
25
|
+
Requires-Dist: torch>=2.6,<3; extra == "model"
|
|
26
|
+
Requires-Dist: transformers>=4.51,<6; extra == "model"
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# eigenscope-sdk
|
|
30
|
+
|
|
31
|
+
Official Python SDK, CLI, RAG gate adapters, multimodal client, and loaded-model subspace hooks for **EigenScope**.
|
|
32
|
+
|
|
33
|
+
EigenScope enforces an explicit security boundary owned by your application:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
raw input -> eigenscope.decompose(...) -> your model/provider call -> eigenscope.rehydrate(...)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Your application keeps full ownership of model credentials, provider selection, and execution—never wrapping or routing model-provider SDKs through third-party proxies.
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install eigenscope-sdk==0.2.16
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
With optional PyTorch / Hugging Face model-hook runtime dependencies (`connect_model`):
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install "eigenscope-sdk[model]==0.2.16"
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Quick Start (Text & Tool Output Protection)
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import os
|
|
57
|
+
from eigenscope_sdk import EigenScopeClient, DOMAIN_SEPARATION_POLICIES
|
|
58
|
+
|
|
59
|
+
client = EigenScopeClient(
|
|
60
|
+
base_url="https://eigenscope.guardianai.network", # or loopback http://127.0.0.1:8443 sidecar
|
|
61
|
+
bearer_token=os.environ["EIGENSCOPE_API_KEY"],
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
decomposed = client.decompose(
|
|
65
|
+
"Analyze Q4 acquisition terms for Redwood Biologics ($4,850,000 escrow).",
|
|
66
|
+
policy=DOMAIN_SEPARATION_POLICIES["LEGAL_CONTRACT_MA_ANALYTICS"],
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
# Pass decomposed["task_core"] to your own model or provider call
|
|
71
|
+
model_reply = your_model_call(decomposed["task_core"])
|
|
72
|
+
restored = client.rehydrate(
|
|
73
|
+
vault_ticket=decomposed["vault_ticket"],
|
|
74
|
+
llm_task_output=model_reply,
|
|
75
|
+
)
|
|
76
|
+
print(restored["rehydrated_text"])
|
|
77
|
+
finally:
|
|
78
|
+
client.scrub(decomposed["vault_ticket"])
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Included Modules & Adapters
|
|
82
|
+
|
|
83
|
+
- **`EigenScopeClient`**: Fail-closed client for `/v1/decompose`, `/v1/rehydrate`, `/v1/vault/scrub`, `/v1/latent/project`, RAG endpoints (`/v1/rag/ingest`, `/v1/rag/retrieve`, `/v1/rag/evaluate`), and multimodal endpoints (`/v1/decompose/audio`, `/v1/decompose/image`, `/v1/decompose/video`, `/v1/rehydrate/media`).
|
|
84
|
+
- **Domain Policies (`DOMAIN_SEPARATION_POLICIES`)**: Pre-configured policies including `CODING_AGENT_FIREWALL`, `UNTRUSTED_TOOL_IPI_FIREWALL`, `HEALTHCARE_CLINICAL_PHI`, `LEGAL_CONTRACT_MA_ANALYTICS`, `TELECOM_6G_SEMANTIC_RAN`, `ROBOTICS_EMBODIED_VLA`, and `OIL_GAS_PRODUCTION_OPS`.
|
|
85
|
+
- **RAG & Tool Quarantine (`eigenscope_sdk.adapters`)**: `EigenScopeCandidateGate`, `EigenScopeLangChainRetriever`, `EigenScopeLlamaIndexPostprocessor`, `EigenScopeHaystackGate`, `ToolOutputQuarantine`, and `sanitize_tool_result`.
|
|
86
|
+
- **Loaded-Model Hooks (`connect_model`)**: Direct residual-stream projection and suppression hooks (`OrthoCoreResidualHook`, `create_residual_clamping_hook`) for self-hosted Hugging Face, TransformerLens, and pyvene deployments.
|
|
87
|
+
- **CLI (`eigenscope`)**: `eigenscope init`, `eigenscope doctor`, `eigenscope ci-verify`, and `eigenscope model-check` (also runnable via `python -m eigenscope_sdk`).
|
|
88
|
+
|
|
89
|
+
## Documentation & Security
|
|
90
|
+
|
|
91
|
+
- Documentation & Integration Guides: https://eigenscope.guardianai.network/integrations
|
|
92
|
+
- OpenAPI Schema & Registry: https://eigenscope.guardianai.network/registry
|
|
93
|
+
- Artifact Verification: https://eigenscope.guardianai.network/security
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
Apache-2.0 — Copyright (c) Guardian AI Inc.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# eigenscope-sdk
|
|
2
|
+
|
|
3
|
+
Official Python SDK, CLI, RAG gate adapters, multimodal client, and loaded-model subspace hooks for **EigenScope**.
|
|
4
|
+
|
|
5
|
+
EigenScope enforces an explicit security boundary owned by your application:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
raw input -> eigenscope.decompose(...) -> your model/provider call -> eigenscope.rehydrate(...)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Your application keeps full ownership of model credentials, provider selection, and execution—never wrapping or routing model-provider SDKs through third-party proxies.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install eigenscope-sdk==0.2.16
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
With optional PyTorch / Hugging Face model-hook runtime dependencies (`connect_model`):
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install "eigenscope-sdk[model]==0.2.16"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start (Text & Tool Output Protection)
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import os
|
|
29
|
+
from eigenscope_sdk import EigenScopeClient, DOMAIN_SEPARATION_POLICIES
|
|
30
|
+
|
|
31
|
+
client = EigenScopeClient(
|
|
32
|
+
base_url="https://eigenscope.guardianai.network", # or loopback http://127.0.0.1:8443 sidecar
|
|
33
|
+
bearer_token=os.environ["EIGENSCOPE_API_KEY"],
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
decomposed = client.decompose(
|
|
37
|
+
"Analyze Q4 acquisition terms for Redwood Biologics ($4,850,000 escrow).",
|
|
38
|
+
policy=DOMAIN_SEPARATION_POLICIES["LEGAL_CONTRACT_MA_ANALYTICS"],
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
try:
|
|
42
|
+
# Pass decomposed["task_core"] to your own model or provider call
|
|
43
|
+
model_reply = your_model_call(decomposed["task_core"])
|
|
44
|
+
restored = client.rehydrate(
|
|
45
|
+
vault_ticket=decomposed["vault_ticket"],
|
|
46
|
+
llm_task_output=model_reply,
|
|
47
|
+
)
|
|
48
|
+
print(restored["rehydrated_text"])
|
|
49
|
+
finally:
|
|
50
|
+
client.scrub(decomposed["vault_ticket"])
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Included Modules & Adapters
|
|
54
|
+
|
|
55
|
+
- **`EigenScopeClient`**: Fail-closed client for `/v1/decompose`, `/v1/rehydrate`, `/v1/vault/scrub`, `/v1/latent/project`, RAG endpoints (`/v1/rag/ingest`, `/v1/rag/retrieve`, `/v1/rag/evaluate`), and multimodal endpoints (`/v1/decompose/audio`, `/v1/decompose/image`, `/v1/decompose/video`, `/v1/rehydrate/media`).
|
|
56
|
+
- **Domain Policies (`DOMAIN_SEPARATION_POLICIES`)**: Pre-configured policies including `CODING_AGENT_FIREWALL`, `UNTRUSTED_TOOL_IPI_FIREWALL`, `HEALTHCARE_CLINICAL_PHI`, `LEGAL_CONTRACT_MA_ANALYTICS`, `TELECOM_6G_SEMANTIC_RAN`, `ROBOTICS_EMBODIED_VLA`, and `OIL_GAS_PRODUCTION_OPS`.
|
|
57
|
+
- **RAG & Tool Quarantine (`eigenscope_sdk.adapters`)**: `EigenScopeCandidateGate`, `EigenScopeLangChainRetriever`, `EigenScopeLlamaIndexPostprocessor`, `EigenScopeHaystackGate`, `ToolOutputQuarantine`, and `sanitize_tool_result`.
|
|
58
|
+
- **Loaded-Model Hooks (`connect_model`)**: Direct residual-stream projection and suppression hooks (`OrthoCoreResidualHook`, `create_residual_clamping_hook`) for self-hosted Hugging Face, TransformerLens, and pyvene deployments.
|
|
59
|
+
- **CLI (`eigenscope`)**: `eigenscope init`, `eigenscope doctor`, `eigenscope ci-verify`, and `eigenscope model-check` (also runnable via `python -m eigenscope_sdk`).
|
|
60
|
+
|
|
61
|
+
## Documentation & Security
|
|
62
|
+
|
|
63
|
+
- Documentation & Integration Guides: https://eigenscope.guardianai.network/integrations
|
|
64
|
+
- OpenAPI Schema & Registry: https://eigenscope.guardianai.network/registry
|
|
65
|
+
- Artifact Verification: https://eigenscope.guardianai.network/security
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
Apache-2.0 — Copyright (c) Guardian AI Inc.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "eigenscope-sdk"
|
|
7
|
+
version = "0.2.16"
|
|
8
|
+
description = "EigenScope Open-Core Python SDK (decompose/rehydrate), RAG/tool quarantine adapters, multimodal helpers, and TransformerLens/pyvene subspace hooks"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = {text = "Apache-2.0"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Aikhomu L F Okoedion"},
|
|
14
|
+
{name = "Guardian AI Inc."}
|
|
15
|
+
]
|
|
16
|
+
keywords = ["eigenscope", "ai-security", "privacy", "prompt-injection", "rag-security", "mechanistic-interpretability"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Intended Audience :: Developers",
|
|
20
|
+
"License :: OSI Approved :: Apache Software License",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.9",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Topic :: Security",
|
|
28
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence"
|
|
29
|
+
]
|
|
30
|
+
urls = {Homepage = "https://eigenscope.guardianai.network", Documentation = "https://eigenscope.guardianai.network/integrations", Repository = "https://github.com/LuckyOkoedion/eigenscope-integration-lab", Security = "https://eigenscope.guardianai.network/security"}
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
eigenscope = "eigenscope_sdk.cli:main"
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
model = ["torch>=2.6,<3", "transformers>=4.51,<6"]
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""EigenScope Open-Core Python SDK (`eigenscope-sdk`, Apache-2.0).
|
|
2
|
+
|
|
3
|
+
Governing Specifications:
|
|
4
|
+
- `SPECS/SDK-AND-INTEGRATION-CONTRACTS.md` (`EGS-SDK-001`, `EGS-SDK-004`)
|
|
5
|
+
- `SPECS/API.md`
|
|
6
|
+
"""
|
|
7
|
+
from .client import (
|
|
8
|
+
CONTRACT_VERSION,
|
|
9
|
+
DOMAIN_SEPARATION_POLICIES,
|
|
10
|
+
EIGENSCOPE_PYTHON_CLIENT_VERSION,
|
|
11
|
+
OCVC_V1_MAGIC,
|
|
12
|
+
OCVC_V2_MAGIC,
|
|
13
|
+
SDK_VERSION,
|
|
14
|
+
ClampingProfile,
|
|
15
|
+
EigenScopeAuthorityUnavailableError,
|
|
16
|
+
EigenScopeClient,
|
|
17
|
+
EigenScopeError,
|
|
18
|
+
EigenScopeGateBlockedError,
|
|
19
|
+
EigenScopeReceipt,
|
|
20
|
+
OrthoCoreAuthorityUnavailableError,
|
|
21
|
+
OrthoCoreClient,
|
|
22
|
+
OrthoCoreError,
|
|
23
|
+
OrthoCoreGatewayClient,
|
|
24
|
+
OrthoCoreGateBlockedError,
|
|
25
|
+
SeparationPolicy,
|
|
26
|
+
StreamingPlaceholderBuffer,
|
|
27
|
+
AhoCorasickFST,
|
|
28
|
+
compute_request_digest,
|
|
29
|
+
compute_symbol_table_commitment,
|
|
30
|
+
decode_ocvc_clip,
|
|
31
|
+
encode_ocvc_v2,
|
|
32
|
+
jcs_canonical_bytes,
|
|
33
|
+
new_request_id,
|
|
34
|
+
parse_png_dimensions,
|
|
35
|
+
parse_retry_after_seconds,
|
|
36
|
+
parse_wav_header,
|
|
37
|
+
validate_service_origin,
|
|
38
|
+
zeroize_buffer,
|
|
39
|
+
)
|
|
40
|
+
from .hooks import (
|
|
41
|
+
SUPPORTED_MODEL_DIMS,
|
|
42
|
+
OrthoCoreResidualHook,
|
|
43
|
+
create_residual_clamping_hook,
|
|
44
|
+
decode_float32_base64,
|
|
45
|
+
encode_float32_base64,
|
|
46
|
+
orthocore_subspace_hook,
|
|
47
|
+
)
|
|
48
|
+
from .adapters import (
|
|
49
|
+
AdmittedRagCandidate,
|
|
50
|
+
AuditReceiptEmitter,
|
|
51
|
+
EigenScopeCandidateGate,
|
|
52
|
+
EigenScopeHaystackGate,
|
|
53
|
+
EigenScopeLangChainRetriever,
|
|
54
|
+
EigenScopeLlamaIndexPostprocessor,
|
|
55
|
+
GatedRagResult,
|
|
56
|
+
QuarantinedRagCandidate,
|
|
57
|
+
QuarantinedToolResult,
|
|
58
|
+
RagCandidate,
|
|
59
|
+
ToolOutputQuarantine,
|
|
60
|
+
sanitize_tool_result,
|
|
61
|
+
)
|
|
62
|
+
from .model_connection import MODEL_RUNTIME_API_VERSION, ModelConnection, ModelConnectionError, connect_model
|
|
63
|
+
|
|
64
|
+
__version__ = "0.2.16"
|
|
65
|
+
__author__ = "Aikhomu L F Okoedion, Guardian AI Inc."
|
|
66
|
+
|
|
67
|
+
__all__ = [
|
|
68
|
+
"CONTRACT_VERSION",
|
|
69
|
+
"EIGENSCOPE_PYTHON_CLIENT_VERSION",
|
|
70
|
+
"OCVC_V1_MAGIC",
|
|
71
|
+
"OCVC_V2_MAGIC",
|
|
72
|
+
"SDK_VERSION",
|
|
73
|
+
"MODEL_RUNTIME_API_VERSION",
|
|
74
|
+
"ModelConnection",
|
|
75
|
+
"ModelConnectionError",
|
|
76
|
+
"connect_model",
|
|
77
|
+
"AdmittedRagCandidate",
|
|
78
|
+
"AuditReceiptEmitter",
|
|
79
|
+
"EigenScopeCandidateGate",
|
|
80
|
+
"EigenScopeHaystackGate",
|
|
81
|
+
"EigenScopeLangChainRetriever",
|
|
82
|
+
"EigenScopeLlamaIndexPostprocessor",
|
|
83
|
+
"GatedRagResult",
|
|
84
|
+
"QuarantinedRagCandidate",
|
|
85
|
+
"QuarantinedToolResult",
|
|
86
|
+
"RagCandidate",
|
|
87
|
+
"ToolOutputQuarantine",
|
|
88
|
+
"sanitize_tool_result",
|
|
89
|
+
"DOMAIN_SEPARATION_POLICIES",
|
|
90
|
+
"SUPPORTED_MODEL_DIMS",
|
|
91
|
+
"AhoCorasickFST",
|
|
92
|
+
"ClampingProfile",
|
|
93
|
+
"EigenScopeAuthorityUnavailableError",
|
|
94
|
+
"EigenScopeClient",
|
|
95
|
+
"EigenScopeError",
|
|
96
|
+
"EigenScopeGateBlockedError",
|
|
97
|
+
"EigenScopeReceipt",
|
|
98
|
+
"OrthoCoreAuthorityUnavailableError",
|
|
99
|
+
"OrthoCoreClient",
|
|
100
|
+
"OrthoCoreError",
|
|
101
|
+
"OrthoCoreGatewayClient",
|
|
102
|
+
"OrthoCoreGateBlockedError",
|
|
103
|
+
"OrthoCoreResidualHook",
|
|
104
|
+
"SeparationPolicy",
|
|
105
|
+
"StreamingPlaceholderBuffer",
|
|
106
|
+
"compute_request_digest",
|
|
107
|
+
"compute_symbol_table_commitment",
|
|
108
|
+
"create_residual_clamping_hook",
|
|
109
|
+
"decode_float32_base64",
|
|
110
|
+
"decode_ocvc_clip",
|
|
111
|
+
"encode_float32_base64",
|
|
112
|
+
"encode_ocvc_v2",
|
|
113
|
+
"jcs_canonical_bytes",
|
|
114
|
+
"new_request_id",
|
|
115
|
+
"orthocore_subspace_hook",
|
|
116
|
+
"parse_png_dimensions",
|
|
117
|
+
"parse_retry_after_seconds",
|
|
118
|
+
"parse_wav_header",
|
|
119
|
+
"validate_service_origin",
|
|
120
|
+
"zeroize_buffer",
|
|
121
|
+
]
|