deeprails 0.6.0 → 0.8.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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +30 -6
  4. data/lib/deeprails/internal/transport/pooled_net_requester.rb +30 -24
  5. data/lib/deeprails/models/defend_create_workflow_params.rb +4 -4
  6. data/lib/deeprails/models/defend_response.rb +4 -4
  7. data/lib/deeprails/models/defend_submit_event_params.rb +6 -6
  8. data/lib/deeprails/models/evaluate_create_params.rb +4 -4
  9. data/lib/deeprails/models/evaluation.rb +4 -4
  10. data/lib/deeprails/models/monitor_detail_response.rb +150 -0
  11. data/lib/deeprails/models/monitor_event_response.rb +41 -0
  12. data/lib/deeprails/models/monitor_response.rb +83 -0
  13. data/lib/deeprails/models/monitor_submit_event_params.rb +4 -4
  14. data/lib/deeprails/models.rb +6 -2
  15. data/lib/deeprails/resources/defend.rb +2 -2
  16. data/lib/deeprails/resources/monitor.rb +8 -8
  17. data/lib/deeprails/version.rb +1 -1
  18. data/lib/deeprails.rb +3 -3
  19. data/rbi/deeprails/models/defend_create_workflow_params.rbi +6 -6
  20. data/rbi/deeprails/models/defend_response.rbi +6 -6
  21. data/rbi/deeprails/models/defend_submit_event_params.rbi +8 -8
  22. data/rbi/deeprails/models/evaluate_create_params.rbi +6 -6
  23. data/rbi/deeprails/models/evaluation.rbi +6 -6
  24. data/rbi/deeprails/models/monitor_detail_response.rbi +251 -0
  25. data/rbi/deeprails/models/monitor_event_response.rbi +64 -0
  26. data/rbi/deeprails/models/monitor_response.rbi +142 -0
  27. data/rbi/deeprails/models/monitor_submit_event_params.rbi +6 -6
  28. data/rbi/deeprails/models.rbi +6 -2
  29. data/rbi/deeprails/resources/defend.rbi +4 -4
  30. data/rbi/deeprails/resources/evaluate.rbi +2 -2
  31. data/rbi/deeprails/resources/monitor.rbi +6 -6
  32. data/sig/deeprails/models/defend_create_workflow_params.rbs +5 -5
  33. data/sig/deeprails/models/defend_response.rbs +5 -5
  34. data/sig/deeprails/models/monitor_detail_response.rbs +134 -0
  35. data/sig/deeprails/models/monitor_event_response.rbs +37 -0
  36. data/sig/deeprails/models/monitor_response.rbs +73 -0
  37. data/sig/deeprails/models.rbs +6 -2
  38. data/sig/deeprails/resources/defend.rbs +1 -1
  39. data/sig/deeprails/resources/monitor.rbs +4 -4
  40. metadata +11 -11
  41. data/lib/deeprails/models/api_response.rb +0 -116
  42. data/lib/deeprails/models/monitor_retrieve_response.rb +0 -183
  43. data/lib/deeprails/models/monitor_submit_event_response.rb +0 -74
  44. data/rbi/deeprails/models/api_response.rbi +0 -201
  45. data/rbi/deeprails/models/monitor_retrieve_response.rbi +0 -333
  46. data/rbi/deeprails/models/monitor_submit_event_response.rbi +0 -131
  47. data/sig/deeprails/models/api_response.rbs +0 -100
  48. data/sig/deeprails/models/monitor_retrieve_response.rbs +0 -167
  49. data/sig/deeprails/models/monitor_submit_event_response.rbs +0 -70
@@ -9,7 +9,7 @@ module Deeprails
9
9
  # Use this endpoint to create a new guardrail workflow with optional guardrail
10
10
  # thresholds and improvement actions
11
11
  #
12
- # @overload create_workflow(improvement_action:, name:, type:, automatic_hallucination_tolerance_levels: nil, custom_hallucination_threshold_values: nil, description: nil, max_improvement_attempt: nil, request_options: {})
12
+ # @overload create_workflow(improvement_action:, name:, type:, automatic_hallucination_tolerance_levels: nil, custom_hallucination_threshold_values: nil, description: nil, max_improvement_attempts: nil, request_options: {})
13
13
  #
14
14
  # @param improvement_action [Symbol, Deeprails::Models::DefendCreateWorkflowParams::ImprovementAction] The action used to improve outputs that fail one or guardrail metrics for the wo
15
15
  #
@@ -23,7 +23,7 @@ module Deeprails
23
23
  #
24
24
  # @param description [String] Description for the workflow.
25
25
  #
26
- # @param max_improvement_attempt [Integer] Max. number of improvement action retries until a given event passes the guardra
26
+ # @param max_improvement_attempts [Integer] Max. number of improvement action retries until a given event passes the guardra
27
27
  #
28
28
  # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
29
29
  #
@@ -14,7 +14,7 @@ module Deeprails
14
14
  #
15
15
  # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
16
16
  #
17
- # @return [Deeprails::Models::APIResponse]
17
+ # @return [Deeprails::Models::MonitorResponse]
18
18
  #
19
19
  # @see Deeprails::Models::MonitorCreateParams
20
20
  def create(params)
@@ -23,7 +23,7 @@ module Deeprails
23
23
  method: :post,
24
24
  path: "monitor",
25
25
  body: parsed,
26
- model: Deeprails::APIResponse,
26
+ model: Deeprails::MonitorResponse,
27
27
  options: options
28
28
  )
29
29
  end
@@ -39,7 +39,7 @@ module Deeprails
39
39
  #
40
40
  # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
41
41
  #
42
- # @return [Deeprails::Models::MonitorRetrieveResponse]
42
+ # @return [Deeprails::Models::MonitorDetailResponse]
43
43
  #
44
44
  # @see Deeprails::Models::MonitorRetrieveParams
45
45
  def retrieve(monitor_id, params = {})
@@ -48,7 +48,7 @@ module Deeprails
48
48
  method: :get,
49
49
  path: ["monitor/%1$s", monitor_id],
50
50
  query: parsed,
51
- model: Deeprails::Models::MonitorRetrieveResponse,
51
+ model: Deeprails::MonitorDetailResponse,
52
52
  options: options
53
53
  )
54
54
  end
@@ -71,7 +71,7 @@ module Deeprails
71
71
  #
72
72
  # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
73
73
  #
74
- # @return [Deeprails::Models::APIResponse]
74
+ # @return [Deeprails::Models::MonitorResponse]
75
75
  #
76
76
  # @see Deeprails::Models::MonitorUpdateParams
77
77
  def update(monitor_id, params = {})
@@ -80,7 +80,7 @@ module Deeprails
80
80
  method: :put,
81
81
  path: ["monitor/%1$s", monitor_id],
82
82
  body: parsed,
83
- model: Deeprails::APIResponse,
83
+ model: Deeprails::MonitorResponse,
84
84
  options: options
85
85
  )
86
86
  end
@@ -109,7 +109,7 @@ module Deeprails
109
109
  #
110
110
  # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
111
111
  #
112
- # @return [Deeprails::Models::MonitorSubmitEventResponse]
112
+ # @return [Deeprails::Models::MonitorEventResponse]
113
113
  #
114
114
  # @see Deeprails::Models::MonitorSubmitEventParams
115
115
  def submit_event(monitor_id, params)
@@ -118,7 +118,7 @@ module Deeprails
118
118
  method: :post,
119
119
  path: ["monitor/%1$s/events", monitor_id],
120
120
  body: parsed,
121
- model: Deeprails::Models::MonitorSubmitEventResponse,
121
+ model: Deeprails::MonitorEventResponse,
122
122
  options: options
123
123
  )
124
124
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Deeprails
4
- VERSION = "0.6.0"
4
+ VERSION = "0.8.0"
5
5
  end
data/lib/deeprails.rb CHANGED
@@ -50,7 +50,6 @@ require_relative "deeprails/errors"
50
50
  require_relative "deeprails/internal/transport/base_client"
51
51
  require_relative "deeprails/internal/transport/pooled_net_requester"
52
52
  require_relative "deeprails/client"
53
- require_relative "deeprails/models/api_response"
54
53
  require_relative "deeprails/models/defend_create_workflow_params"
55
54
  require_relative "deeprails/models/defend_response"
56
55
  require_relative "deeprails/models/defend_retrieve_event_params"
@@ -61,10 +60,11 @@ require_relative "deeprails/models/evaluate_create_params"
61
60
  require_relative "deeprails/models/evaluate_retrieve_params"
62
61
  require_relative "deeprails/models/evaluation"
63
62
  require_relative "deeprails/models/monitor_create_params"
63
+ require_relative "deeprails/models/monitor_detail_response"
64
+ require_relative "deeprails/models/monitor_event_response"
65
+ require_relative "deeprails/models/monitor_response"
64
66
  require_relative "deeprails/models/monitor_retrieve_params"
65
- require_relative "deeprails/models/monitor_retrieve_response"
66
67
  require_relative "deeprails/models/monitor_submit_event_params"
67
- require_relative "deeprails/models/monitor_submit_event_response"
68
68
  require_relative "deeprails/models/monitor_update_params"
69
69
  require_relative "deeprails/models/workflow_event_response"
70
70
  require_relative "deeprails/models"
@@ -88,10 +88,10 @@ module Deeprails
88
88
  # Max. number of improvement action retries until a given event passes the
89
89
  # guardrails. Defaults to 10.
90
90
  sig { returns(T.nilable(Integer)) }
91
- attr_reader :max_improvement_attempt
91
+ attr_reader :max_improvement_attempts
92
92
 
93
- sig { params(max_improvement_attempt: Integer).void }
94
- attr_writer :max_improvement_attempt
93
+ sig { params(max_improvement_attempts: Integer).void }
94
+ attr_writer :max_improvement_attempts
95
95
 
96
96
  sig do
97
97
  params(
@@ -106,7 +106,7 @@ module Deeprails
106
106
  ],
107
107
  custom_hallucination_threshold_values: T::Hash[Symbol, Float],
108
108
  description: String,
109
- max_improvement_attempt: Integer,
109
+ max_improvement_attempts: Integer,
110
110
  request_options: Deeprails::RequestOptions::OrHash
111
111
  ).returns(T.attached_class)
112
112
  end
@@ -138,7 +138,7 @@ module Deeprails
138
138
  description: nil,
139
139
  # Max. number of improvement action retries until a given event passes the
140
140
  # guardrails. Defaults to 10.
141
- max_improvement_attempt: nil,
141
+ max_improvement_attempts: nil,
142
142
  request_options: {}
143
143
  )
144
144
  end
@@ -157,7 +157,7 @@ module Deeprails
157
157
  ],
158
158
  custom_hallucination_threshold_values: T::Hash[Symbol, Float],
159
159
  description: String,
160
- max_improvement_attempt: Integer,
160
+ max_improvement_attempts: Integer,
161
161
  request_options: Deeprails::RequestOptions
162
162
  }
163
163
  )
@@ -53,10 +53,10 @@ module Deeprails
53
53
  # Max. number of improvement action retries until a given event passes the
54
54
  # guardrails.
55
55
  sig { returns(T.nilable(Integer)) }
56
- attr_reader :max_improvement_attempt
56
+ attr_reader :max_improvement_attempts
57
57
 
58
- sig { params(max_improvement_attempt: Integer).void }
59
- attr_writer :max_improvement_attempt
58
+ sig { params(max_improvement_attempts: Integer).void }
59
+ attr_writer :max_improvement_attempts
60
60
 
61
61
  # The most recent time the workflow was modified in UTC.
62
62
  sig { returns(T.nilable(Time)) }
@@ -90,7 +90,7 @@ module Deeprails
90
90
  description: String,
91
91
  improvement_action:
92
92
  Deeprails::DefendResponse::ImprovementAction::OrSymbol,
93
- max_improvement_attempt: Integer,
93
+ max_improvement_attempts: Integer,
94
94
  modified_at: Time,
95
95
  status: Deeprails::DefendResponse::Status::OrSymbol,
96
96
  success_rate: Float
@@ -113,7 +113,7 @@ module Deeprails
113
113
  improvement_action: nil,
114
114
  # Max. number of improvement action retries until a given event passes the
115
115
  # guardrails.
116
- max_improvement_attempt: nil,
116
+ max_improvement_attempts: nil,
117
117
  # The most recent time the workflow was modified in UTC.
118
118
  modified_at: nil,
119
119
  # Status of the selected workflow. May be `inactive` or `active`. Inactive
@@ -133,7 +133,7 @@ module Deeprails
133
133
  description: String,
134
134
  improvement_action:
135
135
  Deeprails::DefendResponse::ImprovementAction::TaggedSymbol,
136
- max_improvement_attempt: Integer,
136
+ max_improvement_attempts: Integer,
137
137
  modified_at: Time,
138
138
  status: Deeprails::DefendResponse::Status::TaggedSymbol,
139
139
  success_rate: Float
@@ -15,8 +15,8 @@ module Deeprails
15
15
  end
16
16
 
17
17
  # A dictionary of inputs sent to the LLM to generate output. The dictionary must
18
- # contain at least `user_prompt` or `system_prompt` field. For
19
- # ground_truth_aherence guadrail metric, `ground_truth` should be provided.
18
+ # contain at least a `user_prompt` field or a `system_prompt` field. For the
19
+ # ground_truth_adherence guardrail metric, `ground_truth` should be provided.
20
20
  sig { returns(Deeprails::DefendSubmitEventParams::ModelInput) }
21
21
  attr_reader :model_input
22
22
 
@@ -61,8 +61,8 @@ module Deeprails
61
61
  end
62
62
  def self.new(
63
63
  # A dictionary of inputs sent to the LLM to generate output. The dictionary must
64
- # contain at least `user_prompt` or `system_prompt` field. For
65
- # ground_truth_aherence guadrail metric, `ground_truth` should be provided.
64
+ # contain at least a `user_prompt` field or a `system_prompt` field. For the
65
+ # ground_truth_adherence guardrail metric, `ground_truth` should be provided.
66
66
  model_input:,
67
67
  # Output generated by the LLM to be evaluated.
68
68
  model_output:,
@@ -103,7 +103,7 @@ module Deeprails
103
103
  )
104
104
  end
105
105
 
106
- # The ground truth for evaluating Ground Truth Adherence guardrail.
106
+ # The ground truth for evaluating the Ground Truth Adherence guardrail.
107
107
  sig { returns(T.nilable(String)) }
108
108
  attr_reader :ground_truth
109
109
 
@@ -125,8 +125,8 @@ module Deeprails
125
125
  attr_writer :user_prompt
126
126
 
127
127
  # A dictionary of inputs sent to the LLM to generate output. The dictionary must
128
- # contain at least `user_prompt` or `system_prompt` field. For
129
- # ground_truth_aherence guadrail metric, `ground_truth` should be provided.
128
+ # contain at least a `user_prompt` field or a `system_prompt` field. For the
129
+ # ground_truth_adherence guardrail metric, `ground_truth` should be provided.
130
130
  sig do
131
131
  params(
132
132
  ground_truth: String,
@@ -135,7 +135,7 @@ module Deeprails
135
135
  ).returns(T.attached_class)
136
136
  end
137
137
  def self.new(
138
- # The ground truth for evaluating Ground Truth Adherence guardrail.
138
+ # The ground truth for evaluating the Ground Truth Adherence guardrail.
139
139
  ground_truth: nil,
140
140
  # The system prompt used to generate the output.
141
141
  system_prompt: nil,
@@ -12,8 +12,8 @@ module Deeprails
12
12
  end
13
13
 
14
14
  # A dictionary of inputs sent to the LLM to generate output. The dictionary must
15
- # contain at least `user_prompt` or `system_prompt` field. For
16
- # ground_truth_aherence guadrail metric, `ground_truth` should be provided.
15
+ # contain at least a `user_prompt` field or a `system_prompt` field. For
16
+ # ground_truth_adherence guardrail metric, `ground_truth` should be provided.
17
17
  sig { returns(Deeprails::EvaluateCreateParams::ModelInput) }
18
18
  attr_reader :model_input
19
19
 
@@ -85,8 +85,8 @@ module Deeprails
85
85
  end
86
86
  def self.new(
87
87
  # A dictionary of inputs sent to the LLM to generate output. The dictionary must
88
- # contain at least `user_prompt` or `system_prompt` field. For
89
- # ground_truth_aherence guadrail metric, `ground_truth` should be provided.
88
+ # contain at least a `user_prompt` field or a `system_prompt` field. For
89
+ # ground_truth_adherence guardrail metric, `ground_truth` should be provided.
90
90
  model_input:,
91
91
  # Output generated by the LLM to be evaluated.
92
92
  model_output:,
@@ -157,8 +157,8 @@ module Deeprails
157
157
  attr_writer :user_prompt
158
158
 
159
159
  # A dictionary of inputs sent to the LLM to generate output. The dictionary must
160
- # contain at least `user_prompt` or `system_prompt` field. For
161
- # ground_truth_aherence guadrail metric, `ground_truth` should be provided.
160
+ # contain at least a `user_prompt` field or a `system_prompt` field. For
161
+ # ground_truth_adherence guardrail metric, `ground_truth` should be provided.
162
162
  sig do
163
163
  params(
164
164
  ground_truth: String,
@@ -17,8 +17,8 @@ module Deeprails
17
17
  attr_accessor :evaluation_status
18
18
 
19
19
  # A dictionary of inputs sent to the LLM to generate output. The dictionary must
20
- # contain at least `user_prompt` or `system_prompt` field. For
21
- # ground_truth_aherence guadrail metric, `ground_truth` should be provided.
20
+ # contain at least a `user_prompt` field or a `system_prompt` field. For
21
+ # ground_truth_adherence guardrail metric, `ground_truth` should be provided.
22
22
  sig { returns(Deeprails::Evaluation::ModelInput) }
23
23
  attr_reader :model_input
24
24
 
@@ -162,8 +162,8 @@ module Deeprails
162
162
  # Status of the evaluation.
163
163
  evaluation_status:,
164
164
  # A dictionary of inputs sent to the LLM to generate output. The dictionary must
165
- # contain at least `user_prompt` or `system_prompt` field. For
166
- # ground_truth_aherence guadrail metric, `ground_truth` should be provided.
165
+ # contain at least a `user_prompt` field or a `system_prompt` field. For
166
+ # ground_truth_adherence guardrail metric, `ground_truth` should be provided.
167
167
  model_input:,
168
168
  # Output generated by the LLM to be evaluated.
169
169
  model_output:,
@@ -298,8 +298,8 @@ module Deeprails
298
298
  attr_writer :user_prompt
299
299
 
300
300
  # A dictionary of inputs sent to the LLM to generate output. The dictionary must
301
- # contain at least `user_prompt` or `system_prompt` field. For
302
- # ground_truth_aherence guadrail metric, `ground_truth` should be provided.
301
+ # contain at least a `user_prompt` field or a `system_prompt` field. For
302
+ # ground_truth_adherence guardrail metric, `ground_truth` should be provided.
303
303
  sig do
304
304
  params(
305
305
  ground_truth: String,
@@ -0,0 +1,251 @@
1
+ # typed: strong
2
+
3
+ module Deeprails
4
+ module Models
5
+ class MonitorDetailResponse < Deeprails::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Deeprails::MonitorDetailResponse, Deeprails::Internal::AnyHash)
9
+ end
10
+
11
+ # A unique monitor ID.
12
+ sig { returns(String) }
13
+ attr_accessor :monitor_id
14
+
15
+ # Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
16
+ # longer record and evaluate events.
17
+ sig do
18
+ returns(Deeprails::MonitorDetailResponse::MonitorStatus::TaggedSymbol)
19
+ end
20
+ attr_accessor :monitor_status
21
+
22
+ # Name of this monitor.
23
+ sig { returns(String) }
24
+ attr_accessor :name
25
+
26
+ # The time the monitor was created in UTC.
27
+ sig { returns(T.nilable(Time)) }
28
+ attr_reader :created_at
29
+
30
+ sig { params(created_at: Time).void }
31
+ attr_writer :created_at
32
+
33
+ # Description of this monitor.
34
+ sig { returns(T.nilable(String)) }
35
+ attr_reader :description
36
+
37
+ sig { params(description: String).void }
38
+ attr_writer :description
39
+
40
+ # An array of all evaluations performed by this monitor. Each one corresponds to a
41
+ # separate monitor event.
42
+ sig { returns(T.nilable(T::Array[Deeprails::Evaluation])) }
43
+ attr_reader :evaluations
44
+
45
+ sig { params(evaluations: T::Array[Deeprails::Evaluation::OrHash]).void }
46
+ attr_writer :evaluations
47
+
48
+ # Contains five fields used for stats of this monitor: total evaluations,
49
+ # completed evaluations, failed evaluations, queued evaluations, and in progress
50
+ # evaluations.
51
+ sig { returns(T.nilable(Deeprails::MonitorDetailResponse::Stats)) }
52
+ attr_reader :stats
53
+
54
+ sig do
55
+ params(stats: Deeprails::MonitorDetailResponse::Stats::OrHash).void
56
+ end
57
+ attr_writer :stats
58
+
59
+ # The most recent time the monitor was modified in UTC.
60
+ sig { returns(T.nilable(Time)) }
61
+ attr_reader :updated_at
62
+
63
+ sig { params(updated_at: Time).void }
64
+ attr_writer :updated_at
65
+
66
+ # User ID of the user who created the monitor.
67
+ sig { returns(T.nilable(String)) }
68
+ attr_reader :user_id
69
+
70
+ sig { params(user_id: String).void }
71
+ attr_writer :user_id
72
+
73
+ sig do
74
+ params(
75
+ monitor_id: String,
76
+ monitor_status:
77
+ Deeprails::MonitorDetailResponse::MonitorStatus::OrSymbol,
78
+ name: String,
79
+ created_at: Time,
80
+ description: String,
81
+ evaluations: T::Array[Deeprails::Evaluation::OrHash],
82
+ stats: Deeprails::MonitorDetailResponse::Stats::OrHash,
83
+ updated_at: Time,
84
+ user_id: String
85
+ ).returns(T.attached_class)
86
+ end
87
+ def self.new(
88
+ # A unique monitor ID.
89
+ monitor_id:,
90
+ # Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
91
+ # longer record and evaluate events.
92
+ monitor_status:,
93
+ # Name of this monitor.
94
+ name:,
95
+ # The time the monitor was created in UTC.
96
+ created_at: nil,
97
+ # Description of this monitor.
98
+ description: nil,
99
+ # An array of all evaluations performed by this monitor. Each one corresponds to a
100
+ # separate monitor event.
101
+ evaluations: nil,
102
+ # Contains five fields used for stats of this monitor: total evaluations,
103
+ # completed evaluations, failed evaluations, queued evaluations, and in progress
104
+ # evaluations.
105
+ stats: nil,
106
+ # The most recent time the monitor was modified in UTC.
107
+ updated_at: nil,
108
+ # User ID of the user who created the monitor.
109
+ user_id: nil
110
+ )
111
+ end
112
+
113
+ sig do
114
+ override.returns(
115
+ {
116
+ monitor_id: String,
117
+ monitor_status:
118
+ Deeprails::MonitorDetailResponse::MonitorStatus::TaggedSymbol,
119
+ name: String,
120
+ created_at: Time,
121
+ description: String,
122
+ evaluations: T::Array[Deeprails::Evaluation],
123
+ stats: Deeprails::MonitorDetailResponse::Stats,
124
+ updated_at: Time,
125
+ user_id: String
126
+ }
127
+ )
128
+ end
129
+ def to_hash
130
+ end
131
+
132
+ # Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
133
+ # longer record and evaluate events.
134
+ module MonitorStatus
135
+ extend Deeprails::Internal::Type::Enum
136
+
137
+ TaggedSymbol =
138
+ T.type_alias do
139
+ T.all(Symbol, Deeprails::MonitorDetailResponse::MonitorStatus)
140
+ end
141
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
142
+
143
+ ACTIVE =
144
+ T.let(
145
+ :active,
146
+ Deeprails::MonitorDetailResponse::MonitorStatus::TaggedSymbol
147
+ )
148
+ INACTIVE =
149
+ T.let(
150
+ :inactive,
151
+ Deeprails::MonitorDetailResponse::MonitorStatus::TaggedSymbol
152
+ )
153
+
154
+ sig do
155
+ override.returns(
156
+ T::Array[
157
+ Deeprails::MonitorDetailResponse::MonitorStatus::TaggedSymbol
158
+ ]
159
+ )
160
+ end
161
+ def self.values
162
+ end
163
+ end
164
+
165
+ class Stats < Deeprails::Internal::Type::BaseModel
166
+ OrHash =
167
+ T.type_alias do
168
+ T.any(
169
+ Deeprails::MonitorDetailResponse::Stats,
170
+ Deeprails::Internal::AnyHash
171
+ )
172
+ end
173
+
174
+ # Number of evaluations that completed successfully.
175
+ sig { returns(T.nilable(Integer)) }
176
+ attr_reader :completed_evaluations
177
+
178
+ sig { params(completed_evaluations: Integer).void }
179
+ attr_writer :completed_evaluations
180
+
181
+ # Number of evaluations that failed.
182
+ sig { returns(T.nilable(Integer)) }
183
+ attr_reader :failed_evaluations
184
+
185
+ sig { params(failed_evaluations: Integer).void }
186
+ attr_writer :failed_evaluations
187
+
188
+ # Number of evaluations currently in progress.
189
+ sig { returns(T.nilable(Integer)) }
190
+ attr_reader :in_progress_evaluations
191
+
192
+ sig { params(in_progress_evaluations: Integer).void }
193
+ attr_writer :in_progress_evaluations
194
+
195
+ # Number of evaluations currently queued.
196
+ sig { returns(T.nilable(Integer)) }
197
+ attr_reader :queued_evaluations
198
+
199
+ sig { params(queued_evaluations: Integer).void }
200
+ attr_writer :queued_evaluations
201
+
202
+ # Total number of evaluations performed by this monitor.
203
+ sig { returns(T.nilable(Integer)) }
204
+ attr_reader :total_evaluations
205
+
206
+ sig { params(total_evaluations: Integer).void }
207
+ attr_writer :total_evaluations
208
+
209
+ # Contains five fields used for stats of this monitor: total evaluations,
210
+ # completed evaluations, failed evaluations, queued evaluations, and in progress
211
+ # evaluations.
212
+ sig do
213
+ params(
214
+ completed_evaluations: Integer,
215
+ failed_evaluations: Integer,
216
+ in_progress_evaluations: Integer,
217
+ queued_evaluations: Integer,
218
+ total_evaluations: Integer
219
+ ).returns(T.attached_class)
220
+ end
221
+ def self.new(
222
+ # Number of evaluations that completed successfully.
223
+ completed_evaluations: nil,
224
+ # Number of evaluations that failed.
225
+ failed_evaluations: nil,
226
+ # Number of evaluations currently in progress.
227
+ in_progress_evaluations: nil,
228
+ # Number of evaluations currently queued.
229
+ queued_evaluations: nil,
230
+ # Total number of evaluations performed by this monitor.
231
+ total_evaluations: nil
232
+ )
233
+ end
234
+
235
+ sig do
236
+ override.returns(
237
+ {
238
+ completed_evaluations: Integer,
239
+ failed_evaluations: Integer,
240
+ in_progress_evaluations: Integer,
241
+ queued_evaluations: Integer,
242
+ total_evaluations: Integer
243
+ }
244
+ )
245
+ end
246
+ def to_hash
247
+ end
248
+ end
249
+ end
250
+ end
251
+ end
@@ -0,0 +1,64 @@
1
+ # typed: strong
2
+
3
+ module Deeprails
4
+ module Models
5
+ class MonitorEventResponse < Deeprails::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(Deeprails::MonitorEventResponse, Deeprails::Internal::AnyHash)
9
+ end
10
+
11
+ # A unique evaluation ID associated with this event.
12
+ sig { returns(String) }
13
+ attr_accessor :evaluation_id
14
+
15
+ # A unique monitor event ID.
16
+ sig { returns(String) }
17
+ attr_accessor :event_id
18
+
19
+ # Monitor ID associated with this event.
20
+ sig { returns(String) }
21
+ attr_accessor :monitor_id
22
+
23
+ # The time the monitor event was created in UTC.
24
+ sig { returns(T.nilable(Time)) }
25
+ attr_reader :created_at
26
+
27
+ sig { params(created_at: Time).void }
28
+ attr_writer :created_at
29
+
30
+ sig do
31
+ params(
32
+ evaluation_id: String,
33
+ event_id: String,
34
+ monitor_id: String,
35
+ created_at: Time
36
+ ).returns(T.attached_class)
37
+ end
38
+ def self.new(
39
+ # A unique evaluation ID associated with this event.
40
+ evaluation_id:,
41
+ # A unique monitor event ID.
42
+ event_id:,
43
+ # Monitor ID associated with this event.
44
+ monitor_id:,
45
+ # The time the monitor event was created in UTC.
46
+ created_at: nil
47
+ )
48
+ end
49
+
50
+ sig do
51
+ override.returns(
52
+ {
53
+ evaluation_id: String,
54
+ event_id: String,
55
+ monitor_id: String,
56
+ created_at: Time
57
+ }
58
+ )
59
+ end
60
+ def to_hash
61
+ end
62
+ end
63
+ end
64
+ end