deeprails 0.12.0 → 0.14.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.
@@ -8,140 +8,92 @@ module Deeprails
8
8
  T.any(Deeprails::DefendResponse, Deeprails::Internal::AnyHash)
9
9
  end
10
10
 
11
- # Name of the workflow.
12
- sig { returns(String) }
13
- attr_accessor :name
14
-
15
- # A unique workflow ID.
16
- sig { returns(String) }
17
- attr_accessor :workflow_id
18
-
19
11
  # Mapping of guardrail metric names to tolerance values. Values can be strings
20
12
  # (`low`, `medium`, `high`) for automatic tolerance levels.
21
13
  sig do
22
14
  returns(
23
- T.nilable(
24
- T::Hash[
25
- Symbol,
26
- Deeprails::DefendResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
27
- ]
28
- )
15
+ T::Hash[
16
+ Symbol,
17
+ Deeprails::DefendResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
18
+ ]
29
19
  )
30
20
  end
31
- attr_reader :automatic_hallucination_tolerance_levels
32
-
33
- sig do
34
- params(
35
- automatic_hallucination_tolerance_levels:
36
- T::Hash[
37
- Symbol,
38
- Deeprails::DefendResponse::AutomaticHallucinationToleranceLevel::OrSymbol
39
- ]
40
- ).void
41
- end
42
- attr_writer :automatic_hallucination_tolerance_levels
21
+ attr_accessor :automatic_hallucination_tolerance_levels
43
22
 
44
23
  # Extended AI capabilities available to the event, if any. Can be `web_search`
45
24
  # and/or `file_search`.
46
- sig do
47
- returns(T.nilable(T::Array[Deeprails::DefendResponse::Capability]))
48
- end
49
- attr_reader :capabilities
50
-
51
- sig do
52
- params(
53
- capabilities: T::Array[Deeprails::DefendResponse::Capability::OrHash]
54
- ).void
55
- end
56
- attr_writer :capabilities
25
+ sig { returns(T::Array[Deeprails::DefendResponse::Capability]) }
26
+ attr_accessor :capabilities
57
27
 
58
28
  # The time the workflow was created in UTC.
59
- sig { returns(T.nilable(Time)) }
60
- attr_reader :created_at
61
-
62
- sig { params(created_at: Time).void }
63
- attr_writer :created_at
29
+ sig { returns(Time) }
30
+ attr_accessor :created_at
64
31
 
65
32
  # Mapping of guardrail metric names to threshold values. Values can be floating
66
33
  # point numbers (0.0-1.0) for custom thresholds.
67
- sig { returns(T.nilable(T::Hash[Symbol, Float])) }
68
- attr_reader :custom_hallucination_threshold_values
34
+ sig { returns(T::Hash[Symbol, Float]) }
35
+ attr_accessor :custom_hallucination_threshold_values
69
36
 
70
- sig do
71
- params(
72
- custom_hallucination_threshold_values: T::Hash[Symbol, Float]
73
- ).void
74
- end
75
- attr_writer :custom_hallucination_threshold_values
76
-
77
- # Description for the workflow.
78
- sig { returns(T.nilable(String)) }
79
- attr_reader :description
80
-
81
- sig { params(description: String).void }
82
- attr_writer :description
37
+ # A description for the workflow, to help you remember what that workflow means to
38
+ # your organization.
39
+ sig { returns(String) }
40
+ attr_accessor :description
83
41
 
84
42
  # An array of events associated with this workflow.
85
- sig { returns(T.nilable(T::Array[Deeprails::DefendResponse::Event])) }
86
- attr_reader :events
87
-
88
- sig do
89
- params(events: T::Array[Deeprails::DefendResponse::Event::OrHash]).void
90
- end
91
- attr_writer :events
43
+ sig { returns(T::Array[Deeprails::DefendResponse::Event]) }
44
+ attr_accessor :events
92
45
 
93
46
  # List of files associated with the workflow. If this is not empty, models can
94
47
  # search these files when performing evaluations or remediations
95
- sig { returns(T.nilable(T::Array[Deeprails::DefendResponse::File])) }
96
- attr_reader :files
97
-
98
- sig do
99
- params(files: T::Array[Deeprails::DefendResponse::File::OrHash]).void
100
- end
101
- attr_writer :files
48
+ sig { returns(T::Array[Deeprails::DefendResponse::File]) }
49
+ attr_accessor :files
102
50
 
103
- sig { returns(T.nilable(Deeprails::DefendResponse::Stats)) }
104
- attr_reader :stats
105
-
106
- sig { params(stats: Deeprails::DefendResponse::Stats::OrHash).void }
107
- attr_writer :stats
51
+ # A human-readable name for the workflow that will correspond to it's workflow ID.
52
+ sig { returns(String) }
53
+ attr_accessor :name
108
54
 
109
55
  # Status of the selected workflow. May be `inactive` or `active`. Inactive
110
56
  # workflows will not accept events.
111
- sig do
112
- returns(T.nilable(Deeprails::DefendResponse::Status::TaggedSymbol))
113
- end
114
- attr_reader :status
115
-
116
- sig { params(status: Deeprails::DefendResponse::Status::OrSymbol).void }
117
- attr_writer :status
57
+ sig { returns(Deeprails::DefendResponse::Status::TaggedSymbol) }
58
+ attr_accessor :status
118
59
 
119
60
  # Type of thresholds used to evaluate the event.
61
+ sig { returns(Deeprails::DefendResponse::ThresholdType::TaggedSymbol) }
62
+ attr_accessor :threshold_type
63
+
64
+ # The most recent time the workflow was updated in UTC.
65
+ sig { returns(Time) }
66
+ attr_accessor :updated_at
67
+
68
+ # A unique workflow ID.
69
+ sig { returns(String) }
70
+ attr_accessor :workflow_id
71
+
72
+ # The action used to improve outputs that fail one or more guardrail metrics for
73
+ # the workflow events.
120
74
  sig do
121
75
  returns(
122
- T.nilable(Deeprails::DefendResponse::ThresholdType::TaggedSymbol)
76
+ T.nilable(Deeprails::DefendResponse::ImprovementAction::TaggedSymbol)
123
77
  )
124
78
  end
125
- attr_reader :threshold_type
79
+ attr_reader :improvement_action
126
80
 
127
81
  sig do
128
82
  params(
129
- threshold_type: Deeprails::DefendResponse::ThresholdType::OrSymbol
83
+ improvement_action:
84
+ Deeprails::DefendResponse::ImprovementAction::OrSymbol
130
85
  ).void
131
86
  end
132
- attr_writer :threshold_type
87
+ attr_writer :improvement_action
133
88
 
134
- # The most recent time the workflow was updated in UTC.
135
- sig { returns(T.nilable(Time)) }
136
- attr_reader :updated_at
89
+ sig { returns(T.nilable(Deeprails::DefendResponse::Stats)) }
90
+ attr_reader :stats
137
91
 
138
- sig { params(updated_at: Time).void }
139
- attr_writer :updated_at
92
+ sig { params(stats: Deeprails::DefendResponse::Stats::OrHash).void }
93
+ attr_writer :stats
140
94
 
141
95
  sig do
142
96
  params(
143
- name: String,
144
- workflow_id: String,
145
97
  automatic_hallucination_tolerance_levels:
146
98
  T::Hash[
147
99
  Symbol,
@@ -153,51 +105,57 @@ module Deeprails
153
105
  description: String,
154
106
  events: T::Array[Deeprails::DefendResponse::Event::OrHash],
155
107
  files: T::Array[Deeprails::DefendResponse::File::OrHash],
156
- stats: Deeprails::DefendResponse::Stats::OrHash,
108
+ name: String,
157
109
  status: Deeprails::DefendResponse::Status::OrSymbol,
158
110
  threshold_type: Deeprails::DefendResponse::ThresholdType::OrSymbol,
159
- updated_at: Time
111
+ updated_at: Time,
112
+ workflow_id: String,
113
+ improvement_action:
114
+ Deeprails::DefendResponse::ImprovementAction::OrSymbol,
115
+ stats: Deeprails::DefendResponse::Stats::OrHash
160
116
  ).returns(T.attached_class)
161
117
  end
162
118
  def self.new(
163
- # Name of the workflow.
164
- name:,
165
- # A unique workflow ID.
166
- workflow_id:,
167
119
  # Mapping of guardrail metric names to tolerance values. Values can be strings
168
120
  # (`low`, `medium`, `high`) for automatic tolerance levels.
169
- automatic_hallucination_tolerance_levels: nil,
121
+ automatic_hallucination_tolerance_levels:,
170
122
  # Extended AI capabilities available to the event, if any. Can be `web_search`
171
123
  # and/or `file_search`.
172
- capabilities: nil,
124
+ capabilities:,
173
125
  # The time the workflow was created in UTC.
174
- created_at: nil,
126
+ created_at:,
175
127
  # Mapping of guardrail metric names to threshold values. Values can be floating
176
128
  # point numbers (0.0-1.0) for custom thresholds.
177
- custom_hallucination_threshold_values: nil,
178
- # Description for the workflow.
179
- description: nil,
129
+ custom_hallucination_threshold_values:,
130
+ # A description for the workflow, to help you remember what that workflow means to
131
+ # your organization.
132
+ description:,
180
133
  # An array of events associated with this workflow.
181
- events: nil,
134
+ events:,
182
135
  # List of files associated with the workflow. If this is not empty, models can
183
136
  # search these files when performing evaluations or remediations
184
- files: nil,
185
- stats: nil,
137
+ files:,
138
+ # A human-readable name for the workflow that will correspond to it's workflow ID.
139
+ name:,
186
140
  # Status of the selected workflow. May be `inactive` or `active`. Inactive
187
141
  # workflows will not accept events.
188
- status: nil,
142
+ status:,
189
143
  # Type of thresholds used to evaluate the event.
190
- threshold_type: nil,
144
+ threshold_type:,
191
145
  # The most recent time the workflow was updated in UTC.
192
- updated_at: nil
146
+ updated_at:,
147
+ # A unique workflow ID.
148
+ workflow_id:,
149
+ # The action used to improve outputs that fail one or more guardrail metrics for
150
+ # the workflow events.
151
+ improvement_action: nil,
152
+ stats: nil
193
153
  )
194
154
  end
195
155
 
196
156
  sig do
197
157
  override.returns(
198
158
  {
199
- name: String,
200
- workflow_id: String,
201
159
  automatic_hallucination_tolerance_levels:
202
160
  T::Hash[
203
161
  Symbol,
@@ -209,11 +167,15 @@ module Deeprails
209
167
  description: String,
210
168
  events: T::Array[Deeprails::DefendResponse::Event],
211
169
  files: T::Array[Deeprails::DefendResponse::File],
212
- stats: Deeprails::DefendResponse::Stats,
170
+ name: String,
213
171
  status: Deeprails::DefendResponse::Status::TaggedSymbol,
214
172
  threshold_type:
215
173
  Deeprails::DefendResponse::ThresholdType::TaggedSymbol,
216
- updated_at: Time
174
+ updated_at: Time,
175
+ workflow_id: String,
176
+ improvement_action:
177
+ Deeprails::DefendResponse::ImprovementAction::TaggedSymbol,
178
+ stats: Deeprails::DefendResponse::Stats
217
179
  }
218
180
  )
219
181
  end
@@ -578,6 +540,91 @@ module Deeprails
578
540
  end
579
541
  end
580
542
 
543
+ # Status of the selected workflow. May be `inactive` or `active`. Inactive
544
+ # workflows will not accept events.
545
+ module Status
546
+ extend Deeprails::Internal::Type::Enum
547
+
548
+ TaggedSymbol =
549
+ T.type_alias { T.all(Symbol, Deeprails::DefendResponse::Status) }
550
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
551
+
552
+ INACTIVE =
553
+ T.let(:inactive, Deeprails::DefendResponse::Status::TaggedSymbol)
554
+ ACTIVE = T.let(:active, Deeprails::DefendResponse::Status::TaggedSymbol)
555
+
556
+ sig do
557
+ override.returns(
558
+ T::Array[Deeprails::DefendResponse::Status::TaggedSymbol]
559
+ )
560
+ end
561
+ def self.values
562
+ end
563
+ end
564
+
565
+ # Type of thresholds used to evaluate the event.
566
+ module ThresholdType
567
+ extend Deeprails::Internal::Type::Enum
568
+
569
+ TaggedSymbol =
570
+ T.type_alias do
571
+ T.all(Symbol, Deeprails::DefendResponse::ThresholdType)
572
+ end
573
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
574
+
575
+ CUSTOM =
576
+ T.let(:custom, Deeprails::DefendResponse::ThresholdType::TaggedSymbol)
577
+ AUTOMATIC =
578
+ T.let(
579
+ :automatic,
580
+ Deeprails::DefendResponse::ThresholdType::TaggedSymbol
581
+ )
582
+
583
+ sig do
584
+ override.returns(
585
+ T::Array[Deeprails::DefendResponse::ThresholdType::TaggedSymbol]
586
+ )
587
+ end
588
+ def self.values
589
+ end
590
+ end
591
+
592
+ # The action used to improve outputs that fail one or more guardrail metrics for
593
+ # the workflow events.
594
+ module ImprovementAction
595
+ extend Deeprails::Internal::Type::Enum
596
+
597
+ TaggedSymbol =
598
+ T.type_alias do
599
+ T.all(Symbol, Deeprails::DefendResponse::ImprovementAction)
600
+ end
601
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
602
+
603
+ REGEN =
604
+ T.let(
605
+ :regen,
606
+ Deeprails::DefendResponse::ImprovementAction::TaggedSymbol
607
+ )
608
+ FIXIT =
609
+ T.let(
610
+ :fixit,
611
+ Deeprails::DefendResponse::ImprovementAction::TaggedSymbol
612
+ )
613
+ DO_NOTHING =
614
+ T.let(
615
+ :do_nothing,
616
+ Deeprails::DefendResponse::ImprovementAction::TaggedSymbol
617
+ )
618
+
619
+ sig do
620
+ override.returns(
621
+ T::Array[Deeprails::DefendResponse::ImprovementAction::TaggedSymbol]
622
+ )
623
+ end
624
+ def self.values
625
+ end
626
+ end
627
+
581
628
  class Stats < Deeprails::Internal::Type::BaseModel
582
629
  OrHash =
583
630
  T.type_alias do
@@ -637,55 +684,6 @@ module Deeprails
637
684
  def to_hash
638
685
  end
639
686
  end
640
-
641
- # Status of the selected workflow. May be `inactive` or `active`. Inactive
642
- # workflows will not accept events.
643
- module Status
644
- extend Deeprails::Internal::Type::Enum
645
-
646
- TaggedSymbol =
647
- T.type_alias { T.all(Symbol, Deeprails::DefendResponse::Status) }
648
- OrSymbol = T.type_alias { T.any(Symbol, String) }
649
-
650
- INACTIVE =
651
- T.let(:inactive, Deeprails::DefendResponse::Status::TaggedSymbol)
652
- ACTIVE = T.let(:active, Deeprails::DefendResponse::Status::TaggedSymbol)
653
-
654
- sig do
655
- override.returns(
656
- T::Array[Deeprails::DefendResponse::Status::TaggedSymbol]
657
- )
658
- end
659
- def self.values
660
- end
661
- end
662
-
663
- # Type of thresholds used to evaluate the event.
664
- module ThresholdType
665
- extend Deeprails::Internal::Type::Enum
666
-
667
- TaggedSymbol =
668
- T.type_alias do
669
- T.all(Symbol, Deeprails::DefendResponse::ThresholdType)
670
- end
671
- OrSymbol = T.type_alias { T.any(Symbol, String) }
672
-
673
- CUSTOM =
674
- T.let(:custom, Deeprails::DefendResponse::ThresholdType::TaggedSymbol)
675
- AUTOMATIC =
676
- T.let(
677
- :automatic,
678
- Deeprails::DefendResponse::ThresholdType::TaggedSymbol
679
- )
680
-
681
- sig do
682
- override.returns(
683
- T::Array[Deeprails::DefendResponse::ThresholdType::TaggedSymbol]
684
- )
685
- end
686
- def self.values
687
- end
688
- end
689
687
  end
690
688
  end
691
689
  end