the-third-eye 0.1.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.
Files changed (35) hide show
  1. the_third_eye-0.1.0/.github/workflows/ci.yml +28 -0
  2. the_third_eye-0.1.0/.github/workflows/publish.yml +34 -0
  3. the_third_eye-0.1.0/LICENSE +16 -0
  4. the_third_eye-0.1.0/PKG-INFO +398 -0
  5. the_third_eye-0.1.0/README.md +352 -0
  6. the_third_eye-0.1.0/adapters/read_gateway_usage.py +353 -0
  7. the_third_eye-0.1.0/adapters/read_guardrail_events.py +342 -0
  8. the_third_eye-0.1.0/adapters/read_lakehouse_monitoring.py +443 -0
  9. the_third_eye-0.1.0/config/criticality_defaults.yaml +210 -0
  10. the_third_eye-0.1.0/config/risk_weights.yaml +149 -0
  11. the_third_eye-0.1.0/copilot_studio/topic_flow_notes.md +306 -0
  12. the_third_eye-0.1.0/demo/app.js +729 -0
  13. the_third_eye-0.1.0/demo/data/synthetic_data.js +401 -0
  14. the_third_eye-0.1.0/demo/index.html +564 -0
  15. the_third_eye-0.1.0/demo/styles.css +1149 -0
  16. the_third_eye-0.1.0/discovery/lineage_walker.py +323 -0
  17. the_third_eye-0.1.0/discovery/sync_model_registry.py +541 -0
  18. the_third_eye-0.1.0/genie/instruction_doc.md +201 -0
  19. the_third_eye-0.1.0/passport/generate_model_passport.py +363 -0
  20. the_third_eye-0.1.0/pyproject.toml +79 -0
  21. the_third_eye-0.1.0/remediation/generate_root_cause.py +411 -0
  22. the_third_eye-0.1.0/scoring/compute_health_score.py +400 -0
  23. the_third_eye-0.1.0/scoring/correlate_signals.py +404 -0
  24. the_third_eye-0.1.0/sql/01_create_catalog_schema.sql +134 -0
  25. the_third_eye-0.1.0/sql/02_create_tables.sql +346 -0
  26. the_third_eye-0.1.0/sql/03_create_metric_views.sql +424 -0
  27. the_third_eye-0.1.0/tests/test_scoring.py +18 -0
  28. the_third_eye-0.1.0/third_eye/__init__.py +3 -0
  29. the_third_eye-0.1.0/third_eye/__main__.py +28 -0
  30. the_third_eye-0.1.0/third_eye/scoring.py +54 -0
  31. the_third_eye-0.1.0/thirdeye_project.md +411 -0
  32. the_third_eye-0.1.0/v2_stretch/auto_retrain/auto_retrain_pipeline.py +212 -0
  33. the_third_eye-0.1.0/v2_stretch/blast_radius/blast_radius_analyzer.py +208 -0
  34. the_third_eye-0.1.0/v2_stretch/multi_workspace/federation_sync.py +115 -0
  35. the_third_eye-0.1.0/workflows/third_eye_pipeline.yml +334 -0
@@ -0,0 +1,28 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: ["master"]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python-version }}
19
+ - name: Install package
20
+ run: python -m pip install -e ".[dev]"
21
+ - name: Lint
22
+ run: ruff check .
23
+ - name: Test
24
+ run: pytest
25
+ - name: Build package
26
+ run: python -m build
27
+ - name: Check package metadata
28
+ run: python -m twine check dist/*
@@ -0,0 +1,34 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+ id-token: write
10
+
11
+ jobs:
12
+ publish:
13
+ runs-on: ubuntu-latest
14
+ environment: pypi
15
+ steps:
16
+ - name: Checkout
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.12"
23
+
24
+ - name: Install build tooling
25
+ run: python -m pip install --upgrade build twine
26
+
27
+ - name: Build distributions
28
+ run: python -m build
29
+
30
+ - name: Validate distributions
31
+ run: python -m twine check dist/*
32
+
33
+ - name: Publish to PyPI
34
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,16 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+
4
+ Copyright 2026 Ravi Kumar
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License");
7
+ you may not use this file except in compliance with the License.
8
+ You may obtain a copy of the License at
9
+
10
+ https://www.apache.org/licenses/LICENSE-2.0
11
+
12
+ Unless required by applicable law or agreed to in writing, software
13
+ distributed under the License is distributed on an "AS IS" BASIS,
14
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ See the License for the specific language governing permissions and
16
+ limitations under the License.
@@ -0,0 +1,398 @@
1
+ Metadata-Version: 2.5
2
+ Name: the-third-eye
3
+ Version: 0.1.0
4
+ Summary: AI model health and governance control plane for Databricks.
5
+ Project-URL: Homepage, https://github.com/dcsgod/theThirdEye
6
+ Project-URL: Repository, https://github.com/dcsgod/theThirdEye
7
+ Project-URL: Documentation, https://github.com/dcsgod/theThirdEye#readme
8
+ Project-URL: Issues, https://github.com/dcsgod/theThirdEye/issues
9
+ Project-URL: Changelog, https://github.com/dcsgod/theThirdEye/releases
10
+ Author-email: Ravi Kumar <93548891+dcsgod@users.noreply.github.com>
11
+ License: Apache-2.0
12
+ License-File: LICENSE
13
+ Keywords: ai-governance,ai-observability,databricks,mlops,model-monitoring,modelops
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Programming Language :: Python :: 3
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 :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Requires-Python: >=3.10
25
+ Requires-Dist: pyyaml>=6.0
26
+ Provides-Extra: all
27
+ Requires-Dist: build>=1.2; extra == 'all'
28
+ Requires-Dist: databricks-sdk>=0.50; extra == 'all'
29
+ Requires-Dist: mlflow>=2.0; extra == 'all'
30
+ Requires-Dist: pyspark>=3.5; extra == 'all'
31
+ Requires-Dist: pytest>=8.0; extra == 'all'
32
+ Requires-Dist: ruff>=0.8; extra == 'all'
33
+ Requires-Dist: twine>=6.0; extra == 'all'
34
+ Provides-Extra: databricks
35
+ Requires-Dist: databricks-sdk>=0.50; extra == 'databricks'
36
+ Requires-Dist: mlflow>=2.0; extra == 'databricks'
37
+ Requires-Dist: pyspark>=3.5; extra == 'databricks'
38
+ Provides-Extra: dev
39
+ Requires-Dist: build>=1.2; extra == 'dev'
40
+ Requires-Dist: pytest>=8.0; extra == 'dev'
41
+ Requires-Dist: ruff>=0.8; extra == 'dev'
42
+ Requires-Dist: twine>=6.0; extra == 'dev'
43
+ Provides-Extra: llm
44
+ Requires-Dist: databricks-sdk>=0.50; extra == 'llm'
45
+ Description-Content-Type: text/markdown
46
+
47
+ # The Third Eye
48
+
49
+ ### AI model health and governance control plane for Databricks
50
+
51
+ > **Watch. Understand. Act.**
52
+ >
53
+ > Databricks provides the signals. The Third Eye turns them into decisions.
54
+
55
+ [![CI](https://github.com/dcsgod/theThirdEye/actions/workflows/ci.yml/badge.svg)](https://github.com/dcsgod/theThirdEye/actions/workflows/ci.yml)
56
+ [![PyPI](https://img.shields.io/pypi/v/the-third-eye?style=for-the-badge&color=4267E8)](https://pypi.org/project/the-third-eye/)
57
+ [![Python](https://img.shields.io/pypi/pyversions/third-eye?style=for-the-badge)](https://pypi.org/project/third-eye/)
58
+ [![License](https://img.shields.io/badge/License-Apache%202.0-4267E8?style=for-the-badge)](https://www.apache.org/licenses/LICENSE-2.0)
59
+
60
+ ---
61
+
62
+ ## What is The Third Eye?
63
+
64
+ The Third Eye is a **Databricks-native AI health and governance control plane**.
65
+
66
+ It does not replace Model Serving, MLflow, Unity Catalog, Lakehouse Monitoring, Unity Gateway, or Workflows. It sits above those primitives and turns their signals into an explainable operating view:
67
+
68
+ ```text
69
+ Databricks signals
70
+ │
71
+ ├── monitoring
72
+ ├── inference / trace
73
+ ├── lineage
74
+ ├── usage / cost
75
+ └── governance / guardrails
76
+ │
77
+ ▼
78
+ The Third Eye
79
+ │
80
+ ├── normalize
81
+ ├── correlate
82
+ ├── score
83
+ ├── explain
84
+ └── recommend
85
+ │
86
+ ▼
87
+ governed model health
88
+ │
89
+ ├── dashboard
90
+ ├── Genie
91
+ └── Teams / Slack
92
+ ```
93
+
94
+ **Positioning:** not another drift detector. Not another dashboard. The Third Eye is the **decision layer above the native Databricks AI stack**.
95
+
96
+ ---
97
+
98
+ ## Why this exists
99
+
100
+ AI fleets fail in ways that are difficult to diagnose from a single metric.
101
+
102
+ A model can look healthy in one system while another already shows a warning:
103
+
104
+ - feature drift is rising
105
+ - quality is deteriorating
106
+ - an upstream table changed
107
+ - token or endpoint cost spiked
108
+ - a gateway policy was breached
109
+ - model criticality makes the event more urgent
110
+
111
+ The Third Eye correlates these signals into a single evidence-backed health view.
112
+
113
+ ### The core distinction
114
+
115
+ ```text
116
+ Traditional monitoring:
117
+ metric → threshold → alert
118
+
119
+ The Third Eye:
120
+ signals → correlation → context → risk → explanation → action
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Core capabilities
126
+
127
+ | Capability | What The Third Eye adds |
128
+ |---|---|
129
+ | **Zero-touch discovery** | Builds a governed model inventory from MLflow, Unity Catalog, and Gateway assets |
130
+ | **Signal normalization** | Creates a common index over native Databricks signals |
131
+ | **Evidence correlation** | Links drift, quality, usage, guardrail, and lineage events |
132
+ | **Composite health** | Produces a criticality-aware 0-100 health score |
133
+ | **Confidence** | Separates strong evidence from incomplete evidence |
134
+ | **Root cause** | Generates evidence-grounded narratives |
135
+ | **Remediation** | Produces ranked next actions rather than just alerts |
136
+ | **Model passport** | Produces a compact governance and audit view per model |
137
+ | **Decision surface** | Feeds AI/BI, Genie, Teams, and Slack from governed outputs |
138
+
139
+ ---
140
+
141
+ ## Architecture
142
+
143
+ ```text
144
+ ┌──────────────────────── Databricks native layer ────────────────────────┐
145
+ │ Unity Catalog · MLflow · Monitoring · Inference / Trace · Lineage │
146
+ │ Unity Gateway · Usage · Guardrails · Databricks Workflows │
147
+ └────────────────────────────────┬────────────────────────────────────────┘
148
+ │
149
+ ▼
150
+ ┌──────────────────────────┐
151
+ │ Discovery & Sync │
152
+ │ model / asset registry │
153
+ └─────────────┬────────────┘
154
+ ▼
155
+ ┌──────────────────────────┐
156
+ │ Signal Normalization │
157
+ │ common signal index │
158
+ └─────────────┬────────────┘
159
+ ▼
160
+ ┌──────────────────────────┐
161
+ │ Correlation & Scoring │
162
+ │ health + confidence │
163
+ └─────────────┬────────────┘
164
+ ▼
165
+ governance.model_health.*
166
+ │ │ │
167
+ ▼ ▼ ▼
168
+ AI/BI Genie Alerts
169
+ │
170
+ ▼
171
+ Root cause / remediation
172
+ ```
173
+
174
+ ![The Third Eye](https://github.com/user-attachments/assets/255a6eb7-6836-4570-9f84-2633b03916ed)
175
+
176
+ ---
177
+
178
+ ## Repository structure
179
+
180
+ The repository remains the full Databricks implementation and deployment reference:
181
+
182
+ ```text
183
+ adapters/ native-signal adapters
184
+ discovery/ model and lineage discovery
185
+ scoring/ correlation and health scoring jobs
186
+ remediation/ root-cause and remediation generation
187
+ passport/ model passport generation
188
+ sql/ Unity Catalog bootstrap + governed tables
189
+ genie/ Genie instructions
190
+ copilot_studio/ notification / topic notes
191
+ workflows/ Databricks Workflow definitions
192
+ demo/ product demonstration assets
193
+ v2_stretch/ planned governed-autonomy components
194
+ third_eye/ reusable Python scoring primitives
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Quickstart
200
+
201
+ ### Install the reusable Python package
202
+
203
+ ```bash
204
+ pip install the-third-eye
205
+ ```
206
+
207
+ ### Use the portable scoring kernel
208
+
209
+ ```python
210
+ from third_eye.scoring import health_score, health_tier
211
+
212
+ score = health_score(
213
+ drift=0.30,
214
+ quality=0.92,
215
+ cost=0.15,
216
+ guardrail=0.05,
217
+ )
218
+
219
+ print(f"Health: {score:.2f}")
220
+ print(f"Tier: {health_tier(score)}")
221
+ ```
222
+
223
+ The package is intentionally small. It exposes deterministic scoring primitives while the Databricks-specific orchestration remains in the repository.
224
+
225
+ ### Databricks integrations
226
+
227
+ ```bash
228
+ pip install "the-third-eye[databricks]"
229
+ ```
230
+
231
+ This optional extra installs the Databricks SDK, MLflow, and Spark dependencies used by the workspace integration layer.
232
+
233
+ ---
234
+
235
+ ## Run locally
236
+
237
+ The Databricks jobs support the existing mock-mode development path:
238
+
239
+ ```bash
240
+ set THIRD_EYE_MOCK_MODE=true
241
+ python scoring/compute_health_score.py
242
+ python scoring/correlate_signals.py
243
+ ```
244
+
245
+ PowerShell:
246
+
247
+ ```powershell
248
+ $env:THIRD_EYE_MOCK_MODE = "true"
249
+ python scoring/compute_health_score.py
250
+ python scoring/correlate_signals.py
251
+ ```
252
+
253
+ ---
254
+
255
+ ## The health score
256
+
257
+ The central composite calculation is:
258
+
259
+ ```text
260
+ health_score = 100 - (
261
+ w1 · drift
262
+ + w2 · (1 - quality)
263
+ + w3 · cost
264
+ + w4 · guardrail
265
+ ) · criticality_weight
266
+ ```
267
+
268
+ The portable Python implementation keeps this kernel deterministic and independent of Databricks runtime concerns.
269
+
270
+ ---
271
+
272
+ ## Evidence before action
273
+
274
+ The Third Eye follows a **read-first, evidence-before-action** principle.
275
+
276
+ A single weak signal should not automatically become a production action.
277
+
278
+ ```text
279
+ signal
280
+ ↓
281
+ corroborating evidence
282
+ ↓
283
+ criticality context
284
+ ↓
285
+ risk / confidence
286
+ ↓
287
+ incident
288
+ ↓
289
+ root cause
290
+ ↓
291
+ recommended action
292
+ ```
293
+
294
+ High-impact production actions remain policy-controlled.
295
+
296
+ ---
297
+
298
+ ## Security and governance
299
+
300
+ The control plane is designed around governed access rather than copying source systems.
301
+
302
+ Key principles:
303
+
304
+ - native Databricks tables remain the source of record
305
+ - normalized signals store pointers and snapshots rather than duplicating raw telemetry
306
+ - secrets should be resolved through Databricks Secrets
307
+ - high-impact automation remains policy-controlled
308
+ - evidence and confidence accompany health decisions
309
+
310
+ ---
311
+
312
+ ## Roadmap
313
+
314
+ ### V1
315
+
316
+ Discovery → normalization → correlation → scoring → diagnosis → governed outputs.
317
+
318
+ ### V2
319
+
320
+ Governed autonomy:
321
+
322
+ ```text
323
+ health degradation
324
+ ↓
325
+ candidate retraining
326
+ ↓
327
+ champion / challenger
328
+ ↓
329
+ approval gate
330
+ ↓
331
+ promotion / rollback
332
+ ```
333
+
334
+ Planned work includes blast-radius analysis, multi-workspace federation, silent-failure detection, richer compliance reporting, and cost-of-drift business impact.
335
+
336
+ ---
337
+
338
+ ## Development
339
+
340
+ ```bash
341
+ git clone https://github.com/dcsgod/theThirdEye.git
342
+ cd theThirdEye
343
+
344
+ python -m pip install -e ".[dev]"
345
+ ruff check .
346
+ pytest
347
+ python -m build
348
+ python -m twine check dist/*
349
+ ```
350
+
351
+ ---
352
+
353
+ ## Publishing to PyPI
354
+
355
+ The repository includes a GitHub Actions workflow for **PyPI Trusted Publishing**.
356
+
357
+ ```text
358
+ GitHub Release
359
+ ↓
360
+ build sdist + wheel
361
+ ↓
362
+ twine check
363
+ ↓
364
+ PyPI Trusted Publishing
365
+ ```
366
+
367
+ For the first release, configure a PyPI Trusted Publisher with:
368
+
369
+ ```text
370
+ Owner: dcsgod
371
+ Repository: theThirdEye
372
+ Workflow: publish.yml
373
+ Environment: pypi
374
+ ```
375
+
376
+ Then create a GitHub release such as:
377
+
378
+ ```text
379
+ v0.1.0
380
+ ```
381
+
382
+ The workflow publishes the built distributions to PyPI without a long-lived API token.
383
+
384
+ ---
385
+
386
+ ## License
387
+
388
+ Apache-2.0.
389
+
390
+ ---
391
+
392
+ <div align="center">
393
+
394
+ **The Third Eye**
395
+
396
+ *Watch. Understand. Act.*
397
+
398
+ </div>