deeprails 0.10.0 → 0.12.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 +278 -38
- 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_params.rb +47 -1
- data/lib/deeprails/models/monitor_create_response.rb +51 -0
- data/lib/deeprails/models/monitor_detail_response.rb +69 -70
- data/lib/deeprails/models/monitor_event_detail_response.rb +182 -0
- data/lib/deeprails/models/monitor_event_response.rb +1 -9
- data/lib/deeprails/models/monitor_retrieve_params.rb +6 -2
- data/lib/deeprails/models/monitor_submit_event_params.rb +1 -35
- 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 +12 -2
- data/lib/deeprails/resources/defend.rb +20 -13
- data/lib/deeprails/resources/files.rb +1 -1
- data/lib/deeprails/resources/monitor.rb +22 -14
- data/lib/deeprails/version.rb +1 -1
- data/lib/deeprails.rb +7 -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 +555 -72
- 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_params.rbi +97 -0
- data/rbi/deeprails/models/monitor_create_response.rbi +83 -0
- data/rbi/deeprails/models/monitor_detail_response.rbi +144 -104
- data/rbi/deeprails/models/monitor_event_detail_response.rbi +383 -0
- data/rbi/deeprails/models/monitor_event_response.rbi +4 -18
- data/rbi/deeprails/models/monitor_retrieve_params.rbi +4 -2
- data/rbi/deeprails/models/monitor_submit_event_params.rbi +0 -88
- 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 +685 -0
- data/rbi/deeprails/models/workflow_event_response.rbi +49 -42
- data/rbi/deeprails/models.rbi +12 -2
- data/rbi/deeprails/resources/defend.rbi +17 -12
- data/rbi/deeprails/resources/files.rbi +1 -1
- data/rbi/deeprails/resources/monitor.rbi +22 -20
- 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 +297 -28
- 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_params.rbs +44 -1
- data/sig/deeprails/models/monitor_create_response.rbs +41 -0
- data/sig/deeprails/models/monitor_detail_response.rbs +72 -61
- 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_submit_event_params.rbs +0 -33
- 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 +315 -0
- data/sig/deeprails/models/workflow_event_response.rbs +24 -24
- data/sig/deeprails/models.rbs +12 -2
- data/sig/deeprails/resources/defend.rbs +5 -4
- data/sig/deeprails/resources/files.rbs +1 -1
- data/sig/deeprails/resources/monitor.rbs +6 -5
- metadata +20 -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
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Deeprails
|
|
4
|
+
module Models
|
|
5
|
+
class MonitorEventDetailResponse < Deeprails::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(
|
|
9
|
+
Deeprails::MonitorEventDetailResponse,
|
|
10
|
+
Deeprails::Internal::AnyHash
|
|
11
|
+
)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# The capabilities associated with the monitor event.
|
|
15
|
+
sig do
|
|
16
|
+
returns(
|
|
17
|
+
T.nilable(T::Array[Deeprails::MonitorEventDetailResponse::Capability])
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
attr_reader :capabilities
|
|
21
|
+
|
|
22
|
+
sig do
|
|
23
|
+
params(
|
|
24
|
+
capabilities:
|
|
25
|
+
T::Array[Deeprails::MonitorEventDetailResponse::Capability::OrHash]
|
|
26
|
+
).void
|
|
27
|
+
end
|
|
28
|
+
attr_writer :capabilities
|
|
29
|
+
|
|
30
|
+
# The time spent on the evaluation in seconds.
|
|
31
|
+
sig { returns(T.nilable(String)) }
|
|
32
|
+
attr_reader :eval_time
|
|
33
|
+
|
|
34
|
+
sig { params(eval_time: String).void }
|
|
35
|
+
attr_writer :eval_time
|
|
36
|
+
|
|
37
|
+
# The result of the evaluation of the monitor event.
|
|
38
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
39
|
+
attr_reader :evaluation_result
|
|
40
|
+
|
|
41
|
+
sig { params(evaluation_result: T::Hash[Symbol, T.anything]).void }
|
|
42
|
+
attr_writer :evaluation_result
|
|
43
|
+
|
|
44
|
+
# A unique monitor event ID.
|
|
45
|
+
sig { returns(T.nilable(String)) }
|
|
46
|
+
attr_reader :event_id
|
|
47
|
+
|
|
48
|
+
sig { params(event_id: String).void }
|
|
49
|
+
attr_writer :event_id
|
|
50
|
+
|
|
51
|
+
# The files associated with the monitor event.
|
|
52
|
+
sig do
|
|
53
|
+
returns(
|
|
54
|
+
T.nilable(T::Array[Deeprails::MonitorEventDetailResponse::File])
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
attr_reader :files
|
|
58
|
+
|
|
59
|
+
sig do
|
|
60
|
+
params(
|
|
61
|
+
files: T::Array[Deeprails::MonitorEventDetailResponse::File::OrHash]
|
|
62
|
+
).void
|
|
63
|
+
end
|
|
64
|
+
attr_writer :files
|
|
65
|
+
|
|
66
|
+
# The guardrail metrics evaluated by the monitor event.
|
|
67
|
+
sig { returns(T.nilable(T::Array[String])) }
|
|
68
|
+
attr_reader :guardrail_metrics
|
|
69
|
+
|
|
70
|
+
sig { params(guardrail_metrics: T::Array[String]).void }
|
|
71
|
+
attr_writer :guardrail_metrics
|
|
72
|
+
|
|
73
|
+
# The model input used to create the monitor event.
|
|
74
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
75
|
+
attr_reader :model_input
|
|
76
|
+
|
|
77
|
+
sig { params(model_input: T::Hash[Symbol, T.anything]).void }
|
|
78
|
+
attr_writer :model_input
|
|
79
|
+
|
|
80
|
+
# The output evaluated by the monitor event.
|
|
81
|
+
sig { returns(T.nilable(String)) }
|
|
82
|
+
attr_reader :model_output
|
|
83
|
+
|
|
84
|
+
sig { params(model_output: String).void }
|
|
85
|
+
attr_writer :model_output
|
|
86
|
+
|
|
87
|
+
# Monitor ID associated with this event.
|
|
88
|
+
sig { returns(T.nilable(String)) }
|
|
89
|
+
attr_reader :monitor_id
|
|
90
|
+
|
|
91
|
+
sig { params(monitor_id: String).void }
|
|
92
|
+
attr_writer :monitor_id
|
|
93
|
+
|
|
94
|
+
# A human-readable tag for the monitor event.
|
|
95
|
+
sig { returns(T.nilable(String)) }
|
|
96
|
+
attr_reader :nametag
|
|
97
|
+
|
|
98
|
+
sig { params(nametag: String).void }
|
|
99
|
+
attr_writer :nametag
|
|
100
|
+
|
|
101
|
+
# The run mode used to evaluate the monitor event.
|
|
102
|
+
sig do
|
|
103
|
+
returns(
|
|
104
|
+
T.nilable(Deeprails::MonitorEventDetailResponse::RunMode::OrSymbol)
|
|
105
|
+
)
|
|
106
|
+
end
|
|
107
|
+
attr_reader :run_mode
|
|
108
|
+
|
|
109
|
+
sig do
|
|
110
|
+
params(
|
|
111
|
+
run_mode: Deeprails::MonitorEventDetailResponse::RunMode::OrSymbol
|
|
112
|
+
).void
|
|
113
|
+
end
|
|
114
|
+
attr_writer :run_mode
|
|
115
|
+
|
|
116
|
+
# Status of the monitor event's evaluation.
|
|
117
|
+
sig do
|
|
118
|
+
returns(
|
|
119
|
+
T.nilable(Deeprails::MonitorEventDetailResponse::Status::OrSymbol)
|
|
120
|
+
)
|
|
121
|
+
end
|
|
122
|
+
attr_reader :status
|
|
123
|
+
|
|
124
|
+
sig do
|
|
125
|
+
params(
|
|
126
|
+
status: Deeprails::MonitorEventDetailResponse::Status::OrSymbol
|
|
127
|
+
).void
|
|
128
|
+
end
|
|
129
|
+
attr_writer :status
|
|
130
|
+
|
|
131
|
+
# The time the monitor event was created in UTC.
|
|
132
|
+
sig { returns(T.nilable(Time)) }
|
|
133
|
+
attr_reader :timestamp
|
|
134
|
+
|
|
135
|
+
sig { params(timestamp: Time).void }
|
|
136
|
+
attr_writer :timestamp
|
|
137
|
+
|
|
138
|
+
sig do
|
|
139
|
+
params(
|
|
140
|
+
capabilities:
|
|
141
|
+
T::Array[Deeprails::MonitorEventDetailResponse::Capability::OrHash],
|
|
142
|
+
eval_time: String,
|
|
143
|
+
evaluation_result: T::Hash[Symbol, T.anything],
|
|
144
|
+
event_id: String,
|
|
145
|
+
files: T::Array[Deeprails::MonitorEventDetailResponse::File::OrHash],
|
|
146
|
+
guardrail_metrics: T::Array[String],
|
|
147
|
+
model_input: T::Hash[Symbol, T.anything],
|
|
148
|
+
model_output: String,
|
|
149
|
+
monitor_id: String,
|
|
150
|
+
nametag: String,
|
|
151
|
+
run_mode: Deeprails::MonitorEventDetailResponse::RunMode::OrSymbol,
|
|
152
|
+
status: Deeprails::MonitorEventDetailResponse::Status::OrSymbol,
|
|
153
|
+
timestamp: Time
|
|
154
|
+
).returns(T.attached_class)
|
|
155
|
+
end
|
|
156
|
+
def self.new(
|
|
157
|
+
# The capabilities associated with the monitor event.
|
|
158
|
+
capabilities: nil,
|
|
159
|
+
# The time spent on the evaluation in seconds.
|
|
160
|
+
eval_time: nil,
|
|
161
|
+
# The result of the evaluation of the monitor event.
|
|
162
|
+
evaluation_result: nil,
|
|
163
|
+
# A unique monitor event ID.
|
|
164
|
+
event_id: nil,
|
|
165
|
+
# The files associated with the monitor event.
|
|
166
|
+
files: nil,
|
|
167
|
+
# The guardrail metrics evaluated by the monitor event.
|
|
168
|
+
guardrail_metrics: nil,
|
|
169
|
+
# The model input used to create the monitor event.
|
|
170
|
+
model_input: nil,
|
|
171
|
+
# The output evaluated by the monitor event.
|
|
172
|
+
model_output: nil,
|
|
173
|
+
# Monitor ID associated with this event.
|
|
174
|
+
monitor_id: nil,
|
|
175
|
+
# A human-readable tag for the monitor event.
|
|
176
|
+
nametag: nil,
|
|
177
|
+
# The run mode used to evaluate the monitor event.
|
|
178
|
+
run_mode: nil,
|
|
179
|
+
# Status of the monitor event's evaluation.
|
|
180
|
+
status: nil,
|
|
181
|
+
# The time the monitor event was created in UTC.
|
|
182
|
+
timestamp: nil
|
|
183
|
+
)
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
sig do
|
|
187
|
+
override.returns(
|
|
188
|
+
{
|
|
189
|
+
capabilities:
|
|
190
|
+
T::Array[Deeprails::MonitorEventDetailResponse::Capability],
|
|
191
|
+
eval_time: String,
|
|
192
|
+
evaluation_result: T::Hash[Symbol, T.anything],
|
|
193
|
+
event_id: String,
|
|
194
|
+
files: T::Array[Deeprails::MonitorEventDetailResponse::File],
|
|
195
|
+
guardrail_metrics: T::Array[String],
|
|
196
|
+
model_input: T::Hash[Symbol, T.anything],
|
|
197
|
+
model_output: String,
|
|
198
|
+
monitor_id: String,
|
|
199
|
+
nametag: String,
|
|
200
|
+
run_mode: Deeprails::MonitorEventDetailResponse::RunMode::OrSymbol,
|
|
201
|
+
status: Deeprails::MonitorEventDetailResponse::Status::OrSymbol,
|
|
202
|
+
timestamp: Time
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
end
|
|
206
|
+
def to_hash
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
class Capability < Deeprails::Internal::Type::BaseModel
|
|
210
|
+
OrHash =
|
|
211
|
+
T.type_alias do
|
|
212
|
+
T.any(
|
|
213
|
+
Deeprails::MonitorEventDetailResponse::Capability,
|
|
214
|
+
Deeprails::Internal::AnyHash
|
|
215
|
+
)
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# The type of capability.
|
|
219
|
+
sig { returns(T.nilable(String)) }
|
|
220
|
+
attr_reader :capability
|
|
221
|
+
|
|
222
|
+
sig { params(capability: String).void }
|
|
223
|
+
attr_writer :capability
|
|
224
|
+
|
|
225
|
+
sig { params(capability: String).returns(T.attached_class) }
|
|
226
|
+
def self.new(
|
|
227
|
+
# The type of capability.
|
|
228
|
+
capability: nil
|
|
229
|
+
)
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
sig { override.returns({ capability: String }) }
|
|
233
|
+
def to_hash
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
class File < Deeprails::Internal::Type::BaseModel
|
|
238
|
+
OrHash =
|
|
239
|
+
T.type_alias do
|
|
240
|
+
T.any(
|
|
241
|
+
Deeprails::MonitorEventDetailResponse::File,
|
|
242
|
+
Deeprails::Internal::AnyHash
|
|
243
|
+
)
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# The ID of the file.
|
|
247
|
+
sig { returns(T.nilable(String)) }
|
|
248
|
+
attr_reader :file_id
|
|
249
|
+
|
|
250
|
+
sig { params(file_id: String).void }
|
|
251
|
+
attr_writer :file_id
|
|
252
|
+
|
|
253
|
+
# The name of the file.
|
|
254
|
+
sig { returns(T.nilable(String)) }
|
|
255
|
+
attr_reader :file_name
|
|
256
|
+
|
|
257
|
+
sig { params(file_name: String).void }
|
|
258
|
+
attr_writer :file_name
|
|
259
|
+
|
|
260
|
+
# The size of the file in bytes.
|
|
261
|
+
sig { returns(T.nilable(Integer)) }
|
|
262
|
+
attr_reader :file_size
|
|
263
|
+
|
|
264
|
+
sig { params(file_size: Integer).void }
|
|
265
|
+
attr_writer :file_size
|
|
266
|
+
|
|
267
|
+
sig do
|
|
268
|
+
params(
|
|
269
|
+
file_id: String,
|
|
270
|
+
file_name: String,
|
|
271
|
+
file_size: Integer
|
|
272
|
+
).returns(T.attached_class)
|
|
273
|
+
end
|
|
274
|
+
def self.new(
|
|
275
|
+
# The ID of the file.
|
|
276
|
+
file_id: nil,
|
|
277
|
+
# The name of the file.
|
|
278
|
+
file_name: nil,
|
|
279
|
+
# The size of the file in bytes.
|
|
280
|
+
file_size: nil
|
|
281
|
+
)
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
sig do
|
|
285
|
+
override.returns(
|
|
286
|
+
{ file_id: String, file_name: String, file_size: Integer }
|
|
287
|
+
)
|
|
288
|
+
end
|
|
289
|
+
def to_hash
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
# The run mode used to evaluate the monitor event.
|
|
294
|
+
module RunMode
|
|
295
|
+
extend Deeprails::Internal::Type::Enum
|
|
296
|
+
|
|
297
|
+
TaggedSymbol =
|
|
298
|
+
T.type_alias do
|
|
299
|
+
T.all(Symbol, Deeprails::MonitorEventDetailResponse::RunMode)
|
|
300
|
+
end
|
|
301
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
302
|
+
|
|
303
|
+
PRECISION_PLUS =
|
|
304
|
+
T.let(
|
|
305
|
+
:precision_plus,
|
|
306
|
+
Deeprails::MonitorEventDetailResponse::RunMode::TaggedSymbol
|
|
307
|
+
)
|
|
308
|
+
PRECISION =
|
|
309
|
+
T.let(
|
|
310
|
+
:precision,
|
|
311
|
+
Deeprails::MonitorEventDetailResponse::RunMode::TaggedSymbol
|
|
312
|
+
)
|
|
313
|
+
SMART =
|
|
314
|
+
T.let(
|
|
315
|
+
:smart,
|
|
316
|
+
Deeprails::MonitorEventDetailResponse::RunMode::TaggedSymbol
|
|
317
|
+
)
|
|
318
|
+
ECONOMY =
|
|
319
|
+
T.let(
|
|
320
|
+
:economy,
|
|
321
|
+
Deeprails::MonitorEventDetailResponse::RunMode::TaggedSymbol
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
sig do
|
|
325
|
+
override.returns(
|
|
326
|
+
T::Array[
|
|
327
|
+
Deeprails::MonitorEventDetailResponse::RunMode::TaggedSymbol
|
|
328
|
+
]
|
|
329
|
+
)
|
|
330
|
+
end
|
|
331
|
+
def self.values
|
|
332
|
+
end
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
# Status of the monitor event's evaluation.
|
|
336
|
+
module Status
|
|
337
|
+
extend Deeprails::Internal::Type::Enum
|
|
338
|
+
|
|
339
|
+
TaggedSymbol =
|
|
340
|
+
T.type_alias do
|
|
341
|
+
T.all(Symbol, Deeprails::MonitorEventDetailResponse::Status)
|
|
342
|
+
end
|
|
343
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
344
|
+
|
|
345
|
+
IN_PROGRESS =
|
|
346
|
+
T.let(
|
|
347
|
+
:in_progress,
|
|
348
|
+
Deeprails::MonitorEventDetailResponse::Status::TaggedSymbol
|
|
349
|
+
)
|
|
350
|
+
COMPLETED =
|
|
351
|
+
T.let(
|
|
352
|
+
:completed,
|
|
353
|
+
Deeprails::MonitorEventDetailResponse::Status::TaggedSymbol
|
|
354
|
+
)
|
|
355
|
+
CANCELED =
|
|
356
|
+
T.let(
|
|
357
|
+
:canceled,
|
|
358
|
+
Deeprails::MonitorEventDetailResponse::Status::TaggedSymbol
|
|
359
|
+
)
|
|
360
|
+
QUEUED =
|
|
361
|
+
T.let(
|
|
362
|
+
:queued,
|
|
363
|
+
Deeprails::MonitorEventDetailResponse::Status::TaggedSymbol
|
|
364
|
+
)
|
|
365
|
+
FAILED =
|
|
366
|
+
T.let(
|
|
367
|
+
:failed,
|
|
368
|
+
Deeprails::MonitorEventDetailResponse::Status::TaggedSymbol
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
sig do
|
|
372
|
+
override.returns(
|
|
373
|
+
T::Array[
|
|
374
|
+
Deeprails::MonitorEventDetailResponse::Status::TaggedSymbol
|
|
375
|
+
]
|
|
376
|
+
)
|
|
377
|
+
end
|
|
378
|
+
def self.values
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
end
|
|
382
|
+
end
|
|
383
|
+
end
|
|
@@ -8,10 +8,6 @@ module Deeprails
|
|
|
8
8
|
T.any(Deeprails::MonitorEventResponse, Deeprails::Internal::AnyHash)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
# A unique evaluation ID associated with this event.
|
|
12
|
-
sig { returns(String) }
|
|
13
|
-
attr_accessor :evaluation_id
|
|
14
|
-
|
|
15
11
|
# A unique monitor event ID.
|
|
16
12
|
sig { returns(String) }
|
|
17
13
|
attr_accessor :event_id
|
|
@@ -28,16 +24,11 @@ module Deeprails
|
|
|
28
24
|
attr_writer :created_at
|
|
29
25
|
|
|
30
26
|
sig do
|
|
31
|
-
params(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
monitor_id: String,
|
|
35
|
-
created_at: Time
|
|
36
|
-
).returns(T.attached_class)
|
|
27
|
+
params(event_id: String, monitor_id: String, created_at: Time).returns(
|
|
28
|
+
T.attached_class
|
|
29
|
+
)
|
|
37
30
|
end
|
|
38
31
|
def self.new(
|
|
39
|
-
# A unique evaluation ID associated with this event.
|
|
40
|
-
evaluation_id:,
|
|
41
32
|
# A unique monitor event ID.
|
|
42
33
|
event_id:,
|
|
43
34
|
# Monitor ID associated with this event.
|
|
@@ -49,12 +40,7 @@ module Deeprails
|
|
|
49
40
|
|
|
50
41
|
sig do
|
|
51
42
|
override.returns(
|
|
52
|
-
{
|
|
53
|
-
evaluation_id: String,
|
|
54
|
-
event_id: String,
|
|
55
|
-
monitor_id: String,
|
|
56
|
-
created_at: Time
|
|
57
|
-
}
|
|
43
|
+
{ event_id: String, monitor_id: String, created_at: Time }
|
|
58
44
|
)
|
|
59
45
|
end
|
|
60
46
|
def to_hash
|
|
@@ -11,7 +11,8 @@ module Deeprails
|
|
|
11
11
|
T.any(Deeprails::MonitorRetrieveParams, Deeprails::Internal::AnyHash)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
# Limit the returned
|
|
14
|
+
# Limit the number of returned evaluations associated with this monitor. Defaults
|
|
15
|
+
# to 10.
|
|
15
16
|
sig { returns(T.nilable(Integer)) }
|
|
16
17
|
attr_reader :limit
|
|
17
18
|
|
|
@@ -25,7 +26,8 @@ module Deeprails
|
|
|
25
26
|
).returns(T.attached_class)
|
|
26
27
|
end
|
|
27
28
|
def self.new(
|
|
28
|
-
# Limit the returned
|
|
29
|
+
# Limit the number of returned evaluations associated with this monitor. Defaults
|
|
30
|
+
# to 10.
|
|
29
31
|
limit: nil,
|
|
30
32
|
request_options: {}
|
|
31
33
|
)
|
|
@@ -14,19 +14,6 @@ module Deeprails
|
|
|
14
14
|
)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
# An array of guardrail metrics that the model input and output pair will be
|
|
18
|
-
# evaluated on. For non-enterprise users, these will be limited to `correctness`,
|
|
19
|
-
# `completeness`, `instruction_adherence`, `context_adherence`,
|
|
20
|
-
# `ground_truth_adherence`, and/or `comprehensive_safety`.
|
|
21
|
-
sig do
|
|
22
|
-
returns(
|
|
23
|
-
T::Array[
|
|
24
|
-
Deeprails::MonitorSubmitEventParams::GuardrailMetric::OrSymbol
|
|
25
|
-
]
|
|
26
|
-
)
|
|
27
|
-
end
|
|
28
|
-
attr_accessor :guardrail_metrics
|
|
29
|
-
|
|
30
17
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
31
18
|
# contain at least a `user_prompt` field or a `system_prompt` field. For
|
|
32
19
|
# ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
@@ -44,13 +31,6 @@ module Deeprails
|
|
|
44
31
|
sig { returns(String) }
|
|
45
32
|
attr_accessor :model_output
|
|
46
33
|
|
|
47
|
-
# Model ID used to generate the output, like `gpt-4o` or `o3`.
|
|
48
|
-
sig { returns(T.nilable(String)) }
|
|
49
|
-
attr_reader :model_used
|
|
50
|
-
|
|
51
|
-
sig { params(model_used: String).void }
|
|
52
|
-
attr_writer :model_used
|
|
53
|
-
|
|
54
34
|
# An optional, user-defined tag for the event.
|
|
55
35
|
sig { returns(T.nilable(String)) }
|
|
56
36
|
attr_reader :nametag
|
|
@@ -78,32 +58,20 @@ module Deeprails
|
|
|
78
58
|
|
|
79
59
|
sig do
|
|
80
60
|
params(
|
|
81
|
-
guardrail_metrics:
|
|
82
|
-
T::Array[
|
|
83
|
-
Deeprails::MonitorSubmitEventParams::GuardrailMetric::OrSymbol
|
|
84
|
-
],
|
|
85
61
|
model_input: Deeprails::MonitorSubmitEventParams::ModelInput::OrHash,
|
|
86
62
|
model_output: String,
|
|
87
|
-
model_used: String,
|
|
88
63
|
nametag: String,
|
|
89
64
|
run_mode: Deeprails::MonitorSubmitEventParams::RunMode::OrSymbol,
|
|
90
65
|
request_options: Deeprails::RequestOptions::OrHash
|
|
91
66
|
).returns(T.attached_class)
|
|
92
67
|
end
|
|
93
68
|
def self.new(
|
|
94
|
-
# An array of guardrail metrics that the model input and output pair will be
|
|
95
|
-
# evaluated on. For non-enterprise users, these will be limited to `correctness`,
|
|
96
|
-
# `completeness`, `instruction_adherence`, `context_adherence`,
|
|
97
|
-
# `ground_truth_adherence`, and/or `comprehensive_safety`.
|
|
98
|
-
guardrail_metrics:,
|
|
99
69
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
100
70
|
# contain at least a `user_prompt` field or a `system_prompt` field. For
|
|
101
71
|
# ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
102
72
|
model_input:,
|
|
103
73
|
# Output generated by the LLM to be evaluated.
|
|
104
74
|
model_output:,
|
|
105
|
-
# Model ID used to generate the output, like `gpt-4o` or `o3`.
|
|
106
|
-
model_used: nil,
|
|
107
75
|
# An optional, user-defined tag for the event.
|
|
108
76
|
nametag: nil,
|
|
109
77
|
# Run mode for the monitor event. The run mode allows the user to optimize for
|
|
@@ -118,13 +86,8 @@ module Deeprails
|
|
|
118
86
|
sig do
|
|
119
87
|
override.returns(
|
|
120
88
|
{
|
|
121
|
-
guardrail_metrics:
|
|
122
|
-
T::Array[
|
|
123
|
-
Deeprails::MonitorSubmitEventParams::GuardrailMetric::OrSymbol
|
|
124
|
-
],
|
|
125
89
|
model_input: Deeprails::MonitorSubmitEventParams::ModelInput,
|
|
126
90
|
model_output: String,
|
|
127
|
-
model_used: String,
|
|
128
91
|
nametag: String,
|
|
129
92
|
run_mode: Deeprails::MonitorSubmitEventParams::RunMode::OrSymbol,
|
|
130
93
|
request_options: Deeprails::RequestOptions
|
|
@@ -134,57 +97,6 @@ module Deeprails
|
|
|
134
97
|
def to_hash
|
|
135
98
|
end
|
|
136
99
|
|
|
137
|
-
module GuardrailMetric
|
|
138
|
-
extend Deeprails::Internal::Type::Enum
|
|
139
|
-
|
|
140
|
-
TaggedSymbol =
|
|
141
|
-
T.type_alias do
|
|
142
|
-
T.all(Symbol, Deeprails::MonitorSubmitEventParams::GuardrailMetric)
|
|
143
|
-
end
|
|
144
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
145
|
-
|
|
146
|
-
CORRECTNESS =
|
|
147
|
-
T.let(
|
|
148
|
-
:correctness,
|
|
149
|
-
Deeprails::MonitorSubmitEventParams::GuardrailMetric::TaggedSymbol
|
|
150
|
-
)
|
|
151
|
-
COMPLETENESS =
|
|
152
|
-
T.let(
|
|
153
|
-
:completeness,
|
|
154
|
-
Deeprails::MonitorSubmitEventParams::GuardrailMetric::TaggedSymbol
|
|
155
|
-
)
|
|
156
|
-
INSTRUCTION_ADHERENCE =
|
|
157
|
-
T.let(
|
|
158
|
-
:instruction_adherence,
|
|
159
|
-
Deeprails::MonitorSubmitEventParams::GuardrailMetric::TaggedSymbol
|
|
160
|
-
)
|
|
161
|
-
CONTEXT_ADHERENCE =
|
|
162
|
-
T.let(
|
|
163
|
-
:context_adherence,
|
|
164
|
-
Deeprails::MonitorSubmitEventParams::GuardrailMetric::TaggedSymbol
|
|
165
|
-
)
|
|
166
|
-
GROUND_TRUTH_ADHERENCE =
|
|
167
|
-
T.let(
|
|
168
|
-
:ground_truth_adherence,
|
|
169
|
-
Deeprails::MonitorSubmitEventParams::GuardrailMetric::TaggedSymbol
|
|
170
|
-
)
|
|
171
|
-
COMPREHENSIVE_SAFETY =
|
|
172
|
-
T.let(
|
|
173
|
-
:comprehensive_safety,
|
|
174
|
-
Deeprails::MonitorSubmitEventParams::GuardrailMetric::TaggedSymbol
|
|
175
|
-
)
|
|
176
|
-
|
|
177
|
-
sig do
|
|
178
|
-
override.returns(
|
|
179
|
-
T::Array[
|
|
180
|
-
Deeprails::MonitorSubmitEventParams::GuardrailMetric::TaggedSymbol
|
|
181
|
-
]
|
|
182
|
-
)
|
|
183
|
-
end
|
|
184
|
-
def self.values
|
|
185
|
-
end
|
|
186
|
-
end
|
|
187
|
-
|
|
188
100
|
class ModelInput < Deeprails::Internal::Type::BaseModel
|
|
189
101
|
OrHash =
|
|
190
102
|
T.type_alias do
|
|
@@ -18,47 +18,41 @@ module Deeprails
|
|
|
18
18
|
sig { params(description: String).void }
|
|
19
19
|
attr_writer :description
|
|
20
20
|
|
|
21
|
+
# Name of the monitor.
|
|
22
|
+
sig { returns(T.nilable(String)) }
|
|
23
|
+
attr_reader :name
|
|
24
|
+
|
|
25
|
+
sig { params(name: String).void }
|
|
26
|
+
attr_writer :name
|
|
27
|
+
|
|
21
28
|
# Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
|
|
22
29
|
# longer record and evaluate events.
|
|
23
30
|
sig do
|
|
24
|
-
returns(
|
|
25
|
-
T.nilable(Deeprails::MonitorUpdateParams::MonitorStatus::OrSymbol)
|
|
26
|
-
)
|
|
31
|
+
returns(T.nilable(Deeprails::MonitorUpdateParams::Status::OrSymbol))
|
|
27
32
|
end
|
|
28
|
-
attr_reader :
|
|
33
|
+
attr_reader :status
|
|
29
34
|
|
|
30
35
|
sig do
|
|
31
|
-
params(
|
|
32
|
-
monitor_status:
|
|
33
|
-
Deeprails::MonitorUpdateParams::MonitorStatus::OrSymbol
|
|
34
|
-
).void
|
|
36
|
+
params(status: Deeprails::MonitorUpdateParams::Status::OrSymbol).void
|
|
35
37
|
end
|
|
36
|
-
attr_writer :
|
|
37
|
-
|
|
38
|
-
# Name of the monitor.
|
|
39
|
-
sig { returns(T.nilable(String)) }
|
|
40
|
-
attr_reader :name
|
|
41
|
-
|
|
42
|
-
sig { params(name: String).void }
|
|
43
|
-
attr_writer :name
|
|
38
|
+
attr_writer :status
|
|
44
39
|
|
|
45
40
|
sig do
|
|
46
41
|
params(
|
|
47
42
|
description: String,
|
|
48
|
-
monitor_status:
|
|
49
|
-
Deeprails::MonitorUpdateParams::MonitorStatus::OrSymbol,
|
|
50
43
|
name: String,
|
|
44
|
+
status: Deeprails::MonitorUpdateParams::Status::OrSymbol,
|
|
51
45
|
request_options: Deeprails::RequestOptions::OrHash
|
|
52
46
|
).returns(T.attached_class)
|
|
53
47
|
end
|
|
54
48
|
def self.new(
|
|
55
49
|
# Description of the monitor.
|
|
56
50
|
description: nil,
|
|
57
|
-
# Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
|
|
58
|
-
# longer record and evaluate events.
|
|
59
|
-
monitor_status: nil,
|
|
60
51
|
# Name of the monitor.
|
|
61
52
|
name: nil,
|
|
53
|
+
# Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
|
|
54
|
+
# longer record and evaluate events.
|
|
55
|
+
status: nil,
|
|
62
56
|
request_options: {}
|
|
63
57
|
)
|
|
64
58
|
end
|
|
@@ -67,9 +61,8 @@ module Deeprails
|
|
|
67
61
|
override.returns(
|
|
68
62
|
{
|
|
69
63
|
description: String,
|
|
70
|
-
monitor_status:
|
|
71
|
-
Deeprails::MonitorUpdateParams::MonitorStatus::OrSymbol,
|
|
72
64
|
name: String,
|
|
65
|
+
status: Deeprails::MonitorUpdateParams::Status::OrSymbol,
|
|
73
66
|
request_options: Deeprails::RequestOptions
|
|
74
67
|
}
|
|
75
68
|
)
|
|
@@ -79,31 +72,21 @@ module Deeprails
|
|
|
79
72
|
|
|
80
73
|
# Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
|
|
81
74
|
# longer record and evaluate events.
|
|
82
|
-
module
|
|
75
|
+
module Status
|
|
83
76
|
extend Deeprails::Internal::Type::Enum
|
|
84
77
|
|
|
85
78
|
TaggedSymbol =
|
|
86
|
-
T.type_alias
|
|
87
|
-
T.all(Symbol, Deeprails::MonitorUpdateParams::MonitorStatus)
|
|
88
|
-
end
|
|
79
|
+
T.type_alias { T.all(Symbol, Deeprails::MonitorUpdateParams::Status) }
|
|
89
80
|
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
90
81
|
|
|
91
82
|
ACTIVE =
|
|
92
|
-
T.let(
|
|
93
|
-
:active,
|
|
94
|
-
Deeprails::MonitorUpdateParams::MonitorStatus::TaggedSymbol
|
|
95
|
-
)
|
|
83
|
+
T.let(:active, Deeprails::MonitorUpdateParams::Status::TaggedSymbol)
|
|
96
84
|
INACTIVE =
|
|
97
|
-
T.let(
|
|
98
|
-
:inactive,
|
|
99
|
-
Deeprails::MonitorUpdateParams::MonitorStatus::TaggedSymbol
|
|
100
|
-
)
|
|
85
|
+
T.let(:inactive, Deeprails::MonitorUpdateParams::Status::TaggedSymbol)
|
|
101
86
|
|
|
102
87
|
sig do
|
|
103
88
|
override.returns(
|
|
104
|
-
T::Array[
|
|
105
|
-
Deeprails::MonitorUpdateParams::MonitorStatus::TaggedSymbol
|
|
106
|
-
]
|
|
89
|
+
T::Array[Deeprails::MonitorUpdateParams::Status::TaggedSymbol]
|
|
107
90
|
)
|
|
108
91
|
end
|
|
109
92
|
def self.values
|