deeprails 0.1.0 → 0.2.1
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 +21 -0
- data/README.md +9 -9
- data/lib/deeprails/models/api_response.rb +1 -4
- data/lib/deeprails/models/defend_create_workflow_params.rb +2 -2
- data/lib/deeprails/models/defend_response.rb +2 -4
- data/lib/deeprails/models/defend_update_workflow_params.rb +1 -20
- data/lib/deeprails/models/monitor_retrieve_response.rb +1 -4
- data/lib/deeprails/models/monitor_submit_event_response.rb +2 -5
- data/lib/deeprails/models/workflow_event_response.rb +0 -2
- data/lib/deeprails/resources/defend.rb +8 -9
- data/lib/deeprails/resources/evaluate.rb +1 -1
- data/lib/deeprails/resources/monitor.rb +8 -4
- data/lib/deeprails/version.rb +1 -1
- data/rbi/deeprails/models/api_response.rbi +0 -3
- data/rbi/deeprails/models/defend_create_workflow_params.rbi +3 -3
- data/rbi/deeprails/models/defend_response.rbi +3 -4
- data/rbi/deeprails/models/defend_update_workflow_params.rbi +0 -47
- data/rbi/deeprails/models/monitor_retrieve_response.rbi +0 -3
- data/rbi/deeprails/models/monitor_submit_event_response.rbi +0 -3
- data/rbi/deeprails/models/workflow_event_response.rbi +0 -1
- data/rbi/deeprails/resources/defend.rbi +8 -10
- data/rbi/deeprails/resources/evaluate.rbi +1 -1
- data/rbi/deeprails/resources/monitor.rbi +8 -4
- data/sig/deeprails/models/defend_update_workflow_params.rbs +1 -24
- data/sig/deeprails/resources/defend.rbs +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be0248dbbca4c9874fba590cd7da2c1d22cb841f007336f33895d86b20fa70d2
|
4
|
+
data.tar.gz: e4db561e063f8a1f46ee9b3fc2720416de013c43a9e6adaa90c2a74ac183835d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a77669f716a31e007a4d28f014883cd9528de8f4315c2a0d6ab124aca191adc6ce337af4bfe35e1eed37cf00460bfc58ae60bd78c161e792b7e633114c30b13b
|
7
|
+
data.tar.gz: ae57fce3e5033659dcb57e3d27a4eb63ade8e12ccca484107150bb9607913f811dd5738ac4f78b21cfc0841cdb0fefd96c3d3839a55794aa671d72dcc4a27f61
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.2.1 (2025-10-09)
|
4
|
+
|
5
|
+
Full Changelog: [v0.2.0...v0.2.1](https://github.com/deeprails/deeprails-ruby-sdk/compare/v0.2.0...v0.2.1)
|
6
|
+
|
7
|
+
### Chores
|
8
|
+
|
9
|
+
* ignore linter error for tests having large collections ([202c9e1](https://github.com/deeprails/deeprails-ruby-sdk/commit/202c9e1977aaebb7e09883564d4694a2d41e4416))
|
10
|
+
|
11
|
+
## 0.2.0 (2025-10-08)
|
12
|
+
|
13
|
+
Full Changelog: [v0.1.0...v0.2.0](https://github.com/deeprails/deeprails-ruby-sdk/compare/v0.1.0...v0.2.0)
|
14
|
+
|
15
|
+
### Features
|
16
|
+
|
17
|
+
* **api:** adding code samples ([9597e09](https://github.com/deeprails/deeprails-ruby-sdk/commit/9597e09967d659172d52c3935b3dd8f3e0018783))
|
18
|
+
|
19
|
+
|
20
|
+
### Chores
|
21
|
+
|
22
|
+
* sync repo ([a33597d](https://github.com/deeprails/deeprails-ruby-sdk/commit/a33597d5677081f50207f926f9950d9914700fb3))
|
23
|
+
|
3
24
|
## 0.1.0 (2025-10-07)
|
4
25
|
|
5
26
|
Full Changelog: [v0.0.2...v0.1.0](https://github.com/deeprails/deeprails-ruby-sdk/compare/v0.0.2...v0.1.0)
|
data/README.md
CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
15
15
|
<!-- x-release-please-start-version -->
|
16
16
|
|
17
17
|
```ruby
|
18
|
-
gem "deeprails", "~> 0.1
|
18
|
+
gem "deeprails", "~> 0.2.1"
|
19
19
|
```
|
20
20
|
|
21
21
|
<!-- x-release-please-end -->
|
@@ -32,7 +32,7 @@ deeprails = Deeprails::Client.new(
|
|
32
32
|
|
33
33
|
defend_response = deeprails.defend.create_workflow(
|
34
34
|
improvement_action: "fixit",
|
35
|
-
metrics: {completeness: 0.
|
35
|
+
metrics: {completeness: 0.8, instruction_adherence: 0.75},
|
36
36
|
name: "Push Alert Workflow",
|
37
37
|
type: "custom"
|
38
38
|
)
|
@@ -48,7 +48,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
|
|
48
48
|
begin
|
49
49
|
defend = deeprails.defend.create_workflow(
|
50
50
|
improvement_action: "fixit",
|
51
|
-
metrics: {completeness: 0.
|
51
|
+
metrics: {completeness: 0.8, instruction_adherence: 0.75},
|
52
52
|
name: "Push Alert Workflow",
|
53
53
|
type: "custom"
|
54
54
|
)
|
@@ -96,7 +96,7 @@ deeprails = Deeprails::Client.new(
|
|
96
96
|
# Or, configure per-request:
|
97
97
|
deeprails.defend.create_workflow(
|
98
98
|
improvement_action: "fixit",
|
99
|
-
metrics: {completeness: 0.
|
99
|
+
metrics: {completeness: 0.8, instruction_adherence: 0.75},
|
100
100
|
name: "Push Alert Workflow",
|
101
101
|
type: "custom",
|
102
102
|
request_options: {max_retries: 5}
|
@@ -116,7 +116,7 @@ deeprails = Deeprails::Client.new(
|
|
116
116
|
# Or, configure per-request:
|
117
117
|
deeprails.defend.create_workflow(
|
118
118
|
improvement_action: "fixit",
|
119
|
-
metrics: {completeness: 0.
|
119
|
+
metrics: {completeness: 0.8, instruction_adherence: 0.75},
|
120
120
|
name: "Push Alert Workflow",
|
121
121
|
type: "custom",
|
122
122
|
request_options: {timeout: 5}
|
@@ -153,7 +153,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
|
|
153
153
|
defend_response =
|
154
154
|
deeprails.defend.create_workflow(
|
155
155
|
improvement_action: "fixit",
|
156
|
-
metrics: {completeness: 0.
|
156
|
+
metrics: {completeness: 0.8, instruction_adherence: 0.75},
|
157
157
|
name: "Push Alert Workflow",
|
158
158
|
type: "custom",
|
159
159
|
request_options: {
|
@@ -203,7 +203,7 @@ You can provide typesafe request parameters like so:
|
|
203
203
|
```ruby
|
204
204
|
deeprails.defend.create_workflow(
|
205
205
|
improvement_action: "fixit",
|
206
|
-
metrics: {completeness: 0.
|
206
|
+
metrics: {completeness: 0.8, instruction_adherence: 0.75},
|
207
207
|
name: "Push Alert Workflow",
|
208
208
|
type: "custom"
|
209
209
|
)
|
@@ -215,7 +215,7 @@ Or, equivalently:
|
|
215
215
|
# Hashes work, but are not typesafe:
|
216
216
|
deeprails.defend.create_workflow(
|
217
217
|
improvement_action: "fixit",
|
218
|
-
metrics: {completeness: 0.
|
218
|
+
metrics: {completeness: 0.8, instruction_adherence: 0.75},
|
219
219
|
name: "Push Alert Workflow",
|
220
220
|
type: "custom"
|
221
221
|
)
|
@@ -223,7 +223,7 @@ deeprails.defend.create_workflow(
|
|
223
223
|
# You can also splat a full Params class:
|
224
224
|
params = Deeprails::DefendCreateWorkflowParams.new(
|
225
225
|
improvement_action: "fixit",
|
226
|
-
metrics: {completeness: 0.
|
226
|
+
metrics: {completeness: 0.8, instruction_adherence: 0.75},
|
227
227
|
name: "Push Alert Workflow",
|
228
228
|
type: "custom"
|
229
229
|
)
|
@@ -11,7 +11,6 @@ module Deeprails
|
|
11
11
|
required :success, Deeprails::Internal::Type::Boolean
|
12
12
|
|
13
13
|
# @!attribute data
|
14
|
-
# Response payload for creating or updating a monitor.
|
15
14
|
#
|
16
15
|
# @return [Deeprails::Models::APIResponse::Data, nil]
|
17
16
|
optional :data, -> { Deeprails::APIResponse::Data }
|
@@ -31,7 +30,7 @@ module Deeprails
|
|
31
30
|
#
|
32
31
|
# @param success [Boolean] Represents whether the request was completed successfully.
|
33
32
|
#
|
34
|
-
# @param data [Deeprails::Models::APIResponse::Data]
|
33
|
+
# @param data [Deeprails::Models::APIResponse::Data]
|
35
34
|
#
|
36
35
|
# @param message [String] The accompanying message for the request. Includes error details when applicable
|
37
36
|
|
@@ -84,8 +83,6 @@ module Deeprails
|
|
84
83
|
# Some parameter documentations has been truncated, see
|
85
84
|
# {Deeprails::Models::APIResponse::Data} for more details.
|
86
85
|
#
|
87
|
-
# Response payload for creating or updating a monitor.
|
88
|
-
#
|
89
86
|
# @param monitor_id [String] A unique monitor ID.
|
90
87
|
#
|
91
88
|
# @param name [String] Name of the monitor.
|
@@ -10,7 +10,7 @@ module Deeprails
|
|
10
10
|
# @!attribute improvement_action
|
11
11
|
# The action used to improve outputs that fail one or guardrail metrics for the
|
12
12
|
# workflow events. May be `regenerate`, `fixit`, or null which represents “do
|
13
|
-
# nothing”.
|
13
|
+
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
|
14
14
|
# Fixit attempts to directly address the shortcomings of the output using the
|
15
15
|
# guardrail failure rationale. Do nothing does not attempt any improvement.
|
16
16
|
#
|
@@ -87,7 +87,7 @@ module Deeprails
|
|
87
87
|
|
88
88
|
# The action used to improve outputs that fail one or guardrail metrics for the
|
89
89
|
# workflow events. May be `regenerate`, `fixit`, or null which represents “do
|
90
|
-
# nothing”.
|
90
|
+
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
|
91
91
|
# Fixit attempts to directly address the shortcomings of the output using the
|
92
92
|
# guardrail failure rationale. Do nothing does not attempt any improvement.
|
93
93
|
module ImprovementAction
|
@@ -31,7 +31,7 @@ module Deeprails
|
|
31
31
|
# @!attribute improvement_action
|
32
32
|
# The action used to improve outputs that fail one or more guardrail metrics for
|
33
33
|
# the workflow events. May be `regenerate`, `fixit`, or null which represents “do
|
34
|
-
# nothing”.
|
34
|
+
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
|
35
35
|
# Fixit attempts to directly address the shortcomings of the output using the
|
36
36
|
# guardrail failure rationale. Do nothing does not attempt any improvement.
|
37
37
|
#
|
@@ -68,8 +68,6 @@ module Deeprails
|
|
68
68
|
# Some parameter documentations has been truncated, see
|
69
69
|
# {Deeprails::Models::DefendResponse} for more details.
|
70
70
|
#
|
71
|
-
# Response payload for guardrail workflow operations.
|
72
|
-
#
|
73
71
|
# @param name [String] Name of the workflow.
|
74
72
|
#
|
75
73
|
# @param workflow_id [String] A unique workflow ID.
|
@@ -90,7 +88,7 @@ module Deeprails
|
|
90
88
|
|
91
89
|
# The action used to improve outputs that fail one or more guardrail metrics for
|
92
90
|
# the workflow events. May be `regenerate`, `fixit`, or null which represents “do
|
93
|
-
# nothing”.
|
91
|
+
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
|
94
92
|
# Fixit attempts to directly address the shortcomings of the output using the
|
95
93
|
# guardrail failure rationale. Do nothing does not attempt any improvement.
|
96
94
|
#
|
@@ -19,31 +19,12 @@ module Deeprails
|
|
19
19
|
# @return [String, nil]
|
20
20
|
optional :name, String
|
21
21
|
|
22
|
-
# @!
|
23
|
-
# Type of thresholds to use for the workflow, either `automatic` or `custom`.
|
24
|
-
#
|
25
|
-
# @return [Symbol, Deeprails::Models::DefendUpdateWorkflowParams::Type, nil]
|
26
|
-
optional :type, enum: -> { Deeprails::DefendUpdateWorkflowParams::Type }
|
27
|
-
|
28
|
-
# @!method initialize(description: nil, name: nil, type: nil, request_options: {})
|
22
|
+
# @!method initialize(description: nil, name: nil, request_options: {})
|
29
23
|
# @param description [String] Description for the workflow.
|
30
24
|
#
|
31
25
|
# @param name [String] Name of the workflow.
|
32
26
|
#
|
33
|
-
# @param type [Symbol, Deeprails::Models::DefendUpdateWorkflowParams::Type] Type of thresholds to use for the workflow, either `automatic` or `custom`.
|
34
|
-
#
|
35
27
|
# @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}]
|
36
|
-
|
37
|
-
# Type of thresholds to use for the workflow, either `automatic` or `custom`.
|
38
|
-
module Type
|
39
|
-
extend Deeprails::Internal::Type::Enum
|
40
|
-
|
41
|
-
AUTOMATIC = :automatic
|
42
|
-
CUSTOM = :custom
|
43
|
-
|
44
|
-
# @!method self.values
|
45
|
-
# @return [Array<Symbol>]
|
46
|
-
end
|
47
28
|
end
|
48
29
|
end
|
49
30
|
end
|
@@ -11,7 +11,6 @@ module Deeprails
|
|
11
11
|
required :success, Deeprails::Internal::Type::Boolean
|
12
12
|
|
13
13
|
# @!attribute data
|
14
|
-
# Detailed response payload for retrieving a monitor and its evaluations.
|
15
14
|
#
|
16
15
|
# @return [Deeprails::Models::MonitorRetrieveResponse::Data, nil]
|
17
16
|
optional :data, -> { Deeprails::Models::MonitorRetrieveResponse::Data }
|
@@ -31,7 +30,7 @@ module Deeprails
|
|
31
30
|
#
|
32
31
|
# @param success [Boolean] Represents whether the request was completed successfully.
|
33
32
|
#
|
34
|
-
# @param data [Deeprails::Models::MonitorRetrieveResponse::Data]
|
33
|
+
# @param data [Deeprails::Models::MonitorRetrieveResponse::Data]
|
35
34
|
#
|
36
35
|
# @param message [String] The accompanying message for the request. Includes error details when applicable
|
37
36
|
|
@@ -99,8 +98,6 @@ module Deeprails
|
|
99
98
|
# Some parameter documentations has been truncated, see
|
100
99
|
# {Deeprails::Models::MonitorRetrieveResponse::Data} for more details.
|
101
100
|
#
|
102
|
-
# Detailed response payload for retrieving a monitor and its evaluations.
|
103
|
-
#
|
104
101
|
# @param monitor_id [String] A unique monitor ID.
|
105
102
|
#
|
106
103
|
# @param monitor_status [Symbol, Deeprails::Models::MonitorRetrieveResponse::Data::MonitorStatus] Status of the monitor. Can be `active` or `inactive`. Inactive monitors no lon
|
@@ -11,7 +11,6 @@ module Deeprails
|
|
11
11
|
required :success, Deeprails::Internal::Type::Boolean
|
12
12
|
|
13
13
|
# @!attribute data
|
14
|
-
# Response payload for monitor event operations.
|
15
14
|
#
|
16
15
|
# @return [Deeprails::Models::MonitorSubmitEventResponse::Data, nil]
|
17
16
|
optional :data, -> { Deeprails::Models::MonitorSubmitEventResponse::Data }
|
@@ -31,9 +30,9 @@ module Deeprails
|
|
31
30
|
#
|
32
31
|
# @param success [Boolean] Represents whether the request was completed successfully.
|
33
32
|
#
|
34
|
-
# @param data [Deeprails::Models::MonitorSubmitEventResponse::Data]
|
33
|
+
# @param data [Deeprails::Models::MonitorSubmitEventResponse::Data]
|
35
34
|
#
|
36
|
-
# @param message [String] The accompanying message for the request. Includes error details when
|
35
|
+
# @param message [String] The accompanying message for the request. Includes error details when applicable
|
37
36
|
|
38
37
|
# @see Deeprails::Models::MonitorSubmitEventResponse#data
|
39
38
|
class Data < Deeprails::Internal::Type::BaseModel
|
@@ -62,8 +61,6 @@ module Deeprails
|
|
62
61
|
optional :created_at, Time
|
63
62
|
|
64
63
|
# @!method initialize(evaluation_id:, event_id:, monitor_id:, created_at: nil)
|
65
|
-
# Response payload for monitor event operations.
|
66
|
-
#
|
67
64
|
# @param evaluation_id [String] A unique evaluation ID associated with this event.
|
68
65
|
#
|
69
66
|
# @param event_id [String] A unique monitor event ID.
|
@@ -41,8 +41,6 @@ module Deeprails
|
|
41
41
|
# Some parameter documentations has been truncated, see
|
42
42
|
# {Deeprails::Models::WorkflowEventResponse} for more details.
|
43
43
|
#
|
44
|
-
# Response payload for workflow event operations.
|
45
|
-
#
|
46
44
|
# @param event_id [String] A unique workflow event ID.
|
47
45
|
#
|
48
46
|
# @param workflow_id [String] Workflow ID associated with the event.
|
@@ -6,8 +6,8 @@ module Deeprails
|
|
6
6
|
# Some parameter documentations has been truncated, see
|
7
7
|
# {Deeprails::Models::DefendCreateWorkflowParams} for more details.
|
8
8
|
#
|
9
|
-
#
|
10
|
-
# improvement actions
|
9
|
+
# Use this endpoint to create a new guardrail workflow with optional guardrail
|
10
|
+
# thresholds and improvement actions
|
11
11
|
#
|
12
12
|
# @overload create_workflow(improvement_action:, metrics:, name:, type:, automatic_tolerance: nil, description: nil, max_retries: nil, request_options: {})
|
13
13
|
#
|
@@ -41,7 +41,7 @@ module Deeprails
|
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
44
|
-
#
|
44
|
+
# Use this endpoint to retrieve a specific event of a guardrail workflow
|
45
45
|
#
|
46
46
|
# @overload retrieve_event(event_id, workflow_id:, request_options: {})
|
47
47
|
#
|
@@ -68,7 +68,7 @@ module Deeprails
|
|
68
68
|
)
|
69
69
|
end
|
70
70
|
|
71
|
-
#
|
71
|
+
# Use this endpoint to retrieve the details for a specific defend workflow
|
72
72
|
#
|
73
73
|
# @overload retrieve_workflow(workflow_id, request_options: {})
|
74
74
|
#
|
@@ -91,7 +91,8 @@ module Deeprails
|
|
91
91
|
# Some parameter documentations has been truncated, see
|
92
92
|
# {Deeprails::Models::DefendSubmitEventParams} for more details.
|
93
93
|
#
|
94
|
-
#
|
94
|
+
# Use this endpoint to submit a model input and output pair to a workflow for
|
95
|
+
# evaluation
|
95
96
|
#
|
96
97
|
# @overload submit_event(workflow_id, model_input:, model_output:, model_used:, nametag:, run_mode:, request_options: {})
|
97
98
|
#
|
@@ -123,9 +124,9 @@ module Deeprails
|
|
123
124
|
)
|
124
125
|
end
|
125
126
|
|
126
|
-
#
|
127
|
+
# Use this endpoint to update an existing guardrail workflow
|
127
128
|
#
|
128
|
-
# @overload update_workflow(workflow_id, description: nil, name: nil,
|
129
|
+
# @overload update_workflow(workflow_id, description: nil, name: nil, request_options: {})
|
129
130
|
#
|
130
131
|
# @param workflow_id [String] The ID of the workflow to edit.
|
131
132
|
#
|
@@ -133,8 +134,6 @@ module Deeprails
|
|
133
134
|
#
|
134
135
|
# @param name [String] Name of the workflow.
|
135
136
|
#
|
136
|
-
# @param type [Symbol, Deeprails::Models::DefendUpdateWorkflowParams::Type] Type of thresholds to use for the workflow, either `automatic` or `custom`.
|
137
|
-
#
|
138
137
|
# @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
|
139
138
|
#
|
140
139
|
# @return [Deeprails::Models::DefendResponse]
|
@@ -3,7 +3,8 @@
|
|
3
3
|
module Deeprails
|
4
4
|
module Resources
|
5
5
|
class Monitor
|
6
|
-
#
|
6
|
+
# Use this endpoint to create a new monitor to evaluate model inputs and outputs
|
7
|
+
# using guardrails
|
7
8
|
#
|
8
9
|
# @overload create(name:, description: nil, request_options: {})
|
9
10
|
#
|
@@ -27,7 +28,8 @@ module Deeprails
|
|
27
28
|
)
|
28
29
|
end
|
29
30
|
|
30
|
-
#
|
31
|
+
# Use this endpoint to retrieve the details and evaluations associated with a
|
32
|
+
# specific monitor
|
31
33
|
#
|
32
34
|
# @overload retrieve(monitor_id, limit: nil, request_options: {})
|
33
35
|
#
|
@@ -54,7 +56,8 @@ module Deeprails
|
|
54
56
|
# Some parameter documentations has been truncated, see
|
55
57
|
# {Deeprails::Models::MonitorUpdateParams} for more details.
|
56
58
|
#
|
57
|
-
#
|
59
|
+
# Use this endpoint to update the name, description, or status of an existing
|
60
|
+
# monitor
|
58
61
|
#
|
59
62
|
# @overload update(monitor_id, description: nil, monitor_status: nil, name: nil, request_options: {})
|
60
63
|
#
|
@@ -85,7 +88,8 @@ module Deeprails
|
|
85
88
|
# Some parameter documentations has been truncated, see
|
86
89
|
# {Deeprails::Models::MonitorSubmitEventParams} for more details.
|
87
90
|
#
|
88
|
-
#
|
91
|
+
# Use this endpoint to submit a model input and output pair to a monitor for
|
92
|
+
# evaluation
|
89
93
|
#
|
90
94
|
# @overload submit_event(monitor_id, guardrail_metrics:, model_input:, model_output:, model_used: nil, nametag: nil, run_mode: nil, request_options: {})
|
91
95
|
#
|
data/lib/deeprails/version.rb
CHANGED
@@ -12,7 +12,6 @@ module Deeprails
|
|
12
12
|
sig { returns(T::Boolean) }
|
13
13
|
attr_accessor :success
|
14
14
|
|
15
|
-
# Response payload for creating or updating a monitor.
|
16
15
|
sig { returns(T.nilable(Deeprails::APIResponse::Data)) }
|
17
16
|
attr_reader :data
|
18
17
|
|
@@ -38,7 +37,6 @@ module Deeprails
|
|
38
37
|
def self.new(
|
39
38
|
# Represents whether the request was completed successfully.
|
40
39
|
success:,
|
41
|
-
# Response payload for creating or updating a monitor.
|
42
40
|
data: nil,
|
43
41
|
# The accompanying message for the request. Includes error details when
|
44
42
|
# applicable.
|
@@ -117,7 +115,6 @@ module Deeprails
|
|
117
115
|
sig { params(user_id: String).void }
|
118
116
|
attr_writer :user_id
|
119
117
|
|
120
|
-
# Response payload for creating or updating a monitor.
|
121
118
|
sig do
|
122
119
|
params(
|
123
120
|
monitor_id: String,
|
@@ -16,7 +16,7 @@ module Deeprails
|
|
16
16
|
|
17
17
|
# The action used to improve outputs that fail one or guardrail metrics for the
|
18
18
|
# workflow events. May be `regenerate`, `fixit`, or null which represents “do
|
19
|
-
# nothing”.
|
19
|
+
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
|
20
20
|
# Fixit attempts to directly address the shortcomings of the output using the
|
21
21
|
# guardrail failure rationale. Do nothing does not attempt any improvement.
|
22
22
|
sig do
|
@@ -101,7 +101,7 @@ module Deeprails
|
|
101
101
|
def self.new(
|
102
102
|
# The action used to improve outputs that fail one or guardrail metrics for the
|
103
103
|
# workflow events. May be `regenerate`, `fixit`, or null which represents “do
|
104
|
-
# nothing”.
|
104
|
+
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
|
105
105
|
# Fixit attempts to directly address the shortcomings of the output using the
|
106
106
|
# guardrail failure rationale. Do nothing does not attempt any improvement.
|
107
107
|
improvement_action:,
|
@@ -154,7 +154,7 @@ module Deeprails
|
|
154
154
|
|
155
155
|
# The action used to improve outputs that fail one or guardrail metrics for the
|
156
156
|
# workflow events. May be `regenerate`, `fixit`, or null which represents “do
|
157
|
-
# nothing”.
|
157
|
+
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
|
158
158
|
# Fixit attempts to directly address the shortcomings of the output using the
|
159
159
|
# guardrail failure rationale. Do nothing does not attempt any improvement.
|
160
160
|
module ImprovementAction
|
@@ -32,7 +32,7 @@ module Deeprails
|
|
32
32
|
|
33
33
|
# The action used to improve outputs that fail one or more guardrail metrics for
|
34
34
|
# the workflow events. May be `regenerate`, `fixit`, or null which represents “do
|
35
|
-
# nothing”.
|
35
|
+
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
|
36
36
|
# Fixit attempts to directly address the shortcomings of the output using the
|
37
37
|
# guardrail failure rationale. Do nothing does not attempt any improvement.
|
38
38
|
sig do
|
@@ -74,7 +74,6 @@ module Deeprails
|
|
74
74
|
sig { params(success_rate: Float).void }
|
75
75
|
attr_writer :success_rate
|
76
76
|
|
77
|
-
# Response payload for guardrail workflow operations.
|
78
77
|
sig do
|
79
78
|
params(
|
80
79
|
name: String,
|
@@ -100,7 +99,7 @@ module Deeprails
|
|
100
99
|
description: nil,
|
101
100
|
# The action used to improve outputs that fail one or more guardrail metrics for
|
102
101
|
# the workflow events. May be `regenerate`, `fixit`, or null which represents “do
|
103
|
-
# nothing”.
|
102
|
+
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
|
104
103
|
# Fixit attempts to directly address the shortcomings of the output using the
|
105
104
|
# guardrail failure rationale. Do nothing does not attempt any improvement.
|
106
105
|
improvement_action: nil,
|
@@ -140,7 +139,7 @@ module Deeprails
|
|
140
139
|
|
141
140
|
# The action used to improve outputs that fail one or more guardrail metrics for
|
142
141
|
# the workflow events. May be `regenerate`, `fixit`, or null which represents “do
|
143
|
-
# nothing”.
|
142
|
+
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
|
144
143
|
# Fixit attempts to directly address the shortcomings of the output using the
|
145
144
|
# guardrail failure rationale. Do nothing does not attempt any improvement.
|
146
145
|
module ImprovementAction
|
@@ -28,24 +28,10 @@ module Deeprails
|
|
28
28
|
sig { params(name: String).void }
|
29
29
|
attr_writer :name
|
30
30
|
|
31
|
-
# Type of thresholds to use for the workflow, either `automatic` or `custom`.
|
32
|
-
sig do
|
33
|
-
returns(
|
34
|
-
T.nilable(Deeprails::DefendUpdateWorkflowParams::Type::OrSymbol)
|
35
|
-
)
|
36
|
-
end
|
37
|
-
attr_reader :type
|
38
|
-
|
39
|
-
sig do
|
40
|
-
params(type: Deeprails::DefendUpdateWorkflowParams::Type::OrSymbol).void
|
41
|
-
end
|
42
|
-
attr_writer :type
|
43
|
-
|
44
31
|
sig do
|
45
32
|
params(
|
46
33
|
description: String,
|
47
34
|
name: String,
|
48
|
-
type: Deeprails::DefendUpdateWorkflowParams::Type::OrSymbol,
|
49
35
|
request_options: Deeprails::RequestOptions::OrHash
|
50
36
|
).returns(T.attached_class)
|
51
37
|
end
|
@@ -54,8 +40,6 @@ module Deeprails
|
|
54
40
|
description: nil,
|
55
41
|
# Name of the workflow.
|
56
42
|
name: nil,
|
57
|
-
# Type of thresholds to use for the workflow, either `automatic` or `custom`.
|
58
|
-
type: nil,
|
59
43
|
request_options: {}
|
60
44
|
)
|
61
45
|
end
|
@@ -65,43 +49,12 @@ module Deeprails
|
|
65
49
|
{
|
66
50
|
description: String,
|
67
51
|
name: String,
|
68
|
-
type: Deeprails::DefendUpdateWorkflowParams::Type::OrSymbol,
|
69
52
|
request_options: Deeprails::RequestOptions
|
70
53
|
}
|
71
54
|
)
|
72
55
|
end
|
73
56
|
def to_hash
|
74
57
|
end
|
75
|
-
|
76
|
-
# Type of thresholds to use for the workflow, either `automatic` or `custom`.
|
77
|
-
module Type
|
78
|
-
extend Deeprails::Internal::Type::Enum
|
79
|
-
|
80
|
-
TaggedSymbol =
|
81
|
-
T.type_alias do
|
82
|
-
T.all(Symbol, Deeprails::DefendUpdateWorkflowParams::Type)
|
83
|
-
end
|
84
|
-
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
85
|
-
|
86
|
-
AUTOMATIC =
|
87
|
-
T.let(
|
88
|
-
:automatic,
|
89
|
-
Deeprails::DefendUpdateWorkflowParams::Type::TaggedSymbol
|
90
|
-
)
|
91
|
-
CUSTOM =
|
92
|
-
T.let(
|
93
|
-
:custom,
|
94
|
-
Deeprails::DefendUpdateWorkflowParams::Type::TaggedSymbol
|
95
|
-
)
|
96
|
-
|
97
|
-
sig do
|
98
|
-
override.returns(
|
99
|
-
T::Array[Deeprails::DefendUpdateWorkflowParams::Type::TaggedSymbol]
|
100
|
-
)
|
101
|
-
end
|
102
|
-
def self.values
|
103
|
-
end
|
104
|
-
end
|
105
58
|
end
|
106
59
|
end
|
107
60
|
end
|
@@ -15,7 +15,6 @@ module Deeprails
|
|
15
15
|
sig { returns(T::Boolean) }
|
16
16
|
attr_accessor :success
|
17
17
|
|
18
|
-
# Detailed response payload for retrieving a monitor and its evaluations.
|
19
18
|
sig do
|
20
19
|
returns(T.nilable(Deeprails::Models::MonitorRetrieveResponse::Data))
|
21
20
|
end
|
@@ -47,7 +46,6 @@ module Deeprails
|
|
47
46
|
def self.new(
|
48
47
|
# Represents whether the request was completed successfully.
|
49
48
|
success:,
|
50
|
-
# Detailed response payload for retrieving a monitor and its evaluations.
|
51
49
|
data: nil,
|
52
50
|
# The accompanying message for the request. Includes error details when
|
53
51
|
# applicable.
|
@@ -149,7 +147,6 @@ module Deeprails
|
|
149
147
|
sig { params(user_id: String).void }
|
150
148
|
attr_writer :user_id
|
151
149
|
|
152
|
-
# Detailed response payload for retrieving a monitor and its evaluations.
|
153
150
|
sig do
|
154
151
|
params(
|
155
152
|
monitor_id: String,
|
@@ -15,7 +15,6 @@ module Deeprails
|
|
15
15
|
sig { returns(T::Boolean) }
|
16
16
|
attr_accessor :success
|
17
17
|
|
18
|
-
# Response payload for monitor event operations.
|
19
18
|
sig do
|
20
19
|
returns(T.nilable(Deeprails::Models::MonitorSubmitEventResponse::Data))
|
21
20
|
end
|
@@ -47,7 +46,6 @@ module Deeprails
|
|
47
46
|
def self.new(
|
48
47
|
# Represents whether the request was completed successfully.
|
49
48
|
success:,
|
50
|
-
# Response payload for monitor event operations.
|
51
49
|
data: nil,
|
52
50
|
# The accompanying message for the request. Includes error details when
|
53
51
|
# applicable.
|
@@ -95,7 +93,6 @@ module Deeprails
|
|
95
93
|
sig { params(created_at: Time).void }
|
96
94
|
attr_writer :created_at
|
97
95
|
|
98
|
-
# Response payload for monitor event operations.
|
99
96
|
sig do
|
100
97
|
params(
|
101
98
|
evaluation_id: String,
|
@@ -3,8 +3,8 @@
|
|
3
3
|
module Deeprails
|
4
4
|
module Resources
|
5
5
|
class Defend
|
6
|
-
#
|
7
|
-
# improvement actions
|
6
|
+
# Use this endpoint to create a new guardrail workflow with optional guardrail
|
7
|
+
# thresholds and improvement actions
|
8
8
|
sig do
|
9
9
|
params(
|
10
10
|
improvement_action:
|
@@ -24,7 +24,7 @@ module Deeprails
|
|
24
24
|
def create_workflow(
|
25
25
|
# The action used to improve outputs that fail one or guardrail metrics for the
|
26
26
|
# workflow events. May be `regenerate`, `fixit`, or null which represents “do
|
27
|
-
# nothing”.
|
27
|
+
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
|
28
28
|
# Fixit attempts to directly address the shortcomings of the output using the
|
29
29
|
# guardrail failure rationale. Do nothing does not attempt any improvement.
|
30
30
|
improvement_action:,
|
@@ -54,7 +54,7 @@ module Deeprails
|
|
54
54
|
)
|
55
55
|
end
|
56
56
|
|
57
|
-
#
|
57
|
+
# Use this endpoint to retrieve a specific event of a guardrail workflow
|
58
58
|
sig do
|
59
59
|
params(
|
60
60
|
event_id: String,
|
@@ -71,7 +71,7 @@ module Deeprails
|
|
71
71
|
)
|
72
72
|
end
|
73
73
|
|
74
|
-
#
|
74
|
+
# Use this endpoint to retrieve the details for a specific defend workflow
|
75
75
|
sig do
|
76
76
|
params(
|
77
77
|
workflow_id: String,
|
@@ -85,7 +85,8 @@ module Deeprails
|
|
85
85
|
)
|
86
86
|
end
|
87
87
|
|
88
|
-
#
|
88
|
+
# Use this endpoint to submit a model input and output pair to a workflow for
|
89
|
+
# evaluation
|
89
90
|
sig do
|
90
91
|
params(
|
91
92
|
workflow_id: String,
|
@@ -119,13 +120,12 @@ module Deeprails
|
|
119
120
|
)
|
120
121
|
end
|
121
122
|
|
122
|
-
#
|
123
|
+
# Use this endpoint to update an existing guardrail workflow
|
123
124
|
sig do
|
124
125
|
params(
|
125
126
|
workflow_id: String,
|
126
127
|
description: String,
|
127
128
|
name: String,
|
128
|
-
type: Deeprails::DefendUpdateWorkflowParams::Type::OrSymbol,
|
129
129
|
request_options: Deeprails::RequestOptions::OrHash
|
130
130
|
).returns(Deeprails::DefendResponse)
|
131
131
|
end
|
@@ -136,8 +136,6 @@ module Deeprails
|
|
136
136
|
description: nil,
|
137
137
|
# Name of the workflow.
|
138
138
|
name: nil,
|
139
|
-
# Type of thresholds to use for the workflow, either `automatic` or `custom`.
|
140
|
-
type: nil,
|
141
139
|
request_options: {}
|
142
140
|
)
|
143
141
|
end
|
@@ -3,7 +3,8 @@
|
|
3
3
|
module Deeprails
|
4
4
|
module Resources
|
5
5
|
class Monitor
|
6
|
-
#
|
6
|
+
# Use this endpoint to create a new monitor to evaluate model inputs and outputs
|
7
|
+
# using guardrails
|
7
8
|
sig do
|
8
9
|
params(
|
9
10
|
name: String,
|
@@ -20,7 +21,8 @@ module Deeprails
|
|
20
21
|
)
|
21
22
|
end
|
22
23
|
|
23
|
-
#
|
24
|
+
# Use this endpoint to retrieve the details and evaluations associated with a
|
25
|
+
# specific monitor
|
24
26
|
sig do
|
25
27
|
params(
|
26
28
|
monitor_id: String,
|
@@ -37,7 +39,8 @@ module Deeprails
|
|
37
39
|
)
|
38
40
|
end
|
39
41
|
|
40
|
-
#
|
42
|
+
# Use this endpoint to update the name, description, or status of an existing
|
43
|
+
# monitor
|
41
44
|
sig do
|
42
45
|
params(
|
43
46
|
monitor_id: String,
|
@@ -62,7 +65,8 @@ module Deeprails
|
|
62
65
|
)
|
63
66
|
end
|
64
67
|
|
65
|
-
#
|
68
|
+
# Use this endpoint to submit a model input and output pair to a monitor for
|
69
|
+
# evaluation
|
66
70
|
sig do
|
67
71
|
params(
|
68
72
|
monitor_id: String,
|
@@ -1,11 +1,7 @@
|
|
1
1
|
module Deeprails
|
2
2
|
module Models
|
3
3
|
type defend_update_workflow_params =
|
4
|
-
{
|
5
|
-
description: String,
|
6
|
-
name: String,
|
7
|
-
type: Deeprails::Models::DefendUpdateWorkflowParams::type_
|
8
|
-
}
|
4
|
+
{ description: String, name: String }
|
9
5
|
& Deeprails::Internal::Type::request_parameters
|
10
6
|
|
11
7
|
class DefendUpdateWorkflowParams < Deeprails::Internal::Type::BaseModel
|
@@ -20,36 +16,17 @@ module Deeprails
|
|
20
16
|
|
21
17
|
def name=: (String) -> String
|
22
18
|
|
23
|
-
attr_reader type: Deeprails::Models::DefendUpdateWorkflowParams::type_?
|
24
|
-
|
25
|
-
def type=: (
|
26
|
-
Deeprails::Models::DefendUpdateWorkflowParams::type_
|
27
|
-
) -> Deeprails::Models::DefendUpdateWorkflowParams::type_
|
28
|
-
|
29
19
|
def initialize: (
|
30
20
|
?description: String,
|
31
21
|
?name: String,
|
32
|
-
?type: Deeprails::Models::DefendUpdateWorkflowParams::type_,
|
33
22
|
?request_options: Deeprails::request_opts
|
34
23
|
) -> void
|
35
24
|
|
36
25
|
def to_hash: -> {
|
37
26
|
description: String,
|
38
27
|
name: String,
|
39
|
-
type: Deeprails::Models::DefendUpdateWorkflowParams::type_,
|
40
28
|
request_options: Deeprails::RequestOptions
|
41
29
|
}
|
42
|
-
|
43
|
-
type type_ = :automatic | :custom
|
44
|
-
|
45
|
-
module Type
|
46
|
-
extend Deeprails::Internal::Type::Enum
|
47
|
-
|
48
|
-
AUTOMATIC: :automatic
|
49
|
-
CUSTOM: :custom
|
50
|
-
|
51
|
-
def self?.values: -> ::Array[Deeprails::Models::DefendUpdateWorkflowParams::type_]
|
52
|
-
end
|
53
30
|
end
|
54
31
|
end
|
55
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deeprails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deeprails
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-10-
|
11
|
+
date: 2025-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|