deeprails 0.11.0 → 0.12.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 +18 -0
- data/README.md +26 -40
- data/lib/deeprails/internal/transport/base_client.rb +7 -1
- data/lib/deeprails/internal/transport/pooled_net_requester.rb +6 -2
- data/lib/deeprails/internal/type/base_model.rb +5 -5
- data/lib/deeprails/models/defend_create_response.rb +51 -0
- data/lib/deeprails/models/defend_create_workflow_params.rb +19 -19
- data/lib/deeprails/models/defend_response.rb +278 -38
- data/lib/deeprails/models/defend_retrieve_workflow_params.rb +13 -1
- data/lib/deeprails/models/defend_update_response.rb +51 -0
- data/lib/deeprails/models/file_response.rb +6 -22
- data/lib/deeprails/models/file_upload_params.rb +3 -3
- data/lib/deeprails/models/monitor_create_response.rb +51 -0
- data/lib/deeprails/models/monitor_detail_response.rb +69 -70
- data/lib/deeprails/models/monitor_event_detail_response.rb +182 -0
- data/lib/deeprails/models/monitor_event_response.rb +1 -9
- data/lib/deeprails/models/monitor_retrieve_params.rb +6 -2
- data/lib/deeprails/models/monitor_update_params.rb +11 -11
- data/lib/deeprails/models/monitor_update_response.rb +51 -0
- data/lib/deeprails/models/workflow_event_detail_response.rb +314 -0
- data/lib/deeprails/models/workflow_event_response.rb +29 -30
- data/lib/deeprails/models.rb +12 -2
- data/lib/deeprails/resources/defend.rb +20 -13
- data/lib/deeprails/resources/files.rb +1 -1
- data/lib/deeprails/resources/monitor.rb +11 -8
- data/lib/deeprails/version.rb +1 -1
- data/lib/deeprails.rb +7 -1
- data/manifest.yaml +1 -0
- data/rbi/deeprails/internal/transport/base_client.rbi +5 -0
- data/rbi/deeprails/internal/transport/pooled_net_requester.rbi +6 -2
- data/rbi/deeprails/internal/type/base_model.rbi +8 -4
- data/rbi/deeprails/models/defend_create_response.rbi +83 -0
- data/rbi/deeprails/models/defend_create_workflow_params.rbi +33 -27
- data/rbi/deeprails/models/defend_response.rbi +555 -72
- data/rbi/deeprails/models/defend_retrieve_workflow_params.rbi +23 -5
- data/rbi/deeprails/models/defend_update_response.rbi +83 -0
- data/rbi/deeprails/models/file_response.rbi +11 -39
- data/rbi/deeprails/models/file_upload_params.rbi +3 -6
- data/rbi/deeprails/models/monitor_create_response.rbi +83 -0
- data/rbi/deeprails/models/monitor_detail_response.rbi +144 -104
- data/rbi/deeprails/models/monitor_event_detail_response.rbi +383 -0
- data/rbi/deeprails/models/monitor_event_response.rbi +4 -18
- data/rbi/deeprails/models/monitor_retrieve_params.rbi +4 -2
- data/rbi/deeprails/models/monitor_update_params.rbi +21 -38
- data/rbi/deeprails/models/monitor_update_response.rbi +83 -0
- data/rbi/deeprails/models/workflow_event_detail_response.rbi +685 -0
- data/rbi/deeprails/models/workflow_event_response.rbi +49 -42
- data/rbi/deeprails/models.rbi +12 -2
- data/rbi/deeprails/resources/defend.rbi +17 -12
- data/rbi/deeprails/resources/files.rbi +1 -1
- data/rbi/deeprails/resources/monitor.rbi +8 -8
- data/sig/deeprails/internal/transport/base_client.rbs +2 -0
- data/sig/deeprails/internal/transport/pooled_net_requester.rbs +4 -1
- data/sig/deeprails/models/defend_create_response.rbs +41 -0
- data/sig/deeprails/models/defend_create_workflow_params.rbs +7 -7
- data/sig/deeprails/models/defend_response.rbs +297 -28
- data/sig/deeprails/models/defend_retrieve_workflow_params.rbs +13 -3
- data/sig/deeprails/models/defend_update_response.rbs +41 -0
- data/sig/deeprails/models/file_response.rbs +5 -27
- data/sig/deeprails/models/file_upload_params.rbs +4 -5
- data/sig/deeprails/models/monitor_create_response.rbs +41 -0
- data/sig/deeprails/models/monitor_detail_response.rbs +72 -61
- data/sig/deeprails/models/monitor_event_detail_response.rbs +181 -0
- data/sig/deeprails/models/monitor_event_response.rbs +2 -15
- data/sig/deeprails/models/monitor_update_params.rbs +13 -13
- data/sig/deeprails/models/monitor_update_response.rbs +41 -0
- data/sig/deeprails/models/workflow_event_detail_response.rbs +315 -0
- data/sig/deeprails/models/workflow_event_response.rbs +24 -24
- data/sig/deeprails/models.rbs +12 -2
- data/sig/deeprails/resources/defend.rbs +5 -4
- data/sig/deeprails/resources/files.rbs +1 -1
- data/sig/deeprails/resources/monitor.rbs +3 -3
- metadata +20 -5
- data/lib/deeprails/models/monitor_response.rb +0 -83
- data/rbi/deeprails/models/monitor_response.rbi +0 -142
- data/sig/deeprails/models/monitor_response.rbs +0 -73
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee919b4b7355075fd7166bd63ffa82cb21d9593633f89ea46f07fc6ea9bba9e5
|
|
4
|
+
data.tar.gz: f7571dc221d9b1dfade476d9f82ec5ff6d6ff06210633d2b719c9fb187bb4e0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 66998c7bcb53ee7678e66375b37a9e7f71b0620f2c97891cf3f8f56196a15b3f4fa3f0e159403f7c5c09bd5a3fb36db0310c75137fe6ab9a29b0c535efcf270a
|
|
7
|
+
data.tar.gz: 6e8b371ff4bdaa0f8ed19edf9eb833e6a0813f48ea6f5d94d5a033ddd73745d96eac693cf0073d18f907d57790181e2c9b82601e30719e4531bc0131de67ea5d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.12.0 (2025-11-10)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.11.0...v0.12.0](https://github.com/deeprails/deeprails-ruby-sdk/compare/v0.11.0...v0.12.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** Mass restructuring of API, including response bodies and naming schemes ([f52f6ee](https://github.com/deeprails/deeprails-ruby-sdk/commit/f52f6ee3484c15c0f403a2fd615552e6926d0626))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* better thread safety via early initializing SSL store during HTTP client creation ([461a0a4](https://github.com/deeprails/deeprails-ruby-sdk/commit/461a0a45e6914b0376077215f353eb83685edc5f))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Chores
|
|
18
|
+
|
|
19
|
+
* bump dependency version and update sorbet types ([444f9a0](https://github.com/deeprails/deeprails-ruby-sdk/commit/444f9a073d6a85bd83f64c201edfc2065f518bc8))
|
|
20
|
+
|
|
3
21
|
## 0.11.0 (2025-11-02)
|
|
4
22
|
|
|
5
23
|
Full Changelog: [v0.10.0...v0.11.0](https://github.com/deeprails/deeprails-ruby-sdk/compare/v0.10.0...v0.11.0)
|
data/README.md
CHANGED
|
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
|
|
|
15
15
|
<!-- x-release-please-start-version -->
|
|
16
16
|
|
|
17
17
|
```ruby
|
|
18
|
-
gem "deeprails", "~> 0.
|
|
18
|
+
gem "deeprails", "~> 0.12.0"
|
|
19
19
|
```
|
|
20
20
|
|
|
21
21
|
<!-- x-release-please-end -->
|
|
@@ -30,38 +30,17 @@ deeprails = Deeprails::Client.new(
|
|
|
30
30
|
api_key: ENV["DEEPRAILS_API_KEY"] # This is the default and can be omitted
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
defend_create_response = deeprails.defend.create_workflow(
|
|
34
34
|
improvement_action: "fixit",
|
|
35
35
|
name: "Push Alert Workflow",
|
|
36
|
-
|
|
37
|
-
custom_hallucination_threshold_values: {completeness: 0.7, instruction_adherence: 0.75}
|
|
36
|
+
threshold_type: "automatic",
|
|
37
|
+
custom_hallucination_threshold_values: {completeness: 0.7, instruction_adherence: 0.75},
|
|
38
|
+
web_search: true
|
|
38
39
|
)
|
|
39
40
|
|
|
40
|
-
puts(
|
|
41
|
+
puts(defend_create_response.workflow_id)
|
|
41
42
|
```
|
|
42
43
|
|
|
43
|
-
### File uploads
|
|
44
|
-
|
|
45
|
-
Request parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, [`StringIO`](https://rubyapi.org/3.2/o/stringio), or more.
|
|
46
|
-
|
|
47
|
-
```ruby
|
|
48
|
-
require "pathname"
|
|
49
|
-
|
|
50
|
-
# Use `Pathname` to send the filename and/or avoid paging a large file into memory:
|
|
51
|
-
file_response = deeprails.files.upload(file: Pathname("/path/to/file"))
|
|
52
|
-
|
|
53
|
-
# Alternatively, pass file contents or a `StringIO` directly:
|
|
54
|
-
file_response = deeprails.files.upload(file: File.read("/path/to/file"))
|
|
55
|
-
|
|
56
|
-
# Or, to control the filename and/or content type:
|
|
57
|
-
file = Deeprails::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…")
|
|
58
|
-
file_response = deeprails.files.upload(file: file)
|
|
59
|
-
|
|
60
|
-
puts(file_response.file_id)
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Note that you can also pass a raw `IO` descriptor, but this disables retries, as the library can't be sure if the descriptor is a file or pipe (which cannot be rewound).
|
|
64
|
-
|
|
65
44
|
### Handling errors
|
|
66
45
|
|
|
67
46
|
When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `Deeprails::Errors::APIError` will be thrown:
|
|
@@ -71,8 +50,9 @@ begin
|
|
|
71
50
|
defend = deeprails.defend.create_workflow(
|
|
72
51
|
improvement_action: "fixit",
|
|
73
52
|
name: "Push Alert Workflow",
|
|
74
|
-
|
|
75
|
-
custom_hallucination_threshold_values: {completeness: 0.7, instruction_adherence: 0.75}
|
|
53
|
+
threshold_type: "automatic",
|
|
54
|
+
custom_hallucination_threshold_values: {completeness: 0.7, instruction_adherence: 0.75},
|
|
55
|
+
web_search: true
|
|
76
56
|
)
|
|
77
57
|
rescue Deeprails::Errors::APIConnectionError => e
|
|
78
58
|
puts("The server could not be reached")
|
|
@@ -119,8 +99,9 @@ deeprails = Deeprails::Client.new(
|
|
|
119
99
|
deeprails.defend.create_workflow(
|
|
120
100
|
improvement_action: "fixit",
|
|
121
101
|
name: "Push Alert Workflow",
|
|
122
|
-
|
|
102
|
+
threshold_type: "automatic",
|
|
123
103
|
custom_hallucination_threshold_values: {completeness: 0.7, instruction_adherence: 0.75},
|
|
104
|
+
web_search: true,
|
|
124
105
|
request_options: {max_retries: 5}
|
|
125
106
|
)
|
|
126
107
|
```
|
|
@@ -139,8 +120,9 @@ deeprails = Deeprails::Client.new(
|
|
|
139
120
|
deeprails.defend.create_workflow(
|
|
140
121
|
improvement_action: "fixit",
|
|
141
122
|
name: "Push Alert Workflow",
|
|
142
|
-
|
|
123
|
+
threshold_type: "automatic",
|
|
143
124
|
custom_hallucination_threshold_values: {completeness: 0.7, instruction_adherence: 0.75},
|
|
125
|
+
web_search: true,
|
|
144
126
|
request_options: {timeout: 5}
|
|
145
127
|
)
|
|
146
128
|
```
|
|
@@ -172,12 +154,13 @@ You can send undocumented parameters to any endpoint, and read undocumented resp
|
|
|
172
154
|
Note: the `extra_` parameters of the same name overrides the documented parameters.
|
|
173
155
|
|
|
174
156
|
```ruby
|
|
175
|
-
|
|
157
|
+
defend_create_response =
|
|
176
158
|
deeprails.defend.create_workflow(
|
|
177
159
|
improvement_action: "fixit",
|
|
178
160
|
name: "Push Alert Workflow",
|
|
179
|
-
|
|
161
|
+
threshold_type: "automatic",
|
|
180
162
|
custom_hallucination_threshold_values: {completeness: 0.7, instruction_adherence: 0.75},
|
|
163
|
+
web_search: true,
|
|
181
164
|
request_options: {
|
|
182
165
|
extra_query: {my_query_parameter: value},
|
|
183
166
|
extra_body: {my_body_parameter: value},
|
|
@@ -185,7 +168,7 @@ defend_response =
|
|
|
185
168
|
}
|
|
186
169
|
)
|
|
187
170
|
|
|
188
|
-
puts(
|
|
171
|
+
puts(defend_create_response[:my_undocumented_property])
|
|
189
172
|
```
|
|
190
173
|
|
|
191
174
|
#### Undocumented request params
|
|
@@ -226,8 +209,9 @@ You can provide typesafe request parameters like so:
|
|
|
226
209
|
deeprails.defend.create_workflow(
|
|
227
210
|
improvement_action: "fixit",
|
|
228
211
|
name: "Push Alert Workflow",
|
|
229
|
-
|
|
230
|
-
custom_hallucination_threshold_values: {completeness: 0.7, instruction_adherence: 0.75}
|
|
212
|
+
threshold_type: "automatic",
|
|
213
|
+
custom_hallucination_threshold_values: {completeness: 0.7, instruction_adherence: 0.75},
|
|
214
|
+
web_search: true
|
|
231
215
|
)
|
|
232
216
|
```
|
|
233
217
|
|
|
@@ -238,16 +222,18 @@ Or, equivalently:
|
|
|
238
222
|
deeprails.defend.create_workflow(
|
|
239
223
|
improvement_action: "fixit",
|
|
240
224
|
name: "Push Alert Workflow",
|
|
241
|
-
|
|
242
|
-
custom_hallucination_threshold_values: {completeness: 0.7, instruction_adherence: 0.75}
|
|
225
|
+
threshold_type: "automatic",
|
|
226
|
+
custom_hallucination_threshold_values: {completeness: 0.7, instruction_adherence: 0.75},
|
|
227
|
+
web_search: true
|
|
243
228
|
)
|
|
244
229
|
|
|
245
230
|
# You can also splat a full Params class:
|
|
246
231
|
params = Deeprails::DefendCreateWorkflowParams.new(
|
|
247
232
|
improvement_action: "fixit",
|
|
248
233
|
name: "Push Alert Workflow",
|
|
249
|
-
|
|
250
|
-
custom_hallucination_threshold_values: {completeness: 0.7, instruction_adherence: 0.75}
|
|
234
|
+
threshold_type: "automatic",
|
|
235
|
+
custom_hallucination_threshold_values: {completeness: 0.7, instruction_adherence: 0.75},
|
|
236
|
+
web_search: true
|
|
251
237
|
)
|
|
252
238
|
deeprails.defend.create_workflow(**params)
|
|
253
239
|
```
|
|
@@ -201,7 +201,8 @@ module Deeprails
|
|
|
201
201
|
self.class::PLATFORM_HEADERS,
|
|
202
202
|
{
|
|
203
203
|
"accept" => "application/json",
|
|
204
|
-
"content-type" => "application/json"
|
|
204
|
+
"content-type" => "application/json",
|
|
205
|
+
"user-agent" => user_agent
|
|
205
206
|
},
|
|
206
207
|
headers
|
|
207
208
|
)
|
|
@@ -219,6 +220,11 @@ module Deeprails
|
|
|
219
220
|
# @return [Hash{String=>String}]
|
|
220
221
|
private def auth_headers = {}
|
|
221
222
|
|
|
223
|
+
# @api private
|
|
224
|
+
#
|
|
225
|
+
# @return [String]
|
|
226
|
+
private def user_agent = "#{self.class.name}/Ruby #{Deeprails::VERSION}"
|
|
227
|
+
|
|
222
228
|
# @api private
|
|
223
229
|
#
|
|
224
230
|
# @return [String]
|
|
@@ -16,10 +16,11 @@ module Deeprails
|
|
|
16
16
|
class << self
|
|
17
17
|
# @api private
|
|
18
18
|
#
|
|
19
|
+
# @param cert_store [OpenSSL::X509::Store]
|
|
19
20
|
# @param url [URI::Generic]
|
|
20
21
|
#
|
|
21
22
|
# @return [Net::HTTP]
|
|
22
|
-
def connect(url)
|
|
23
|
+
def connect(cert_store:, url:)
|
|
23
24
|
port =
|
|
24
25
|
case [url.port, url.scheme]
|
|
25
26
|
in [Integer, _]
|
|
@@ -33,6 +34,8 @@ module Deeprails
|
|
|
33
34
|
Net::HTTP.new(url.host, port).tap do
|
|
34
35
|
_1.use_ssl = %w[https wss].include?(url.scheme)
|
|
35
36
|
_1.max_retries = 0
|
|
37
|
+
|
|
38
|
+
(_1.cert_store = cert_store) if _1.use_ssl?
|
|
36
39
|
end
|
|
37
40
|
end
|
|
38
41
|
|
|
@@ -102,7 +105,7 @@ module Deeprails
|
|
|
102
105
|
pool =
|
|
103
106
|
@mutex.synchronize do
|
|
104
107
|
@pools[origin] ||= ConnectionPool.new(size: @size) do
|
|
105
|
-
self.class.connect(url)
|
|
108
|
+
self.class.connect(cert_store: @cert_store, url: url)
|
|
106
109
|
end
|
|
107
110
|
end
|
|
108
111
|
|
|
@@ -192,6 +195,7 @@ module Deeprails
|
|
|
192
195
|
def initialize(size: self.class::DEFAULT_MAX_CONNECTIONS)
|
|
193
196
|
@mutex = Mutex.new
|
|
194
197
|
@size = size
|
|
198
|
+
@cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths)
|
|
195
199
|
@pools = {}
|
|
196
200
|
end
|
|
197
201
|
|
|
@@ -438,11 +438,11 @@ module Deeprails
|
|
|
438
438
|
# @return [Hash{Symbol=>Object}]
|
|
439
439
|
#
|
|
440
440
|
# @example
|
|
441
|
-
# # `
|
|
442
|
-
#
|
|
443
|
-
#
|
|
444
|
-
#
|
|
445
|
-
#
|
|
441
|
+
# # `defend_create_response` is a `Deeprails::DefendCreateResponse`
|
|
442
|
+
# defend_create_response => {
|
|
443
|
+
# created_at: created_at,
|
|
444
|
+
# status: status,
|
|
445
|
+
# workflow_id: workflow_id
|
|
446
446
|
# }
|
|
447
447
|
def deconstruct_keys(keys)
|
|
448
448
|
(keys || self.class.known_fields.keys)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Deeprails
|
|
4
|
+
module Models
|
|
5
|
+
# @see Deeprails::Resources::Defend#create_workflow
|
|
6
|
+
class DefendCreateResponse < Deeprails::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute created_at
|
|
8
|
+
# The time the workflow was created in UTC.
|
|
9
|
+
#
|
|
10
|
+
# @return [Time]
|
|
11
|
+
required :created_at, Time
|
|
12
|
+
|
|
13
|
+
# @!attribute status
|
|
14
|
+
# Status of the selected workflow. May be `inactive` or `active`. Inactive
|
|
15
|
+
# workflows will not accept events.
|
|
16
|
+
#
|
|
17
|
+
# @return [Symbol, Deeprails::Models::DefendCreateResponse::Status]
|
|
18
|
+
required :status, enum: -> { Deeprails::DefendCreateResponse::Status }
|
|
19
|
+
|
|
20
|
+
# @!attribute workflow_id
|
|
21
|
+
# A unique workflow ID.
|
|
22
|
+
#
|
|
23
|
+
# @return [String]
|
|
24
|
+
required :workflow_id, String
|
|
25
|
+
|
|
26
|
+
# @!method initialize(created_at:, status:, workflow_id:)
|
|
27
|
+
# Some parameter documentations has been truncated, see
|
|
28
|
+
# {Deeprails::Models::DefendCreateResponse} for more details.
|
|
29
|
+
#
|
|
30
|
+
# @param created_at [Time] The time the workflow was created in UTC.
|
|
31
|
+
#
|
|
32
|
+
# @param status [Symbol, Deeprails::Models::DefendCreateResponse::Status] Status of the selected workflow. May be `inactive` or `active`. Inactive workf
|
|
33
|
+
#
|
|
34
|
+
# @param workflow_id [String] A unique workflow ID.
|
|
35
|
+
|
|
36
|
+
# Status of the selected workflow. May be `inactive` or `active`. Inactive
|
|
37
|
+
# workflows will not accept events.
|
|
38
|
+
#
|
|
39
|
+
# @see Deeprails::Models::DefendCreateResponse#status
|
|
40
|
+
module Status
|
|
41
|
+
extend Deeprails::Internal::Type::Enum
|
|
42
|
+
|
|
43
|
+
INACTIVE = :inactive
|
|
44
|
+
ACTIVE = :active
|
|
45
|
+
|
|
46
|
+
# @!method self.values
|
|
47
|
+
# @return [Array<Symbol>]
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -8,11 +8,11 @@ module Deeprails
|
|
|
8
8
|
include Deeprails::Internal::Type::RequestParameters
|
|
9
9
|
|
|
10
10
|
# @!attribute improvement_action
|
|
11
|
-
# The action used to improve outputs that fail one or guardrail metrics for
|
|
12
|
-
# workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the
|
|
13
|
-
# input prompt with minor induced variance. FixIt attempts to directly
|
|
14
|
-
# shortcomings of the output using the guardrail failure rationale. Do
|
|
15
|
-
# does not attempt any improvement.
|
|
11
|
+
# The action used to improve outputs that fail one or more guardrail metrics for
|
|
12
|
+
# the workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the
|
|
13
|
+
# user's input prompt with minor induced variance. FixIt attempts to directly
|
|
14
|
+
# address the shortcomings of the output using the guardrail failure rationale. Do
|
|
15
|
+
# Nothing does not attempt any improvement.
|
|
16
16
|
#
|
|
17
17
|
# @return [Symbol, Deeprails::Models::DefendCreateWorkflowParams::ImprovementAction]
|
|
18
18
|
required :improvement_action, enum: -> { Deeprails::DefendCreateWorkflowParams::ImprovementAction }
|
|
@@ -23,15 +23,15 @@ module Deeprails
|
|
|
23
23
|
# @return [String]
|
|
24
24
|
required :name, String
|
|
25
25
|
|
|
26
|
-
# @!attribute
|
|
26
|
+
# @!attribute threshold_type
|
|
27
27
|
# Type of thresholds to use for the workflow, either `automatic` or `custom`.
|
|
28
28
|
# Automatic thresholds are assigned internally after the user specifies a
|
|
29
29
|
# qualitative tolerance for the metrics, whereas custom metrics allow the user to
|
|
30
30
|
# set the threshold for each metric as a floating point number between 0.0 and
|
|
31
31
|
# 1.0.
|
|
32
32
|
#
|
|
33
|
-
# @return [Symbol, Deeprails::Models::DefendCreateWorkflowParams::
|
|
34
|
-
required :
|
|
33
|
+
# @return [Symbol, Deeprails::Models::DefendCreateWorkflowParams::ThresholdType]
|
|
34
|
+
required :threshold_type, enum: -> { Deeprails::DefendCreateWorkflowParams::ThresholdType }
|
|
35
35
|
|
|
36
36
|
# @!attribute automatic_hallucination_tolerance_levels
|
|
37
37
|
# Mapping of guardrail metrics to hallucination tolerance levels (either `low`,
|
|
@@ -65,7 +65,7 @@ module Deeprails
|
|
|
65
65
|
optional :file_search, Deeprails::Internal::Type::ArrayOf[String]
|
|
66
66
|
|
|
67
67
|
# @!attribute max_improvement_attempts
|
|
68
|
-
# Max. number of improvement action
|
|
68
|
+
# Max. number of improvement action attempts until a given event passes the
|
|
69
69
|
# guardrails. Defaults to 10.
|
|
70
70
|
#
|
|
71
71
|
# @return [Integer, nil]
|
|
@@ -77,15 +77,15 @@ module Deeprails
|
|
|
77
77
|
# @return [Boolean, nil]
|
|
78
78
|
optional :web_search, Deeprails::Internal::Type::Boolean
|
|
79
79
|
|
|
80
|
-
# @!method initialize(improvement_action:, name:,
|
|
80
|
+
# @!method initialize(improvement_action:, name:, threshold_type:, automatic_hallucination_tolerance_levels: nil, custom_hallucination_threshold_values: nil, description: nil, file_search: nil, max_improvement_attempts: nil, web_search: nil, request_options: {})
|
|
81
81
|
# Some parameter documentations has been truncated, see
|
|
82
82
|
# {Deeprails::Models::DefendCreateWorkflowParams} for more details.
|
|
83
83
|
#
|
|
84
|
-
# @param improvement_action [Symbol, Deeprails::Models::DefendCreateWorkflowParams::ImprovementAction] The action used to improve outputs that fail one or guardrail metrics for
|
|
84
|
+
# @param improvement_action [Symbol, Deeprails::Models::DefendCreateWorkflowParams::ImprovementAction] The action used to improve outputs that fail one or more guardrail metrics for t
|
|
85
85
|
#
|
|
86
86
|
# @param name [String] Name of the workflow.
|
|
87
87
|
#
|
|
88
|
-
# @param
|
|
88
|
+
# @param threshold_type [Symbol, Deeprails::Models::DefendCreateWorkflowParams::ThresholdType] Type of thresholds to use for the workflow, either `automatic` or `custom`. Aut
|
|
89
89
|
#
|
|
90
90
|
# @param automatic_hallucination_tolerance_levels [Hash{Symbol=>Symbol, Deeprails::Models::DefendCreateWorkflowParams::AutomaticHallucinationToleranceLevel}] Mapping of guardrail metrics to hallucination tolerance levels
|
|
91
91
|
#
|
|
@@ -95,17 +95,17 @@ module Deeprails
|
|
|
95
95
|
#
|
|
96
96
|
# @param file_search [Array<String>] An array of file IDs to search in the workflow's evaluations. Files must be uplo
|
|
97
97
|
#
|
|
98
|
-
# @param max_improvement_attempts [Integer] Max. number of improvement action
|
|
98
|
+
# @param max_improvement_attempts [Integer] Max. number of improvement action attempts until a given event passes the guardr
|
|
99
99
|
#
|
|
100
100
|
# @param web_search [Boolean] Whether to enable web search for this workflow's evaluations. Defaults to false.
|
|
101
101
|
#
|
|
102
102
|
# @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}]
|
|
103
103
|
|
|
104
|
-
# The action used to improve outputs that fail one or guardrail metrics for
|
|
105
|
-
# workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the
|
|
106
|
-
# input prompt with minor induced variance. FixIt attempts to directly
|
|
107
|
-
# shortcomings of the output using the guardrail failure rationale. Do
|
|
108
|
-
# does not attempt any improvement.
|
|
104
|
+
# The action used to improve outputs that fail one or more guardrail metrics for
|
|
105
|
+
# the workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs the
|
|
106
|
+
# user's input prompt with minor induced variance. FixIt attempts to directly
|
|
107
|
+
# address the shortcomings of the output using the guardrail failure rationale. Do
|
|
108
|
+
# Nothing does not attempt any improvement.
|
|
109
109
|
module ImprovementAction
|
|
110
110
|
extend Deeprails::Internal::Type::Enum
|
|
111
111
|
|
|
@@ -122,7 +122,7 @@ module Deeprails
|
|
|
122
122
|
# qualitative tolerance for the metrics, whereas custom metrics allow the user to
|
|
123
123
|
# set the threshold for each metric as a floating point number between 0.0 and
|
|
124
124
|
# 1.0.
|
|
125
|
-
module
|
|
125
|
+
module ThresholdType
|
|
126
126
|
extend Deeprails::Internal::Type::Enum
|
|
127
127
|
|
|
128
128
|
AUTOMATIC = :automatic
|