deeprails 0.12.0 → 0.14.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.
@@ -4,6 +4,20 @@ module Deeprails
4
4
  module Models
5
5
  # @see Deeprails::Resources::Defend#retrieve_event
6
6
  class WorkflowEventDetailResponse < Deeprails::Internal::Type::BaseModel
7
+ # @!attribute evaluation_history
8
+ # History of evaluations for the event.
9
+ #
10
+ # @return [Array<Deeprails::Models::WorkflowEventDetailResponse::EvaluationHistory>]
11
+ required :evaluation_history,
12
+ -> { Deeprails::Internal::Type::ArrayOf[Deeprails::WorkflowEventDetailResponse::EvaluationHistory] }
13
+
14
+ # @!attribute evaluation_result
15
+ # Evaluation result consisting of average scores and rationales for each of the
16
+ # evaluated guardrail metrics.
17
+ #
18
+ # @return [Hash{Symbol=>Object}]
19
+ required :evaluation_result, Deeprails::Internal::Type::HashOf[Deeprails::Internal::Type::Unknown]
20
+
7
21
  # @!attribute event_id
8
22
  # A unique workflow event ID.
9
23
  #
@@ -22,11 +36,32 @@ module Deeprails
22
36
  # @return [Boolean]
23
37
  required :filtered, Deeprails::Internal::Type::Boolean
24
38
 
25
- # @!attribute improvement_tool_type
26
- # Type of improvement tool used to improve the event.
39
+ # @!attribute improved_model_output
40
+ # Improved model output after improvement tool was applied and each metric passed
41
+ # evaluation.
42
+ #
43
+ # @return [String]
44
+ required :improved_model_output, String
45
+
46
+ # @!attribute improvement_action
47
+ # Type of improvement action used to improve the event.
48
+ #
49
+ # @return [Symbol, Deeprails::Models::WorkflowEventDetailResponse::ImprovementAction]
50
+ required :improvement_action, enum: -> { Deeprails::WorkflowEventDetailResponse::ImprovementAction }
51
+
52
+ # @!attribute improvement_tool_status
53
+ # Status of the improvement tool used to improve the event.
54
+ #
55
+ # @return [Symbol, Deeprails::Models::WorkflowEventDetailResponse::ImprovementToolStatus, nil]
56
+ required :improvement_tool_status,
57
+ enum: -> { Deeprails::WorkflowEventDetailResponse::ImprovementToolStatus },
58
+ nil?: true
59
+
60
+ # @!attribute threshold_type
61
+ # Type of thresholds used to evaluate the event.
27
62
  #
28
- # @return [Symbol, Deeprails::Models::WorkflowEventDetailResponse::ImprovementToolType]
29
- required :improvement_tool_type, enum: -> { Deeprails::WorkflowEventDetailResponse::ImprovementToolType }
63
+ # @return [Symbol, Deeprails::Models::WorkflowEventDetailResponse::ThresholdType]
64
+ required :threshold_type, enum: -> { Deeprails::WorkflowEventDetailResponse::ThresholdType }
30
65
 
31
66
  # @!attribute workflow_id
32
67
  # Workflow ID associated with the event.
@@ -57,20 +92,6 @@ module Deeprails
57
92
  # @return [Hash{Symbol=>Float}, nil]
58
93
  optional :custom_hallucination_threshold_values, Deeprails::Internal::Type::HashOf[Float]
59
94
 
60
- # @!attribute evaluation_history
61
- # History of evaluations for the event.
62
- #
63
- # @return [Array<Deeprails::Models::WorkflowEventDetailResponse::EvaluationHistory>, nil]
64
- optional :evaluation_history,
65
- -> { Deeprails::Internal::Type::ArrayOf[Deeprails::WorkflowEventDetailResponse::EvaluationHistory] }
66
-
67
- # @!attribute evaluation_result
68
- # Evaluation result consisting of average scores and rationales for each of the
69
- # evaluated guardrail metrics.
70
- #
71
- # @return [Hash{Symbol=>Object}, nil]
72
- optional :evaluation_result, Deeprails::Internal::Type::HashOf[Deeprails::Internal::Type::Unknown]
73
-
74
95
  # @!attribute files
75
96
  # List of files available to the event, if any. Will only be present if
76
97
  # `file_search` is enabled.
@@ -78,38 +99,27 @@ module Deeprails
78
99
  # @return [Array<Deeprails::Models::WorkflowEventDetailResponse::File>, nil]
79
100
  optional :files, -> { Deeprails::Internal::Type::ArrayOf[Deeprails::WorkflowEventDetailResponse::File] }
80
101
 
81
- # @!attribute improved_model_output
82
- # Improved model output after improvement tool was applied and each metric passed
83
- # evaluation.
84
- #
85
- # @return [String, nil]
86
- optional :improved_model_output, String
87
-
88
- # @!attribute improvement_tool_status
89
- # Status of the improvement tool used to improve the event.
90
- #
91
- # @return [Symbol, Deeprails::Models::WorkflowEventDetailResponse::ImprovementToolStatus, nil]
92
- optional :improvement_tool_status,
93
- enum: -> { Deeprails::WorkflowEventDetailResponse::ImprovementToolStatus },
94
- nil?: true
95
-
96
- # @!attribute threshold_type
97
- # Type of thresholds used to evaluate the event.
98
- #
99
- # @return [Symbol, Deeprails::Models::WorkflowEventDetailResponse::ThresholdType, nil]
100
- optional :threshold_type, enum: -> { Deeprails::WorkflowEventDetailResponse::ThresholdType }
101
-
102
- # @!method initialize(event_id:, event_status:, filtered:, improvement_tool_type:, workflow_id:, automatic_hallucination_tolerance_levels: nil, capabilities: nil, custom_hallucination_threshold_values: nil, evaluation_history: nil, evaluation_result: nil, files: nil, improved_model_output: nil, improvement_tool_status: nil, threshold_type: nil)
102
+ # @!method initialize(evaluation_history:, evaluation_result:, event_id:, event_status:, filtered:, improved_model_output:, improvement_action:, improvement_tool_status:, threshold_type:, workflow_id:, automatic_hallucination_tolerance_levels: nil, capabilities: nil, custom_hallucination_threshold_values: nil, files: nil)
103
103
  # Some parameter documentations has been truncated, see
104
104
  # {Deeprails::Models::WorkflowEventDetailResponse} for more details.
105
105
  #
106
+ # @param evaluation_history [Array<Deeprails::Models::WorkflowEventDetailResponse::EvaluationHistory>] History of evaluations for the event.
107
+ #
108
+ # @param evaluation_result [Hash{Symbol=>Object}] Evaluation result consisting of average scores and rationales for each of the ev
109
+ #
106
110
  # @param event_id [String] A unique workflow event ID.
107
111
  #
108
112
  # @param event_status [Symbol, Deeprails::Models::WorkflowEventDetailResponse::EventStatus] Status of the event.
109
113
  #
110
114
  # @param filtered [Boolean] Whether the event was filtered and requires improvement.
111
115
  #
112
- # @param improvement_tool_type [Symbol, Deeprails::Models::WorkflowEventDetailResponse::ImprovementToolType] Type of improvement tool used to improve the event.
116
+ # @param improved_model_output [String] Improved model output after improvement tool was applied and each metric passed
117
+ #
118
+ # @param improvement_action [Symbol, Deeprails::Models::WorkflowEventDetailResponse::ImprovementAction] Type of improvement action used to improve the event.
119
+ #
120
+ # @param improvement_tool_status [Symbol, Deeprails::Models::WorkflowEventDetailResponse::ImprovementToolStatus, nil] Status of the improvement tool used to improve the event.
121
+ #
122
+ # @param threshold_type [Symbol, Deeprails::Models::WorkflowEventDetailResponse::ThresholdType] Type of thresholds used to evaluate the event.
113
123
  #
114
124
  # @param workflow_id [String] Workflow ID associated with the event.
115
125
  #
@@ -119,65 +129,7 @@ module Deeprails
119
129
  #
120
130
  # @param custom_hallucination_threshold_values [Hash{Symbol=>Float}] Mapping of guardrail metric names to threshold values. Values are floating point
121
131
  #
122
- # @param evaluation_history [Array<Deeprails::Models::WorkflowEventDetailResponse::EvaluationHistory>] History of evaluations for the event.
123
- #
124
- # @param evaluation_result [Hash{Symbol=>Object}] Evaluation result consisting of average scores and rationales for each of the ev
125
- #
126
132
  # @param files [Array<Deeprails::Models::WorkflowEventDetailResponse::File>] List of files available to the event, if any. Will only be present if `file_sear
127
- #
128
- # @param improved_model_output [String] Improved model output after improvement tool was applied and each metric passed
129
- #
130
- # @param improvement_tool_status [Symbol, Deeprails::Models::WorkflowEventDetailResponse::ImprovementToolStatus, nil] Status of the improvement tool used to improve the event.
131
- #
132
- # @param threshold_type [Symbol, Deeprails::Models::WorkflowEventDetailResponse::ThresholdType] Type of thresholds used to evaluate the event.
133
-
134
- # Status of the event.
135
- #
136
- # @see Deeprails::Models::WorkflowEventDetailResponse#event_status
137
- module EventStatus
138
- extend Deeprails::Internal::Type::Enum
139
-
140
- IN_PROGRESS = :"In Progress"
141
- COMPLETED = :Completed
142
-
143
- # @!method self.values
144
- # @return [Array<Symbol>]
145
- end
146
-
147
- # Type of improvement tool used to improve the event.
148
- #
149
- # @see Deeprails::Models::WorkflowEventDetailResponse#improvement_tool_type
150
- module ImprovementToolType
151
- extend Deeprails::Internal::Type::Enum
152
-
153
- REGEN = :regen
154
- FIXIT = :fixit
155
- DO_NOTHING = :do_nothing
156
-
157
- # @!method self.values
158
- # @return [Array<Symbol>]
159
- end
160
-
161
- module AutomaticHallucinationToleranceLevel
162
- extend Deeprails::Internal::Type::Enum
163
-
164
- LOW = :low
165
- MEDIUM = :medium
166
- HIGH = :high
167
-
168
- # @!method self.values
169
- # @return [Array<Symbol>]
170
- end
171
-
172
- class Capability < Deeprails::Internal::Type::BaseModel
173
- # @!attribute capability
174
- #
175
- # @return [String, nil]
176
- optional :capability, String
177
-
178
- # @!method initialize(capability: nil)
179
- # @param capability [String]
180
- end
181
133
 
182
134
  class EvaluationHistory < Deeprails::Internal::Type::BaseModel
183
135
  # @!attribute attempt
@@ -261,26 +213,31 @@ module Deeprails
261
213
  # @param run_mode [String]
262
214
  end
263
215
 
264
- class File < Deeprails::Internal::Type::BaseModel
265
- # @!attribute file_id
266
- #
267
- # @return [String, nil]
268
- optional :file_id, String
216
+ # Status of the event.
217
+ #
218
+ # @see Deeprails::Models::WorkflowEventDetailResponse#event_status
219
+ module EventStatus
220
+ extend Deeprails::Internal::Type::Enum
269
221
 
270
- # @!attribute file_name
271
- #
272
- # @return [String, nil]
273
- optional :file_name, String
222
+ IN_PROGRESS = :"In Progress"
223
+ COMPLETED = :Completed
274
224
 
275
- # @!attribute file_size
276
- #
277
- # @return [Integer, nil]
278
- optional :file_size, Integer
225
+ # @!method self.values
226
+ # @return [Array<Symbol>]
227
+ end
279
228
 
280
- # @!method initialize(file_id: nil, file_name: nil, file_size: nil)
281
- # @param file_id [String]
282
- # @param file_name [String]
283
- # @param file_size [Integer]
229
+ # Type of improvement action used to improve the event.
230
+ #
231
+ # @see Deeprails::Models::WorkflowEventDetailResponse#improvement_action
232
+ module ImprovementAction
233
+ extend Deeprails::Internal::Type::Enum
234
+
235
+ REGEN = :regen
236
+ FIXIT = :fixit
237
+ DO_NOTHING = :do_nothing
238
+
239
+ # @!method self.values
240
+ # @return [Array<Symbol>]
284
241
  end
285
242
 
286
243
  # Status of the improvement tool used to improve the event.
@@ -309,6 +266,49 @@ module Deeprails
309
266
  # @!method self.values
310
267
  # @return [Array<Symbol>]
311
268
  end
269
+
270
+ module AutomaticHallucinationToleranceLevel
271
+ extend Deeprails::Internal::Type::Enum
272
+
273
+ LOW = :low
274
+ MEDIUM = :medium
275
+ HIGH = :high
276
+
277
+ # @!method self.values
278
+ # @return [Array<Symbol>]
279
+ end
280
+
281
+ class Capability < Deeprails::Internal::Type::BaseModel
282
+ # @!attribute capability
283
+ #
284
+ # @return [String, nil]
285
+ optional :capability, String
286
+
287
+ # @!method initialize(capability: nil)
288
+ # @param capability [String]
289
+ end
290
+
291
+ class File < Deeprails::Internal::Type::BaseModel
292
+ # @!attribute file_id
293
+ #
294
+ # @return [String, nil]
295
+ optional :file_id, String
296
+
297
+ # @!attribute file_name
298
+ #
299
+ # @return [String, nil]
300
+ optional :file_name, String
301
+
302
+ # @!attribute file_size
303
+ #
304
+ # @return [Integer, nil]
305
+ optional :file_size, Integer
306
+
307
+ # @!method initialize(file_id: nil, file_name: nil, file_size: nil)
308
+ # @param file_id [String]
309
+ # @param file_name [String]
310
+ # @param file_size [Integer]
311
+ end
312
312
  end
313
313
  end
314
314
  end
@@ -69,6 +69,8 @@ module Deeprails
69
69
 
70
70
  MonitorEventResponse = Deeprails::Models::MonitorEventResponse
71
71
 
72
+ MonitorRetrieveEventParams = Deeprails::Models::MonitorRetrieveEventParams
73
+
72
74
  MonitorRetrieveParams = Deeprails::Models::MonitorRetrieveParams
73
75
 
74
76
  MonitorSubmitEventParams = Deeprails::Models::MonitorSubmitEventParams
@@ -97,6 +97,33 @@ module Deeprails
97
97
  )
98
98
  end
99
99
 
100
+ # Use this endpoint to retrieve the details of a specific monitor event
101
+ #
102
+ # @overload retrieve_event(event_id, monitor_id:, request_options: {})
103
+ #
104
+ # @param event_id [String] The ID of the requested monitor event.
105
+ #
106
+ # @param monitor_id [String] The ID of the monitor associated with this event.
107
+ #
108
+ # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
109
+ #
110
+ # @return [Deeprails::Models::MonitorEventDetailResponse]
111
+ #
112
+ # @see Deeprails::Models::MonitorRetrieveEventParams
113
+ def retrieve_event(event_id, params)
114
+ parsed, options = Deeprails::MonitorRetrieveEventParams.dump_request(params)
115
+ monitor_id =
116
+ parsed.delete(:monitor_id) do
117
+ raise ArgumentError.new("missing required path argument #{_1}")
118
+ end
119
+ @client.request(
120
+ method: :get,
121
+ path: ["monitor/%1$s/events/%2$s", monitor_id, event_id],
122
+ model: Deeprails::MonitorEventDetailResponse,
123
+ options: options
124
+ )
125
+ end
126
+
100
127
  # Some parameter documentations has been truncated, see
101
128
  # {Deeprails::Models::MonitorSubmitEventParams} for more details.
102
129
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deeprails
4
- VERSION = "0.12.0"
4
+ VERSION = "0.14.0"
5
5
  end
data/lib/deeprails.rb CHANGED
@@ -66,6 +66,7 @@ require_relative "deeprails/models/monitor_create_response"
66
66
  require_relative "deeprails/models/monitor_detail_response"
67
67
  require_relative "deeprails/models/monitor_event_detail_response"
68
68
  require_relative "deeprails/models/monitor_event_response"
69
+ require_relative "deeprails/models/monitor_retrieve_event_params"
69
70
  require_relative "deeprails/models/monitor_retrieve_params"
70
71
  require_relative "deeprails/models/monitor_submit_event_params"
71
72
  require_relative "deeprails/models/monitor_update_params"