deeprails 0.1.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 (131) hide show
  1. checksums.yaml +7 -0
  2. data/.ignore +2 -0
  3. data/CHANGELOG.md +18 -0
  4. data/README.md +273 -0
  5. data/SECURITY.md +27 -0
  6. data/lib/deeprails/client.rb +82 -0
  7. data/lib/deeprails/errors.rb +228 -0
  8. data/lib/deeprails/file_part.rb +58 -0
  9. data/lib/deeprails/internal/transport/base_client.rb +567 -0
  10. data/lib/deeprails/internal/transport/pooled_net_requester.rb +198 -0
  11. data/lib/deeprails/internal/type/array_of.rb +168 -0
  12. data/lib/deeprails/internal/type/base_model.rb +531 -0
  13. data/lib/deeprails/internal/type/base_page.rb +55 -0
  14. data/lib/deeprails/internal/type/boolean.rb +77 -0
  15. data/lib/deeprails/internal/type/converter.rb +327 -0
  16. data/lib/deeprails/internal/type/enum.rb +131 -0
  17. data/lib/deeprails/internal/type/file_input.rb +111 -0
  18. data/lib/deeprails/internal/type/hash_of.rb +188 -0
  19. data/lib/deeprails/internal/type/request_parameters.rb +42 -0
  20. data/lib/deeprails/internal/type/union.rb +237 -0
  21. data/lib/deeprails/internal/type/unknown.rb +81 -0
  22. data/lib/deeprails/internal/util.rb +915 -0
  23. data/lib/deeprails/internal.rb +20 -0
  24. data/lib/deeprails/models/api_response.rb +119 -0
  25. data/lib/deeprails/models/defend_create_workflow_params.rb +132 -0
  26. data/lib/deeprails/models/defend_response.rb +123 -0
  27. data/lib/deeprails/models/defend_retrieve_event_params.rb +20 -0
  28. data/lib/deeprails/models/defend_retrieve_workflow_params.rb +14 -0
  29. data/lib/deeprails/models/defend_submit_event_params.rb +98 -0
  30. data/lib/deeprails/models/defend_update_workflow_params.rb +49 -0
  31. data/lib/deeprails/models/evaluate_create_params.rb +123 -0
  32. data/lib/deeprails/models/evaluate_retrieve_params.rb +14 -0
  33. data/lib/deeprails/models/evaluation.rb +225 -0
  34. data/lib/deeprails/models/monitor_create_params.rb +30 -0
  35. data/lib/deeprails/models/monitor_retrieve_params.rb +22 -0
  36. data/lib/deeprails/models/monitor_retrieve_response.rb +186 -0
  37. data/lib/deeprails/models/monitor_submit_event_params.rb +124 -0
  38. data/lib/deeprails/models/monitor_submit_event_response.rb +77 -0
  39. data/lib/deeprails/models/monitor_update_params.rb +54 -0
  40. data/lib/deeprails/models/workflow_event_response.rb +57 -0
  41. data/lib/deeprails/models.rb +71 -0
  42. data/lib/deeprails/request_options.rb +77 -0
  43. data/lib/deeprails/resources/defend.rb +162 -0
  44. data/lib/deeprails/resources/evaluate.rb +70 -0
  45. data/lib/deeprails/resources/monitor.rb +130 -0
  46. data/lib/deeprails/version.rb +5 -0
  47. data/lib/deeprails.rb +73 -0
  48. data/manifest.yaml +15 -0
  49. data/rbi/deeprails/client.rbi +55 -0
  50. data/rbi/deeprails/errors.rbi +205 -0
  51. data/rbi/deeprails/file_part.rbi +37 -0
  52. data/rbi/deeprails/internal/transport/base_client.rbi +293 -0
  53. data/rbi/deeprails/internal/transport/pooled_net_requester.rbi +79 -0
  54. data/rbi/deeprails/internal/type/array_of.rbi +104 -0
  55. data/rbi/deeprails/internal/type/base_model.rbi +304 -0
  56. data/rbi/deeprails/internal/type/base_page.rbi +42 -0
  57. data/rbi/deeprails/internal/type/boolean.rbi +58 -0
  58. data/rbi/deeprails/internal/type/converter.rbi +216 -0
  59. data/rbi/deeprails/internal/type/enum.rbi +82 -0
  60. data/rbi/deeprails/internal/type/file_input.rbi +59 -0
  61. data/rbi/deeprails/internal/type/hash_of.rbi +104 -0
  62. data/rbi/deeprails/internal/type/request_parameters.rbi +29 -0
  63. data/rbi/deeprails/internal/type/union.rbi +128 -0
  64. data/rbi/deeprails/internal/type/unknown.rbi +58 -0
  65. data/rbi/deeprails/internal/util.rbi +487 -0
  66. data/rbi/deeprails/internal.rbi +18 -0
  67. data/rbi/deeprails/models/api_response.rbi +204 -0
  68. data/rbi/deeprails/models/defend_create_workflow_params.rbi +270 -0
  69. data/rbi/deeprails/models/defend_response.rbi +198 -0
  70. data/rbi/deeprails/models/defend_retrieve_event_params.rbi +38 -0
  71. data/rbi/deeprails/models/defend_retrieve_workflow_params.rbi +30 -0
  72. data/rbi/deeprails/models/defend_submit_event_params.rbi +170 -0
  73. data/rbi/deeprails/models/defend_update_workflow_params.rbi +107 -0
  74. data/rbi/deeprails/models/evaluate_create_params.rbi +253 -0
  75. data/rbi/deeprails/models/evaluate_retrieve_params.rbi +27 -0
  76. data/rbi/deeprails/models/evaluation.rbi +382 -0
  77. data/rbi/deeprails/models/monitor_create_params.rbi +54 -0
  78. data/rbi/deeprails/models/monitor_retrieve_params.rbi +43 -0
  79. data/rbi/deeprails/models/monitor_retrieve_response.rbi +336 -0
  80. data/rbi/deeprails/models/monitor_submit_event_params.rbi +264 -0
  81. data/rbi/deeprails/models/monitor_submit_event_response.rbi +134 -0
  82. data/rbi/deeprails/models/monitor_update_params.rbi +114 -0
  83. data/rbi/deeprails/models/workflow_event_response.rbi +85 -0
  84. data/rbi/deeprails/models.rbi +33 -0
  85. data/rbi/deeprails/request_options.rbi +59 -0
  86. data/rbi/deeprails/resources/defend.rbi +151 -0
  87. data/rbi/deeprails/resources/evaluate.rbi +66 -0
  88. data/rbi/deeprails/resources/monitor.rbi +114 -0
  89. data/rbi/deeprails/version.rbi +5 -0
  90. data/sig/deeprails/client.rbs +30 -0
  91. data/sig/deeprails/errors.rbs +117 -0
  92. data/sig/deeprails/file_part.rbs +21 -0
  93. data/sig/deeprails/internal/transport/base_client.rbs +131 -0
  94. data/sig/deeprails/internal/transport/pooled_net_requester.rbs +45 -0
  95. data/sig/deeprails/internal/type/array_of.rbs +48 -0
  96. data/sig/deeprails/internal/type/base_model.rbs +102 -0
  97. data/sig/deeprails/internal/type/base_page.rbs +24 -0
  98. data/sig/deeprails/internal/type/boolean.rbs +26 -0
  99. data/sig/deeprails/internal/type/converter.rbs +79 -0
  100. data/sig/deeprails/internal/type/enum.rbs +32 -0
  101. data/sig/deeprails/internal/type/file_input.rbs +25 -0
  102. data/sig/deeprails/internal/type/hash_of.rbs +48 -0
  103. data/sig/deeprails/internal/type/request_parameters.rbs +19 -0
  104. data/sig/deeprails/internal/type/union.rbs +52 -0
  105. data/sig/deeprails/internal/type/unknown.rbs +26 -0
  106. data/sig/deeprails/internal/util.rbs +185 -0
  107. data/sig/deeprails/internal.rbs +9 -0
  108. data/sig/deeprails/models/api_response.rbs +100 -0
  109. data/sig/deeprails/models/defend_create_workflow_params.rbs +98 -0
  110. data/sig/deeprails/models/defend_response.rbs +96 -0
  111. data/sig/deeprails/models/defend_retrieve_event_params.rbs +23 -0
  112. data/sig/deeprails/models/defend_retrieve_workflow_params.rbs +15 -0
  113. data/sig/deeprails/models/defend_submit_event_params.rbs +73 -0
  114. data/sig/deeprails/models/defend_update_workflow_params.rbs +55 -0
  115. data/sig/deeprails/models/evaluate_create_params.rbs +107 -0
  116. data/sig/deeprails/models/evaluate_retrieve_params.rbs +15 -0
  117. data/sig/deeprails/models/evaluation.rbs +189 -0
  118. data/sig/deeprails/models/monitor_create_params.rbs +30 -0
  119. data/sig/deeprails/models/monitor_retrieve_params.rbs +25 -0
  120. data/sig/deeprails/models/monitor_retrieve_response.rbs +167 -0
  121. data/sig/deeprails/models/monitor_submit_event_params.rbs +107 -0
  122. data/sig/deeprails/models/monitor_submit_event_response.rbs +70 -0
  123. data/sig/deeprails/models/monitor_update_params.rbs +55 -0
  124. data/sig/deeprails/models/workflow_event_response.rbs +46 -0
  125. data/sig/deeprails/models.rbs +31 -0
  126. data/sig/deeprails/request_options.rbs +34 -0
  127. data/sig/deeprails/resources/defend.rbs +47 -0
  128. data/sig/deeprails/resources/evaluate.rbs +22 -0
  129. data/sig/deeprails/resources/monitor.rbs +38 -0
  130. data/sig/deeprails/version.rbs +3 -0
  131. metadata +188 -0
@@ -0,0 +1,123 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Deeprails
4
+ module Models
5
+ # @see Deeprails::Resources::Evaluate#create
6
+ class EvaluateCreateParams < Deeprails::Internal::Type::BaseModel
7
+ extend Deeprails::Internal::Type::RequestParameters::Converter
8
+ include Deeprails::Internal::Type::RequestParameters
9
+
10
+ # @!attribute model_input
11
+ # A dictionary of inputs sent to the LLM to generate output. This must contain a
12
+ # `user_prompt` field and an optional `context` field. Additional properties are
13
+ # allowed.
14
+ #
15
+ # @return [Deeprails::Models::EvaluateCreateParams::ModelInput]
16
+ required :model_input, -> { Deeprails::EvaluateCreateParams::ModelInput }
17
+
18
+ # @!attribute model_output
19
+ # Output generated by the LLM to be evaluated.
20
+ #
21
+ # @return [String]
22
+ required :model_output, String
23
+
24
+ # @!attribute run_mode
25
+ # Run mode for the evaluation. The run mode allows the user to optimize for speed,
26
+ # accuracy, and cost by determining which models are used to evaluate the event.
27
+ # Available run modes include `precision_plus`, `precision`, `smart`, and
28
+ # `economy`. Defaults to `smart`.
29
+ #
30
+ # @return [Symbol, Deeprails::Models::EvaluateCreateParams::RunMode]
31
+ required :run_mode, enum: -> { Deeprails::EvaluateCreateParams::RunMode }
32
+
33
+ # @!attribute guardrail_metrics
34
+ # An array of guardrail metrics that the model input and output pair will be
35
+ # evaluated on. For non-enterprise users, these will be limited to the allowed
36
+ # guardrail metrics.
37
+ #
38
+ # @return [Array<Symbol, Deeprails::Models::EvaluateCreateParams::GuardrailMetric>, nil]
39
+ optional :guardrail_metrics,
40
+ -> { Deeprails::Internal::Type::ArrayOf[enum: Deeprails::EvaluateCreateParams::GuardrailMetric] }
41
+
42
+ # @!attribute model_used
43
+ # Model ID used to generate the output, like `gpt-4o` or `o3`.
44
+ #
45
+ # @return [String, nil]
46
+ optional :model_used, String
47
+
48
+ # @!attribute nametag
49
+ # An optional, user-defined tag for the evaluation.
50
+ #
51
+ # @return [String, nil]
52
+ optional :nametag, String
53
+
54
+ # @!method initialize(model_input:, model_output:, run_mode:, guardrail_metrics: nil, model_used: nil, nametag: nil, request_options: {})
55
+ # Some parameter documentations has been truncated, see
56
+ # {Deeprails::Models::EvaluateCreateParams} for more details.
57
+ #
58
+ # @param model_input [Deeprails::Models::EvaluateCreateParams::ModelInput] A dictionary of inputs sent to the LLM to generate output. This must contain a
59
+ #
60
+ # @param model_output [String] Output generated by the LLM to be evaluated.
61
+ #
62
+ # @param run_mode [Symbol, Deeprails::Models::EvaluateCreateParams::RunMode] Run mode for the evaluation. The run mode allows the user to optimize for speed
63
+ #
64
+ # @param guardrail_metrics [Array<Symbol, Deeprails::Models::EvaluateCreateParams::GuardrailMetric>] An array of guardrail metrics that the model input and output pair will be evalu
65
+ #
66
+ # @param model_used [String] Model ID used to generate the output, like `gpt-4o` or `o3`.
67
+ #
68
+ # @param nametag [String] An optional, user-defined tag for the evaluation.
69
+ #
70
+ # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}]
71
+
72
+ class ModelInput < Deeprails::Internal::Type::BaseModel
73
+ # @!attribute user_prompt
74
+ #
75
+ # @return [String]
76
+ required :user_prompt, String
77
+
78
+ # @!attribute context
79
+ #
80
+ # @return [String, nil]
81
+ optional :context, String
82
+
83
+ # @!method initialize(user_prompt:, context: nil)
84
+ # A dictionary of inputs sent to the LLM to generate output. This must contain a
85
+ # `user_prompt` field and an optional `context` field. Additional properties are
86
+ # allowed.
87
+ #
88
+ # @param user_prompt [String]
89
+ # @param context [String]
90
+ end
91
+
92
+ # Run mode for the evaluation. The run mode allows the user to optimize for speed,
93
+ # accuracy, and cost by determining which models are used to evaluate the event.
94
+ # Available run modes include `precision_plus`, `precision`, `smart`, and
95
+ # `economy`. Defaults to `smart`.
96
+ module RunMode
97
+ extend Deeprails::Internal::Type::Enum
98
+
99
+ PRECISION_PLUS = :precision_plus
100
+ PRECISION = :precision
101
+ SMART = :smart
102
+ ECONOMY = :economy
103
+
104
+ # @!method self.values
105
+ # @return [Array<Symbol>]
106
+ end
107
+
108
+ module GuardrailMetric
109
+ extend Deeprails::Internal::Type::Enum
110
+
111
+ CORRECTNESS = :correctness
112
+ COMPLETENESS = :completeness
113
+ INSTRUCTION_ADHERENCE = :instruction_adherence
114
+ CONTEXT_ADHERENCE = :context_adherence
115
+ GROUND_TRUTH_ADHERENCE = :ground_truth_adherence
116
+ COMPREHENSIVE_SAFETY = :comprehensive_safety
117
+
118
+ # @!method self.values
119
+ # @return [Array<Symbol>]
120
+ end
121
+ end
122
+ end
123
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Deeprails
4
+ module Models
5
+ # @see Deeprails::Resources::Evaluate#retrieve
6
+ class EvaluateRetrieveParams < Deeprails::Internal::Type::BaseModel
7
+ extend Deeprails::Internal::Type::RequestParameters::Converter
8
+ include Deeprails::Internal::Type::RequestParameters
9
+
10
+ # @!method initialize(request_options: {})
11
+ # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}]
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,225 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Deeprails
4
+ module Models
5
+ # @see Deeprails::Resources::Evaluate#create
6
+ class Evaluation < Deeprails::Internal::Type::BaseModel
7
+ # @!attribute eval_id
8
+ # A unique evaluation ID.
9
+ #
10
+ # @return [String]
11
+ required :eval_id, String
12
+
13
+ # @!attribute evaluation_status
14
+ # Status of the evaluation.
15
+ #
16
+ # @return [Symbol, Deeprails::Models::Evaluation::EvaluationStatus]
17
+ required :evaluation_status, enum: -> { Deeprails::Evaluation::EvaluationStatus }
18
+
19
+ # @!attribute model_input
20
+ # A dictionary of inputs sent to the LLM to generate output. The dictionary must
21
+ # contain a `user_prompt` field and an optional `context` field. Additional
22
+ # properties are allowed.
23
+ #
24
+ # @return [Deeprails::Models::Evaluation::ModelInput]
25
+ required :model_input, -> { Deeprails::Evaluation::ModelInput }
26
+
27
+ # @!attribute model_output
28
+ # Output generated by the LLM to be evaluated.
29
+ #
30
+ # @return [String]
31
+ required :model_output, String
32
+
33
+ # @!attribute run_mode
34
+ # Run mode for the evaluation. The run mode allows the user to optimize for speed,
35
+ # accuracy, and cost by determining which models are used to evaluate the event.
36
+ #
37
+ # @return [Symbol, Deeprails::Models::Evaluation::RunMode]
38
+ required :run_mode, enum: -> { Deeprails::Evaluation::RunMode }
39
+
40
+ # @!attribute created_at
41
+ # The time the evaluation was created in UTC.
42
+ #
43
+ # @return [Time, nil]
44
+ optional :created_at, Time
45
+
46
+ # @!attribute end_timestamp
47
+ # The time the evaluation completed in UTC.
48
+ #
49
+ # @return [Time, nil]
50
+ optional :end_timestamp, Time
51
+
52
+ # @!attribute error_message
53
+ # Description of the error causing the evaluation to fail, if any.
54
+ #
55
+ # @return [String, nil]
56
+ optional :error_message, String
57
+
58
+ # @!attribute error_timestamp
59
+ # The time the error causing the evaluation to fail was recorded.
60
+ #
61
+ # @return [Time, nil]
62
+ optional :error_timestamp, Time
63
+
64
+ # @!attribute evaluation_result
65
+ # Evaluation result consisting of average scores and rationales for each of the
66
+ # evaluated guardrail metrics.
67
+ #
68
+ # @return [Hash{Symbol=>Object}, nil]
69
+ optional :evaluation_result, Deeprails::Internal::Type::HashOf[Deeprails::Internal::Type::Unknown]
70
+
71
+ # @!attribute evaluation_total_cost
72
+ # Total cost of the evaluation.
73
+ #
74
+ # @return [Float, nil]
75
+ optional :evaluation_total_cost, Float
76
+
77
+ # @!attribute guardrail_metrics
78
+ # An array of guardrail metrics that the model input and output pair will be
79
+ # evaluated on.
80
+ #
81
+ # @return [Array<Symbol, Deeprails::Models::Evaluation::GuardrailMetric>, nil]
82
+ optional :guardrail_metrics,
83
+ -> { Deeprails::Internal::Type::ArrayOf[enum: Deeprails::Evaluation::GuardrailMetric] }
84
+
85
+ # @!attribute model_used
86
+ # Model ID used to generate the output, like `gpt-4o` or `o3`.
87
+ #
88
+ # @return [String, nil]
89
+ optional :model_used, String
90
+
91
+ # @!attribute modified_at
92
+ # The most recent time the evaluation was modified in UTC.
93
+ #
94
+ # @return [Time, nil]
95
+ optional :modified_at, Time
96
+
97
+ # @!attribute nametag
98
+ # An optional, user-defined tag for the evaluation.
99
+ #
100
+ # @return [String, nil]
101
+ optional :nametag, String
102
+
103
+ # @!attribute progress
104
+ # Evaluation progress. Values range between 0 and 100; 100 corresponds to a
105
+ # completed `evaluation_status`.
106
+ #
107
+ # @return [Integer, nil]
108
+ optional :progress, Integer
109
+
110
+ # @!attribute start_timestamp
111
+ # The time the evaluation started in UTC.
112
+ #
113
+ # @return [Time, nil]
114
+ optional :start_timestamp, Time
115
+
116
+ # @!method initialize(eval_id:, evaluation_status:, model_input:, model_output:, run_mode:, created_at: nil, end_timestamp: nil, error_message: nil, error_timestamp: nil, evaluation_result: nil, evaluation_total_cost: nil, guardrail_metrics: nil, model_used: nil, modified_at: nil, nametag: nil, progress: nil, start_timestamp: nil)
117
+ # Some parameter documentations has been truncated, see
118
+ # {Deeprails::Models::Evaluation} for more details.
119
+ #
120
+ # @param eval_id [String] A unique evaluation ID.
121
+ #
122
+ # @param evaluation_status [Symbol, Deeprails::Models::Evaluation::EvaluationStatus] Status of the evaluation.
123
+ #
124
+ # @param model_input [Deeprails::Models::Evaluation::ModelInput] A dictionary of inputs sent to the LLM to generate output. The dictionary must c
125
+ #
126
+ # @param model_output [String] Output generated by the LLM to be evaluated.
127
+ #
128
+ # @param run_mode [Symbol, Deeprails::Models::Evaluation::RunMode] Run mode for the evaluation. The run mode allows the user to optimize for speed
129
+ #
130
+ # @param created_at [Time] The time the evaluation was created in UTC.
131
+ #
132
+ # @param end_timestamp [Time] The time the evaluation completed in UTC.
133
+ #
134
+ # @param error_message [String] Description of the error causing the evaluation to fail, if any.
135
+ #
136
+ # @param error_timestamp [Time] The time the error causing the evaluation to fail was recorded.
137
+ #
138
+ # @param evaluation_result [Hash{Symbol=>Object}] Evaluation result consisting of average scores and rationales for each of the ev
139
+ #
140
+ # @param evaluation_total_cost [Float] Total cost of the evaluation.
141
+ #
142
+ # @param guardrail_metrics [Array<Symbol, Deeprails::Models::Evaluation::GuardrailMetric>] An array of guardrail metrics that the model input and output pair will be evalu
143
+ #
144
+ # @param model_used [String] Model ID used to generate the output, like `gpt-4o` or `o3`.
145
+ #
146
+ # @param modified_at [Time] The most recent time the evaluation was modified in UTC.
147
+ #
148
+ # @param nametag [String] An optional, user-defined tag for the evaluation.
149
+ #
150
+ # @param progress [Integer] Evaluation progress. Values range between 0 and 100; 100 corresponds to a compl
151
+ #
152
+ # @param start_timestamp [Time] The time the evaluation started in UTC.
153
+
154
+ # Status of the evaluation.
155
+ #
156
+ # @see Deeprails::Models::Evaluation#evaluation_status
157
+ module EvaluationStatus
158
+ extend Deeprails::Internal::Type::Enum
159
+
160
+ IN_PROGRESS = :in_progress
161
+ COMPLETED = :completed
162
+ CANCELED = :canceled
163
+ QUEUED = :queued
164
+ FAILED = :failed
165
+
166
+ # @!method self.values
167
+ # @return [Array<Symbol>]
168
+ end
169
+
170
+ # @see Deeprails::Models::Evaluation#model_input
171
+ class ModelInput < Deeprails::Internal::Type::BaseModel
172
+ # @!attribute user_prompt
173
+ # The user prompt used to generate the output.
174
+ #
175
+ # @return [String]
176
+ required :user_prompt, String
177
+
178
+ # @!attribute context
179
+ # Optional context supplied to the LLM when generating the output.
180
+ #
181
+ # @return [String, nil]
182
+ optional :context, String
183
+
184
+ # @!method initialize(user_prompt:, context: nil)
185
+ # A dictionary of inputs sent to the LLM to generate output. The dictionary must
186
+ # contain a `user_prompt` field and an optional `context` field. Additional
187
+ # properties are allowed.
188
+ #
189
+ # @param user_prompt [String] The user prompt used to generate the output.
190
+ #
191
+ # @param context [String] Optional context supplied to the LLM when generating the output.
192
+ end
193
+
194
+ # Run mode for the evaluation. The run mode allows the user to optimize for speed,
195
+ # accuracy, and cost by determining which models are used to evaluate the event.
196
+ #
197
+ # @see Deeprails::Models::Evaluation#run_mode
198
+ module RunMode
199
+ extend Deeprails::Internal::Type::Enum
200
+
201
+ PRECISION_PLUS = :precision_plus
202
+ PRECISION = :precision
203
+ SMART = :smart
204
+ ECONOMY = :economy
205
+
206
+ # @!method self.values
207
+ # @return [Array<Symbol>]
208
+ end
209
+
210
+ module GuardrailMetric
211
+ extend Deeprails::Internal::Type::Enum
212
+
213
+ CORRECTNESS = :correctness
214
+ COMPLETENESS = :completeness
215
+ INSTRUCTION_ADHERENCE = :instruction_adherence
216
+ CONTEXT_ADHERENCE = :context_adherence
217
+ GROUND_TRUTH_ADHERENCE = :ground_truth_adherence
218
+ COMPREHENSIVE_SAFETY = :comprehensive_safety
219
+
220
+ # @!method self.values
221
+ # @return [Array<Symbol>]
222
+ end
223
+ end
224
+ end
225
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Deeprails
4
+ module Models
5
+ # @see Deeprails::Resources::Monitor#create
6
+ class MonitorCreateParams < Deeprails::Internal::Type::BaseModel
7
+ extend Deeprails::Internal::Type::RequestParameters::Converter
8
+ include Deeprails::Internal::Type::RequestParameters
9
+
10
+ # @!attribute name
11
+ # Name of the new monitor.
12
+ #
13
+ # @return [String]
14
+ required :name, String
15
+
16
+ # @!attribute description
17
+ # Description of the new monitor.
18
+ #
19
+ # @return [String, nil]
20
+ optional :description, String
21
+
22
+ # @!method initialize(name:, description: nil, request_options: {})
23
+ # @param name [String] Name of the new monitor.
24
+ #
25
+ # @param description [String] Description of the new monitor.
26
+ #
27
+ # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}]
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Deeprails
4
+ module Models
5
+ # @see Deeprails::Resources::Monitor#retrieve
6
+ class MonitorRetrieveParams < Deeprails::Internal::Type::BaseModel
7
+ extend Deeprails::Internal::Type::RequestParameters::Converter
8
+ include Deeprails::Internal::Type::RequestParameters
9
+
10
+ # @!attribute limit
11
+ # Limit the returned events associated with this monitor. Defaults to 10.
12
+ #
13
+ # @return [Integer, nil]
14
+ optional :limit, Integer
15
+
16
+ # @!method initialize(limit: nil, request_options: {})
17
+ # @param limit [Integer] Limit the returned events associated with this monitor. Defaults to 10.
18
+ #
19
+ # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}]
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,186 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Deeprails
4
+ module Models
5
+ # @see Deeprails::Resources::Monitor#retrieve
6
+ class MonitorRetrieveResponse < Deeprails::Internal::Type::BaseModel
7
+ # @!attribute success
8
+ # Represents whether the request was completed successfully.
9
+ #
10
+ # @return [Boolean]
11
+ required :success, Deeprails::Internal::Type::Boolean
12
+
13
+ # @!attribute data
14
+ # Detailed response payload for retrieving a monitor and its evaluations.
15
+ #
16
+ # @return [Deeprails::Models::MonitorRetrieveResponse::Data, nil]
17
+ optional :data, -> { Deeprails::Models::MonitorRetrieveResponse::Data }
18
+
19
+ # @!attribute message
20
+ # The accompanying message for the request. Includes error details when
21
+ # applicable.
22
+ #
23
+ # @return [String, nil]
24
+ optional :message, String
25
+
26
+ # @!method initialize(success:, data: nil, message: nil)
27
+ # Some parameter documentations has been truncated, see
28
+ # {Deeprails::Models::MonitorRetrieveResponse} for more details.
29
+ #
30
+ # Response wrapper for operations returning a MonitorDetailResponse.
31
+ #
32
+ # @param success [Boolean] Represents whether the request was completed successfully.
33
+ #
34
+ # @param data [Deeprails::Models::MonitorRetrieveResponse::Data] Detailed response payload for retrieving a monitor and its evaluations.
35
+ #
36
+ # @param message [String] The accompanying message for the request. Includes error details when applicable
37
+
38
+ # @see Deeprails::Models::MonitorRetrieveResponse#data
39
+ class Data < Deeprails::Internal::Type::BaseModel
40
+ # @!attribute monitor_id
41
+ # A unique monitor ID.
42
+ #
43
+ # @return [String]
44
+ required :monitor_id, String
45
+
46
+ # @!attribute monitor_status
47
+ # Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
48
+ # longer record and evaluate events.
49
+ #
50
+ # @return [Symbol, Deeprails::Models::MonitorRetrieveResponse::Data::MonitorStatus]
51
+ required :monitor_status, enum: -> { Deeprails::Models::MonitorRetrieveResponse::Data::MonitorStatus }
52
+
53
+ # @!attribute name
54
+ # Name of this monitor.
55
+ #
56
+ # @return [String]
57
+ required :name, String
58
+
59
+ # @!attribute created_at
60
+ # The time the monitor was created in UTC.
61
+ #
62
+ # @return [Time, nil]
63
+ optional :created_at, Time
64
+
65
+ # @!attribute description
66
+ # Description of this monitor.
67
+ #
68
+ # @return [String, nil]
69
+ optional :description, String
70
+
71
+ # @!attribute evaluations
72
+ # An array of all evaluations performed by this monitor. Each one corresponds to a
73
+ # separate monitor event.
74
+ #
75
+ # @return [Array<Deeprails::Models::Evaluation>, nil]
76
+ optional :evaluations, -> { Deeprails::Internal::Type::ArrayOf[Deeprails::Evaluation] }
77
+
78
+ # @!attribute stats
79
+ # Contains five fields used for stats of this monitor: total evaluations,
80
+ # completed evaluations, failed evaluations, queued evaluations, and in progress
81
+ # evaluations.
82
+ #
83
+ # @return [Deeprails::Models::MonitorRetrieveResponse::Data::Stats, nil]
84
+ optional :stats, -> { Deeprails::Models::MonitorRetrieveResponse::Data::Stats }
85
+
86
+ # @!attribute updated_at
87
+ # The most recent time the monitor was modified in UTC.
88
+ #
89
+ # @return [Time, nil]
90
+ optional :updated_at, Time
91
+
92
+ # @!attribute user_id
93
+ # User ID of the user who created the monitor.
94
+ #
95
+ # @return [String, nil]
96
+ optional :user_id, String
97
+
98
+ # @!method initialize(monitor_id:, monitor_status:, name:, created_at: nil, description: nil, evaluations: nil, stats: nil, updated_at: nil, user_id: nil)
99
+ # Some parameter documentations has been truncated, see
100
+ # {Deeprails::Models::MonitorRetrieveResponse::Data} for more details.
101
+ #
102
+ # Detailed response payload for retrieving a monitor and its evaluations.
103
+ #
104
+ # @param monitor_id [String] A unique monitor ID.
105
+ #
106
+ # @param monitor_status [Symbol, Deeprails::Models::MonitorRetrieveResponse::Data::MonitorStatus] Status of the monitor. Can be `active` or `inactive`. Inactive monitors no lon
107
+ #
108
+ # @param name [String] Name of this monitor.
109
+ #
110
+ # @param created_at [Time] The time the monitor was created in UTC.
111
+ #
112
+ # @param description [String] Description of this monitor.
113
+ #
114
+ # @param evaluations [Array<Deeprails::Models::Evaluation>] An array of all evaluations performed by this monitor. Each one corresponds to
115
+ #
116
+ # @param stats [Deeprails::Models::MonitorRetrieveResponse::Data::Stats] Contains five fields used for stats of this monitor: total evaluations, complete
117
+ #
118
+ # @param updated_at [Time] The most recent time the monitor was modified in UTC.
119
+ #
120
+ # @param user_id [String] User ID of the user who created the monitor.
121
+
122
+ # Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
123
+ # longer record and evaluate events.
124
+ #
125
+ # @see Deeprails::Models::MonitorRetrieveResponse::Data#monitor_status
126
+ module MonitorStatus
127
+ extend Deeprails::Internal::Type::Enum
128
+
129
+ ACTIVE = :active
130
+ INACTIVE = :inactive
131
+
132
+ # @!method self.values
133
+ # @return [Array<Symbol>]
134
+ end
135
+
136
+ # @see Deeprails::Models::MonitorRetrieveResponse::Data#stats
137
+ class Stats < Deeprails::Internal::Type::BaseModel
138
+ # @!attribute completed_evaluations
139
+ # Number of evaluations that completed successfully.
140
+ #
141
+ # @return [Integer, nil]
142
+ optional :completed_evaluations, Integer
143
+
144
+ # @!attribute failed_evaluations
145
+ # Number of evaluations that failed.
146
+ #
147
+ # @return [Integer, nil]
148
+ optional :failed_evaluations, Integer
149
+
150
+ # @!attribute in_progress_evaluations
151
+ # Number of evaluations currently in progress.
152
+ #
153
+ # @return [Integer, nil]
154
+ optional :in_progress_evaluations, Integer
155
+
156
+ # @!attribute queued_evaluations
157
+ # Number of evaluations currently queued.
158
+ #
159
+ # @return [Integer, nil]
160
+ optional :queued_evaluations, Integer
161
+
162
+ # @!attribute total_evaluations
163
+ # Total number of evaluations performed by this monitor.
164
+ #
165
+ # @return [Integer, nil]
166
+ optional :total_evaluations, Integer
167
+
168
+ # @!method initialize(completed_evaluations: nil, failed_evaluations: nil, in_progress_evaluations: nil, queued_evaluations: nil, total_evaluations: nil)
169
+ # Contains five fields used for stats of this monitor: total evaluations,
170
+ # completed evaluations, failed evaluations, queued evaluations, and in progress
171
+ # evaluations.
172
+ #
173
+ # @param completed_evaluations [Integer] Number of evaluations that completed successfully.
174
+ #
175
+ # @param failed_evaluations [Integer] Number of evaluations that failed.
176
+ #
177
+ # @param in_progress_evaluations [Integer] Number of evaluations currently in progress.
178
+ #
179
+ # @param queued_evaluations [Integer] Number of evaluations currently queued.
180
+ #
181
+ # @param total_evaluations [Integer] Total number of evaluations performed by this monitor.
182
+ end
183
+ end
184
+ end
185
+ end
186
+ end