deeprails 0.12.0 → 0.13.0

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.
@@ -0,0 +1,38 @@
1
+ # typed: strong
2
+
3
+ module Deeprails
4
+ module Models
5
+ class MonitorRetrieveEventParams < Deeprails::Internal::Type::BaseModel
6
+ extend Deeprails::Internal::Type::RequestParameters::Converter
7
+ include Deeprails::Internal::Type::RequestParameters
8
+
9
+ OrHash =
10
+ T.type_alias do
11
+ T.any(
12
+ Deeprails::MonitorRetrieveEventParams,
13
+ Deeprails::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :monitor_id
19
+
20
+ sig do
21
+ params(
22
+ monitor_id: String,
23
+ request_options: Deeprails::RequestOptions::OrHash
24
+ ).returns(T.attached_class)
25
+ end
26
+ def self.new(monitor_id:, request_options: {})
27
+ end
28
+
29
+ sig do
30
+ override.returns(
31
+ { monitor_id: String, request_options: Deeprails::RequestOptions }
32
+ )
33
+ end
34
+ def to_hash
35
+ end
36
+ end
37
+ end
38
+ end
@@ -11,6 +11,19 @@ module Deeprails
11
11
  )
12
12
  end
13
13
 
14
+ # History of evaluations for the event.
15
+ sig do
16
+ returns(
17
+ T::Array[Deeprails::WorkflowEventDetailResponse::EvaluationHistory]
18
+ )
19
+ end
20
+ attr_accessor :evaluation_history
21
+
22
+ # Evaluation result consisting of average scores and rationales for each of the
23
+ # evaluated guardrail metrics.
24
+ sig { returns(T::Hash[Symbol, T.anything]) }
25
+ attr_accessor :evaluation_result
26
+
14
27
  # A unique workflow event ID.
15
28
  sig { returns(String) }
16
29
  attr_accessor :event_id
@@ -27,6 +40,21 @@ module Deeprails
27
40
  sig { returns(T::Boolean) }
28
41
  attr_accessor :filtered
29
42
 
43
+ # Improved model output after improvement tool was applied and each metric passed
44
+ # evaluation.
45
+ sig { returns(String) }
46
+ attr_accessor :improved_model_output
47
+
48
+ # Status of the improvement tool used to improve the event.
49
+ sig do
50
+ returns(
51
+ T.nilable(
52
+ Deeprails::WorkflowEventDetailResponse::ImprovementToolStatus::TaggedSymbol
53
+ )
54
+ )
55
+ end
56
+ attr_accessor :improvement_tool_status
57
+
30
58
  # Type of improvement tool used to improve the event.
31
59
  sig do
32
60
  returns(
@@ -35,6 +63,14 @@ module Deeprails
35
63
  end
36
64
  attr_accessor :improvement_tool_type
37
65
 
66
+ # Type of thresholds used to evaluate the event.
67
+ sig do
68
+ returns(
69
+ Deeprails::WorkflowEventDetailResponse::ThresholdType::TaggedSymbol
70
+ )
71
+ end
72
+ attr_accessor :threshold_type
73
+
38
74
  # Workflow ID associated with the event.
39
75
  sig { returns(String) }
40
76
  attr_accessor :workflow_id
@@ -95,34 +131,6 @@ module Deeprails
95
131
  end
96
132
  attr_writer :custom_hallucination_threshold_values
97
133
 
98
- # History of evaluations for the event.
99
- sig do
100
- returns(
101
- T.nilable(
102
- T::Array[Deeprails::WorkflowEventDetailResponse::EvaluationHistory]
103
- )
104
- )
105
- end
106
- attr_reader :evaluation_history
107
-
108
- sig do
109
- params(
110
- evaluation_history:
111
- T::Array[
112
- Deeprails::WorkflowEventDetailResponse::EvaluationHistory::OrHash
113
- ]
114
- ).void
115
- end
116
- attr_writer :evaluation_history
117
-
118
- # Evaluation result consisting of average scores and rationales for each of the
119
- # evaluated guardrail metrics.
120
- sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
121
- attr_reader :evaluation_result
122
-
123
- sig { params(evaluation_result: T::Hash[Symbol, T.anything]).void }
124
- attr_writer :evaluation_result
125
-
126
134
  # List of files available to the event, if any. Will only be present if
127
135
  # `file_search` is enabled.
128
136
  sig do
@@ -139,50 +147,26 @@ module Deeprails
139
147
  end
140
148
  attr_writer :files
141
149
 
142
- # Improved model output after improvement tool was applied and each metric passed
143
- # evaluation.
144
- sig { returns(T.nilable(String)) }
145
- attr_reader :improved_model_output
146
-
147
- sig { params(improved_model_output: String).void }
148
- attr_writer :improved_model_output
149
-
150
- # Status of the improvement tool used to improve the event.
151
- sig do
152
- returns(
153
- T.nilable(
154
- Deeprails::WorkflowEventDetailResponse::ImprovementToolStatus::TaggedSymbol
155
- )
156
- )
157
- end
158
- attr_accessor :improvement_tool_status
159
-
160
- # Type of thresholds used to evaluate the event.
161
- sig do
162
- returns(
163
- T.nilable(
164
- Deeprails::WorkflowEventDetailResponse::ThresholdType::TaggedSymbol
165
- )
166
- )
167
- end
168
- attr_reader :threshold_type
169
-
170
- sig do
171
- params(
172
- threshold_type:
173
- Deeprails::WorkflowEventDetailResponse::ThresholdType::OrSymbol
174
- ).void
175
- end
176
- attr_writer :threshold_type
177
-
178
150
  sig do
179
151
  params(
152
+ evaluation_history:
153
+ T::Array[
154
+ Deeprails::WorkflowEventDetailResponse::EvaluationHistory::OrHash
155
+ ],
156
+ evaluation_result: T::Hash[Symbol, T.anything],
180
157
  event_id: String,
181
158
  event_status:
182
159
  Deeprails::WorkflowEventDetailResponse::EventStatus::OrSymbol,
183
160
  filtered: T::Boolean,
161
+ improved_model_output: String,
162
+ improvement_tool_status:
163
+ T.nilable(
164
+ Deeprails::WorkflowEventDetailResponse::ImprovementToolStatus::OrSymbol
165
+ ),
184
166
  improvement_tool_type:
185
167
  Deeprails::WorkflowEventDetailResponse::ImprovementToolType::OrSymbol,
168
+ threshold_type:
169
+ Deeprails::WorkflowEventDetailResponse::ThresholdType::OrSymbol,
186
170
  workflow_id: String,
187
171
  automatic_hallucination_tolerance_levels:
188
172
  T::Hash[
@@ -194,30 +178,30 @@ module Deeprails
194
178
  Deeprails::WorkflowEventDetailResponse::Capability::OrHash
195
179
  ],
196
180
  custom_hallucination_threshold_values: T::Hash[Symbol, Float],
197
- evaluation_history:
198
- T::Array[
199
- Deeprails::WorkflowEventDetailResponse::EvaluationHistory::OrHash
200
- ],
201
- evaluation_result: T::Hash[Symbol, T.anything],
202
- files: T::Array[Deeprails::WorkflowEventDetailResponse::File::OrHash],
203
- improved_model_output: String,
204
- improvement_tool_status:
205
- T.nilable(
206
- Deeprails::WorkflowEventDetailResponse::ImprovementToolStatus::OrSymbol
207
- ),
208
- threshold_type:
209
- Deeprails::WorkflowEventDetailResponse::ThresholdType::OrSymbol
181
+ files: T::Array[Deeprails::WorkflowEventDetailResponse::File::OrHash]
210
182
  ).returns(T.attached_class)
211
183
  end
212
184
  def self.new(
185
+ # History of evaluations for the event.
186
+ evaluation_history:,
187
+ # Evaluation result consisting of average scores and rationales for each of the
188
+ # evaluated guardrail metrics.
189
+ evaluation_result:,
213
190
  # A unique workflow event ID.
214
191
  event_id:,
215
192
  # Status of the event.
216
193
  event_status:,
217
194
  # Whether the event was filtered and requires improvement.
218
195
  filtered:,
196
+ # Improved model output after improvement tool was applied and each metric passed
197
+ # evaluation.
198
+ improved_model_output:,
199
+ # Status of the improvement tool used to improve the event.
200
+ improvement_tool_status:,
219
201
  # Type of improvement tool used to improve the event.
220
202
  improvement_tool_type:,
203
+ # Type of thresholds used to evaluate the event.
204
+ threshold_type:,
221
205
  # Workflow ID associated with the event.
222
206
  workflow_id:,
223
207
  # Mapping of guardrail metric names to tolerance values. Values are strings
@@ -229,33 +213,33 @@ module Deeprails
229
213
  # Mapping of guardrail metric names to threshold values. Values are floating point
230
214
  # numbers (0.0-1.0) representing custom thresholds.
231
215
  custom_hallucination_threshold_values: nil,
232
- # History of evaluations for the event.
233
- evaluation_history: nil,
234
- # Evaluation result consisting of average scores and rationales for each of the
235
- # evaluated guardrail metrics.
236
- evaluation_result: nil,
237
216
  # List of files available to the event, if any. Will only be present if
238
217
  # `file_search` is enabled.
239
- files: nil,
240
- # Improved model output after improvement tool was applied and each metric passed
241
- # evaluation.
242
- improved_model_output: nil,
243
- # Status of the improvement tool used to improve the event.
244
- improvement_tool_status: nil,
245
- # Type of thresholds used to evaluate the event.
246
- threshold_type: nil
218
+ files: nil
247
219
  )
248
220
  end
249
221
 
250
222
  sig do
251
223
  override.returns(
252
224
  {
225
+ evaluation_history:
226
+ T::Array[
227
+ Deeprails::WorkflowEventDetailResponse::EvaluationHistory
228
+ ],
229
+ evaluation_result: T::Hash[Symbol, T.anything],
253
230
  event_id: String,
254
231
  event_status:
255
232
  Deeprails::WorkflowEventDetailResponse::EventStatus::TaggedSymbol,
256
233
  filtered: T::Boolean,
234
+ improved_model_output: String,
235
+ improvement_tool_status:
236
+ T.nilable(
237
+ Deeprails::WorkflowEventDetailResponse::ImprovementToolStatus::TaggedSymbol
238
+ ),
257
239
  improvement_tool_type:
258
240
  Deeprails::WorkflowEventDetailResponse::ImprovementToolType::TaggedSymbol,
241
+ threshold_type:
242
+ Deeprails::WorkflowEventDetailResponse::ThresholdType::TaggedSymbol,
259
243
  workflow_id: String,
260
244
  automatic_hallucination_tolerance_levels:
261
245
  T::Hash[
@@ -265,160 +249,13 @@ module Deeprails
265
249
  capabilities:
266
250
  T::Array[Deeprails::WorkflowEventDetailResponse::Capability],
267
251
  custom_hallucination_threshold_values: T::Hash[Symbol, Float],
268
- evaluation_history:
269
- T::Array[
270
- Deeprails::WorkflowEventDetailResponse::EvaluationHistory
271
- ],
272
- evaluation_result: T::Hash[Symbol, T.anything],
273
- files: T::Array[Deeprails::WorkflowEventDetailResponse::File],
274
- improved_model_output: String,
275
- improvement_tool_status:
276
- T.nilable(
277
- Deeprails::WorkflowEventDetailResponse::ImprovementToolStatus::TaggedSymbol
278
- ),
279
- threshold_type:
280
- Deeprails::WorkflowEventDetailResponse::ThresholdType::TaggedSymbol
252
+ files: T::Array[Deeprails::WorkflowEventDetailResponse::File]
281
253
  }
282
254
  )
283
255
  end
284
256
  def to_hash
285
257
  end
286
258
 
287
- # Status of the event.
288
- module EventStatus
289
- extend Deeprails::Internal::Type::Enum
290
-
291
- TaggedSymbol =
292
- T.type_alias do
293
- T.all(Symbol, Deeprails::WorkflowEventDetailResponse::EventStatus)
294
- end
295
- OrSymbol = T.type_alias { T.any(Symbol, String) }
296
-
297
- IN_PROGRESS =
298
- T.let(
299
- :"In Progress",
300
- Deeprails::WorkflowEventDetailResponse::EventStatus::TaggedSymbol
301
- )
302
- COMPLETED =
303
- T.let(
304
- :Completed,
305
- Deeprails::WorkflowEventDetailResponse::EventStatus::TaggedSymbol
306
- )
307
-
308
- sig do
309
- override.returns(
310
- T::Array[
311
- Deeprails::WorkflowEventDetailResponse::EventStatus::TaggedSymbol
312
- ]
313
- )
314
- end
315
- def self.values
316
- end
317
- end
318
-
319
- # Type of improvement tool used to improve the event.
320
- module ImprovementToolType
321
- extend Deeprails::Internal::Type::Enum
322
-
323
- TaggedSymbol =
324
- T.type_alias do
325
- T.all(
326
- Symbol,
327
- Deeprails::WorkflowEventDetailResponse::ImprovementToolType
328
- )
329
- end
330
- OrSymbol = T.type_alias { T.any(Symbol, String) }
331
-
332
- REGEN =
333
- T.let(
334
- :regen,
335
- Deeprails::WorkflowEventDetailResponse::ImprovementToolType::TaggedSymbol
336
- )
337
- FIXIT =
338
- T.let(
339
- :fixit,
340
- Deeprails::WorkflowEventDetailResponse::ImprovementToolType::TaggedSymbol
341
- )
342
- DO_NOTHING =
343
- T.let(
344
- :do_nothing,
345
- Deeprails::WorkflowEventDetailResponse::ImprovementToolType::TaggedSymbol
346
- )
347
-
348
- sig do
349
- override.returns(
350
- T::Array[
351
- Deeprails::WorkflowEventDetailResponse::ImprovementToolType::TaggedSymbol
352
- ]
353
- )
354
- end
355
- def self.values
356
- end
357
- end
358
-
359
- module AutomaticHallucinationToleranceLevel
360
- extend Deeprails::Internal::Type::Enum
361
-
362
- TaggedSymbol =
363
- T.type_alias do
364
- T.all(
365
- Symbol,
366
- Deeprails::WorkflowEventDetailResponse::AutomaticHallucinationToleranceLevel
367
- )
368
- end
369
- OrSymbol = T.type_alias { T.any(Symbol, String) }
370
-
371
- LOW =
372
- T.let(
373
- :low,
374
- Deeprails::WorkflowEventDetailResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
375
- )
376
- MEDIUM =
377
- T.let(
378
- :medium,
379
- Deeprails::WorkflowEventDetailResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
380
- )
381
- HIGH =
382
- T.let(
383
- :high,
384
- Deeprails::WorkflowEventDetailResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
385
- )
386
-
387
- sig do
388
- override.returns(
389
- T::Array[
390
- Deeprails::WorkflowEventDetailResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
391
- ]
392
- )
393
- end
394
- def self.values
395
- end
396
- end
397
-
398
- class Capability < Deeprails::Internal::Type::BaseModel
399
- OrHash =
400
- T.type_alias do
401
- T.any(
402
- Deeprails::WorkflowEventDetailResponse::Capability,
403
- Deeprails::Internal::AnyHash
404
- )
405
- end
406
-
407
- sig { returns(T.nilable(String)) }
408
- attr_reader :capability
409
-
410
- sig { params(capability: String).void }
411
- attr_writer :capability
412
-
413
- sig { params(capability: String).returns(T.attached_class) }
414
- def self.new(capability: nil)
415
- end
416
-
417
- sig { override.returns({ capability: String }) }
418
- def to_hash
419
- end
420
- end
421
-
422
259
  class EvaluationHistory < Deeprails::Internal::Type::BaseModel
423
260
  OrHash =
424
261
  T.type_alias do
@@ -563,49 +400,35 @@ module Deeprails
563
400
  end
564
401
  end
565
402
 
566
- class File < Deeprails::Internal::Type::BaseModel
567
- OrHash =
403
+ # Status of the event.
404
+ module EventStatus
405
+ extend Deeprails::Internal::Type::Enum
406
+
407
+ TaggedSymbol =
568
408
  T.type_alias do
569
- T.any(
570
- Deeprails::WorkflowEventDetailResponse::File,
571
- Deeprails::Internal::AnyHash
572
- )
409
+ T.all(Symbol, Deeprails::WorkflowEventDetailResponse::EventStatus)
573
410
  end
411
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
574
412
 
575
- sig { returns(T.nilable(String)) }
576
- attr_reader :file_id
577
-
578
- sig { params(file_id: String).void }
579
- attr_writer :file_id
580
-
581
- sig { returns(T.nilable(String)) }
582
- attr_reader :file_name
583
-
584
- sig { params(file_name: String).void }
585
- attr_writer :file_name
586
-
587
- sig { returns(T.nilable(Integer)) }
588
- attr_reader :file_size
589
-
590
- sig { params(file_size: Integer).void }
591
- attr_writer :file_size
592
-
593
- sig do
594
- params(
595
- file_id: String,
596
- file_name: String,
597
- file_size: Integer
598
- ).returns(T.attached_class)
599
- end
600
- def self.new(file_id: nil, file_name: nil, file_size: nil)
601
- end
413
+ IN_PROGRESS =
414
+ T.let(
415
+ :"In Progress",
416
+ Deeprails::WorkflowEventDetailResponse::EventStatus::TaggedSymbol
417
+ )
418
+ COMPLETED =
419
+ T.let(
420
+ :Completed,
421
+ Deeprails::WorkflowEventDetailResponse::EventStatus::TaggedSymbol
422
+ )
602
423
 
603
424
  sig do
604
425
  override.returns(
605
- { file_id: String, file_name: String, file_size: Integer }
426
+ T::Array[
427
+ Deeprails::WorkflowEventDetailResponse::EventStatus::TaggedSymbol
428
+ ]
606
429
  )
607
430
  end
608
- def to_hash
431
+ def self.values
609
432
  end
610
433
  end
611
434
 
@@ -649,6 +472,46 @@ module Deeprails
649
472
  end
650
473
  end
651
474
 
475
+ # Type of improvement tool used to improve the event.
476
+ module ImprovementToolType
477
+ extend Deeprails::Internal::Type::Enum
478
+
479
+ TaggedSymbol =
480
+ T.type_alias do
481
+ T.all(
482
+ Symbol,
483
+ Deeprails::WorkflowEventDetailResponse::ImprovementToolType
484
+ )
485
+ end
486
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
487
+
488
+ REGEN =
489
+ T.let(
490
+ :regen,
491
+ Deeprails::WorkflowEventDetailResponse::ImprovementToolType::TaggedSymbol
492
+ )
493
+ FIXIT =
494
+ T.let(
495
+ :fixit,
496
+ Deeprails::WorkflowEventDetailResponse::ImprovementToolType::TaggedSymbol
497
+ )
498
+ DO_NOTHING =
499
+ T.let(
500
+ :do_nothing,
501
+ Deeprails::WorkflowEventDetailResponse::ImprovementToolType::TaggedSymbol
502
+ )
503
+
504
+ sig do
505
+ override.returns(
506
+ T::Array[
507
+ Deeprails::WorkflowEventDetailResponse::ImprovementToolType::TaggedSymbol
508
+ ]
509
+ )
510
+ end
511
+ def self.values
512
+ end
513
+ end
514
+
652
515
  # Type of thresholds used to evaluate the event.
653
516
  module ThresholdType
654
517
  extend Deeprails::Internal::Type::Enum
@@ -680,6 +543,115 @@ module Deeprails
680
543
  def self.values
681
544
  end
682
545
  end
546
+
547
+ module AutomaticHallucinationToleranceLevel
548
+ extend Deeprails::Internal::Type::Enum
549
+
550
+ TaggedSymbol =
551
+ T.type_alias do
552
+ T.all(
553
+ Symbol,
554
+ Deeprails::WorkflowEventDetailResponse::AutomaticHallucinationToleranceLevel
555
+ )
556
+ end
557
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
558
+
559
+ LOW =
560
+ T.let(
561
+ :low,
562
+ Deeprails::WorkflowEventDetailResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
563
+ )
564
+ MEDIUM =
565
+ T.let(
566
+ :medium,
567
+ Deeprails::WorkflowEventDetailResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
568
+ )
569
+ HIGH =
570
+ T.let(
571
+ :high,
572
+ Deeprails::WorkflowEventDetailResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
573
+ )
574
+
575
+ sig do
576
+ override.returns(
577
+ T::Array[
578
+ Deeprails::WorkflowEventDetailResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
579
+ ]
580
+ )
581
+ end
582
+ def self.values
583
+ end
584
+ end
585
+
586
+ class Capability < Deeprails::Internal::Type::BaseModel
587
+ OrHash =
588
+ T.type_alias do
589
+ T.any(
590
+ Deeprails::WorkflowEventDetailResponse::Capability,
591
+ Deeprails::Internal::AnyHash
592
+ )
593
+ end
594
+
595
+ sig { returns(T.nilable(String)) }
596
+ attr_reader :capability
597
+
598
+ sig { params(capability: String).void }
599
+ attr_writer :capability
600
+
601
+ sig { params(capability: String).returns(T.attached_class) }
602
+ def self.new(capability: nil)
603
+ end
604
+
605
+ sig { override.returns({ capability: String }) }
606
+ def to_hash
607
+ end
608
+ end
609
+
610
+ class File < Deeprails::Internal::Type::BaseModel
611
+ OrHash =
612
+ T.type_alias do
613
+ T.any(
614
+ Deeprails::WorkflowEventDetailResponse::File,
615
+ Deeprails::Internal::AnyHash
616
+ )
617
+ end
618
+
619
+ sig { returns(T.nilable(String)) }
620
+ attr_reader :file_id
621
+
622
+ sig { params(file_id: String).void }
623
+ attr_writer :file_id
624
+
625
+ sig { returns(T.nilable(String)) }
626
+ attr_reader :file_name
627
+
628
+ sig { params(file_name: String).void }
629
+ attr_writer :file_name
630
+
631
+ sig { returns(T.nilable(Integer)) }
632
+ attr_reader :file_size
633
+
634
+ sig { params(file_size: Integer).void }
635
+ attr_writer :file_size
636
+
637
+ sig do
638
+ params(
639
+ file_id: String,
640
+ file_name: String,
641
+ file_size: Integer
642
+ ).returns(T.attached_class)
643
+ end
644
+ def self.new(file_id: nil, file_name: nil, file_size: nil)
645
+ end
646
+
647
+ sig do
648
+ override.returns(
649
+ { file_id: String, file_name: String, file_size: Integer }
650
+ )
651
+ end
652
+ def to_hash
653
+ end
654
+ end
683
655
  end
684
656
  end
685
657
  end
@@ -31,6 +31,8 @@ module Deeprails
31
31
 
32
32
  MonitorEventResponse = Deeprails::Models::MonitorEventResponse
33
33
 
34
+ MonitorRetrieveEventParams = Deeprails::Models::MonitorRetrieveEventParams
35
+
34
36
  MonitorRetrieveParams = Deeprails::Models::MonitorRetrieveParams
35
37
 
36
38
  MonitorSubmitEventParams = Deeprails::Models::MonitorSubmitEventParams
@@ -79,6 +79,23 @@ module Deeprails
79
79
  )
80
80
  end
81
81
 
82
+ # Use this endpoint to retrieve the details of a specific monitor event
83
+ sig do
84
+ params(
85
+ event_id: String,
86
+ monitor_id: String,
87
+ request_options: Deeprails::RequestOptions::OrHash
88
+ ).returns(Deeprails::MonitorEventDetailResponse)
89
+ end
90
+ def retrieve_event(
91
+ # The ID of the requested monitor event.
92
+ event_id,
93
+ # The ID of the monitor associated with this event.
94
+ monitor_id:,
95
+ request_options: {}
96
+ )
97
+ end
98
+
82
99
  # Use this endpoint to submit a model input and output pair to a monitor for
83
100
  # evaluation
84
101
  sig do