deeprails 0.2.0 → 0.3.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.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -2
  3. data/README.md +5 -5
  4. data/lib/deeprails/models/api_response.rb +1 -4
  5. data/lib/deeprails/models/defend_create_workflow_params.rb +2 -2
  6. data/lib/deeprails/models/defend_response.rb +2 -4
  7. data/lib/deeprails/models/defend_submit_event_params.rb +9 -9
  8. data/lib/deeprails/models/defend_update_workflow_params.rb +1 -20
  9. data/lib/deeprails/models/monitor_retrieve_response.rb +1 -4
  10. data/lib/deeprails/models/monitor_submit_event_response.rb +2 -5
  11. data/lib/deeprails/models/workflow_event_response.rb +0 -2
  12. data/lib/deeprails/resources/defend.rb +11 -12
  13. data/lib/deeprails/resources/evaluate.rb +1 -1
  14. data/lib/deeprails/resources/monitor.rb +8 -4
  15. data/lib/deeprails/version.rb +1 -1
  16. data/rbi/deeprails/models/api_response.rbi +0 -3
  17. data/rbi/deeprails/models/defend_create_workflow_params.rbi +3 -3
  18. data/rbi/deeprails/models/defend_response.rbi +3 -4
  19. data/rbi/deeprails/models/defend_submit_event_params.rbi +11 -8
  20. data/rbi/deeprails/models/defend_update_workflow_params.rbi +0 -47
  21. data/rbi/deeprails/models/monitor_retrieve_response.rbi +0 -3
  22. data/rbi/deeprails/models/monitor_submit_event_response.rbi +0 -3
  23. data/rbi/deeprails/models/workflow_event_response.rbi +0 -1
  24. data/rbi/deeprails/resources/defend.rbi +11 -13
  25. data/rbi/deeprails/resources/evaluate.rbi +1 -1
  26. data/rbi/deeprails/resources/monitor.rbi +8 -4
  27. data/sig/deeprails/models/defend_submit_event_params.rbs +8 -6
  28. data/sig/deeprails/models/defend_update_workflow_params.rbs +1 -24
  29. data/sig/deeprails/resources/defend.rbs +1 -2
  30. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99529867238b3137b3164417b82f0ca730d8a58cac3aa93e8860196d700fa319
4
- data.tar.gz: b2b025c486e864c36ab1ba31b2d4fbfb80425687d0c531cdbed7bf0740a8ad90
3
+ metadata.gz: df06a891cae5fe9af356f4a883a1d7cdfe032694c8ecb2c137e4a9b50d102052
4
+ data.tar.gz: e9608b32d1e68dd23abe32c56d3abde77b5fb895ce9f9d429e885b4aea46a163
5
5
  SHA512:
6
- metadata.gz: 59b158ba57448e76cb9c0534552ee096eb6370cd86ecafb65ddf2ab087f75a7a87889507c50fe94c35c7cd261145591a5c408b833a5d020d2d61fa0474dcc2cc
7
- data.tar.gz: eabae44d439fd4a6936402ab146c9489b5ec1616ea0a4a36ed4243b894b00aeea19ca15d00afbc701e2bbd1be087dc3b6a8b13dda58079e3e2b6276ae3eaa7d5
6
+ metadata.gz: 5458a4f2cfc15179a2380c88c5af82a5d54e56b05b1d5ae2f190796c1af93b20b0498bc4b1f3c4b2d9b03b1a3fa3dbf45565e9da5944b70376be06c46324b2df
7
+ data.tar.gz: 61c15fa86dbc9ebed224b38091ca0637bc7f6feadd6eea10847d57ed4ef0fe2600243d57bf2339c159a7b49078804157a38c0bd2f9305e9adaa5dccd3bbe5fd1
data/CHANGELOG.md CHANGED
@@ -1,12 +1,33 @@
1
1
  # Changelog
2
2
 
3
- ## 0.2.0 (2025-10-07)
3
+ ## 0.3.0 (2025-10-10)
4
+
5
+ Full Changelog: [v0.2.1...v0.3.0](https://github.com/deeprails/deeprails-ruby-sdk/compare/v0.2.1...v0.3.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** manual updates ([986412f](https://github.com/deeprails/deeprails-ruby-sdk/commit/986412f6888691af0abdec609a5d456bdac2c1e9))
10
+
11
+ ## 0.2.1 (2025-10-09)
12
+
13
+ Full Changelog: [v0.2.0...v0.2.1](https://github.com/deeprails/deeprails-ruby-sdk/compare/v0.2.0...v0.2.1)
14
+
15
+ ### Chores
16
+
17
+ * ignore linter error for tests having large collections ([202c9e1](https://github.com/deeprails/deeprails-ruby-sdk/commit/202c9e1977aaebb7e09883564d4694a2d41e4416))
18
+
19
+ ## 0.2.0 (2025-10-08)
4
20
 
5
21
  Full Changelog: [v0.1.0...v0.2.0](https://github.com/deeprails/deeprails-ruby-sdk/compare/v0.1.0...v0.2.0)
6
22
 
7
23
  ### Features
8
24
 
9
- * **api:** manual updates ([40308c3](https://github.com/deeprails/deeprails-ruby-sdk/commit/40308c3e3ebfb15a6ab606a13f75e97656daff19))
25
+ * **api:** adding code samples ([9597e09](https://github.com/deeprails/deeprails-ruby-sdk/commit/9597e09967d659172d52c3935b3dd8f3e0018783))
26
+
27
+
28
+ ### Chores
29
+
30
+ * sync repo ([a33597d](https://github.com/deeprails/deeprails-ruby-sdk/commit/a33597d5677081f50207f926f9950d9914700fb3))
10
31
 
11
32
  ## 0.1.0 (2025-10-07)
12
33
 
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.2.0"
18
+ gem "deeprails", "~> 0.3.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -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.85, instruction_adherence: 0.75},
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.85, instruction_adherence: 0.75},
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.85, instruction_adherence: 0.75},
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.85, instruction_adherence: 0.75},
156
+ metrics: {completeness: 0.8, instruction_adherence: 0.75},
157
157
  name: "Push Alert Workflow",
158
158
  type: "custom",
159
159
  request_options: {
@@ -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] Response payload for creating or updating a monitor.
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”. ReGen runs the user's exact input prompt with minor induced variance.
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”. ReGen runs the user's exact input prompt with minor induced variance.
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”. ReGen runs the user's exact input prompt with minor induced variance.
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”. ReGen runs the user's exact input prompt with minor induced variance.
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
  #
@@ -27,12 +27,6 @@ module Deeprails
27
27
  # @return [String]
28
28
  required :model_used, String
29
29
 
30
- # @!attribute nametag
31
- # An optional, user-defined tag for the event.
32
- #
33
- # @return [String]
34
- required :nametag, String
35
-
36
30
  # @!attribute run_mode
37
31
  # Run mode for the workflow event. The run mode allows the user to optimize for
38
32
  # speed, accuracy, and cost by determining which models are used to evaluate the
@@ -42,7 +36,13 @@ module Deeprails
42
36
  # @return [Symbol, Deeprails::Models::DefendSubmitEventParams::RunMode]
43
37
  required :run_mode, enum: -> { Deeprails::DefendSubmitEventParams::RunMode }
44
38
 
45
- # @!method initialize(model_input:, model_output:, model_used:, nametag:, run_mode:, request_options: {})
39
+ # @!attribute nametag
40
+ # An optional, user-defined tag for the event.
41
+ #
42
+ # @return [String, nil]
43
+ optional :nametag, String
44
+
45
+ # @!method initialize(model_input:, model_output:, model_used:, run_mode:, nametag: nil, request_options: {})
46
46
  # Some parameter documentations has been truncated, see
47
47
  # {Deeprails::Models::DefendSubmitEventParams} for more details.
48
48
  #
@@ -52,10 +52,10 @@ module Deeprails
52
52
  #
53
53
  # @param model_used [String] Model ID used to generate the output, like `gpt-4o` or `o3`.
54
54
  #
55
- # @param nametag [String] An optional, user-defined tag for the event.
56
- #
57
55
  # @param run_mode [Symbol, Deeprails::Models::DefendSubmitEventParams::RunMode] Run mode for the workflow event. The run mode allows the user to optimize for s
58
56
  #
57
+ # @param nametag [String] An optional, user-defined tag for the event.
58
+ #
59
59
  # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}]
60
60
 
61
61
  class ModelInput < Deeprails::Internal::Type::BaseModel
@@ -19,31 +19,12 @@ module Deeprails
19
19
  # @return [String, nil]
20
20
  optional :name, String
21
21
 
22
- # @!attribute type
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] Detailed response payload for retrieving a monitor and its evaluations.
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] Response payload for monitor event operations.
33
+ # @param data [Deeprails::Models::MonitorSubmitEventResponse::Data]
35
34
  #
36
- # @param message [String] The accompanying message for the request. Includes error details when applicabl
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
- # Create a new guardrail workflow with optional guardrail thresholds and
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
- # Retrieve a specific event of a guardrail workflow.
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
- # Retrieve the details for a specific guardrail workflow.
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,9 +91,10 @@ module Deeprails
91
91
  # Some parameter documentations has been truncated, see
92
92
  # {Deeprails::Models::DefendSubmitEventParams} for more details.
93
93
  #
94
- # Submit a model input and output pair to a workflow for evaluation.
94
+ # Use this endpoint to submit a model input and output pair to a workflow for
95
+ # evaluation
95
96
  #
96
- # @overload submit_event(workflow_id, model_input:, model_output:, model_used:, nametag:, run_mode:, request_options: {})
97
+ # @overload submit_event(workflow_id, model_input:, model_output:, model_used:, run_mode:, nametag: nil, request_options: {})
97
98
  #
98
99
  # @param workflow_id [String] Workflow ID associated with this event.
99
100
  #
@@ -103,10 +104,10 @@ module Deeprails
103
104
  #
104
105
  # @param model_used [String] Model ID used to generate the output, like `gpt-4o` or `o3`.
105
106
  #
106
- # @param nametag [String] An optional, user-defined tag for the event.
107
- #
108
107
  # @param run_mode [Symbol, Deeprails::Models::DefendSubmitEventParams::RunMode] Run mode for the workflow event. The run mode allows the user to optimize for s
109
108
  #
109
+ # @param nametag [String] An optional, user-defined tag for the event.
110
+ #
110
111
  # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
111
112
  #
112
113
  # @return [Deeprails::Models::WorkflowEventResponse]
@@ -123,9 +124,9 @@ module Deeprails
123
124
  )
124
125
  end
125
126
 
126
- # Update an existing guardrail workflow.
127
+ # Use this endpoint to update an existing guardrail workflow
127
128
  #
128
- # @overload update_workflow(workflow_id, description: nil, name: nil, type: nil, request_options: {})
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]
@@ -39,7 +39,7 @@ module Deeprails
39
39
  )
40
40
  end
41
41
 
42
- # Retrieve the evaluation record for a given evaluation ID.
42
+ # Use this endpoint to retrieve the evaluation record for a given evaluation ID
43
43
  #
44
44
  # @overload retrieve(eval_id, request_options: {})
45
45
  #
@@ -3,7 +3,8 @@
3
3
  module Deeprails
4
4
  module Resources
5
5
  class Monitor
6
- # Create a new monitor to evaluate model inputs and outputs using guardrails.
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
- # Retrieve the details and evaluations associated with a specific monitor.
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
- # Update the name, description, or status of an existing monitor.
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
- # Submit a model input and output pair to a monitor for evaluation.
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
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deeprails
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
@@ -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”. ReGen runs the user's exact input prompt with minor induced variance.
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”. ReGen runs the user's exact input prompt with minor induced variance.
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”. ReGen runs the user's exact input prompt with minor induced variance.
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”. ReGen runs the user's exact input prompt with minor induced variance.
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”. ReGen runs the user's exact input prompt with minor induced variance.
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”. ReGen runs the user's exact input prompt with minor induced variance.
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
@@ -35,10 +35,6 @@ module Deeprails
35
35
  sig { returns(String) }
36
36
  attr_accessor :model_used
37
37
 
38
- # An optional, user-defined tag for the event.
39
- sig { returns(String) }
40
- attr_accessor :nametag
41
-
42
38
  # Run mode for the workflow event. The run mode allows the user to optimize for
43
39
  # speed, accuracy, and cost by determining which models are used to evaluate the
44
40
  # event. Available run modes include `precision_plus`, `precision`, `smart`, and
@@ -46,13 +42,20 @@ module Deeprails
46
42
  sig { returns(Deeprails::DefendSubmitEventParams::RunMode::OrSymbol) }
47
43
  attr_accessor :run_mode
48
44
 
45
+ # An optional, user-defined tag for the event.
46
+ sig { returns(T.nilable(String)) }
47
+ attr_reader :nametag
48
+
49
+ sig { params(nametag: String).void }
50
+ attr_writer :nametag
51
+
49
52
  sig do
50
53
  params(
51
54
  model_input: Deeprails::DefendSubmitEventParams::ModelInput::OrHash,
52
55
  model_output: String,
53
56
  model_used: String,
54
- nametag: String,
55
57
  run_mode: Deeprails::DefendSubmitEventParams::RunMode::OrSymbol,
58
+ nametag: String,
56
59
  request_options: Deeprails::RequestOptions::OrHash
57
60
  ).returns(T.attached_class)
58
61
  end
@@ -65,13 +68,13 @@ module Deeprails
65
68
  model_output:,
66
69
  # Model ID used to generate the output, like `gpt-4o` or `o3`.
67
70
  model_used:,
68
- # An optional, user-defined tag for the event.
69
- nametag:,
70
71
  # Run mode for the workflow event. The run mode allows the user to optimize for
71
72
  # speed, accuracy, and cost by determining which models are used to evaluate the
72
73
  # event. Available run modes include `precision_plus`, `precision`, `smart`, and
73
74
  # `economy`. Defaults to `smart`.
74
75
  run_mode:,
76
+ # An optional, user-defined tag for the event.
77
+ nametag: nil,
75
78
  request_options: {}
76
79
  )
77
80
  end
@@ -82,8 +85,8 @@ module Deeprails
82
85
  model_input: Deeprails::DefendSubmitEventParams::ModelInput,
83
86
  model_output: String,
84
87
  model_used: String,
85
- nametag: String,
86
88
  run_mode: Deeprails::DefendSubmitEventParams::RunMode::OrSymbol,
89
+ nametag: String,
87
90
  request_options: Deeprails::RequestOptions
88
91
  }
89
92
  )
@@ -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,
@@ -40,7 +40,6 @@ module Deeprails
40
40
  sig { params(filtered: T::Boolean).void }
41
41
  attr_writer :filtered
42
42
 
43
- # Response payload for workflow event operations.
44
43
  sig do
45
44
  params(
46
45
  event_id: String,
@@ -3,8 +3,8 @@
3
3
  module Deeprails
4
4
  module Resources
5
5
  class Defend
6
- # Create a new guardrail workflow with optional guardrail thresholds and
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”. ReGen runs the user's exact input prompt with minor induced variance.
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
- # Retrieve a specific event of a guardrail workflow.
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
- # Retrieve the details for a specific guardrail workflow.
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,15 +85,16 @@ module Deeprails
85
85
  )
86
86
  end
87
87
 
88
- # Submit a model input and output pair to a workflow for evaluation.
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,
92
93
  model_input: Deeprails::DefendSubmitEventParams::ModelInput::OrHash,
93
94
  model_output: String,
94
95
  model_used: String,
95
- nametag: String,
96
96
  run_mode: Deeprails::DefendSubmitEventParams::RunMode::OrSymbol,
97
+ nametag: String,
97
98
  request_options: Deeprails::RequestOptions::OrHash
98
99
  ).returns(Deeprails::WorkflowEventResponse)
99
100
  end
@@ -108,24 +109,23 @@ module Deeprails
108
109
  model_output:,
109
110
  # Model ID used to generate the output, like `gpt-4o` or `o3`.
110
111
  model_used:,
111
- # An optional, user-defined tag for the event.
112
- nametag:,
113
112
  # Run mode for the workflow event. The run mode allows the user to optimize for
114
113
  # speed, accuracy, and cost by determining which models are used to evaluate the
115
114
  # event. Available run modes include `precision_plus`, `precision`, `smart`, and
116
115
  # `economy`. Defaults to `smart`.
117
116
  run_mode:,
117
+ # An optional, user-defined tag for the event.
118
+ nametag: nil,
118
119
  request_options: {}
119
120
  )
120
121
  end
121
122
 
122
- # Update an existing guardrail workflow.
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
@@ -43,7 +43,7 @@ module Deeprails
43
43
  )
44
44
  end
45
45
 
46
- # Retrieve the evaluation record for a given evaluation ID.
46
+ # Use this endpoint to retrieve the evaluation record for a given evaluation ID
47
47
  sig do
48
48
  params(
49
49
  eval_id: String,
@@ -3,7 +3,8 @@
3
3
  module Deeprails
4
4
  module Resources
5
5
  class Monitor
6
- # Create a new monitor to evaluate model inputs and outputs using guardrails.
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
- # Retrieve the details and evaluations associated with a specific monitor.
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
- # Update the name, description, or status of an existing monitor.
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
- # Submit a model input and output pair to a monitor for evaluation.
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,
@@ -5,8 +5,8 @@ module Deeprails
5
5
  model_input: Deeprails::DefendSubmitEventParams::ModelInput,
6
6
  model_output: String,
7
7
  model_used: String,
8
- nametag: String,
9
- run_mode: Deeprails::Models::DefendSubmitEventParams::run_mode
8
+ run_mode: Deeprails::Models::DefendSubmitEventParams::run_mode,
9
+ nametag: String
10
10
  }
11
11
  & Deeprails::Internal::Type::request_parameters
12
12
 
@@ -20,16 +20,18 @@ module Deeprails
20
20
 
21
21
  attr_accessor model_used: String
22
22
 
23
- attr_accessor nametag: String
24
-
25
23
  attr_accessor run_mode: Deeprails::Models::DefendSubmitEventParams::run_mode
26
24
 
25
+ attr_reader nametag: String?
26
+
27
+ def nametag=: (String) -> String
28
+
27
29
  def initialize: (
28
30
  model_input: Deeprails::DefendSubmitEventParams::ModelInput,
29
31
  model_output: String,
30
32
  model_used: String,
31
- nametag: String,
32
33
  run_mode: Deeprails::Models::DefendSubmitEventParams::run_mode,
34
+ ?nametag: String,
33
35
  ?request_options: Deeprails::request_opts
34
36
  ) -> void
35
37
 
@@ -37,8 +39,8 @@ module Deeprails
37
39
  model_input: Deeprails::DefendSubmitEventParams::ModelInput,
38
40
  model_output: String,
39
41
  model_used: String,
40
- nametag: String,
41
42
  run_mode: Deeprails::Models::DefendSubmitEventParams::run_mode,
43
+ nametag: String,
42
44
  request_options: Deeprails::RequestOptions
43
45
  }
44
46
 
@@ -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
@@ -28,8 +28,8 @@ module Deeprails
28
28
  model_input: Deeprails::DefendSubmitEventParams::ModelInput,
29
29
  model_output: String,
30
30
  model_used: String,
31
- nametag: String,
32
31
  run_mode: Deeprails::Models::DefendSubmitEventParams::run_mode,
32
+ ?nametag: String,
33
33
  ?request_options: Deeprails::request_opts
34
34
  ) -> Deeprails::WorkflowEventResponse
35
35
 
@@ -37,7 +37,6 @@ module Deeprails
37
37
  String workflow_id,
38
38
  ?description: String,
39
39
  ?name: String,
40
- ?type: Deeprails::Models::DefendUpdateWorkflowParams::type_,
41
40
  ?request_options: Deeprails::request_opts
42
41
  ) -> Deeprails::DefendResponse
43
42
 
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.2.0
4
+ version: 0.3.0
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-07 00:00:00.000000000 Z
11
+ date: 2025-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool