deeprails 0.7.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +1 -1
- data/lib/deeprails/internal/transport/pooled_net_requester.rb +30 -24
- data/lib/deeprails/models/defend_create_workflow_params.rb +4 -4
- data/lib/deeprails/models/defend_response.rb +4 -4
- data/lib/deeprails/models/defend_submit_event_params.rb +4 -4
- data/lib/deeprails/models/evaluate_create_params.rb +2 -2
- data/lib/deeprails/models/evaluation.rb +2 -2
- data/lib/deeprails/models/monitor_detail_response.rb +150 -0
- data/lib/deeprails/models/monitor_event_response.rb +41 -0
- data/lib/deeprails/models/monitor_response.rb +83 -0
- data/lib/deeprails/models/monitor_submit_event_params.rb +2 -2
- data/lib/deeprails/models.rb +6 -2
- data/lib/deeprails/resources/defend.rb +2 -2
- data/lib/deeprails/resources/monitor.rb +8 -8
- data/lib/deeprails/version.rb +1 -1
- data/lib/deeprails.rb +3 -3
- data/rbi/deeprails/models/defend_create_workflow_params.rbi +6 -6
- data/rbi/deeprails/models/defend_response.rbi +6 -6
- data/rbi/deeprails/models/defend_submit_event_params.rbi +5 -5
- data/rbi/deeprails/models/evaluate_create_params.rbi +3 -3
- data/rbi/deeprails/models/evaluation.rbi +3 -3
- data/rbi/deeprails/models/monitor_detail_response.rbi +251 -0
- data/rbi/deeprails/models/monitor_event_response.rbi +64 -0
- data/rbi/deeprails/models/monitor_response.rbi +142 -0
- data/rbi/deeprails/models/monitor_submit_event_params.rbi +3 -3
- data/rbi/deeprails/models.rbi +6 -2
- data/rbi/deeprails/resources/defend.rbi +3 -3
- data/rbi/deeprails/resources/evaluate.rbi +1 -1
- data/rbi/deeprails/resources/monitor.rbi +5 -5
- data/sig/deeprails/models/defend_create_workflow_params.rbs +5 -5
- data/sig/deeprails/models/defend_response.rbs +5 -5
- data/sig/deeprails/models/monitor_detail_response.rbs +134 -0
- data/sig/deeprails/models/monitor_event_response.rbs +37 -0
- data/sig/deeprails/models/monitor_response.rbs +73 -0
- data/sig/deeprails/models.rbs +6 -2
- data/sig/deeprails/resources/defend.rbs +1 -1
- data/sig/deeprails/resources/monitor.rbs +4 -4
- metadata +11 -11
- data/lib/deeprails/models/api_response.rb +0 -116
- data/lib/deeprails/models/monitor_retrieve_response.rb +0 -183
- data/lib/deeprails/models/monitor_submit_event_response.rb +0 -74
- data/rbi/deeprails/models/api_response.rbi +0 -201
- data/rbi/deeprails/models/monitor_retrieve_response.rbi +0 -333
- data/rbi/deeprails/models/monitor_submit_event_response.rbi +0 -131
- data/sig/deeprails/models/api_response.rbs +0 -100
- data/sig/deeprails/models/monitor_retrieve_response.rbs +0 -167
- data/sig/deeprails/models/monitor_submit_event_response.rbs +0 -70
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 :
|
|
91
|
+
attr_reader :max_improvement_attempts
|
|
92
92
|
|
|
93
|
-
sig { params(
|
|
94
|
-
attr_writer :
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 :
|
|
56
|
+
attr_reader :max_improvement_attempts
|
|
57
57
|
|
|
58
|
-
sig { params(
|
|
59
|
-
attr_writer :
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
136
|
+
max_improvement_attempts: Integer,
|
|
137
137
|
modified_at: Time,
|
|
138
138
|
status: Deeprails::DefendResponse::Status::TaggedSymbol,
|
|
139
139
|
success_rate: Float
|
|
@@ -15,7 +15,7 @@ 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 the
|
|
18
|
+
# contain at least a `user_prompt` field or a `system_prompt` field. For the
|
|
19
19
|
# ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
20
20
|
sig { returns(Deeprails::DefendSubmitEventParams::ModelInput) }
|
|
21
21
|
attr_reader :model_input
|
|
@@ -61,7 +61,7 @@ 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 the
|
|
64
|
+
# contain at least a `user_prompt` field or a `system_prompt` field. For the
|
|
65
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.
|
|
@@ -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,7 +125,7 @@ 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 the
|
|
128
|
+
# contain at least a `user_prompt` field or a `system_prompt` field. For the
|
|
129
129
|
# ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
130
130
|
sig do
|
|
131
131
|
params(
|
|
@@ -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,7 +12,7 @@ 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
|
|
15
|
+
# contain at least a `user_prompt` field or a `system_prompt` field. For
|
|
16
16
|
# ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
17
17
|
sig { returns(Deeprails::EvaluateCreateParams::ModelInput) }
|
|
18
18
|
attr_reader :model_input
|
|
@@ -85,7 +85,7 @@ 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
|
|
88
|
+
# contain at least a `user_prompt` field or a `system_prompt` field. For
|
|
89
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.
|
|
@@ -157,7 +157,7 @@ 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
|
|
160
|
+
# contain at least a `user_prompt` field or a `system_prompt` field. For
|
|
161
161
|
# ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
162
162
|
sig do
|
|
163
163
|
params(
|
|
@@ -17,7 +17,7 @@ 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
|
|
20
|
+
# contain at least a `user_prompt` field or a `system_prompt` field. For
|
|
21
21
|
# ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
22
22
|
sig { returns(Deeprails::Evaluation::ModelInput) }
|
|
23
23
|
attr_reader :model_input
|
|
@@ -162,7 +162,7 @@ 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
|
|
165
|
+
# contain at least a `user_prompt` field or a `system_prompt` field. For
|
|
166
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.
|
|
@@ -298,7 +298,7 @@ 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
|
|
301
|
+
# contain at least a `user_prompt` field or a `system_prompt` field. For
|
|
302
302
|
# ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
303
303
|
sig do
|
|
304
304
|
params(
|
|
@@ -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
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Deeprails
|
|
4
|
+
module Models
|
|
5
|
+
class MonitorResponse < Deeprails::Internal::Type::BaseModel
|
|
6
|
+
OrHash =
|
|
7
|
+
T.type_alias do
|
|
8
|
+
T.any(Deeprails::MonitorResponse, Deeprails::Internal::AnyHash)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# A unique monitor ID.
|
|
12
|
+
sig { returns(String) }
|
|
13
|
+
attr_accessor :monitor_id
|
|
14
|
+
|
|
15
|
+
# Name of the monitor.
|
|
16
|
+
sig { returns(String) }
|
|
17
|
+
attr_accessor :name
|
|
18
|
+
|
|
19
|
+
# The time the monitor was created in UTC.
|
|
20
|
+
sig { returns(T.nilable(Time)) }
|
|
21
|
+
attr_reader :created_at
|
|
22
|
+
|
|
23
|
+
sig { params(created_at: Time).void }
|
|
24
|
+
attr_writer :created_at
|
|
25
|
+
|
|
26
|
+
# Description of the monitor.
|
|
27
|
+
sig { returns(T.nilable(String)) }
|
|
28
|
+
attr_reader :description
|
|
29
|
+
|
|
30
|
+
sig { params(description: String).void }
|
|
31
|
+
attr_writer :description
|
|
32
|
+
|
|
33
|
+
# Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
|
|
34
|
+
# longer record and evaluate events.
|
|
35
|
+
sig do
|
|
36
|
+
returns(
|
|
37
|
+
T.nilable(Deeprails::MonitorResponse::MonitorStatus::TaggedSymbol)
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
attr_reader :monitor_status
|
|
41
|
+
|
|
42
|
+
sig do
|
|
43
|
+
params(
|
|
44
|
+
monitor_status: Deeprails::MonitorResponse::MonitorStatus::OrSymbol
|
|
45
|
+
).void
|
|
46
|
+
end
|
|
47
|
+
attr_writer :monitor_status
|
|
48
|
+
|
|
49
|
+
# The most recent time the monitor was modified in UTC.
|
|
50
|
+
sig { returns(T.nilable(Time)) }
|
|
51
|
+
attr_reader :updated_at
|
|
52
|
+
|
|
53
|
+
sig { params(updated_at: Time).void }
|
|
54
|
+
attr_writer :updated_at
|
|
55
|
+
|
|
56
|
+
# User ID of the user who created the monitor.
|
|
57
|
+
sig { returns(T.nilable(String)) }
|
|
58
|
+
attr_reader :user_id
|
|
59
|
+
|
|
60
|
+
sig { params(user_id: String).void }
|
|
61
|
+
attr_writer :user_id
|
|
62
|
+
|
|
63
|
+
sig do
|
|
64
|
+
params(
|
|
65
|
+
monitor_id: String,
|
|
66
|
+
name: String,
|
|
67
|
+
created_at: Time,
|
|
68
|
+
description: String,
|
|
69
|
+
monitor_status: Deeprails::MonitorResponse::MonitorStatus::OrSymbol,
|
|
70
|
+
updated_at: Time,
|
|
71
|
+
user_id: String
|
|
72
|
+
).returns(T.attached_class)
|
|
73
|
+
end
|
|
74
|
+
def self.new(
|
|
75
|
+
# A unique monitor ID.
|
|
76
|
+
monitor_id:,
|
|
77
|
+
# Name of the monitor.
|
|
78
|
+
name:,
|
|
79
|
+
# The time the monitor was created in UTC.
|
|
80
|
+
created_at: nil,
|
|
81
|
+
# Description of the monitor.
|
|
82
|
+
description: nil,
|
|
83
|
+
# Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
|
|
84
|
+
# longer record and evaluate events.
|
|
85
|
+
monitor_status: nil,
|
|
86
|
+
# The most recent time the monitor was modified in UTC.
|
|
87
|
+
updated_at: nil,
|
|
88
|
+
# User ID of the user who created the monitor.
|
|
89
|
+
user_id: nil
|
|
90
|
+
)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
sig do
|
|
94
|
+
override.returns(
|
|
95
|
+
{
|
|
96
|
+
monitor_id: String,
|
|
97
|
+
name: String,
|
|
98
|
+
created_at: Time,
|
|
99
|
+
description: String,
|
|
100
|
+
monitor_status:
|
|
101
|
+
Deeprails::MonitorResponse::MonitorStatus::TaggedSymbol,
|
|
102
|
+
updated_at: Time,
|
|
103
|
+
user_id: String
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
end
|
|
107
|
+
def to_hash
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
|
|
111
|
+
# longer record and evaluate events.
|
|
112
|
+
module MonitorStatus
|
|
113
|
+
extend Deeprails::Internal::Type::Enum
|
|
114
|
+
|
|
115
|
+
TaggedSymbol =
|
|
116
|
+
T.type_alias do
|
|
117
|
+
T.all(Symbol, Deeprails::MonitorResponse::MonitorStatus)
|
|
118
|
+
end
|
|
119
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
120
|
+
|
|
121
|
+
ACTIVE =
|
|
122
|
+
T.let(
|
|
123
|
+
:active,
|
|
124
|
+
Deeprails::MonitorResponse::MonitorStatus::TaggedSymbol
|
|
125
|
+
)
|
|
126
|
+
INACTIVE =
|
|
127
|
+
T.let(
|
|
128
|
+
:inactive,
|
|
129
|
+
Deeprails::MonitorResponse::MonitorStatus::TaggedSymbol
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
sig do
|
|
133
|
+
override.returns(
|
|
134
|
+
T::Array[Deeprails::MonitorResponse::MonitorStatus::TaggedSymbol]
|
|
135
|
+
)
|
|
136
|
+
end
|
|
137
|
+
def self.values
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
@@ -28,7 +28,7 @@ module Deeprails
|
|
|
28
28
|
attr_accessor :guardrail_metrics
|
|
29
29
|
|
|
30
30
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
31
|
-
# contain at least a `user_prompt` or `system_prompt` field. For
|
|
31
|
+
# contain at least a `user_prompt` field or a `system_prompt` field. For
|
|
32
32
|
# ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
33
33
|
sig { returns(Deeprails::MonitorSubmitEventParams::ModelInput) }
|
|
34
34
|
attr_reader :model_input
|
|
@@ -97,7 +97,7 @@ module Deeprails
|
|
|
97
97
|
# `ground_truth_adherence`, and/or `comprehensive_safety`.
|
|
98
98
|
guardrail_metrics:,
|
|
99
99
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
100
|
-
# contain at least a `user_prompt` or `system_prompt` field. For
|
|
100
|
+
# contain at least a `user_prompt` field or a `system_prompt` field. For
|
|
101
101
|
# ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
102
102
|
model_input:,
|
|
103
103
|
# Output generated by the LLM to be evaluated.
|
|
@@ -216,7 +216,7 @@ module Deeprails
|
|
|
216
216
|
attr_writer :user_prompt
|
|
217
217
|
|
|
218
218
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
219
|
-
# contain at least a `user_prompt` or `system_prompt` field. For
|
|
219
|
+
# contain at least a `user_prompt` field or a `system_prompt` field. For
|
|
220
220
|
# ground_truth_adherence guardrail metric, `ground_truth` should be provided.
|
|
221
221
|
sig do
|
|
222
222
|
params(
|