deeprails 0.18.0 → 0.24.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.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +92 -0
  3. data/README.md +1 -1
  4. data/lib/deeprails/internal/stream.rb +29 -0
  5. data/lib/deeprails/internal/transport/base_client.rb +3 -1
  6. data/lib/deeprails/internal/transport/pooled_net_requester.rb +13 -11
  7. data/lib/deeprails/internal/type/base_stream.rb +83 -0
  8. data/lib/deeprails/internal/util.rb +39 -3
  9. data/lib/deeprails/models/defend_create_workflow_params.rb +14 -1
  10. data/lib/deeprails/models/defend_response.rb +134 -10
  11. data/lib/deeprails/models/defend_retrieve_event_params.rb +7 -1
  12. data/lib/deeprails/models/defend_retrieve_workflow_params.rb +8 -1
  13. data/lib/deeprails/models/defend_submit_and_stream_event_params.rb +92 -0
  14. data/lib/deeprails/models/defend_submit_and_stream_event_response.rb +7 -0
  15. data/lib/deeprails/models/defend_submit_event_params.rb +70 -20
  16. data/lib/deeprails/models/defend_update_response.rb +9 -1
  17. data/lib/deeprails/models/defend_update_workflow_params.rb +138 -5
  18. data/lib/deeprails/models/monitor_create_params.rb +14 -1
  19. data/lib/deeprails/models/monitor_detail_response.rb +60 -17
  20. data/lib/deeprails/models/monitor_event_detail_response.rb +11 -5
  21. data/lib/deeprails/models/monitor_retrieve_event_params.rb +7 -1
  22. data/lib/deeprails/models/monitor_retrieve_params.rb +8 -1
  23. data/lib/deeprails/models/monitor_submit_event_params.rb +70 -20
  24. data/lib/deeprails/models/monitor_update_params.rb +53 -5
  25. data/lib/deeprails/models/workflow_event_detail_response.rb +99 -16
  26. data/lib/deeprails/models/workflow_event_response.rb +9 -1
  27. data/lib/deeprails/models.rb +2 -0
  28. data/lib/deeprails/resources/defend.rb +70 -5
  29. data/lib/deeprails/resources/monitor.rb +16 -7
  30. data/lib/deeprails/version.rb +1 -1
  31. data/lib/deeprails.rb +5 -0
  32. data/manifest.yaml +1 -0
  33. data/rbi/deeprails/internal/stream.rbi +20 -0
  34. data/rbi/deeprails/internal/transport/base_client.rbi +18 -2
  35. data/rbi/deeprails/internal/type/base_stream.rbi +75 -0
  36. data/rbi/deeprails/internal/util.rbi +21 -1
  37. data/rbi/deeprails/models/defend_create_workflow_params.rbi +21 -0
  38. data/rbi/deeprails/models/defend_response.rbi +286 -14
  39. data/rbi/deeprails/models/defend_retrieve_event_params.rbi +10 -2
  40. data/rbi/deeprails/models/defend_retrieve_workflow_params.rbi +10 -1
  41. data/rbi/deeprails/models/defend_submit_and_stream_event_params.rbi +155 -0
  42. data/rbi/deeprails/models/defend_submit_and_stream_event_response.rbi +7 -0
  43. data/rbi/deeprails/models/defend_submit_event_params.rbi +134 -31
  44. data/rbi/deeprails/models/defend_update_response.rbi +14 -3
  45. data/rbi/deeprails/models/defend_update_workflow_params.rbi +304 -4
  46. data/rbi/deeprails/models/monitor_create_params.rbi +21 -0
  47. data/rbi/deeprails/models/monitor_detail_response.rbi +122 -28
  48. data/rbi/deeprails/models/monitor_event_detail_response.rbi +20 -8
  49. data/rbi/deeprails/models/monitor_retrieve_event_params.rbi +10 -2
  50. data/rbi/deeprails/models/monitor_retrieve_params.rbi +10 -1
  51. data/rbi/deeprails/models/monitor_submit_event_params.rbi +134 -31
  52. data/rbi/deeprails/models/monitor_update_params.rbi +113 -4
  53. data/rbi/deeprails/models/workflow_event_detail_response.rbi +204 -24
  54. data/rbi/deeprails/models/workflow_event_response.rbi +8 -0
  55. data/rbi/deeprails/models.rbi +3 -0
  56. data/rbi/deeprails/resources/defend.rbi +101 -6
  57. data/rbi/deeprails/resources/monitor.rbi +31 -8
  58. data/sig/deeprails/internal/stream.rbs +9 -0
  59. data/sig/deeprails/internal/type/base_stream.rbs +38 -0
  60. data/sig/deeprails/internal/util.rbs +10 -0
  61. data/sig/deeprails/models/defend_create_workflow_params.rbs +7 -0
  62. data/sig/deeprails/models/defend_response.rbs +114 -8
  63. data/sig/deeprails/models/defend_retrieve_event_params.rbs +6 -1
  64. data/sig/deeprails/models/defend_retrieve_workflow_params.rbs +6 -1
  65. data/sig/deeprails/models/defend_submit_and_stream_event_params.rbs +73 -0
  66. data/sig/deeprails/models/defend_submit_and_stream_event_response.rbs +5 -0
  67. data/sig/deeprails/models/defend_submit_event_params.rbs +53 -13
  68. data/sig/deeprails/models/defend_update_response.rbs +10 -3
  69. data/sig/deeprails/models/defend_update_workflow_params.rbs +108 -1
  70. data/sig/deeprails/models/monitor_create_params.rbs +7 -0
  71. data/sig/deeprails/models/monitor_detail_response.rbs +48 -13
  72. data/sig/deeprails/models/monitor_event_detail_response.rbs +12 -4
  73. data/sig/deeprails/models/monitor_retrieve_event_params.rbs +6 -1
  74. data/sig/deeprails/models/monitor_retrieve_params.rbs +6 -1
  75. data/sig/deeprails/models/monitor_submit_event_params.rbs +53 -13
  76. data/sig/deeprails/models/monitor_update_params.rbs +50 -1
  77. data/sig/deeprails/models/workflow_event_detail_response.rbs +100 -15
  78. data/sig/deeprails/models/workflow_event_response.rbs +5 -0
  79. data/sig/deeprails/models.rbs +2 -0
  80. data/sig/deeprails/resources/defend.rbs +20 -0
  81. data/sig/deeprails/resources/monitor.rbs +4 -0
  82. metadata +28 -2
@@ -20,8 +20,8 @@ module Deeprails
20
20
  end
21
21
  attr_accessor :automatic_hallucination_tolerance_levels
22
22
 
23
- # Extended AI capabilities available to the event, if any. Can be `web_search`
24
- # and/or `file_search`.
23
+ # Extended AI capabilities available to the event, if any. Can be `web_search`,
24
+ # `file_search`, and/or `context_awareness`.
25
25
  sig { returns(T::Array[Deeprails::DefendResponse::Capability]) }
26
26
  attr_accessor :capabilities
27
27
 
@@ -119,8 +119,8 @@ module Deeprails
119
119
  # Mapping of guardrail metric names to tolerance values. Values can be strings
120
120
  # (`low`, `medium`, `high`) for automatic tolerance levels.
121
121
  automatic_hallucination_tolerance_levels:,
122
- # Extended AI capabilities available to the event, if any. Can be `web_search`
123
- # and/or `file_search`.
122
+ # Extended AI capabilities available to the event, if any. Can be `web_search`,
123
+ # `file_search`, and/or `context_awareness`.
124
124
  capabilities:,
125
125
  # The time the workflow was created in UTC.
126
126
  created_at:,
@@ -254,6 +254,13 @@ module Deeprails
254
254
  )
255
255
  end
256
256
 
257
+ # The ID of the billing request for the event.
258
+ sig { returns(T.nilable(String)) }
259
+ attr_reader :billing_request_id
260
+
261
+ sig { params(billing_request_id: String).void }
262
+ attr_writer :billing_request_id
263
+
257
264
  # An array of evaluations for this event.
258
265
  sig do
259
266
  returns(
@@ -284,42 +291,88 @@ module Deeprails
284
291
  sig { params(improved_model_output: String).void }
285
292
  attr_writer :improved_model_output
286
293
 
287
- # Status of the improvement tool used to improve the event.
288
- sig { returns(T.nilable(String)) }
294
+ # Status of the improvement tool used to improve the event. `improvement_required`
295
+ # indicates that the evaluation is complete and the improvement action is needed
296
+ # but is not taking place. `improved` and `improvement_failed` indicate when the
297
+ # improvement action concludes, successfully and unsuccessfully, respectively.
298
+ # `no_improvement_required` means that the first evaluation passed all its
299
+ # metrics!
300
+ sig do
301
+ returns(
302
+ T.nilable(
303
+ Deeprails::DefendResponse::Event::ImprovementToolStatus::TaggedSymbol
304
+ )
305
+ )
306
+ end
289
307
  attr_reader :improvement_tool_status
290
308
 
291
- sig { params(improvement_tool_status: String).void }
309
+ sig do
310
+ params(
311
+ improvement_tool_status:
312
+ Deeprails::DefendResponse::Event::ImprovementToolStatus::OrSymbol
313
+ ).void
314
+ end
292
315
  attr_writer :improvement_tool_status
293
316
 
317
+ # Status of the event.
318
+ sig do
319
+ returns(
320
+ T.nilable(Deeprails::DefendResponse::Event::Status::TaggedSymbol)
321
+ )
322
+ end
323
+ attr_reader :status
324
+
325
+ sig do
326
+ params(
327
+ status: Deeprails::DefendResponse::Event::Status::OrSymbol
328
+ ).void
329
+ end
330
+ attr_writer :status
331
+
294
332
  sig do
295
333
  params(
334
+ billing_request_id: String,
296
335
  evaluations:
297
336
  T::Array[Deeprails::DefendResponse::Event::Evaluation::OrHash],
298
337
  event_id: String,
299
338
  improved_model_output: String,
300
- improvement_tool_status: String
339
+ improvement_tool_status:
340
+ Deeprails::DefendResponse::Event::ImprovementToolStatus::OrSymbol,
341
+ status: Deeprails::DefendResponse::Event::Status::OrSymbol
301
342
  ).returns(T.attached_class)
302
343
  end
303
344
  def self.new(
345
+ # The ID of the billing request for the event.
346
+ billing_request_id: nil,
304
347
  # An array of evaluations for this event.
305
348
  evaluations: nil,
306
349
  # A unique workflow event ID.
307
350
  event_id: nil,
308
351
  # Improved model output after improvement tool was applied.
309
352
  improved_model_output: nil,
310
- # Status of the improvement tool used to improve the event.
311
- improvement_tool_status: nil
353
+ # Status of the improvement tool used to improve the event. `improvement_required`
354
+ # indicates that the evaluation is complete and the improvement action is needed
355
+ # but is not taking place. `improved` and `improvement_failed` indicate when the
356
+ # improvement action concludes, successfully and unsuccessfully, respectively.
357
+ # `no_improvement_required` means that the first evaluation passed all its
358
+ # metrics!
359
+ improvement_tool_status: nil,
360
+ # Status of the event.
361
+ status: nil
312
362
  )
313
363
  end
314
364
 
315
365
  sig do
316
366
  override.returns(
317
367
  {
368
+ billing_request_id: String,
318
369
  evaluations:
319
370
  T::Array[Deeprails::DefendResponse::Event::Evaluation],
320
371
  event_id: String,
321
372
  improved_model_output: String,
322
- improvement_tool_status: String
373
+ improvement_tool_status:
374
+ Deeprails::DefendResponse::Event::ImprovementToolStatus::TaggedSymbol,
375
+ status: Deeprails::DefendResponse::Event::Status::TaggedSymbol
323
376
  }
324
377
  )
325
378
  end
@@ -335,6 +388,14 @@ module Deeprails
335
388
  )
336
389
  end
337
390
 
391
+ # Analysis of the failures of the model_output according to the guardrail metrics
392
+ # evaluated.
393
+ sig { returns(T.nilable(String)) }
394
+ attr_reader :analysis_of_failures
395
+
396
+ sig { params(analysis_of_failures: String).void }
397
+ attr_writer :analysis_of_failures
398
+
338
399
  # The attempt number or identifier for this evaluation.
339
400
  sig { returns(T.nilable(String)) }
340
401
  attr_reader :attempt
@@ -384,6 +445,36 @@ module Deeprails
384
445
  sig { params(guardrail_metrics: T::Array[String]).void }
385
446
  attr_writer :guardrail_metrics
386
447
 
448
+ # Status of the improvement tool used to improve the event. `improvement_required`
449
+ # indicates that the evaluation is complete and the improvement action is needed
450
+ # but is not taking place. `improved` and `improvement_failed` indicate when the
451
+ # improvement action concludes, successfully and unsuccessfully, respectively.
452
+ # `no_improvement_required` means that the first evaluation passed all its
453
+ # metrics!
454
+ sig do
455
+ returns(
456
+ T.nilable(
457
+ Deeprails::DefendResponse::Event::Evaluation::ImprovementToolStatus::TaggedSymbol
458
+ )
459
+ )
460
+ end
461
+ attr_reader :improvement_tool_status
462
+
463
+ sig do
464
+ params(
465
+ improvement_tool_status:
466
+ Deeprails::DefendResponse::Event::Evaluation::ImprovementToolStatus::OrSymbol
467
+ ).void
468
+ end
469
+ attr_writer :improvement_tool_status
470
+
471
+ # A list of key improvements made to the model_output to address the failures.
472
+ sig { returns(T.nilable(T::Array[String])) }
473
+ attr_reader :key_improvements
474
+
475
+ sig { params(key_improvements: T::Array[String]).void }
476
+ attr_writer :key_improvements
477
+
387
478
  # The model input used for the evaluation.
388
479
  sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
389
480
  attr_reader :model_input
@@ -428,6 +519,7 @@ module Deeprails
428
519
 
429
520
  sig do
430
521
  params(
522
+ analysis_of_failures: String,
431
523
  attempt: String,
432
524
  created_at: Time,
433
525
  error_message: String,
@@ -435,6 +527,9 @@ module Deeprails
435
527
  evaluation_status: String,
436
528
  evaluation_total_cost: Float,
437
529
  guardrail_metrics: T::Array[String],
530
+ improvement_tool_status:
531
+ Deeprails::DefendResponse::Event::Evaluation::ImprovementToolStatus::OrSymbol,
532
+ key_improvements: T::Array[String],
438
533
  model_input: T::Hash[Symbol, T.anything],
439
534
  model_output: String,
440
535
  modified_at: Time,
@@ -444,6 +539,9 @@ module Deeprails
444
539
  ).returns(T.attached_class)
445
540
  end
446
541
  def self.new(
542
+ # Analysis of the failures of the model_output according to the guardrail metrics
543
+ # evaluated.
544
+ analysis_of_failures: nil,
447
545
  # The attempt number or identifier for this evaluation.
448
546
  attempt: nil,
449
547
  # The time the evaluation was created in UTC.
@@ -458,6 +556,15 @@ module Deeprails
458
556
  evaluation_total_cost: nil,
459
557
  # An array of guardrail metrics evaluated.
460
558
  guardrail_metrics: nil,
559
+ # Status of the improvement tool used to improve the event. `improvement_required`
560
+ # indicates that the evaluation is complete and the improvement action is needed
561
+ # but is not taking place. `improved` and `improvement_failed` indicate when the
562
+ # improvement action concludes, successfully and unsuccessfully, respectively.
563
+ # `no_improvement_required` means that the first evaluation passed all its
564
+ # metrics!
565
+ improvement_tool_status: nil,
566
+ # A list of key improvements made to the model_output to address the failures.
567
+ key_improvements: nil,
461
568
  # The model input used for the evaluation.
462
569
  model_input: nil,
463
570
  # The model output that was evaluated.
@@ -476,6 +583,7 @@ module Deeprails
476
583
  sig do
477
584
  override.returns(
478
585
  {
586
+ analysis_of_failures: String,
479
587
  attempt: String,
480
588
  created_at: Time,
481
589
  error_message: String,
@@ -483,6 +591,9 @@ module Deeprails
483
591
  evaluation_status: String,
484
592
  evaluation_total_cost: Float,
485
593
  guardrail_metrics: T::Array[String],
594
+ improvement_tool_status:
595
+ Deeprails::DefendResponse::Event::Evaluation::ImprovementToolStatus::TaggedSymbol,
596
+ key_improvements: T::Array[String],
486
597
  model_input: T::Hash[Symbol, T.anything],
487
598
  model_output: String,
488
599
  modified_at: Time,
@@ -494,6 +605,141 @@ module Deeprails
494
605
  end
495
606
  def to_hash
496
607
  end
608
+
609
+ # Status of the improvement tool used to improve the event. `improvement_required`
610
+ # indicates that the evaluation is complete and the improvement action is needed
611
+ # but is not taking place. `improved` and `improvement_failed` indicate when the
612
+ # improvement action concludes, successfully and unsuccessfully, respectively.
613
+ # `no_improvement_required` means that the first evaluation passed all its
614
+ # metrics!
615
+ module ImprovementToolStatus
616
+ extend Deeprails::Internal::Type::Enum
617
+
618
+ TaggedSymbol =
619
+ T.type_alias do
620
+ T.all(
621
+ Symbol,
622
+ Deeprails::DefendResponse::Event::Evaluation::ImprovementToolStatus
623
+ )
624
+ end
625
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
626
+
627
+ IMPROVED =
628
+ T.let(
629
+ :improved,
630
+ Deeprails::DefendResponse::Event::Evaluation::ImprovementToolStatus::TaggedSymbol
631
+ )
632
+ IMPROVEMENT_FAILED =
633
+ T.let(
634
+ :improvement_failed,
635
+ Deeprails::DefendResponse::Event::Evaluation::ImprovementToolStatus::TaggedSymbol
636
+ )
637
+ NO_IMPROVEMENT_REQUIRED =
638
+ T.let(
639
+ :no_improvement_required,
640
+ Deeprails::DefendResponse::Event::Evaluation::ImprovementToolStatus::TaggedSymbol
641
+ )
642
+ IMPROVEMENT_REQUIRED =
643
+ T.let(
644
+ :improvement_required,
645
+ Deeprails::DefendResponse::Event::Evaluation::ImprovementToolStatus::TaggedSymbol
646
+ )
647
+
648
+ sig do
649
+ override.returns(
650
+ T::Array[
651
+ Deeprails::DefendResponse::Event::Evaluation::ImprovementToolStatus::TaggedSymbol
652
+ ]
653
+ )
654
+ end
655
+ def self.values
656
+ end
657
+ end
658
+ end
659
+
660
+ # Status of the improvement tool used to improve the event. `improvement_required`
661
+ # indicates that the evaluation is complete and the improvement action is needed
662
+ # but is not taking place. `improved` and `improvement_failed` indicate when the
663
+ # improvement action concludes, successfully and unsuccessfully, respectively.
664
+ # `no_improvement_required` means that the first evaluation passed all its
665
+ # metrics!
666
+ module ImprovementToolStatus
667
+ extend Deeprails::Internal::Type::Enum
668
+
669
+ TaggedSymbol =
670
+ T.type_alias do
671
+ T.all(
672
+ Symbol,
673
+ Deeprails::DefendResponse::Event::ImprovementToolStatus
674
+ )
675
+ end
676
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
677
+
678
+ IMPROVED =
679
+ T.let(
680
+ :improved,
681
+ Deeprails::DefendResponse::Event::ImprovementToolStatus::TaggedSymbol
682
+ )
683
+ IMPROVEMENT_FAILED =
684
+ T.let(
685
+ :improvement_failed,
686
+ Deeprails::DefendResponse::Event::ImprovementToolStatus::TaggedSymbol
687
+ )
688
+ NO_IMPROVEMENT_REQUIRED =
689
+ T.let(
690
+ :no_improvement_required,
691
+ Deeprails::DefendResponse::Event::ImprovementToolStatus::TaggedSymbol
692
+ )
693
+ IMPROVEMENT_REQUIRED =
694
+ T.let(
695
+ :improvement_required,
696
+ Deeprails::DefendResponse::Event::ImprovementToolStatus::TaggedSymbol
697
+ )
698
+
699
+ sig do
700
+ override.returns(
701
+ T::Array[
702
+ Deeprails::DefendResponse::Event::ImprovementToolStatus::TaggedSymbol
703
+ ]
704
+ )
705
+ end
706
+ def self.values
707
+ end
708
+ end
709
+
710
+ # Status of the event.
711
+ module Status
712
+ extend Deeprails::Internal::Type::Enum
713
+
714
+ TaggedSymbol =
715
+ T.type_alias do
716
+ T.all(Symbol, Deeprails::DefendResponse::Event::Status)
717
+ end
718
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
719
+
720
+ COMPLETED =
721
+ T.let(
722
+ :completed,
723
+ Deeprails::DefendResponse::Event::Status::TaggedSymbol
724
+ )
725
+ FAILED =
726
+ T.let(
727
+ :failed,
728
+ Deeprails::DefendResponse::Event::Status::TaggedSymbol
729
+ )
730
+ IN_PROGRESS =
731
+ T.let(
732
+ :in_progress,
733
+ Deeprails::DefendResponse::Event::Status::TaggedSymbol
734
+ )
735
+
736
+ sig do
737
+ override.returns(
738
+ T::Array[Deeprails::DefendResponse::Event::Status::TaggedSymbol]
739
+ )
740
+ end
741
+ def self.values
742
+ end
497
743
  end
498
744
  end
499
745
 
@@ -521,19 +767,45 @@ module Deeprails
521
767
  sig { params(file_size: Integer).void }
522
768
  attr_writer :file_size
523
769
 
770
+ sig { returns(T.nilable(String)) }
771
+ attr_reader :presigned_url
772
+
773
+ sig { params(presigned_url: String).void }
774
+ attr_writer :presigned_url
775
+
776
+ sig { returns(T.nilable(Time)) }
777
+ attr_reader :presigned_url_expires_at
778
+
779
+ sig { params(presigned_url_expires_at: Time).void }
780
+ attr_writer :presigned_url_expires_at
781
+
524
782
  sig do
525
783
  params(
526
784
  file_id: String,
527
785
  file_name: String,
528
- file_size: Integer
786
+ file_size: Integer,
787
+ presigned_url: String,
788
+ presigned_url_expires_at: Time
529
789
  ).returns(T.attached_class)
530
790
  end
531
- def self.new(file_id: nil, file_name: nil, file_size: nil)
791
+ def self.new(
792
+ file_id: nil,
793
+ file_name: nil,
794
+ file_size: nil,
795
+ presigned_url: nil,
796
+ presigned_url_expires_at: nil
797
+ )
532
798
  end
533
799
 
534
800
  sig do
535
801
  override.returns(
536
- { file_id: String, file_name: String, file_size: Integer }
802
+ {
803
+ file_id: String,
804
+ file_name: String,
805
+ file_size: Integer,
806
+ presigned_url: String,
807
+ presigned_url_expires_at: Time
808
+ }
537
809
  )
538
810
  end
539
811
  def to_hash
@@ -17,18 +17,26 @@ module Deeprails
17
17
  sig { returns(String) }
18
18
  attr_accessor :workflow_id
19
19
 
20
+ sig { returns(String) }
21
+ attr_accessor :event_id
22
+
20
23
  sig do
21
24
  params(
22
25
  workflow_id: String,
26
+ event_id: String,
23
27
  request_options: Deeprails::RequestOptions::OrHash
24
28
  ).returns(T.attached_class)
25
29
  end
26
- def self.new(workflow_id:, request_options: {})
30
+ def self.new(workflow_id:, event_id:, request_options: {})
27
31
  end
28
32
 
29
33
  sig do
30
34
  override.returns(
31
- { workflow_id: String, request_options: Deeprails::RequestOptions }
35
+ {
36
+ workflow_id: String,
37
+ event_id: String,
38
+ request_options: Deeprails::RequestOptions
39
+ }
32
40
  )
33
41
  end
34
42
  def to_hash
@@ -14,6 +14,9 @@ module Deeprails
14
14
  )
15
15
  end
16
16
 
17
+ sig { returns(String) }
18
+ attr_accessor :workflow_id
19
+
17
20
  # Limit the number of returned events associated with this workflow. Defaults
18
21
  # to 10.
19
22
  sig { returns(T.nilable(Integer)) }
@@ -24,11 +27,13 @@ module Deeprails
24
27
 
25
28
  sig do
26
29
  params(
30
+ workflow_id: String,
27
31
  limit: Integer,
28
32
  request_options: Deeprails::RequestOptions::OrHash
29
33
  ).returns(T.attached_class)
30
34
  end
31
35
  def self.new(
36
+ workflow_id:,
32
37
  # Limit the number of returned events associated with this workflow. Defaults
33
38
  # to 10.
34
39
  limit: nil,
@@ -38,7 +43,11 @@ module Deeprails
38
43
 
39
44
  sig do
40
45
  override.returns(
41
- { limit: Integer, request_options: Deeprails::RequestOptions }
46
+ {
47
+ workflow_id: String,
48
+ limit: Integer,
49
+ request_options: Deeprails::RequestOptions
50
+ }
42
51
  )
43
52
  end
44
53
  def to_hash
@@ -0,0 +1,155 @@
1
+ # typed: strong
2
+
3
+ module Deeprails
4
+ module Models
5
+ class DefendSubmitAndStreamEventParams < 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::DefendSubmitAndStreamEventParams,
13
+ Deeprails::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ sig { returns(String) }
18
+ attr_accessor :workflow_id
19
+
20
+ # The input provided to the model (e.g., prompt, messages).
21
+ sig { returns(T::Hash[Symbol, T.anything]) }
22
+ attr_accessor :model_input
23
+
24
+ # The output generated by the model to be evaluated.
25
+ sig { returns(String) }
26
+ attr_accessor :model_output
27
+
28
+ # The model that generated the output (e.g., "gpt-4", "claude-3").
29
+ sig { returns(String) }
30
+ attr_accessor :model_used
31
+
32
+ # The evaluation run mode. Streaming is supported on all run modes except
33
+ # precision_max and precision_max_codex. Note: super_fast does not support Web
34
+ # Search or File Search — if your workflow has these enabled, use a different run
35
+ # mode or disable the capability on the workflow.
36
+ sig do
37
+ returns(Deeprails::DefendSubmitAndStreamEventParams::RunMode::OrSymbol)
38
+ end
39
+ attr_accessor :run_mode
40
+
41
+ # Enable SSE streaming for real-time token feedback. Supported on all run modes
42
+ # except precision_max and precision_max_codex.
43
+ sig { returns(T.nilable(T::Boolean)) }
44
+ attr_reader :stream
45
+
46
+ sig { params(stream: T::Boolean).void }
47
+ attr_writer :stream
48
+
49
+ # Optional tag to identify this event.
50
+ sig { returns(T.nilable(String)) }
51
+ attr_reader :nametag
52
+
53
+ sig { params(nametag: String).void }
54
+ attr_writer :nametag
55
+
56
+ sig do
57
+ params(
58
+ workflow_id: String,
59
+ model_input: T::Hash[Symbol, T.anything],
60
+ model_output: String,
61
+ model_used: String,
62
+ run_mode:
63
+ Deeprails::DefendSubmitAndStreamEventParams::RunMode::OrSymbol,
64
+ stream: T::Boolean,
65
+ nametag: String,
66
+ request_options: Deeprails::RequestOptions::OrHash
67
+ ).returns(T.attached_class)
68
+ end
69
+ def self.new(
70
+ workflow_id:,
71
+ # The input provided to the model (e.g., prompt, messages).
72
+ model_input:,
73
+ # The output generated by the model to be evaluated.
74
+ model_output:,
75
+ # The model that generated the output (e.g., "gpt-4", "claude-3").
76
+ model_used:,
77
+ # The evaluation run mode. Streaming is supported on all run modes except
78
+ # precision_max and precision_max_codex. Note: super_fast does not support Web
79
+ # Search or File Search — if your workflow has these enabled, use a different run
80
+ # mode or disable the capability on the workflow.
81
+ run_mode:,
82
+ # Enable SSE streaming for real-time token feedback. Supported on all run modes
83
+ # except precision_max and precision_max_codex.
84
+ stream: nil,
85
+ # Optional tag to identify this event.
86
+ nametag: nil,
87
+ request_options: {}
88
+ )
89
+ end
90
+
91
+ sig do
92
+ override.returns(
93
+ {
94
+ workflow_id: String,
95
+ model_input: T::Hash[Symbol, T.anything],
96
+ model_output: String,
97
+ model_used: String,
98
+ run_mode:
99
+ Deeprails::DefendSubmitAndStreamEventParams::RunMode::OrSymbol,
100
+ stream: T::Boolean,
101
+ nametag: String,
102
+ request_options: Deeprails::RequestOptions
103
+ }
104
+ )
105
+ end
106
+ def to_hash
107
+ end
108
+
109
+ # The evaluation run mode. Streaming is supported on all run modes except
110
+ # precision_max and precision_max_codex. Note: super_fast does not support Web
111
+ # Search or File Search — if your workflow has these enabled, use a different run
112
+ # mode or disable the capability on the workflow.
113
+ module RunMode
114
+ extend Deeprails::Internal::Type::Enum
115
+
116
+ TaggedSymbol =
117
+ T.type_alias do
118
+ T.all(Symbol, Deeprails::DefendSubmitAndStreamEventParams::RunMode)
119
+ end
120
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
121
+
122
+ SUPER_FAST =
123
+ T.let(
124
+ :super_fast,
125
+ Deeprails::DefendSubmitAndStreamEventParams::RunMode::TaggedSymbol
126
+ )
127
+ FAST =
128
+ T.let(
129
+ :fast,
130
+ Deeprails::DefendSubmitAndStreamEventParams::RunMode::TaggedSymbol
131
+ )
132
+ PRECISION =
133
+ T.let(
134
+ :precision,
135
+ Deeprails::DefendSubmitAndStreamEventParams::RunMode::TaggedSymbol
136
+ )
137
+ PRECISION_CODEX =
138
+ T.let(
139
+ :precision_codex,
140
+ Deeprails::DefendSubmitAndStreamEventParams::RunMode::TaggedSymbol
141
+ )
142
+
143
+ sig do
144
+ override.returns(
145
+ T::Array[
146
+ Deeprails::DefendSubmitAndStreamEventParams::RunMode::TaggedSymbol
147
+ ]
148
+ )
149
+ end
150
+ def self.values
151
+ end
152
+ end
153
+ end
154
+ end
155
+ end
@@ -0,0 +1,7 @@
1
+ # typed: strong
2
+
3
+ module Deeprails
4
+ module Models
5
+ DefendSubmitAndStreamEventResponse = String
6
+ end
7
+ end