deeprails 0.11.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/README.md +26 -40
- data/lib/deeprails/internal/transport/base_client.rb +7 -1
- data/lib/deeprails/internal/transport/pooled_net_requester.rb +6 -2
- data/lib/deeprails/internal/type/base_model.rb +5 -5
- data/lib/deeprails/models/defend_create_response.rb +51 -0
- data/lib/deeprails/models/defend_create_workflow_params.rb +19 -19
- data/lib/deeprails/models/defend_response.rb +294 -54
- data/lib/deeprails/models/defend_retrieve_workflow_params.rb +13 -1
- data/lib/deeprails/models/defend_update_response.rb +51 -0
- data/lib/deeprails/models/file_response.rb +6 -22
- data/lib/deeprails/models/file_upload_params.rb +3 -3
- data/lib/deeprails/models/monitor_create_response.rb +51 -0
- data/lib/deeprails/models/monitor_detail_response.rb +103 -104
- data/lib/deeprails/models/monitor_event_detail_response.rb +183 -0
- data/lib/deeprails/models/monitor_event_response.rb +1 -9
- data/lib/deeprails/models/monitor_retrieve_event_params.rb +20 -0
- data/lib/deeprails/models/monitor_retrieve_params.rb +6 -2
- data/lib/deeprails/models/monitor_update_params.rb +11 -11
- data/lib/deeprails/models/monitor_update_response.rb +51 -0
- data/lib/deeprails/models/workflow_event_detail_response.rb +314 -0
- data/lib/deeprails/models/workflow_event_response.rb +29 -30
- data/lib/deeprails/models.rb +13 -1
- data/lib/deeprails/resources/defend.rb +20 -13
- data/lib/deeprails/resources/files.rb +1 -1
- data/lib/deeprails/resources/monitor.rb +38 -8
- data/lib/deeprails/version.rb +1 -1
- data/lib/deeprails.rb +8 -1
- data/manifest.yaml +1 -0
- data/rbi/deeprails/internal/transport/base_client.rbi +5 -0
- data/rbi/deeprails/internal/transport/pooled_net_requester.rbi +6 -2
- data/rbi/deeprails/internal/type/base_model.rbi +8 -4
- data/rbi/deeprails/models/defend_create_response.rbi +83 -0
- data/rbi/deeprails/models/defend_create_workflow_params.rbi +33 -27
- data/rbi/deeprails/models/defend_response.rbi +528 -109
- data/rbi/deeprails/models/defend_retrieve_workflow_params.rbi +23 -5
- data/rbi/deeprails/models/defend_update_response.rbi +83 -0
- data/rbi/deeprails/models/file_response.rbi +11 -39
- data/rbi/deeprails/models/file_upload_params.rbi +3 -6
- data/rbi/deeprails/models/monitor_create_response.rbi +83 -0
- data/rbi/deeprails/models/monitor_detail_response.rbi +168 -167
- data/rbi/deeprails/models/monitor_event_detail_response.rbi +386 -0
- data/rbi/deeprails/models/monitor_event_response.rbi +4 -18
- data/rbi/deeprails/models/monitor_retrieve_event_params.rbi +38 -0
- data/rbi/deeprails/models/monitor_retrieve_params.rbi +4 -2
- data/rbi/deeprails/models/monitor_update_params.rbi +21 -38
- data/rbi/deeprails/models/monitor_update_response.rbi +83 -0
- data/rbi/deeprails/models/workflow_event_detail_response.rbi +657 -0
- data/rbi/deeprails/models/workflow_event_response.rbi +49 -42
- data/rbi/deeprails/models.rbi +13 -1
- data/rbi/deeprails/resources/defend.rbi +17 -12
- data/rbi/deeprails/resources/files.rbi +1 -1
- data/rbi/deeprails/resources/monitor.rbi +25 -8
- data/sig/deeprails/internal/transport/base_client.rbs +2 -0
- data/sig/deeprails/internal/transport/pooled_net_requester.rbs +4 -1
- data/sig/deeprails/models/defend_create_response.rbs +41 -0
- data/sig/deeprails/models/defend_create_workflow_params.rbs +7 -7
- data/sig/deeprails/models/defend_response.rbs +282 -47
- data/sig/deeprails/models/defend_retrieve_workflow_params.rbs +13 -3
- data/sig/deeprails/models/defend_update_response.rbs +41 -0
- data/sig/deeprails/models/file_response.rbs +5 -27
- data/sig/deeprails/models/file_upload_params.rbs +4 -5
- data/sig/deeprails/models/monitor_create_response.rbs +41 -0
- data/sig/deeprails/models/monitor_detail_response.rbs +80 -89
- data/sig/deeprails/models/monitor_event_detail_response.rbs +181 -0
- data/sig/deeprails/models/monitor_event_response.rbs +2 -15
- data/sig/deeprails/models/monitor_retrieve_event_params.rbs +23 -0
- data/sig/deeprails/models/monitor_update_params.rbs +13 -13
- data/sig/deeprails/models/monitor_update_response.rbs +41 -0
- data/sig/deeprails/models/workflow_event_detail_response.rbs +303 -0
- data/sig/deeprails/models/workflow_event_response.rbs +24 -24
- data/sig/deeprails/models.rbs +13 -1
- data/sig/deeprails/resources/defend.rbs +5 -4
- data/sig/deeprails/resources/files.rbs +1 -1
- data/sig/deeprails/resources/monitor.rbs +9 -3
- metadata +23 -5
- data/lib/deeprails/models/monitor_response.rb +0 -83
- data/rbi/deeprails/models/monitor_response.rbi +0 -142
- data/sig/deeprails/models/monitor_response.rbs +0 -73
|
@@ -8,180 +8,512 @@ module Deeprails
|
|
|
8
8
|
T.any(Deeprails::DefendResponse, Deeprails::Internal::AnyHash)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
attr_accessor :name
|
|
14
|
-
|
|
15
|
-
# A unique workflow ID.
|
|
16
|
-
sig { returns(String) }
|
|
17
|
-
attr_accessor :workflow_id
|
|
18
|
-
|
|
19
|
-
# The time the workflow was created in UTC.
|
|
20
|
-
sig { returns(T.nilable(Time)) }
|
|
21
|
-
attr_reader :created_at
|
|
22
|
-
|
|
23
|
-
sig { params(created_at: Time).void }
|
|
24
|
-
attr_writer :created_at
|
|
25
|
-
|
|
26
|
-
# Description for the workflow.
|
|
27
|
-
sig { returns(T.nilable(String)) }
|
|
28
|
-
attr_reader :description
|
|
29
|
-
|
|
30
|
-
sig { params(description: String).void }
|
|
31
|
-
attr_writer :description
|
|
32
|
-
|
|
33
|
-
# The action used to improve outputs that fail one or more guardrail metrics for
|
|
34
|
-
# the workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the
|
|
35
|
-
# user's input prompt with minor induced variance. FixIt attempts to directly
|
|
36
|
-
# address the shortcomings of the output using the guardrail failure rationale. Do
|
|
37
|
-
# Nothing does not attempt any improvement.
|
|
11
|
+
# Mapping of guardrail metric names to tolerance values. Values can be strings
|
|
12
|
+
# (`low`, `medium`, `high`) for automatic tolerance levels.
|
|
38
13
|
sig do
|
|
39
14
|
returns(
|
|
40
|
-
T
|
|
15
|
+
T::Hash[
|
|
16
|
+
Symbol,
|
|
17
|
+
Deeprails::DefendResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
|
|
18
|
+
]
|
|
41
19
|
)
|
|
42
20
|
end
|
|
43
|
-
|
|
21
|
+
attr_accessor :automatic_hallucination_tolerance_levels
|
|
44
22
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
).void
|
|
50
|
-
end
|
|
51
|
-
attr_writer :improvement_action
|
|
23
|
+
# Extended AI capabilities available to the event, if any. Can be `web_search`
|
|
24
|
+
# and/or `file_search`.
|
|
25
|
+
sig { returns(T::Array[Deeprails::DefendResponse::Capability]) }
|
|
26
|
+
attr_accessor :capabilities
|
|
52
27
|
|
|
53
|
-
#
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
attr_reader :max_improvement_attempts
|
|
28
|
+
# The time the workflow was created in UTC.
|
|
29
|
+
sig { returns(Time) }
|
|
30
|
+
attr_accessor :created_at
|
|
57
31
|
|
|
58
|
-
|
|
59
|
-
|
|
32
|
+
# Mapping of guardrail metric names to threshold values. Values can be floating
|
|
33
|
+
# point numbers (0.0-1.0) for custom thresholds.
|
|
34
|
+
sig { returns(T::Hash[Symbol, Float]) }
|
|
35
|
+
attr_accessor :custom_hallucination_threshold_values
|
|
60
36
|
|
|
61
|
-
#
|
|
62
|
-
sig { returns(
|
|
63
|
-
|
|
37
|
+
# Description for the workflow.
|
|
38
|
+
sig { returns(String) }
|
|
39
|
+
attr_accessor :description
|
|
40
|
+
|
|
41
|
+
# An array of events associated with this workflow.
|
|
42
|
+
sig { returns(T::Array[Deeprails::DefendResponse::Event]) }
|
|
43
|
+
attr_accessor :events
|
|
64
44
|
|
|
65
|
-
|
|
66
|
-
|
|
45
|
+
# List of files associated with the workflow. If this is not empty, models can
|
|
46
|
+
# search these files when performing evaluations or remediations
|
|
47
|
+
sig { returns(T::Array[Deeprails::DefendResponse::File]) }
|
|
48
|
+
attr_accessor :files
|
|
49
|
+
|
|
50
|
+
# Name of the workflow.
|
|
51
|
+
sig { returns(String) }
|
|
52
|
+
attr_accessor :name
|
|
67
53
|
|
|
68
54
|
# Status of the selected workflow. May be `inactive` or `active`. Inactive
|
|
69
55
|
# workflows will not accept events.
|
|
70
|
-
sig
|
|
71
|
-
|
|
72
|
-
end
|
|
73
|
-
attr_reader :status
|
|
56
|
+
sig { returns(Deeprails::DefendResponse::Status::TaggedSymbol) }
|
|
57
|
+
attr_accessor :status
|
|
74
58
|
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
# Type of thresholds used to evaluate the event.
|
|
60
|
+
sig { returns(Deeprails::DefendResponse::ThresholdType::TaggedSymbol) }
|
|
61
|
+
attr_accessor :threshold_type
|
|
77
62
|
|
|
78
|
-
#
|
|
79
|
-
sig { returns(
|
|
80
|
-
|
|
63
|
+
# The most recent time the workflow was updated in UTC.
|
|
64
|
+
sig { returns(Time) }
|
|
65
|
+
attr_accessor :updated_at
|
|
81
66
|
|
|
82
|
-
|
|
83
|
-
|
|
67
|
+
# A unique workflow ID.
|
|
68
|
+
sig { returns(String) }
|
|
69
|
+
attr_accessor :workflow_id
|
|
70
|
+
|
|
71
|
+
sig { returns(T.nilable(Deeprails::DefendResponse::Stats)) }
|
|
72
|
+
attr_reader :stats
|
|
73
|
+
|
|
74
|
+
sig { params(stats: Deeprails::DefendResponse::Stats::OrHash).void }
|
|
75
|
+
attr_writer :stats
|
|
84
76
|
|
|
85
77
|
sig do
|
|
86
78
|
params(
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
automatic_hallucination_tolerance_levels:
|
|
80
|
+
T::Hash[
|
|
81
|
+
Symbol,
|
|
82
|
+
Deeprails::DefendResponse::AutomaticHallucinationToleranceLevel::OrSymbol
|
|
83
|
+
],
|
|
84
|
+
capabilities: T::Array[Deeprails::DefendResponse::Capability::OrHash],
|
|
89
85
|
created_at: Time,
|
|
86
|
+
custom_hallucination_threshold_values: T::Hash[Symbol, Float],
|
|
90
87
|
description: String,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
modified_at: Time,
|
|
88
|
+
events: T::Array[Deeprails::DefendResponse::Event::OrHash],
|
|
89
|
+
files: T::Array[Deeprails::DefendResponse::File::OrHash],
|
|
90
|
+
name: String,
|
|
95
91
|
status: Deeprails::DefendResponse::Status::OrSymbol,
|
|
96
|
-
|
|
92
|
+
threshold_type: Deeprails::DefendResponse::ThresholdType::OrSymbol,
|
|
93
|
+
updated_at: Time,
|
|
94
|
+
workflow_id: String,
|
|
95
|
+
stats: Deeprails::DefendResponse::Stats::OrHash
|
|
97
96
|
).returns(T.attached_class)
|
|
98
97
|
end
|
|
99
98
|
def self.new(
|
|
100
|
-
#
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
# Mapping of guardrail metric names to tolerance values. Values can be strings
|
|
100
|
+
# (`low`, `medium`, `high`) for automatic tolerance levels.
|
|
101
|
+
automatic_hallucination_tolerance_levels:,
|
|
102
|
+
# Extended AI capabilities available to the event, if any. Can be `web_search`
|
|
103
|
+
# and/or `file_search`.
|
|
104
|
+
capabilities:,
|
|
104
105
|
# The time the workflow was created in UTC.
|
|
105
|
-
created_at
|
|
106
|
+
created_at:,
|
|
107
|
+
# Mapping of guardrail metric names to threshold values. Values can be floating
|
|
108
|
+
# point numbers (0.0-1.0) for custom thresholds.
|
|
109
|
+
custom_hallucination_threshold_values:,
|
|
106
110
|
# Description for the workflow.
|
|
107
|
-
description
|
|
108
|
-
#
|
|
109
|
-
|
|
110
|
-
#
|
|
111
|
-
#
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
# guardrails.
|
|
116
|
-
max_improvement_attempts: nil,
|
|
117
|
-
# The most recent time the workflow was modified in UTC.
|
|
118
|
-
modified_at: nil,
|
|
111
|
+
description:,
|
|
112
|
+
# An array of events associated with this workflow.
|
|
113
|
+
events:,
|
|
114
|
+
# List of files associated with the workflow. If this is not empty, models can
|
|
115
|
+
# search these files when performing evaluations or remediations
|
|
116
|
+
files:,
|
|
117
|
+
# Name of the workflow.
|
|
118
|
+
name:,
|
|
119
119
|
# Status of the selected workflow. May be `inactive` or `active`. Inactive
|
|
120
120
|
# workflows will not accept events.
|
|
121
|
-
status
|
|
122
|
-
#
|
|
123
|
-
|
|
121
|
+
status:,
|
|
122
|
+
# Type of thresholds used to evaluate the event.
|
|
123
|
+
threshold_type:,
|
|
124
|
+
# The most recent time the workflow was updated in UTC.
|
|
125
|
+
updated_at:,
|
|
126
|
+
# A unique workflow ID.
|
|
127
|
+
workflow_id:,
|
|
128
|
+
stats: nil
|
|
124
129
|
)
|
|
125
130
|
end
|
|
126
131
|
|
|
127
132
|
sig do
|
|
128
133
|
override.returns(
|
|
129
134
|
{
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
automatic_hallucination_tolerance_levels:
|
|
136
|
+
T::Hash[
|
|
137
|
+
Symbol,
|
|
138
|
+
Deeprails::DefendResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
|
|
139
|
+
],
|
|
140
|
+
capabilities: T::Array[Deeprails::DefendResponse::Capability],
|
|
132
141
|
created_at: Time,
|
|
142
|
+
custom_hallucination_threshold_values: T::Hash[Symbol, Float],
|
|
133
143
|
description: String,
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
modified_at: Time,
|
|
144
|
+
events: T::Array[Deeprails::DefendResponse::Event],
|
|
145
|
+
files: T::Array[Deeprails::DefendResponse::File],
|
|
146
|
+
name: String,
|
|
138
147
|
status: Deeprails::DefendResponse::Status::TaggedSymbol,
|
|
139
|
-
|
|
148
|
+
threshold_type:
|
|
149
|
+
Deeprails::DefendResponse::ThresholdType::TaggedSymbol,
|
|
150
|
+
updated_at: Time,
|
|
151
|
+
workflow_id: String,
|
|
152
|
+
stats: Deeprails::DefendResponse::Stats
|
|
140
153
|
}
|
|
141
154
|
)
|
|
142
155
|
end
|
|
143
156
|
def to_hash
|
|
144
157
|
end
|
|
145
158
|
|
|
146
|
-
|
|
147
|
-
# the workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the
|
|
148
|
-
# user's input prompt with minor induced variance. FixIt attempts to directly
|
|
149
|
-
# address the shortcomings of the output using the guardrail failure rationale. Do
|
|
150
|
-
# Nothing does not attempt any improvement.
|
|
151
|
-
module ImprovementAction
|
|
159
|
+
module AutomaticHallucinationToleranceLevel
|
|
152
160
|
extend Deeprails::Internal::Type::Enum
|
|
153
161
|
|
|
154
162
|
TaggedSymbol =
|
|
155
163
|
T.type_alias do
|
|
156
|
-
T.all(
|
|
164
|
+
T.all(
|
|
165
|
+
Symbol,
|
|
166
|
+
Deeprails::DefendResponse::AutomaticHallucinationToleranceLevel
|
|
167
|
+
)
|
|
157
168
|
end
|
|
158
169
|
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
159
170
|
|
|
160
|
-
|
|
171
|
+
LOW =
|
|
161
172
|
T.let(
|
|
162
|
-
:
|
|
163
|
-
Deeprails::DefendResponse::
|
|
173
|
+
:low,
|
|
174
|
+
Deeprails::DefendResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
|
|
164
175
|
)
|
|
165
|
-
|
|
176
|
+
MEDIUM =
|
|
166
177
|
T.let(
|
|
167
|
-
:
|
|
168
|
-
Deeprails::DefendResponse::
|
|
178
|
+
:medium,
|
|
179
|
+
Deeprails::DefendResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
|
|
169
180
|
)
|
|
170
|
-
|
|
181
|
+
HIGH =
|
|
171
182
|
T.let(
|
|
172
|
-
:
|
|
173
|
-
Deeprails::DefendResponse::
|
|
183
|
+
:high,
|
|
184
|
+
Deeprails::DefendResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
|
|
174
185
|
)
|
|
175
186
|
|
|
176
187
|
sig do
|
|
177
188
|
override.returns(
|
|
178
|
-
T::Array[
|
|
189
|
+
T::Array[
|
|
190
|
+
Deeprails::DefendResponse::AutomaticHallucinationToleranceLevel::TaggedSymbol
|
|
191
|
+
]
|
|
179
192
|
)
|
|
180
193
|
end
|
|
181
194
|
def self.values
|
|
182
195
|
end
|
|
183
196
|
end
|
|
184
197
|
|
|
198
|
+
class Capability < Deeprails::Internal::Type::BaseModel
|
|
199
|
+
OrHash =
|
|
200
|
+
T.type_alias do
|
|
201
|
+
T.any(
|
|
202
|
+
Deeprails::DefendResponse::Capability,
|
|
203
|
+
Deeprails::Internal::AnyHash
|
|
204
|
+
)
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
sig { returns(T.nilable(String)) }
|
|
208
|
+
attr_reader :capability
|
|
209
|
+
|
|
210
|
+
sig { params(capability: String).void }
|
|
211
|
+
attr_writer :capability
|
|
212
|
+
|
|
213
|
+
sig { params(capability: String).returns(T.attached_class) }
|
|
214
|
+
def self.new(capability: nil)
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
sig { override.returns({ capability: String }) }
|
|
218
|
+
def to_hash
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
class Event < Deeprails::Internal::Type::BaseModel
|
|
223
|
+
OrHash =
|
|
224
|
+
T.type_alias do
|
|
225
|
+
T.any(
|
|
226
|
+
Deeprails::DefendResponse::Event,
|
|
227
|
+
Deeprails::Internal::AnyHash
|
|
228
|
+
)
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# An array of evaluations for this event.
|
|
232
|
+
sig do
|
|
233
|
+
returns(
|
|
234
|
+
T.nilable(T::Array[Deeprails::DefendResponse::Event::Evaluation])
|
|
235
|
+
)
|
|
236
|
+
end
|
|
237
|
+
attr_reader :evaluations
|
|
238
|
+
|
|
239
|
+
sig do
|
|
240
|
+
params(
|
|
241
|
+
evaluations:
|
|
242
|
+
T::Array[Deeprails::DefendResponse::Event::Evaluation::OrHash]
|
|
243
|
+
).void
|
|
244
|
+
end
|
|
245
|
+
attr_writer :evaluations
|
|
246
|
+
|
|
247
|
+
# A unique workflow event ID.
|
|
248
|
+
sig { returns(T.nilable(String)) }
|
|
249
|
+
attr_reader :event_id
|
|
250
|
+
|
|
251
|
+
sig { params(event_id: String).void }
|
|
252
|
+
attr_writer :event_id
|
|
253
|
+
|
|
254
|
+
# Improved model output after improvement tool was applied.
|
|
255
|
+
sig { returns(T.nilable(String)) }
|
|
256
|
+
attr_reader :improved_model_output
|
|
257
|
+
|
|
258
|
+
sig { params(improved_model_output: String).void }
|
|
259
|
+
attr_writer :improved_model_output
|
|
260
|
+
|
|
261
|
+
# Status of the improvement tool used to improve the event.
|
|
262
|
+
sig { returns(T.nilable(String)) }
|
|
263
|
+
attr_reader :improvement_tool_status
|
|
264
|
+
|
|
265
|
+
sig { params(improvement_tool_status: String).void }
|
|
266
|
+
attr_writer :improvement_tool_status
|
|
267
|
+
|
|
268
|
+
sig do
|
|
269
|
+
params(
|
|
270
|
+
evaluations:
|
|
271
|
+
T::Array[Deeprails::DefendResponse::Event::Evaluation::OrHash],
|
|
272
|
+
event_id: String,
|
|
273
|
+
improved_model_output: String,
|
|
274
|
+
improvement_tool_status: String
|
|
275
|
+
).returns(T.attached_class)
|
|
276
|
+
end
|
|
277
|
+
def self.new(
|
|
278
|
+
# An array of evaluations for this event.
|
|
279
|
+
evaluations: nil,
|
|
280
|
+
# A unique workflow event ID.
|
|
281
|
+
event_id: nil,
|
|
282
|
+
# Improved model output after improvement tool was applied.
|
|
283
|
+
improved_model_output: nil,
|
|
284
|
+
# Status of the improvement tool used to improve the event.
|
|
285
|
+
improvement_tool_status: nil
|
|
286
|
+
)
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
sig do
|
|
290
|
+
override.returns(
|
|
291
|
+
{
|
|
292
|
+
evaluations:
|
|
293
|
+
T::Array[Deeprails::DefendResponse::Event::Evaluation],
|
|
294
|
+
event_id: String,
|
|
295
|
+
improved_model_output: String,
|
|
296
|
+
improvement_tool_status: String
|
|
297
|
+
}
|
|
298
|
+
)
|
|
299
|
+
end
|
|
300
|
+
def to_hash
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
class Evaluation < Deeprails::Internal::Type::BaseModel
|
|
304
|
+
OrHash =
|
|
305
|
+
T.type_alias do
|
|
306
|
+
T.any(
|
|
307
|
+
Deeprails::DefendResponse::Event::Evaluation,
|
|
308
|
+
Deeprails::Internal::AnyHash
|
|
309
|
+
)
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
# The attempt number or identifier for this evaluation.
|
|
313
|
+
sig { returns(T.nilable(String)) }
|
|
314
|
+
attr_reader :attempt
|
|
315
|
+
|
|
316
|
+
sig { params(attempt: String).void }
|
|
317
|
+
attr_writer :attempt
|
|
318
|
+
|
|
319
|
+
# The time the evaluation was created in UTC.
|
|
320
|
+
sig { returns(T.nilable(Time)) }
|
|
321
|
+
attr_reader :created_at
|
|
322
|
+
|
|
323
|
+
sig { params(created_at: Time).void }
|
|
324
|
+
attr_writer :created_at
|
|
325
|
+
|
|
326
|
+
# Error message if the evaluation failed.
|
|
327
|
+
sig { returns(T.nilable(String)) }
|
|
328
|
+
attr_reader :error_message
|
|
329
|
+
|
|
330
|
+
sig { params(error_message: String).void }
|
|
331
|
+
attr_writer :error_message
|
|
332
|
+
|
|
333
|
+
# The result of the evaluation.
|
|
334
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
335
|
+
attr_reader :evaluation_result
|
|
336
|
+
|
|
337
|
+
sig { params(evaluation_result: T::Hash[Symbol, T.anything]).void }
|
|
338
|
+
attr_writer :evaluation_result
|
|
339
|
+
|
|
340
|
+
# Status of the evaluation.
|
|
341
|
+
sig { returns(T.nilable(String)) }
|
|
342
|
+
attr_reader :evaluation_status
|
|
343
|
+
|
|
344
|
+
sig { params(evaluation_status: String).void }
|
|
345
|
+
attr_writer :evaluation_status
|
|
346
|
+
|
|
347
|
+
# Total cost of the evaluation.
|
|
348
|
+
sig { returns(T.nilable(Float)) }
|
|
349
|
+
attr_reader :evaluation_total_cost
|
|
350
|
+
|
|
351
|
+
sig { params(evaluation_total_cost: Float).void }
|
|
352
|
+
attr_writer :evaluation_total_cost
|
|
353
|
+
|
|
354
|
+
# An array of guardrail metrics evaluated.
|
|
355
|
+
sig { returns(T.nilable(T::Array[String])) }
|
|
356
|
+
attr_reader :guardrail_metrics
|
|
357
|
+
|
|
358
|
+
sig { params(guardrail_metrics: T::Array[String]).void }
|
|
359
|
+
attr_writer :guardrail_metrics
|
|
360
|
+
|
|
361
|
+
# The model input used for the evaluation.
|
|
362
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
363
|
+
attr_reader :model_input
|
|
364
|
+
|
|
365
|
+
sig { params(model_input: T::Hash[Symbol, T.anything]).void }
|
|
366
|
+
attr_writer :model_input
|
|
367
|
+
|
|
368
|
+
# The model output that was evaluated.
|
|
369
|
+
sig { returns(T.nilable(String)) }
|
|
370
|
+
attr_reader :model_output
|
|
371
|
+
|
|
372
|
+
sig { params(model_output: String).void }
|
|
373
|
+
attr_writer :model_output
|
|
374
|
+
|
|
375
|
+
# The time the evaluation was last modified in UTC.
|
|
376
|
+
sig { returns(T.nilable(Time)) }
|
|
377
|
+
attr_reader :modified_at
|
|
378
|
+
|
|
379
|
+
sig { params(modified_at: Time).void }
|
|
380
|
+
attr_writer :modified_at
|
|
381
|
+
|
|
382
|
+
# An optional tag for the evaluation.
|
|
383
|
+
sig { returns(T.nilable(String)) }
|
|
384
|
+
attr_reader :nametag
|
|
385
|
+
|
|
386
|
+
sig { params(nametag: String).void }
|
|
387
|
+
attr_writer :nametag
|
|
388
|
+
|
|
389
|
+
# Evaluation progress (0-100).
|
|
390
|
+
sig { returns(T.nilable(Integer)) }
|
|
391
|
+
attr_reader :progress
|
|
392
|
+
|
|
393
|
+
sig { params(progress: Integer).void }
|
|
394
|
+
attr_writer :progress
|
|
395
|
+
|
|
396
|
+
# Run mode used for the evaluation.
|
|
397
|
+
sig { returns(T.nilable(String)) }
|
|
398
|
+
attr_reader :run_mode
|
|
399
|
+
|
|
400
|
+
sig { params(run_mode: String).void }
|
|
401
|
+
attr_writer :run_mode
|
|
402
|
+
|
|
403
|
+
sig do
|
|
404
|
+
params(
|
|
405
|
+
attempt: String,
|
|
406
|
+
created_at: Time,
|
|
407
|
+
error_message: String,
|
|
408
|
+
evaluation_result: T::Hash[Symbol, T.anything],
|
|
409
|
+
evaluation_status: String,
|
|
410
|
+
evaluation_total_cost: Float,
|
|
411
|
+
guardrail_metrics: T::Array[String],
|
|
412
|
+
model_input: T::Hash[Symbol, T.anything],
|
|
413
|
+
model_output: String,
|
|
414
|
+
modified_at: Time,
|
|
415
|
+
nametag: String,
|
|
416
|
+
progress: Integer,
|
|
417
|
+
run_mode: String
|
|
418
|
+
).returns(T.attached_class)
|
|
419
|
+
end
|
|
420
|
+
def self.new(
|
|
421
|
+
# The attempt number or identifier for this evaluation.
|
|
422
|
+
attempt: nil,
|
|
423
|
+
# The time the evaluation was created in UTC.
|
|
424
|
+
created_at: nil,
|
|
425
|
+
# Error message if the evaluation failed.
|
|
426
|
+
error_message: nil,
|
|
427
|
+
# The result of the evaluation.
|
|
428
|
+
evaluation_result: nil,
|
|
429
|
+
# Status of the evaluation.
|
|
430
|
+
evaluation_status: nil,
|
|
431
|
+
# Total cost of the evaluation.
|
|
432
|
+
evaluation_total_cost: nil,
|
|
433
|
+
# An array of guardrail metrics evaluated.
|
|
434
|
+
guardrail_metrics: nil,
|
|
435
|
+
# The model input used for the evaluation.
|
|
436
|
+
model_input: nil,
|
|
437
|
+
# The model output that was evaluated.
|
|
438
|
+
model_output: nil,
|
|
439
|
+
# The time the evaluation was last modified in UTC.
|
|
440
|
+
modified_at: nil,
|
|
441
|
+
# An optional tag for the evaluation.
|
|
442
|
+
nametag: nil,
|
|
443
|
+
# Evaluation progress (0-100).
|
|
444
|
+
progress: nil,
|
|
445
|
+
# Run mode used for the evaluation.
|
|
446
|
+
run_mode: nil
|
|
447
|
+
)
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
sig do
|
|
451
|
+
override.returns(
|
|
452
|
+
{
|
|
453
|
+
attempt: String,
|
|
454
|
+
created_at: Time,
|
|
455
|
+
error_message: String,
|
|
456
|
+
evaluation_result: T::Hash[Symbol, T.anything],
|
|
457
|
+
evaluation_status: String,
|
|
458
|
+
evaluation_total_cost: Float,
|
|
459
|
+
guardrail_metrics: T::Array[String],
|
|
460
|
+
model_input: T::Hash[Symbol, T.anything],
|
|
461
|
+
model_output: String,
|
|
462
|
+
modified_at: Time,
|
|
463
|
+
nametag: String,
|
|
464
|
+
progress: Integer,
|
|
465
|
+
run_mode: String
|
|
466
|
+
}
|
|
467
|
+
)
|
|
468
|
+
end
|
|
469
|
+
def to_hash
|
|
470
|
+
end
|
|
471
|
+
end
|
|
472
|
+
end
|
|
473
|
+
|
|
474
|
+
class File < Deeprails::Internal::Type::BaseModel
|
|
475
|
+
OrHash =
|
|
476
|
+
T.type_alias do
|
|
477
|
+
T.any(Deeprails::DefendResponse::File, Deeprails::Internal::AnyHash)
|
|
478
|
+
end
|
|
479
|
+
|
|
480
|
+
sig { returns(T.nilable(String)) }
|
|
481
|
+
attr_reader :file_id
|
|
482
|
+
|
|
483
|
+
sig { params(file_id: String).void }
|
|
484
|
+
attr_writer :file_id
|
|
485
|
+
|
|
486
|
+
sig { returns(T.nilable(String)) }
|
|
487
|
+
attr_reader :file_name
|
|
488
|
+
|
|
489
|
+
sig { params(file_name: String).void }
|
|
490
|
+
attr_writer :file_name
|
|
491
|
+
|
|
492
|
+
sig { returns(T.nilable(Integer)) }
|
|
493
|
+
attr_reader :file_size
|
|
494
|
+
|
|
495
|
+
sig { params(file_size: Integer).void }
|
|
496
|
+
attr_writer :file_size
|
|
497
|
+
|
|
498
|
+
sig do
|
|
499
|
+
params(
|
|
500
|
+
file_id: String,
|
|
501
|
+
file_name: String,
|
|
502
|
+
file_size: Integer
|
|
503
|
+
).returns(T.attached_class)
|
|
504
|
+
end
|
|
505
|
+
def self.new(file_id: nil, file_name: nil, file_size: nil)
|
|
506
|
+
end
|
|
507
|
+
|
|
508
|
+
sig do
|
|
509
|
+
override.returns(
|
|
510
|
+
{ file_id: String, file_name: String, file_size: Integer }
|
|
511
|
+
)
|
|
512
|
+
end
|
|
513
|
+
def to_hash
|
|
514
|
+
end
|
|
515
|
+
end
|
|
516
|
+
|
|
185
517
|
# Status of the selected workflow. May be `inactive` or `active`. Inactive
|
|
186
518
|
# workflows will not accept events.
|
|
187
519
|
module Status
|
|
@@ -203,6 +535,93 @@ module Deeprails
|
|
|
203
535
|
def self.values
|
|
204
536
|
end
|
|
205
537
|
end
|
|
538
|
+
|
|
539
|
+
# Type of thresholds used to evaluate the event.
|
|
540
|
+
module ThresholdType
|
|
541
|
+
extend Deeprails::Internal::Type::Enum
|
|
542
|
+
|
|
543
|
+
TaggedSymbol =
|
|
544
|
+
T.type_alias do
|
|
545
|
+
T.all(Symbol, Deeprails::DefendResponse::ThresholdType)
|
|
546
|
+
end
|
|
547
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
548
|
+
|
|
549
|
+
CUSTOM =
|
|
550
|
+
T.let(:custom, Deeprails::DefendResponse::ThresholdType::TaggedSymbol)
|
|
551
|
+
AUTOMATIC =
|
|
552
|
+
T.let(
|
|
553
|
+
:automatic,
|
|
554
|
+
Deeprails::DefendResponse::ThresholdType::TaggedSymbol
|
|
555
|
+
)
|
|
556
|
+
|
|
557
|
+
sig do
|
|
558
|
+
override.returns(
|
|
559
|
+
T::Array[Deeprails::DefendResponse::ThresholdType::TaggedSymbol]
|
|
560
|
+
)
|
|
561
|
+
end
|
|
562
|
+
def self.values
|
|
563
|
+
end
|
|
564
|
+
end
|
|
565
|
+
|
|
566
|
+
class Stats < Deeprails::Internal::Type::BaseModel
|
|
567
|
+
OrHash =
|
|
568
|
+
T.type_alias do
|
|
569
|
+
T.any(
|
|
570
|
+
Deeprails::DefendResponse::Stats,
|
|
571
|
+
Deeprails::Internal::AnyHash
|
|
572
|
+
)
|
|
573
|
+
end
|
|
574
|
+
|
|
575
|
+
# Number of AI outputs that failed the guardrails.
|
|
576
|
+
sig { returns(T.nilable(Integer)) }
|
|
577
|
+
attr_reader :outputs_below_threshold
|
|
578
|
+
|
|
579
|
+
sig { params(outputs_below_threshold: Integer).void }
|
|
580
|
+
attr_writer :outputs_below_threshold
|
|
581
|
+
|
|
582
|
+
# Number of AI outputs that were improved.
|
|
583
|
+
sig { returns(T.nilable(Integer)) }
|
|
584
|
+
attr_reader :outputs_improved
|
|
585
|
+
|
|
586
|
+
sig { params(outputs_improved: Integer).void }
|
|
587
|
+
attr_writer :outputs_improved
|
|
588
|
+
|
|
589
|
+
# Total number of AI outputs processed by the workflow.
|
|
590
|
+
sig { returns(T.nilable(Integer)) }
|
|
591
|
+
attr_reader :outputs_processed
|
|
592
|
+
|
|
593
|
+
sig { params(outputs_processed: Integer).void }
|
|
594
|
+
attr_writer :outputs_processed
|
|
595
|
+
|
|
596
|
+
sig do
|
|
597
|
+
params(
|
|
598
|
+
outputs_below_threshold: Integer,
|
|
599
|
+
outputs_improved: Integer,
|
|
600
|
+
outputs_processed: Integer
|
|
601
|
+
).returns(T.attached_class)
|
|
602
|
+
end
|
|
603
|
+
def self.new(
|
|
604
|
+
# Number of AI outputs that failed the guardrails.
|
|
605
|
+
outputs_below_threshold: nil,
|
|
606
|
+
# Number of AI outputs that were improved.
|
|
607
|
+
outputs_improved: nil,
|
|
608
|
+
# Total number of AI outputs processed by the workflow.
|
|
609
|
+
outputs_processed: nil
|
|
610
|
+
)
|
|
611
|
+
end
|
|
612
|
+
|
|
613
|
+
sig do
|
|
614
|
+
override.returns(
|
|
615
|
+
{
|
|
616
|
+
outputs_below_threshold: Integer,
|
|
617
|
+
outputs_improved: Integer,
|
|
618
|
+
outputs_processed: Integer
|
|
619
|
+
}
|
|
620
|
+
)
|
|
621
|
+
end
|
|
622
|
+
def to_hash
|
|
623
|
+
end
|
|
624
|
+
end
|
|
206
625
|
end
|
|
207
626
|
end
|
|
208
627
|
end
|