driftrail 2.0.0__py3-none-any.whl → 2.1.0__py3-none-any.whl
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.
- driftrail/__init__.py +190 -6
- driftrail/client.py +501 -313
- driftrail/types.py +642 -1
- driftrail-2.1.0.dist-info/METADATA +469 -0
- driftrail-2.1.0.dist-info/RECORD +9 -0
- driftrail-2.0.0.dist-info/METADATA +0 -226
- driftrail-2.0.0.dist-info/RECORD +0 -9
- {driftrail-2.0.0.dist-info → driftrail-2.1.0.dist-info}/WHEEL +0 -0
- {driftrail-2.0.0.dist-info → driftrail-2.1.0.dist-info}/licenses/LICENSE +0 -0
- {driftrail-2.0.0.dist-info → driftrail-2.1.0.dist-info}/top_level.txt +0 -0
driftrail/types.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
2
|
DriftRail Type Definitions
|
|
3
|
+
Complete type definitions for all SDK features.
|
|
3
4
|
"""
|
|
4
5
|
|
|
5
|
-
from typing import Optional, List, Dict, Any, Literal
|
|
6
|
+
from typing import Optional, List, Dict, Any, Literal, Union
|
|
6
7
|
from dataclasses import dataclass, field, asdict
|
|
8
|
+
from datetime import datetime
|
|
7
9
|
|
|
8
10
|
Provider = Literal["openai", "google", "anthropic", "other"]
|
|
9
11
|
|
|
@@ -185,3 +187,642 @@ class GuardBlockedError(Exception):
|
|
|
185
187
|
self.result = result
|
|
186
188
|
reasons = [t.reason for t in result.triggered]
|
|
187
189
|
super().__init__(f"Content blocked: {'; '.join(reasons)}")
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
# ============ Incident Types ============
|
|
193
|
+
|
|
194
|
+
@dataclass
|
|
195
|
+
class Incident:
|
|
196
|
+
incident_id: str
|
|
197
|
+
title: str
|
|
198
|
+
severity: Literal["low", "medium", "high", "critical"]
|
|
199
|
+
status: Literal["open", "investigating", "mitigating", "resolved", "closed"]
|
|
200
|
+
incident_type: str
|
|
201
|
+
created_at: str
|
|
202
|
+
description: Optional[str] = None
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
@dataclass
|
|
206
|
+
class IncidentStats:
|
|
207
|
+
open: int
|
|
208
|
+
investigating: int
|
|
209
|
+
critical: int
|
|
210
|
+
mttr_hours: float
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
# ============ Compliance Types ============
|
|
214
|
+
|
|
215
|
+
@dataclass
|
|
216
|
+
class ComplianceFramework:
|
|
217
|
+
name: str
|
|
218
|
+
enabled: bool
|
|
219
|
+
status: str
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
@dataclass
|
|
223
|
+
class ComplianceStatus:
|
|
224
|
+
frameworks: List[ComplianceFramework]
|
|
225
|
+
pending_reviews: int
|
|
226
|
+
recent_violations: int
|
|
227
|
+
data_region: str
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
@dataclass
|
|
231
|
+
class ComplianceScore:
|
|
232
|
+
compliance_score: float
|
|
233
|
+
total_events: int
|
|
234
|
+
high_risk_events: int
|
|
235
|
+
high_risk_percentage: float
|
|
236
|
+
date_range: Dict[str, str]
|
|
237
|
+
rating: str
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
@dataclass
|
|
241
|
+
class ComplianceReportMeta:
|
|
242
|
+
report_id: str
|
|
243
|
+
framework: str
|
|
244
|
+
date_from: str
|
|
245
|
+
date_to: str
|
|
246
|
+
compliance_score: float
|
|
247
|
+
findings_count: int
|
|
248
|
+
generated_at: str
|
|
249
|
+
generated_by: str
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
@dataclass
|
|
253
|
+
class CustomControl:
|
|
254
|
+
control_id: str
|
|
255
|
+
name: str
|
|
256
|
+
description: str
|
|
257
|
+
category: str
|
|
258
|
+
evidence_type: str
|
|
259
|
+
keywords: List[str]
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
# ============ Executive Dashboard Types ============
|
|
263
|
+
|
|
264
|
+
@dataclass
|
|
265
|
+
class KpiTargets:
|
|
266
|
+
max_high_risk_percent: float
|
|
267
|
+
target_latency_ms: int
|
|
268
|
+
target_sla_percent: float
|
|
269
|
+
target_mttr_hours: float
|
|
270
|
+
monthly_budget_usd: float
|
|
271
|
+
max_critical_events_daily: int
|
|
272
|
+
target_avg_risk_score: float
|
|
273
|
+
sla_latency_threshold_ms: int
|
|
274
|
+
max_open_incidents: int
|
|
275
|
+
cost_per_1k_tokens: float
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
@dataclass
|
|
279
|
+
class ExecutiveMetrics:
|
|
280
|
+
period: str
|
|
281
|
+
health_score: float
|
|
282
|
+
summary: Dict[str, Any]
|
|
283
|
+
cost_metrics: Dict[str, Any]
|
|
284
|
+
incident_metrics: Dict[str, Any]
|
|
285
|
+
risk_trends: List[Dict[str, Any]]
|
|
286
|
+
volume_trends: List[Dict[str, Any]]
|
|
287
|
+
model_breakdown: List[Dict[str, Any]]
|
|
288
|
+
compliance_status: Dict[str, Any]
|
|
289
|
+
kpi_status: List[Dict[str, Any]]
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
# ============ Model Analytics Types ============
|
|
293
|
+
|
|
294
|
+
@dataclass
|
|
295
|
+
class HistoricalLog:
|
|
296
|
+
event_id: str
|
|
297
|
+
model: str
|
|
298
|
+
provider: str
|
|
299
|
+
environment: str
|
|
300
|
+
timestamp: str
|
|
301
|
+
latency_ms: int
|
|
302
|
+
tokens_in: int
|
|
303
|
+
tokens_out: int
|
|
304
|
+
risk_score: float
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
@dataclass
|
|
308
|
+
class ModelSwitch:
|
|
309
|
+
switch_id: str
|
|
310
|
+
app_id: str
|
|
311
|
+
previous_model: Optional[str]
|
|
312
|
+
new_model: str
|
|
313
|
+
previous_provider: Optional[str]
|
|
314
|
+
new_provider: str
|
|
315
|
+
switch_reason: Optional[str]
|
|
316
|
+
environment: Optional[str]
|
|
317
|
+
switched_at: str
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
@dataclass
|
|
321
|
+
class EnvironmentStats:
|
|
322
|
+
environment: str
|
|
323
|
+
event_count: int
|
|
324
|
+
avg_latency_ms: float
|
|
325
|
+
avg_risk_score: float
|
|
326
|
+
error_rate: float
|
|
327
|
+
models: List[str]
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
@dataclass
|
|
331
|
+
class ModelBenchmark:
|
|
332
|
+
benchmark_id: str
|
|
333
|
+
model: str
|
|
334
|
+
environment: Optional[str]
|
|
335
|
+
avg_latency_ms: float
|
|
336
|
+
p95_latency_ms: float
|
|
337
|
+
avg_risk_score: float
|
|
338
|
+
error_rate: float
|
|
339
|
+
throughput: float
|
|
340
|
+
sample_count: int
|
|
341
|
+
calculated_at: str
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
@dataclass
|
|
345
|
+
class ModelAnalyticsSummary:
|
|
346
|
+
total_models: int
|
|
347
|
+
total_events_7d: int
|
|
348
|
+
avg_latency_ms: float
|
|
349
|
+
top_model: Optional[str]
|
|
350
|
+
environments: List[str]
|
|
351
|
+
recent_switches: int
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
# ============ Drift & Alerts Types ============
|
|
355
|
+
|
|
356
|
+
@dataclass
|
|
357
|
+
class DriftMetrics:
|
|
358
|
+
health_score: float
|
|
359
|
+
current: Dict[str, float]
|
|
360
|
+
baselines: Dict[str, float]
|
|
361
|
+
last_updated: str
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
@dataclass
|
|
365
|
+
class DriftAlert:
|
|
366
|
+
alert_id: str
|
|
367
|
+
app_id: str
|
|
368
|
+
model: Optional[str]
|
|
369
|
+
alert_type: str
|
|
370
|
+
severity: Literal["critical", "warning", "info"]
|
|
371
|
+
current_value: float
|
|
372
|
+
baseline_value: float
|
|
373
|
+
deviation_percent: float
|
|
374
|
+
created_at: str
|
|
375
|
+
acknowledged_at: Optional[str]
|
|
376
|
+
resolved_at: Optional[str]
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
@dataclass
|
|
380
|
+
class DriftTrend:
|
|
381
|
+
date: str
|
|
382
|
+
avg_deviation: float
|
|
383
|
+
alert_count: int
|
|
384
|
+
metrics: Dict[str, float]
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
@dataclass
|
|
388
|
+
class DriftBaseline:
|
|
389
|
+
baseline_id: str
|
|
390
|
+
app_id: str
|
|
391
|
+
model: Optional[str]
|
|
392
|
+
valid_from: str
|
|
393
|
+
avg_risk_score: Optional[float]
|
|
394
|
+
sample_count: int
|
|
395
|
+
risk_distribution: Optional[Dict[str, int]]
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
@dataclass
|
|
399
|
+
class DriftScore:
|
|
400
|
+
overall_score: float
|
|
401
|
+
status: Literal["healthy", "warning", "critical"]
|
|
402
|
+
by_model: List[Dict[str, Any]]
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
# ============ Drift V3 Types ============
|
|
406
|
+
|
|
407
|
+
@dataclass
|
|
408
|
+
class NotificationChannel:
|
|
409
|
+
channel_id: str
|
|
410
|
+
app_id: str
|
|
411
|
+
channel_type: Literal["email", "slack", "webhook", "pagerduty", "teams"]
|
|
412
|
+
name: str
|
|
413
|
+
config: Dict[str, Any]
|
|
414
|
+
severity_filter: List[str]
|
|
415
|
+
is_enabled: bool
|
|
416
|
+
created_at: str
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
@dataclass
|
|
420
|
+
class DriftSegment:
|
|
421
|
+
segment_id: str
|
|
422
|
+
app_id: str
|
|
423
|
+
name: str
|
|
424
|
+
description: Optional[str]
|
|
425
|
+
filter_criteria: Dict[str, Any]
|
|
426
|
+
is_active: bool
|
|
427
|
+
created_at: str
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
@dataclass
|
|
431
|
+
class CorrelationEvent:
|
|
432
|
+
correlation_id: str
|
|
433
|
+
app_id: str
|
|
434
|
+
primary_metric: str
|
|
435
|
+
correlated_metric: str
|
|
436
|
+
correlation_coefficient: float
|
|
437
|
+
lag_minutes: int
|
|
438
|
+
detected_at: str
|
|
439
|
+
is_active: bool
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
@dataclass
|
|
443
|
+
class DistributionSnapshot:
|
|
444
|
+
snapshot_id: str
|
|
445
|
+
app_id: str
|
|
446
|
+
metric_type: str
|
|
447
|
+
distribution_data: Dict[str, Any]
|
|
448
|
+
anomaly_score: float
|
|
449
|
+
is_anomaly: bool
|
|
450
|
+
captured_at: str
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
@dataclass
|
|
454
|
+
class SeasonalityPattern:
|
|
455
|
+
pattern_id: str
|
|
456
|
+
app_id: str
|
|
457
|
+
metric_type: str
|
|
458
|
+
day_of_week: int
|
|
459
|
+
hour_of_day: int
|
|
460
|
+
expected_value: float
|
|
461
|
+
std_deviation: float
|
|
462
|
+
sample_count: int
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
@dataclass
|
|
466
|
+
class BaselineStatistics:
|
|
467
|
+
app_id: str
|
|
468
|
+
model: Optional[str]
|
|
469
|
+
metric_type: str
|
|
470
|
+
mean: float
|
|
471
|
+
std_dev: float
|
|
472
|
+
min: float
|
|
473
|
+
max: float
|
|
474
|
+
p50: float
|
|
475
|
+
p95: float
|
|
476
|
+
p99: float
|
|
477
|
+
sample_count: int
|
|
478
|
+
calculated_at: str
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
# ============ Tracing Types ============
|
|
482
|
+
|
|
483
|
+
SpanType = Literal["llm", "tool", "retrieval", "chain", "agent", "custom"]
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
@dataclass
|
|
487
|
+
class Trace:
|
|
488
|
+
trace_id: str
|
|
489
|
+
app_id: str
|
|
490
|
+
name: Optional[str]
|
|
491
|
+
start_time: str
|
|
492
|
+
end_time: Optional[str]
|
|
493
|
+
duration_ms: Optional[int]
|
|
494
|
+
status: Literal["running", "completed", "error"]
|
|
495
|
+
metadata: Dict[str, Any]
|
|
496
|
+
tags: List[str]
|
|
497
|
+
user_id: Optional[str]
|
|
498
|
+
session_id: Optional[str]
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
@dataclass
|
|
502
|
+
class Span:
|
|
503
|
+
span_id: str
|
|
504
|
+
trace_id: str
|
|
505
|
+
parent_span_id: Optional[str]
|
|
506
|
+
name: str
|
|
507
|
+
span_type: SpanType
|
|
508
|
+
start_time: str
|
|
509
|
+
end_time: Optional[str]
|
|
510
|
+
duration_ms: Optional[int]
|
|
511
|
+
status: Literal["running", "completed", "error"]
|
|
512
|
+
model: Optional[str]
|
|
513
|
+
provider: Optional[str]
|
|
514
|
+
tokens_in: Optional[int]
|
|
515
|
+
tokens_out: Optional[int]
|
|
516
|
+
cost_usd: Optional[float]
|
|
517
|
+
input: Optional[Dict[str, Any]]
|
|
518
|
+
output: Optional[Dict[str, Any]]
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
# ============ Prompt Management Types ============
|
|
522
|
+
|
|
523
|
+
@dataclass
|
|
524
|
+
class Prompt:
|
|
525
|
+
prompt_id: str
|
|
526
|
+
name: str
|
|
527
|
+
description: Optional[str]
|
|
528
|
+
tags: List[str]
|
|
529
|
+
is_active: bool
|
|
530
|
+
created_at: str
|
|
531
|
+
updated_at: str
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
@dataclass
|
|
535
|
+
class PromptVersion:
|
|
536
|
+
version_id: str
|
|
537
|
+
prompt_id: str
|
|
538
|
+
version: int
|
|
539
|
+
content: str
|
|
540
|
+
variables: List[str]
|
|
541
|
+
model_config: Dict[str, Any]
|
|
542
|
+
is_published: bool
|
|
543
|
+
is_default: bool
|
|
544
|
+
commit_message: Optional[str]
|
|
545
|
+
created_at: str
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
# ============ Evaluation Types ============
|
|
549
|
+
|
|
550
|
+
@dataclass
|
|
551
|
+
class EvalDataset:
|
|
552
|
+
dataset_id: str
|
|
553
|
+
name: str
|
|
554
|
+
description: Optional[str]
|
|
555
|
+
schema_type: Literal["qa", "conversation", "classification", "custom"]
|
|
556
|
+
item_count: int
|
|
557
|
+
tags: List[str]
|
|
558
|
+
is_active: bool
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
@dataclass
|
|
562
|
+
class EvalDatasetItem:
|
|
563
|
+
item_id: str
|
|
564
|
+
dataset_id: str
|
|
565
|
+
input: Dict[str, Any]
|
|
566
|
+
expected_output: Optional[Dict[str, Any]]
|
|
567
|
+
context: Optional[Dict[str, Any]]
|
|
568
|
+
metadata: Dict[str, Any]
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
@dataclass
|
|
572
|
+
class EvalRun:
|
|
573
|
+
run_id: str
|
|
574
|
+
dataset_id: str
|
|
575
|
+
name: Optional[str]
|
|
576
|
+
status: Literal["pending", "running", "completed", "failed"]
|
|
577
|
+
model: Optional[str]
|
|
578
|
+
total_items: int
|
|
579
|
+
completed_items: int
|
|
580
|
+
passed_items: int
|
|
581
|
+
failed_items: int
|
|
582
|
+
avg_score: Optional[float]
|
|
583
|
+
created_at: str
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
@dataclass
|
|
587
|
+
class EvalResult:
|
|
588
|
+
result_id: str
|
|
589
|
+
run_id: str
|
|
590
|
+
item_id: str
|
|
591
|
+
input: Dict[str, Any]
|
|
592
|
+
output: Optional[Dict[str, Any]]
|
|
593
|
+
expected_output: Optional[Dict[str, Any]]
|
|
594
|
+
scores: Dict[str, Dict[str, Any]]
|
|
595
|
+
overall_score: Optional[float]
|
|
596
|
+
passed: Optional[bool]
|
|
597
|
+
latency_ms: Optional[int]
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
# ============ Cache Types ============
|
|
601
|
+
|
|
602
|
+
@dataclass
|
|
603
|
+
class CacheSettings:
|
|
604
|
+
is_enabled: bool
|
|
605
|
+
similarity_threshold: float
|
|
606
|
+
ttl_seconds: int
|
|
607
|
+
max_entries: int
|
|
608
|
+
embedding_model: str
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
@dataclass
|
|
612
|
+
class CacheStats:
|
|
613
|
+
total_entries: int
|
|
614
|
+
total_hits: int
|
|
615
|
+
total_tokens_saved: int
|
|
616
|
+
total_cost_saved_usd: float
|
|
617
|
+
hit_rate: float
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
@dataclass
|
|
621
|
+
class CacheLookupResult:
|
|
622
|
+
hit: bool
|
|
623
|
+
cache_id: Optional[str] = None
|
|
624
|
+
output: Optional[str] = None
|
|
625
|
+
metadata: Optional[Dict[str, Any]] = None
|
|
626
|
+
model: Optional[str] = None
|
|
627
|
+
reason: Optional[str] = None
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
# ============ Simulation Types ============
|
|
631
|
+
|
|
632
|
+
@dataclass
|
|
633
|
+
class Simulation:
|
|
634
|
+
simulation_id: str
|
|
635
|
+
name: str
|
|
636
|
+
description: Optional[str]
|
|
637
|
+
persona: Optional[Dict[str, Any]]
|
|
638
|
+
scenario: str
|
|
639
|
+
success_criteria: List[Dict[str, str]]
|
|
640
|
+
max_turns: int
|
|
641
|
+
model: Optional[str]
|
|
642
|
+
status: Literal["draft", "ready", "running", "completed"]
|
|
643
|
+
tags: List[str]
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
@dataclass
|
|
647
|
+
class SimulationRun:
|
|
648
|
+
run_id: str
|
|
649
|
+
simulation_id: str
|
|
650
|
+
status: Literal["running", "completed", "failed", "stopped"]
|
|
651
|
+
turn_count: int
|
|
652
|
+
success: Optional[bool]
|
|
653
|
+
criteria_results: List[Dict[str, Any]]
|
|
654
|
+
summary: Optional[str]
|
|
655
|
+
total_latency_ms: Optional[int]
|
|
656
|
+
total_tokens: Optional[int]
|
|
657
|
+
started_at: str
|
|
658
|
+
completed_at: Optional[str]
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
@dataclass
|
|
662
|
+
class SimulationTurn:
|
|
663
|
+
turn_id: str
|
|
664
|
+
run_id: str
|
|
665
|
+
turn_number: int
|
|
666
|
+
role: Literal["user", "assistant", "system", "tool"]
|
|
667
|
+
content: str
|
|
668
|
+
tool_calls: Optional[List[Dict[str, Any]]]
|
|
669
|
+
tool_results: Optional[List[Dict[str, Any]]]
|
|
670
|
+
latency_ms: Optional[int]
|
|
671
|
+
tokens_in: Optional[int]
|
|
672
|
+
tokens_out: Optional[int]
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
@dataclass
|
|
676
|
+
class SimulationStats:
|
|
677
|
+
total_simulations: int
|
|
678
|
+
total_runs: int
|
|
679
|
+
success_rate: float
|
|
680
|
+
avg_turns: float
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
# ============ Integration Types ============
|
|
684
|
+
|
|
685
|
+
@dataclass
|
|
686
|
+
class Integration:
|
|
687
|
+
integration_id: str
|
|
688
|
+
type: Literal["slack", "teams", "discord"]
|
|
689
|
+
webhook_url: str
|
|
690
|
+
channel_name: Optional[str]
|
|
691
|
+
events: List[str]
|
|
692
|
+
is_active: bool
|
|
693
|
+
created_at: str
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
# ============ Benchmark Types ============
|
|
697
|
+
|
|
698
|
+
@dataclass
|
|
699
|
+
class BenchmarkMetric:
|
|
700
|
+
metric_name: str
|
|
701
|
+
your_value: float
|
|
702
|
+
industry_avg: float
|
|
703
|
+
percentile_25: float
|
|
704
|
+
percentile_50: float
|
|
705
|
+
percentile_75: float
|
|
706
|
+
percentile_90: float
|
|
707
|
+
your_percentile: float
|
|
708
|
+
rating: Literal["excellent", "good", "average", "below_average", "needs_attention"]
|
|
709
|
+
comparison: str
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
@dataclass
|
|
713
|
+
class BenchmarkReport:
|
|
714
|
+
tenant_id: str
|
|
715
|
+
industry: str
|
|
716
|
+
generated_at: str
|
|
717
|
+
date_range: Dict[str, str]
|
|
718
|
+
metrics: List[BenchmarkMetric]
|
|
719
|
+
overall_rating: Literal["excellent", "good", "average", "below_average", "needs_attention"]
|
|
720
|
+
summary: str
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
@dataclass
|
|
724
|
+
class Industry:
|
|
725
|
+
id: str
|
|
726
|
+
name: str
|
|
727
|
+
description: str
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
# ============ Guardrail Types ============
|
|
731
|
+
|
|
732
|
+
@dataclass
|
|
733
|
+
class Guardrail:
|
|
734
|
+
guardrail_id: str
|
|
735
|
+
name: str
|
|
736
|
+
description: Optional[str]
|
|
737
|
+
rule_type: str
|
|
738
|
+
action: Literal["flag", "block", "redact", "warn"]
|
|
739
|
+
config: Dict[str, Any]
|
|
740
|
+
is_active: bool
|
|
741
|
+
priority: int
|
|
742
|
+
created_at: str
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
@dataclass
|
|
746
|
+
class GuardrailStats:
|
|
747
|
+
total_triggers: int
|
|
748
|
+
by_guardrail: List[Dict[str, Any]]
|
|
749
|
+
by_action: List[Dict[str, Any]]
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
# ============ Retention Types ============
|
|
753
|
+
|
|
754
|
+
@dataclass
|
|
755
|
+
class RetentionPolicy:
|
|
756
|
+
policy_id: str
|
|
757
|
+
name: str
|
|
758
|
+
description: Optional[str]
|
|
759
|
+
is_active: bool
|
|
760
|
+
data_type: str
|
|
761
|
+
retention_days: int
|
|
762
|
+
compliance_hold: bool
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
@dataclass
|
|
766
|
+
class RetentionSummary:
|
|
767
|
+
active_policies: int
|
|
768
|
+
total_records_deleted: int
|
|
769
|
+
last_execution: Optional[str]
|
|
770
|
+
compliance_holds: int
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
# ============ Audit Types ============
|
|
774
|
+
|
|
775
|
+
@dataclass
|
|
776
|
+
class AuditLog:
|
|
777
|
+
log_id: str
|
|
778
|
+
action: str
|
|
779
|
+
resource_type: str
|
|
780
|
+
resource_id: Optional[str]
|
|
781
|
+
user_id: Optional[str]
|
|
782
|
+
ip_address: Optional[str]
|
|
783
|
+
details: Dict[str, Any]
|
|
784
|
+
created_at: str
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
# ============ Events Types ============
|
|
788
|
+
|
|
789
|
+
@dataclass
|
|
790
|
+
class Event:
|
|
791
|
+
event_id: str
|
|
792
|
+
app_id: str
|
|
793
|
+
model: str
|
|
794
|
+
provider: str
|
|
795
|
+
input_prompt: str
|
|
796
|
+
output_text: str
|
|
797
|
+
risk_score: float
|
|
798
|
+
latency_ms: int
|
|
799
|
+
tokens_in: int
|
|
800
|
+
tokens_out: int
|
|
801
|
+
created_at: str
|
|
802
|
+
classifications: Optional[Dict[str, Any]] = None
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
# ============ Custom Detection Types ============
|
|
806
|
+
|
|
807
|
+
@dataclass
|
|
808
|
+
class CustomDetection:
|
|
809
|
+
detection_id: str
|
|
810
|
+
name: str
|
|
811
|
+
description: Optional[str]
|
|
812
|
+
detection_type: Literal["keyword", "regex", "semantic", "llm_judge"]
|
|
813
|
+
config: Dict[str, Any]
|
|
814
|
+
severity: Literal["low", "medium", "high", "critical"]
|
|
815
|
+
is_active: bool
|
|
816
|
+
created_at: str
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
# ============ Webhook Types ============
|
|
820
|
+
|
|
821
|
+
@dataclass
|
|
822
|
+
class Webhook:
|
|
823
|
+
webhook_id: str
|
|
824
|
+
url: str
|
|
825
|
+
events: List[str]
|
|
826
|
+
is_active: bool
|
|
827
|
+
secret: Optional[str]
|
|
828
|
+
created_at: str
|