-
Notifications
You must be signed in to change notification settings - Fork 1
200 lines (167 loc) · 6.48 KB
/
Copy pathcalibration.yml
File metadata and controls
200 lines (167 loc) · 6.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
name: ORACLE Calibration & Validation Pipeline
on:
push:
branches: [main, develop]
paths:
- 'backend/src/services/intelligence/**'
- 'backend/src/agents/oracle/**'
- 'backend/evaluation/calibration/**'
- '.github/workflows/calibration.yml'
pull_request:
branches: [main]
paths:
- 'backend/src/services/intelligence/**'
- 'backend/src/agents/oracle/**'
jobs:
calibration:
name: ORACLE Calibration & Validation
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
working-directory: ./backend
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-asyncio
- name: Run ORACLE calibration pipeline
working-directory: ./backend
run: |
python -m evaluation.calibration.calibration_runner
- name: Run validation against fixtures
working-directory: ./backend
run: |
python evaluation/validate_oracle_analysis.py
- name: Check calibration thresholds
working-directory: ./backend
id: check_thresholds
run: |
python evaluation/check_calibration_thresholds.py \
--results-dir evaluation/calibration/results
continue-on-error: true
- name: Strict threshold check (main branch only)
working-directory: ./backend
if: github.ref == 'refs/heads/main'
run: |
python evaluation/check_calibration_thresholds.py \
--strict \
--results-dir evaluation/calibration/results
- name: Upload calibration results
uses: actions/upload-artifact@v4
if: always()
with:
name: oracle-calibration-results
path: backend/evaluation/calibration/results/
retention-days: 30
- name: Upload validation results
uses: actions/upload-artifact@v4
if: always()
with:
name: oracle-validation-results
path: backend/evaluation/calibration/validation_results/
retention-days: 30
- name: Create PR comment with results
if: github.event_name == 'pull_request' && always()
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const path = require('path');
// Find latest calibration report
const resultsDir = './backend/evaluation/calibration/results';
const files = fs.readdirSync(resultsDir)
.filter(f => f.startsWith('calibration_report_'))
.sort()
.reverse();
if (files.length === 0) {
console.log('No calibration report found');
return;
}
const latest = JSON.parse(
fs.readFileSync(path.join(resultsDir, files[0]))
);
const metrics = latest.aggregate_metrics;
const comment = `## 🔬 ORACLE Calibration Results
### Signals
- Precision: \`${metrics.signals.average_precision.toFixed(3)}\`
- Recall: \`${metrics.signals.average_recall.toFixed(3)}\`
- F1: \`${metrics.signals.average_f1_score.toFixed(3)}\`
### Failure Propagation
- Precision: \`${metrics.failures.average_precision.toFixed(3)}\`
- Propagation Accuracy: \`${metrics.failures.average_propagation_accuracy.toFixed(3)}\`
### Viva Questions
- Validity Rate: \`${metrics.viva.average_validity_rate.toFixed(3)}\`
- Grounding Rate: \`${metrics.viva.average_grounding_rate.toFixed(3)}\`
${latest.calibration_recommendations.map(r => \`- \${r}\`).join('\n')}
`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment
});
- name: Report failure
if: failure() && github.ref == 'refs/heads/main'
run: |
echo "❌ Calibration pipeline failed on main branch"
echo "Review calibration results and fix issues before merging"
exit 1
# Optional: Publish calibration dashboard
publish-dashboard:
name: Publish Calibration Dashboard
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: calibration
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download calibration artifacts
uses: actions/download-artifact@v4
with:
name: oracle-calibration-results
path: calibration-results
- name: Update dashboard data
run: |
# In production, would push calibration data to dashboard
# For now, just verify dashboard exists
test -f backend/testing_oracle_ui/calibration_dashboard.html
- name: Deploy dashboard (optional)
# This would deploy to GitHub Pages or your dashboard server
# run: |
# # Deploy logic here
run: |
echo "Dashboard deployment would happen here"
# Optional: Update benchmarks and trends
update-benchmarks:
name: Update Calibration Benchmarks
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: calibration
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download calibration results
uses: actions/download-artifact@v4
with:
name: oracle-calibration-results
- name: Update benchmarks
run: |
# In production, would:
# 1. Read latest calibration report
# 2. Update benchmarks file with new metrics
# 3. Commit and push benchmarks
echo "Benchmark update would happen here"
- name: Track trends
run: |
# In production, would:
# 1. Aggregate metrics over time
# 2. Detect degradation trends
# 3. Alert if metrics decline
echo "Trend tracking would happen here"