deeprails 0.11.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 +18 -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_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_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 +11 -8
- 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_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_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 +8 -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 +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_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_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 +3 -3
- 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
data/manifest.yaml
CHANGED
|
@@ -26,8 +26,12 @@ module Deeprails
|
|
|
26
26
|
|
|
27
27
|
class << self
|
|
28
28
|
# @api private
|
|
29
|
-
sig
|
|
30
|
-
|
|
29
|
+
sig do
|
|
30
|
+
params(cert_store: OpenSSL::X509::Store, url: URI::Generic).returns(
|
|
31
|
+
Net::HTTP
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
def connect(cert_store:, url:)
|
|
31
35
|
end
|
|
32
36
|
|
|
33
37
|
# @api private
|
|
@@ -31,7 +31,7 @@ module Deeprails
|
|
|
31
31
|
#
|
|
32
32
|
# Assumes superclass fields are totally defined before fields are accessed /
|
|
33
33
|
# defined on subclasses.
|
|
34
|
-
sig { params(child:
|
|
34
|
+
sig { params(child: Deeprails::Internal::Type::BaseModel).void }
|
|
35
35
|
def inherited(child)
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -276,9 +276,13 @@ module Deeprails
|
|
|
276
276
|
|
|
277
277
|
# Create a new instance of a model.
|
|
278
278
|
sig do
|
|
279
|
-
params(
|
|
280
|
-
|
|
281
|
-
|
|
279
|
+
params(
|
|
280
|
+
data:
|
|
281
|
+
T.any(
|
|
282
|
+
T::Hash[Symbol, T.anything],
|
|
283
|
+
Deeprails::Internal::Type::BaseModel
|
|
284
|
+
)
|
|
285
|
+
).returns(T.attached_class)
|
|
282
286
|
end
|
|
283
287
|
def self.new(data = {})
|
|
284
288
|
end
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Deeprails
|
|
4
|
+
module Models
|
|
5
|
+
class DefendCreateResponse < Deeprails::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(Deeprails::DefendCreateResponse, Deeprails::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# The time the workflow was created in UTC.
|
|
12
|
+
sig { returns(Time) }
|
|
13
|
+
attr_accessor :created_at
|
|
14
|
+
|
|
15
|
+
# Status of the selected workflow. May be `inactive` or `active`. Inactive
|
|
16
|
+
# workflows will not accept events.
|
|
17
|
+
sig { returns(Deeprails::DefendCreateResponse::Status::TaggedSymbol) }
|
|
18
|
+
attr_accessor :status
|
|
19
|
+
|
|
20
|
+
# A unique workflow ID.
|
|
21
|
+
sig { returns(String) }
|
|
22
|
+
attr_accessor :workflow_id
|
|
23
|
+
|
|
24
|
+
sig do
|
|
25
|
+
params(
|
|
26
|
+
created_at: Time,
|
|
27
|
+
status: Deeprails::DefendCreateResponse::Status::OrSymbol,
|
|
28
|
+
workflow_id: String
|
|
29
|
+
).returns(T.attached_class)
|
|
30
|
+
end
|
|
31
|
+
def self.new(
|
|
32
|
+
# The time the workflow was created in UTC.
|
|
33
|
+
created_at:,
|
|
34
|
+
# Status of the selected workflow. May be `inactive` or `active`. Inactive
|
|
35
|
+
# workflows will not accept events.
|
|
36
|
+
status:,
|
|
37
|
+
# A unique workflow ID.
|
|
38
|
+
workflow_id:
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
sig do
|
|
43
|
+
override.returns(
|
|
44
|
+
{
|
|
45
|
+
created_at: Time,
|
|
46
|
+
status: Deeprails::DefendCreateResponse::Status::TaggedSymbol,
|
|
47
|
+
workflow_id: String
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
def to_hash
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Status of the selected workflow. May be `inactive` or `active`. Inactive
|
|
55
|
+
# workflows will not accept events.
|
|
56
|
+
module Status
|
|
57
|
+
extend Deeprails::Internal::Type::Enum
|
|
58
|
+
|
|
59
|
+
TaggedSymbol =
|
|
60
|
+
T.type_alias do
|
|
61
|
+
T.all(Symbol, Deeprails::DefendCreateResponse::Status)
|
|
62
|
+
end
|
|
63
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
64
|
+
|
|
65
|
+
INACTIVE =
|
|
66
|
+
T.let(
|
|
67
|
+
:inactive,
|
|
68
|
+
Deeprails::DefendCreateResponse::Status::TaggedSymbol
|
|
69
|
+
)
|
|
70
|
+
ACTIVE =
|
|
71
|
+
T.let(:active, Deeprails::DefendCreateResponse::Status::TaggedSymbol)
|
|
72
|
+
|
|
73
|
+
sig do
|
|
74
|
+
override.returns(
|
|
75
|
+
T::Array[Deeprails::DefendCreateResponse::Status::TaggedSymbol]
|
|
76
|
+
)
|
|
77
|
+
end
|
|
78
|
+
def self.values
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -14,11 +14,11 @@ module Deeprails
|
|
|
14
14
|
)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
# The action used to improve outputs that fail one or guardrail metrics for
|
|
18
|
-
# workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the
|
|
19
|
-
# input prompt with minor induced variance. FixIt attempts to directly
|
|
20
|
-
# shortcomings of the output using the guardrail failure rationale. Do
|
|
21
|
-
# does not attempt any improvement.
|
|
17
|
+
# The action used to improve outputs that fail one or more guardrail metrics for
|
|
18
|
+
# the workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the
|
|
19
|
+
# user's input prompt with minor induced variance. FixIt attempts to directly
|
|
20
|
+
# address the shortcomings of the output using the guardrail failure rationale. Do
|
|
21
|
+
# Nothing does not attempt any improvement.
|
|
22
22
|
sig do
|
|
23
23
|
returns(
|
|
24
24
|
Deeprails::DefendCreateWorkflowParams::ImprovementAction::OrSymbol
|
|
@@ -35,8 +35,10 @@ module Deeprails
|
|
|
35
35
|
# qualitative tolerance for the metrics, whereas custom metrics allow the user to
|
|
36
36
|
# set the threshold for each metric as a floating point number between 0.0 and
|
|
37
37
|
# 1.0.
|
|
38
|
-
sig
|
|
39
|
-
|
|
38
|
+
sig do
|
|
39
|
+
returns(Deeprails::DefendCreateWorkflowParams::ThresholdType::OrSymbol)
|
|
40
|
+
end
|
|
41
|
+
attr_accessor :threshold_type
|
|
40
42
|
|
|
41
43
|
# Mapping of guardrail metrics to hallucination tolerance levels (either `low`,
|
|
42
44
|
# `medium`, or `high`). Possible metrics are `completeness`,
|
|
@@ -93,7 +95,7 @@ module Deeprails
|
|
|
93
95
|
sig { params(file_search: T::Array[String]).void }
|
|
94
96
|
attr_writer :file_search
|
|
95
97
|
|
|
96
|
-
# Max. number of improvement action
|
|
98
|
+
# Max. number of improvement action attempts until a given event passes the
|
|
97
99
|
# guardrails. Defaults to 10.
|
|
98
100
|
sig { returns(T.nilable(Integer)) }
|
|
99
101
|
attr_reader :max_improvement_attempts
|
|
@@ -113,7 +115,8 @@ module Deeprails
|
|
|
113
115
|
improvement_action:
|
|
114
116
|
Deeprails::DefendCreateWorkflowParams::ImprovementAction::OrSymbol,
|
|
115
117
|
name: String,
|
|
116
|
-
|
|
118
|
+
threshold_type:
|
|
119
|
+
Deeprails::DefendCreateWorkflowParams::ThresholdType::OrSymbol,
|
|
117
120
|
automatic_hallucination_tolerance_levels:
|
|
118
121
|
T::Hash[
|
|
119
122
|
Symbol,
|
|
@@ -128,11 +131,11 @@ module Deeprails
|
|
|
128
131
|
).returns(T.attached_class)
|
|
129
132
|
end
|
|
130
133
|
def self.new(
|
|
131
|
-
# The action used to improve outputs that fail one or guardrail metrics for
|
|
132
|
-
# workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the
|
|
133
|
-
# input prompt with minor induced variance. FixIt attempts to directly
|
|
134
|
-
# shortcomings of the output using the guardrail failure rationale. Do
|
|
135
|
-
# does not attempt any improvement.
|
|
134
|
+
# The action used to improve outputs that fail one or more guardrail metrics for
|
|
135
|
+
# the workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the
|
|
136
|
+
# user's input prompt with minor induced variance. FixIt attempts to directly
|
|
137
|
+
# address the shortcomings of the output using the guardrail failure rationale. Do
|
|
138
|
+
# Nothing does not attempt any improvement.
|
|
136
139
|
improvement_action:,
|
|
137
140
|
# Name of the workflow.
|
|
138
141
|
name:,
|
|
@@ -141,7 +144,7 @@ module Deeprails
|
|
|
141
144
|
# qualitative tolerance for the metrics, whereas custom metrics allow the user to
|
|
142
145
|
# set the threshold for each metric as a floating point number between 0.0 and
|
|
143
146
|
# 1.0.
|
|
144
|
-
|
|
147
|
+
threshold_type:,
|
|
145
148
|
# Mapping of guardrail metrics to hallucination tolerance levels (either `low`,
|
|
146
149
|
# `medium`, or `high`). Possible metrics are `completeness`,
|
|
147
150
|
# `instruction_adherence`, `context_adherence`, `ground_truth_adherence`, or
|
|
@@ -156,7 +159,7 @@ module Deeprails
|
|
|
156
159
|
# An array of file IDs to search in the workflow's evaluations. Files must be
|
|
157
160
|
# uploaded via the DeepRails API first.
|
|
158
161
|
file_search: nil,
|
|
159
|
-
# Max. number of improvement action
|
|
162
|
+
# Max. number of improvement action attempts until a given event passes the
|
|
160
163
|
# guardrails. Defaults to 10.
|
|
161
164
|
max_improvement_attempts: nil,
|
|
162
165
|
# Whether to enable web search for this workflow's evaluations. Defaults to false.
|
|
@@ -171,7 +174,8 @@ module Deeprails
|
|
|
171
174
|
improvement_action:
|
|
172
175
|
Deeprails::DefendCreateWorkflowParams::ImprovementAction::OrSymbol,
|
|
173
176
|
name: String,
|
|
174
|
-
|
|
177
|
+
threshold_type:
|
|
178
|
+
Deeprails::DefendCreateWorkflowParams::ThresholdType::OrSymbol,
|
|
175
179
|
automatic_hallucination_tolerance_levels:
|
|
176
180
|
T::Hash[
|
|
177
181
|
Symbol,
|
|
@@ -189,11 +193,11 @@ module Deeprails
|
|
|
189
193
|
def to_hash
|
|
190
194
|
end
|
|
191
195
|
|
|
192
|
-
# The action used to improve outputs that fail one or guardrail metrics for
|
|
193
|
-
# workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the
|
|
194
|
-
# input prompt with minor induced variance. FixIt attempts to directly
|
|
195
|
-
# shortcomings of the output using the guardrail failure rationale. Do
|
|
196
|
-
# does not attempt any improvement.
|
|
196
|
+
# The action used to improve outputs that fail one or more guardrail metrics for
|
|
197
|
+
# the workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the
|
|
198
|
+
# user's input prompt with minor induced variance. FixIt attempts to directly
|
|
199
|
+
# address the shortcomings of the output using the guardrail failure rationale. Do
|
|
200
|
+
# Nothing does not attempt any improvement.
|
|
197
201
|
module ImprovementAction
|
|
198
202
|
extend Deeprails::Internal::Type::Enum
|
|
199
203
|
|
|
@@ -238,29 +242,31 @@ module Deeprails
|
|
|
238
242
|
# qualitative tolerance for the metrics, whereas custom metrics allow the user to
|
|
239
243
|
# set the threshold for each metric as a floating point number between 0.0 and
|
|
240
244
|
# 1.0.
|
|
241
|
-
module
|
|
245
|
+
module ThresholdType
|
|
242
246
|
extend Deeprails::Internal::Type::Enum
|
|
243
247
|
|
|
244
248
|
TaggedSymbol =
|
|
245
249
|
T.type_alias do
|
|
246
|
-
T.all(Symbol, Deeprails::DefendCreateWorkflowParams::
|
|
250
|
+
T.all(Symbol, Deeprails::DefendCreateWorkflowParams::ThresholdType)
|
|
247
251
|
end
|
|
248
252
|
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
249
253
|
|
|
250
254
|
AUTOMATIC =
|
|
251
255
|
T.let(
|
|
252
256
|
:automatic,
|
|
253
|
-
Deeprails::DefendCreateWorkflowParams::
|
|
257
|
+
Deeprails::DefendCreateWorkflowParams::ThresholdType::TaggedSymbol
|
|
254
258
|
)
|
|
255
259
|
CUSTOM =
|
|
256
260
|
T.let(
|
|
257
261
|
:custom,
|
|
258
|
-
Deeprails::DefendCreateWorkflowParams::
|
|
262
|
+
Deeprails::DefendCreateWorkflowParams::ThresholdType::TaggedSymbol
|
|
259
263
|
)
|
|
260
264
|
|
|
261
265
|
sig do
|
|
262
266
|
override.returns(
|
|
263
|
-
T::Array[
|
|
267
|
+
T::Array[
|
|
268
|
+
Deeprails::DefendCreateWorkflowParams::ThresholdType::TaggedSymbol
|
|
269
|
+
]
|
|
264
270
|
)
|
|
265
271
|
end
|
|
266
272
|
def self.values
|