deeprails 0.18.0 → 0.24.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 +92 -0
- data/README.md +1 -1
- data/lib/deeprails/internal/stream.rb +29 -0
- data/lib/deeprails/internal/transport/base_client.rb +3 -1
- data/lib/deeprails/internal/transport/pooled_net_requester.rb +13 -11
- data/lib/deeprails/internal/type/base_stream.rb +83 -0
- data/lib/deeprails/internal/util.rb +39 -3
- data/lib/deeprails/models/defend_create_workflow_params.rb +14 -1
- data/lib/deeprails/models/defend_response.rb +134 -10
- data/lib/deeprails/models/defend_retrieve_event_params.rb +7 -1
- data/lib/deeprails/models/defend_retrieve_workflow_params.rb +8 -1
- data/lib/deeprails/models/defend_submit_and_stream_event_params.rb +92 -0
- data/lib/deeprails/models/defend_submit_and_stream_event_response.rb +7 -0
- data/lib/deeprails/models/defend_submit_event_params.rb +70 -20
- data/lib/deeprails/models/defend_update_response.rb +9 -1
- data/lib/deeprails/models/defend_update_workflow_params.rb +138 -5
- data/lib/deeprails/models/monitor_create_params.rb +14 -1
- data/lib/deeprails/models/monitor_detail_response.rb +60 -17
- data/lib/deeprails/models/monitor_event_detail_response.rb +11 -5
- data/lib/deeprails/models/monitor_retrieve_event_params.rb +7 -1
- data/lib/deeprails/models/monitor_retrieve_params.rb +8 -1
- data/lib/deeprails/models/monitor_submit_event_params.rb +70 -20
- data/lib/deeprails/models/monitor_update_params.rb +53 -5
- data/lib/deeprails/models/workflow_event_detail_response.rb +99 -16
- data/lib/deeprails/models/workflow_event_response.rb +9 -1
- data/lib/deeprails/models.rb +2 -0
- data/lib/deeprails/resources/defend.rb +70 -5
- data/lib/deeprails/resources/monitor.rb +16 -7
- data/lib/deeprails/version.rb +1 -1
- data/lib/deeprails.rb +5 -0
- data/manifest.yaml +1 -0
- data/rbi/deeprails/internal/stream.rbi +20 -0
- data/rbi/deeprails/internal/transport/base_client.rbi +18 -2
- data/rbi/deeprails/internal/type/base_stream.rbi +75 -0
- data/rbi/deeprails/internal/util.rbi +21 -1
- data/rbi/deeprails/models/defend_create_workflow_params.rbi +21 -0
- data/rbi/deeprails/models/defend_response.rbi +286 -14
- data/rbi/deeprails/models/defend_retrieve_event_params.rbi +10 -2
- data/rbi/deeprails/models/defend_retrieve_workflow_params.rbi +10 -1
- data/rbi/deeprails/models/defend_submit_and_stream_event_params.rbi +155 -0
- data/rbi/deeprails/models/defend_submit_and_stream_event_response.rbi +7 -0
- data/rbi/deeprails/models/defend_submit_event_params.rbi +134 -31
- data/rbi/deeprails/models/defend_update_response.rbi +14 -3
- data/rbi/deeprails/models/defend_update_workflow_params.rbi +304 -4
- data/rbi/deeprails/models/monitor_create_params.rbi +21 -0
- data/rbi/deeprails/models/monitor_detail_response.rbi +122 -28
- data/rbi/deeprails/models/monitor_event_detail_response.rbi +20 -8
- data/rbi/deeprails/models/monitor_retrieve_event_params.rbi +10 -2
- data/rbi/deeprails/models/monitor_retrieve_params.rbi +10 -1
- data/rbi/deeprails/models/monitor_submit_event_params.rbi +134 -31
- data/rbi/deeprails/models/monitor_update_params.rbi +113 -4
- data/rbi/deeprails/models/workflow_event_detail_response.rbi +204 -24
- data/rbi/deeprails/models/workflow_event_response.rbi +8 -0
- data/rbi/deeprails/models.rbi +3 -0
- data/rbi/deeprails/resources/defend.rbi +101 -6
- data/rbi/deeprails/resources/monitor.rbi +31 -8
- data/sig/deeprails/internal/stream.rbs +9 -0
- data/sig/deeprails/internal/type/base_stream.rbs +38 -0
- data/sig/deeprails/internal/util.rbs +10 -0
- data/sig/deeprails/models/defend_create_workflow_params.rbs +7 -0
- data/sig/deeprails/models/defend_response.rbs +114 -8
- data/sig/deeprails/models/defend_retrieve_event_params.rbs +6 -1
- data/sig/deeprails/models/defend_retrieve_workflow_params.rbs +6 -1
- data/sig/deeprails/models/defend_submit_and_stream_event_params.rbs +73 -0
- data/sig/deeprails/models/defend_submit_and_stream_event_response.rbs +5 -0
- data/sig/deeprails/models/defend_submit_event_params.rbs +53 -13
- data/sig/deeprails/models/defend_update_response.rbs +10 -3
- data/sig/deeprails/models/defend_update_workflow_params.rbs +108 -1
- data/sig/deeprails/models/monitor_create_params.rbs +7 -0
- data/sig/deeprails/models/monitor_detail_response.rbs +48 -13
- data/sig/deeprails/models/monitor_event_detail_response.rbs +12 -4
- data/sig/deeprails/models/monitor_retrieve_event_params.rbs +6 -1
- data/sig/deeprails/models/monitor_retrieve_params.rbs +6 -1
- data/sig/deeprails/models/monitor_submit_event_params.rbs +53 -13
- data/sig/deeprails/models/monitor_update_params.rbs +50 -1
- data/sig/deeprails/models/workflow_event_detail_response.rbs +100 -15
- data/sig/deeprails/models/workflow_event_response.rbs +5 -0
- data/sig/deeprails/models.rbs +2 -0
- data/sig/deeprails/resources/defend.rbs +20 -0
- data/sig/deeprails/resources/monitor.rbs +4 -0
- metadata +28 -2
|
@@ -17,6 +17,7 @@ module Deeprails
|
|
|
17
17
|
Symbol,
|
|
18
18
|
Deeprails::DefendCreateWorkflowParams::AutomaticHallucinationToleranceLevel::OrSymbol
|
|
19
19
|
],
|
|
20
|
+
context_awareness: T::Boolean,
|
|
20
21
|
custom_hallucination_threshold_values: T::Hash[Symbol, Float],
|
|
21
22
|
description: String,
|
|
22
23
|
file_search: T::Array[String],
|
|
@@ -45,6 +46,13 @@ module Deeprails
|
|
|
45
46
|
# `instruction_adherence`, `context_adherence`, `ground_truth_adherence`, or
|
|
46
47
|
# `comprehensive_safety`.
|
|
47
48
|
automatic_hallucination_tolerance_levels: nil,
|
|
49
|
+
# Context includes any structured information that directly relates to the model’s
|
|
50
|
+
# input and expected output—e.g., the recent turn-by-turn history between an AI
|
|
51
|
+
# tutor and a student, facts or state passed through an agentic workflow, or other
|
|
52
|
+
# domain-specific signals your system already knows and wants the model to
|
|
53
|
+
# condition on. This field determines whether to enable context awareness for this
|
|
54
|
+
# workflow's evaluations. Defaults to false.
|
|
55
|
+
context_awareness: nil,
|
|
48
56
|
# Mapping of guardrail metrics to floating point threshold values. Possible
|
|
49
57
|
# metrics are `correctness`, `completeness`, `instruction_adherence`,
|
|
50
58
|
# `context_adherence`, `ground_truth_adherence`, or `comprehensive_safety`.
|
|
@@ -98,6 +106,44 @@ module Deeprails
|
|
|
98
106
|
)
|
|
99
107
|
end
|
|
100
108
|
|
|
109
|
+
# Use this endpoint to submit a model input and output pair to a workflow for
|
|
110
|
+
# evaluation with streaming responses.
|
|
111
|
+
sig do
|
|
112
|
+
params(
|
|
113
|
+
workflow_id: String,
|
|
114
|
+
model_input: T::Hash[Symbol, T.anything],
|
|
115
|
+
model_output: String,
|
|
116
|
+
model_used: String,
|
|
117
|
+
run_mode:
|
|
118
|
+
Deeprails::DefendSubmitAndStreamEventParams::RunMode::OrSymbol,
|
|
119
|
+
stream: T::Boolean,
|
|
120
|
+
nametag: String,
|
|
121
|
+
request_options: Deeprails::RequestOptions::OrHash
|
|
122
|
+
).returns(Deeprails::Internal::Stream[String])
|
|
123
|
+
end
|
|
124
|
+
def submit_and_stream_event_streaming(
|
|
125
|
+
# Path param: The ID of the workflow to create the event for.
|
|
126
|
+
workflow_id,
|
|
127
|
+
# Body param: The input provided to the model (e.g., prompt, messages).
|
|
128
|
+
model_input:,
|
|
129
|
+
# Body param: The output generated by the model to be evaluated.
|
|
130
|
+
model_output:,
|
|
131
|
+
# Body param: The model that generated the output (e.g., "gpt-4", "claude-3").
|
|
132
|
+
model_used:,
|
|
133
|
+
# Body param: The evaluation run mode. Streaming is supported on all run modes
|
|
134
|
+
# except precision_max and precision_max_codex. Note: super_fast does not support
|
|
135
|
+
# Web Search or File Search — if your workflow has these enabled, use a different
|
|
136
|
+
# run mode or disable the capability on the workflow.
|
|
137
|
+
run_mode:,
|
|
138
|
+
# Query param: Enable SSE streaming for real-time token feedback. Supported on all
|
|
139
|
+
# run modes except precision_max and precision_max_codex.
|
|
140
|
+
stream: nil,
|
|
141
|
+
# Body param: Optional tag to identify this event.
|
|
142
|
+
nametag: nil,
|
|
143
|
+
request_options: {}
|
|
144
|
+
)
|
|
145
|
+
end
|
|
146
|
+
|
|
101
147
|
# Use this endpoint to submit a model input and output pair to a workflow for
|
|
102
148
|
# evaluation
|
|
103
149
|
sig do
|
|
@@ -115,8 +161,8 @@ module Deeprails
|
|
|
115
161
|
# Workflow ID associated with this event.
|
|
116
162
|
workflow_id,
|
|
117
163
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
118
|
-
# contain
|
|
119
|
-
#
|
|
164
|
+
# contain a `user_prompt` field. For the ground_truth_adherence guardrail metric,
|
|
165
|
+
# `ground_truth` should be provided.
|
|
120
166
|
model_input:,
|
|
121
167
|
# Output generated by the LLM to be evaluated.
|
|
122
168
|
model_output:,
|
|
@@ -124,8 +170,11 @@ module Deeprails
|
|
|
124
170
|
model_used:,
|
|
125
171
|
# Run mode for the workflow event. The run mode allows the user to optimize for
|
|
126
172
|
# speed, accuracy, and cost by determining which models are used to evaluate the
|
|
127
|
-
# event. Available run modes
|
|
128
|
-
# `
|
|
173
|
+
# event. Available run modes (fastest to most thorough): `super_fast`, `fast`,
|
|
174
|
+
# `precision`, `precision_codex`, `precision_max`, and `precision_max_codex`.
|
|
175
|
+
# Defaults to `fast`. Note: `super_fast` does not support Web Search or File
|
|
176
|
+
# Search — if your workflow has these capabilities enabled, use a different run
|
|
177
|
+
# mode or edit the workflow to disable them.
|
|
129
178
|
run_mode:,
|
|
130
179
|
# An optional, user-defined tag for the event.
|
|
131
180
|
nametag: nil,
|
|
@@ -137,18 +186,64 @@ module Deeprails
|
|
|
137
186
|
sig do
|
|
138
187
|
params(
|
|
139
188
|
workflow_id: String,
|
|
189
|
+
automatic_hallucination_tolerance_levels:
|
|
190
|
+
T::Hash[
|
|
191
|
+
Symbol,
|
|
192
|
+
Deeprails::DefendUpdateWorkflowParams::AutomaticHallucinationToleranceLevel::OrSymbol
|
|
193
|
+
],
|
|
194
|
+
context_awareness: T::Boolean,
|
|
195
|
+
custom_hallucination_threshold_values: T::Hash[Symbol, Float],
|
|
140
196
|
description: String,
|
|
197
|
+
file_search: T::Array[String],
|
|
198
|
+
improvement_action:
|
|
199
|
+
Deeprails::DefendUpdateWorkflowParams::ImprovementAction::OrSymbol,
|
|
200
|
+
max_improvement_attempts: Integer,
|
|
141
201
|
name: String,
|
|
202
|
+
threshold_type:
|
|
203
|
+
Deeprails::DefendUpdateWorkflowParams::ThresholdType::OrSymbol,
|
|
204
|
+
web_search: T::Boolean,
|
|
142
205
|
request_options: Deeprails::RequestOptions::OrHash
|
|
143
206
|
).returns(Deeprails::DefendUpdateResponse)
|
|
144
207
|
end
|
|
145
208
|
def update_workflow(
|
|
146
209
|
# The ID of the workflow to edit.
|
|
147
210
|
workflow_id,
|
|
148
|
-
#
|
|
211
|
+
# New mapping of guardrail metrics to hallucination tolerance levels (either
|
|
212
|
+
# `low`, `medium`, or `high`) to be used when `threshold_type` is set to
|
|
213
|
+
# `automatic`. Possible metrics are `completeness`, `instruction_adherence`,
|
|
214
|
+
# `context_adherence`, `ground_truth_adherence`, or `comprehensive_safety`.
|
|
215
|
+
automatic_hallucination_tolerance_levels: nil,
|
|
216
|
+
# Whether to enable context awareness for this workflow's evaluations.
|
|
217
|
+
context_awareness: nil,
|
|
218
|
+
# New mapping of guardrail metrics to floating point threshold values to be used
|
|
219
|
+
# when `threshold_type` is set to `custom`. Possible metrics are `correctness`,
|
|
220
|
+
# `completeness`, `instruction_adherence`, `context_adherence`,
|
|
221
|
+
# `ground_truth_adherence`, or `comprehensive_safety`.
|
|
222
|
+
custom_hallucination_threshold_values: nil,
|
|
223
|
+
# New description for the workflow.
|
|
149
224
|
description: nil,
|
|
150
|
-
#
|
|
225
|
+
# An array of file IDs to search in the workflow's evaluations. Files must be
|
|
226
|
+
# uploaded via the DeepRails API first.
|
|
227
|
+
file_search: nil,
|
|
228
|
+
# The new action used to improve outputs that fail one or more guardrail metrics
|
|
229
|
+
# for the workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs
|
|
230
|
+
# the user's input prompt with minor induced variance. FixIt attempts to directly
|
|
231
|
+
# address the shortcomings of the output using the guardrail failure rationale. Do
|
|
232
|
+
# Nothing does not attempt any improvement.
|
|
233
|
+
improvement_action: nil,
|
|
234
|
+
# Max. number of improvement action attempts until a given event passes the
|
|
235
|
+
# guardrails. Defaults to 10.
|
|
236
|
+
max_improvement_attempts: nil,
|
|
237
|
+
# New name for the workflow.
|
|
151
238
|
name: nil,
|
|
239
|
+
# New type of thresholds to use for the workflow, either `automatic` or `custom`.
|
|
240
|
+
# Automatic thresholds are assigned internally after the user specifies a
|
|
241
|
+
# qualitative tolerance for the metrics, whereas custom metrics allow the user to
|
|
242
|
+
# set the threshold for each metric as a floating point number between 0.0 and
|
|
243
|
+
# 1.0.
|
|
244
|
+
threshold_type: nil,
|
|
245
|
+
# Whether to enable web search for this workflow's evaluations.
|
|
246
|
+
web_search: nil,
|
|
152
247
|
request_options: {}
|
|
153
248
|
)
|
|
154
249
|
end
|
|
@@ -10,6 +10,7 @@ module Deeprails
|
|
|
10
10
|
guardrail_metrics:
|
|
11
11
|
T::Array[Deeprails::MonitorCreateParams::GuardrailMetric::OrSymbol],
|
|
12
12
|
name: String,
|
|
13
|
+
context_awareness: T::Boolean,
|
|
13
14
|
description: String,
|
|
14
15
|
file_search: T::Array[String],
|
|
15
16
|
web_search: T::Boolean,
|
|
@@ -24,6 +25,13 @@ module Deeprails
|
|
|
24
25
|
guardrail_metrics:,
|
|
25
26
|
# Name of the new monitor.
|
|
26
27
|
name:,
|
|
28
|
+
# Context includes any structured information that directly relates to the model’s
|
|
29
|
+
# input and expected output—e.g., the recent turn-by-turn history between an AI
|
|
30
|
+
# tutor and a student, facts or state passed through an agentic workflow, or other
|
|
31
|
+
# domain-specific signals your system already knows and wants the model to
|
|
32
|
+
# condition on. This field determines whether to enable context awareness for this
|
|
33
|
+
# monitor's evaluations. Defaults to false.
|
|
34
|
+
context_awareness: nil,
|
|
27
35
|
# Description of the new monitor.
|
|
28
36
|
description: nil,
|
|
29
37
|
# An array of file IDs to search in the monitor's evaluations. Files must be
|
|
@@ -54,27 +62,39 @@ module Deeprails
|
|
|
54
62
|
)
|
|
55
63
|
end
|
|
56
64
|
|
|
57
|
-
# Use this endpoint to update the name,
|
|
58
|
-
# monitor
|
|
65
|
+
# Use this endpoint to update the name, status, and/or other details of an
|
|
66
|
+
# existing monitor.
|
|
59
67
|
sig do
|
|
60
68
|
params(
|
|
61
69
|
monitor_id: String,
|
|
62
70
|
description: String,
|
|
71
|
+
file_search: T::Array[String],
|
|
72
|
+
guardrail_metrics:
|
|
73
|
+
T::Array[Deeprails::MonitorUpdateParams::GuardrailMetric::OrSymbol],
|
|
63
74
|
name: String,
|
|
64
75
|
status: Deeprails::MonitorUpdateParams::Status::OrSymbol,
|
|
76
|
+
web_search: T::Boolean,
|
|
65
77
|
request_options: Deeprails::RequestOptions::OrHash
|
|
66
78
|
).returns(Deeprails::MonitorUpdateResponse)
|
|
67
79
|
end
|
|
68
80
|
def update(
|
|
69
81
|
# The ID of the monitor to edit.
|
|
70
82
|
monitor_id,
|
|
71
|
-
#
|
|
83
|
+
# New description of the monitor.
|
|
72
84
|
description: nil,
|
|
73
|
-
#
|
|
85
|
+
# An array of file IDs to search in the monitor's evaluations. Files must be
|
|
86
|
+
# uploaded via the DeepRails API first.
|
|
87
|
+
file_search: nil,
|
|
88
|
+
# An array of the new guardrail metrics that model input and output pairs will be
|
|
89
|
+
# evaluated on.
|
|
90
|
+
guardrail_metrics: nil,
|
|
91
|
+
# New name of the monitor.
|
|
74
92
|
name: nil,
|
|
75
93
|
# Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
|
|
76
94
|
# longer record and evaluate events.
|
|
77
95
|
status: nil,
|
|
96
|
+
# Whether to enable web search for this monitor's evaluations.
|
|
97
|
+
web_search: nil,
|
|
78
98
|
request_options: {}
|
|
79
99
|
)
|
|
80
100
|
end
|
|
@@ -112,8 +132,8 @@ module Deeprails
|
|
|
112
132
|
# The ID of the monitor associated with this event.
|
|
113
133
|
monitor_id,
|
|
114
134
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
115
|
-
# contain
|
|
116
|
-
#
|
|
135
|
+
# contain a `user_prompt` field. For ground_truth_adherence guardrail metric,
|
|
136
|
+
# `ground_truth` should be provided.
|
|
117
137
|
model_input:,
|
|
118
138
|
# Output generated by the LLM to be evaluated.
|
|
119
139
|
model_output:,
|
|
@@ -121,8 +141,11 @@ module Deeprails
|
|
|
121
141
|
nametag: nil,
|
|
122
142
|
# Run mode for the monitor event. The run mode allows the user to optimize for
|
|
123
143
|
# speed, accuracy, and cost by determining which models are used to evaluate the
|
|
124
|
-
# event. Available run modes
|
|
125
|
-
# `
|
|
144
|
+
# event. Available run modes (fastest to most thorough): `super_fast`, `fast`,
|
|
145
|
+
# `precision`, `precision_codex`, `precision_max`, and `precision_max_codex`.
|
|
146
|
+
# Defaults to `fast`. Note: `super_fast` does not support Web Search or File
|
|
147
|
+
# Search — if your monitor has these capabilities enabled, use a different run
|
|
148
|
+
# mode or edit the monitor to disable them.
|
|
126
149
|
run_mode: nil,
|
|
127
150
|
request_options: {}
|
|
128
151
|
)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module Deeprails
|
|
2
|
+
module Internal
|
|
3
|
+
module Type
|
|
4
|
+
module BaseStream[Message, Elem]
|
|
5
|
+
include Enumerable[Elem]
|
|
6
|
+
|
|
7
|
+
attr_reader status: Integer
|
|
8
|
+
|
|
9
|
+
attr_reader headers: ::Hash[String, String]
|
|
10
|
+
|
|
11
|
+
def close: -> void
|
|
12
|
+
|
|
13
|
+
private def iterator: -> Enumerable[Elem]
|
|
14
|
+
|
|
15
|
+
def each: { (Elem arg0) -> void } -> void
|
|
16
|
+
|
|
17
|
+
def to_enum: -> Enumerator[Elem]
|
|
18
|
+
|
|
19
|
+
alias enum_for to_enum
|
|
20
|
+
|
|
21
|
+
def initialize: (
|
|
22
|
+
model: Class | Deeprails::Internal::Type::Converter,
|
|
23
|
+
url: URI::Generic,
|
|
24
|
+
status: Integer,
|
|
25
|
+
headers: ::Hash[String, String],
|
|
26
|
+
response: top,
|
|
27
|
+
unwrap: Symbol
|
|
28
|
+
| Integer
|
|
29
|
+
| ::Array[Symbol | Integer]
|
|
30
|
+
| ^(top arg0) -> top,
|
|
31
|
+
stream: Enumerable[Message]
|
|
32
|
+
) -> void
|
|
33
|
+
|
|
34
|
+
def inspect: -> String
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -106,6 +106,16 @@ module Deeprails
|
|
|
106
106
|
JSON_CONTENT: Regexp
|
|
107
107
|
JSONL_CONTENT: Regexp
|
|
108
108
|
|
|
109
|
+
def encode_query_params: (
|
|
110
|
+
::Hash[Symbol, top] query
|
|
111
|
+
) -> ::Hash[Symbol, top]
|
|
112
|
+
|
|
113
|
+
private def write_query_param_element!: (
|
|
114
|
+
::Hash[Symbol, top] collection,
|
|
115
|
+
String key,
|
|
116
|
+
top element
|
|
117
|
+
) -> nil
|
|
118
|
+
|
|
109
119
|
def self?.write_multipart_content: (
|
|
110
120
|
Enumerator::Yielder y,
|
|
111
121
|
val: top,
|
|
@@ -6,6 +6,7 @@ module Deeprails
|
|
|
6
6
|
name: String,
|
|
7
7
|
threshold_type: Deeprails::Models::DefendCreateWorkflowParams::threshold_type,
|
|
8
8
|
automatic_hallucination_tolerance_levels: ::Hash[Symbol, Deeprails::Models::DefendCreateWorkflowParams::automatic_hallucination_tolerance_level],
|
|
9
|
+
context_awareness: bool,
|
|
9
10
|
custom_hallucination_threshold_values: ::Hash[Symbol, Float],
|
|
10
11
|
description: String,
|
|
11
12
|
file_search: ::Array[String],
|
|
@@ -30,6 +31,10 @@ module Deeprails
|
|
|
30
31
|
::Hash[Symbol, Deeprails::Models::DefendCreateWorkflowParams::automatic_hallucination_tolerance_level]
|
|
31
32
|
) -> ::Hash[Symbol, Deeprails::Models::DefendCreateWorkflowParams::automatic_hallucination_tolerance_level]
|
|
32
33
|
|
|
34
|
+
attr_reader context_awareness: bool?
|
|
35
|
+
|
|
36
|
+
def context_awareness=: (bool) -> bool
|
|
37
|
+
|
|
33
38
|
attr_reader custom_hallucination_threshold_values: ::Hash[Symbol, Float]?
|
|
34
39
|
|
|
35
40
|
def custom_hallucination_threshold_values=: (
|
|
@@ -57,6 +62,7 @@ module Deeprails
|
|
|
57
62
|
name: String,
|
|
58
63
|
threshold_type: Deeprails::Models::DefendCreateWorkflowParams::threshold_type,
|
|
59
64
|
?automatic_hallucination_tolerance_levels: ::Hash[Symbol, Deeprails::Models::DefendCreateWorkflowParams::automatic_hallucination_tolerance_level],
|
|
65
|
+
?context_awareness: bool,
|
|
60
66
|
?custom_hallucination_threshold_values: ::Hash[Symbol, Float],
|
|
61
67
|
?description: String,
|
|
62
68
|
?file_search: ::Array[String],
|
|
@@ -70,6 +76,7 @@ module Deeprails
|
|
|
70
76
|
name: String,
|
|
71
77
|
threshold_type: Deeprails::Models::DefendCreateWorkflowParams::threshold_type,
|
|
72
78
|
automatic_hallucination_tolerance_levels: ::Hash[Symbol, Deeprails::Models::DefendCreateWorkflowParams::automatic_hallucination_tolerance_level],
|
|
79
|
+
context_awareness: bool,
|
|
73
80
|
custom_hallucination_threshold_values: ::Hash[Symbol, Float],
|
|
74
81
|
description: String,
|
|
75
82
|
file_search: ::Array[String],
|
|
@@ -115,13 +115,19 @@ module Deeprails
|
|
|
115
115
|
|
|
116
116
|
type event =
|
|
117
117
|
{
|
|
118
|
+
billing_request_id: String,
|
|
118
119
|
evaluations: ::Array[Deeprails::DefendResponse::Event::Evaluation],
|
|
119
120
|
event_id: String,
|
|
120
121
|
improved_model_output: String,
|
|
121
|
-
improvement_tool_status:
|
|
122
|
+
improvement_tool_status: Deeprails::Models::DefendResponse::Event::improvement_tool_status,
|
|
123
|
+
status: Deeprails::Models::DefendResponse::Event::status
|
|
122
124
|
}
|
|
123
125
|
|
|
124
126
|
class Event < Deeprails::Internal::Type::BaseModel
|
|
127
|
+
attr_reader billing_request_id: String?
|
|
128
|
+
|
|
129
|
+
def billing_request_id=: (String) -> String
|
|
130
|
+
|
|
125
131
|
attr_reader evaluations: ::Array[Deeprails::DefendResponse::Event::Evaluation]?
|
|
126
132
|
|
|
127
133
|
def evaluations=: (
|
|
@@ -136,26 +142,39 @@ module Deeprails
|
|
|
136
142
|
|
|
137
143
|
def improved_model_output=: (String) -> String
|
|
138
144
|
|
|
139
|
-
attr_reader improvement_tool_status:
|
|
145
|
+
attr_reader improvement_tool_status: Deeprails::Models::DefendResponse::Event::improvement_tool_status?
|
|
146
|
+
|
|
147
|
+
def improvement_tool_status=: (
|
|
148
|
+
Deeprails::Models::DefendResponse::Event::improvement_tool_status
|
|
149
|
+
) -> Deeprails::Models::DefendResponse::Event::improvement_tool_status
|
|
150
|
+
|
|
151
|
+
attr_reader status: Deeprails::Models::DefendResponse::Event::status?
|
|
140
152
|
|
|
141
|
-
def
|
|
153
|
+
def status=: (
|
|
154
|
+
Deeprails::Models::DefendResponse::Event::status
|
|
155
|
+
) -> Deeprails::Models::DefendResponse::Event::status
|
|
142
156
|
|
|
143
157
|
def initialize: (
|
|
158
|
+
?billing_request_id: String,
|
|
144
159
|
?evaluations: ::Array[Deeprails::DefendResponse::Event::Evaluation],
|
|
145
160
|
?event_id: String,
|
|
146
161
|
?improved_model_output: String,
|
|
147
|
-
?improvement_tool_status:
|
|
162
|
+
?improvement_tool_status: Deeprails::Models::DefendResponse::Event::improvement_tool_status,
|
|
163
|
+
?status: Deeprails::Models::DefendResponse::Event::status
|
|
148
164
|
) -> void
|
|
149
165
|
|
|
150
166
|
def to_hash: -> {
|
|
167
|
+
billing_request_id: String,
|
|
151
168
|
evaluations: ::Array[Deeprails::DefendResponse::Event::Evaluation],
|
|
152
169
|
event_id: String,
|
|
153
170
|
improved_model_output: String,
|
|
154
|
-
improvement_tool_status:
|
|
171
|
+
improvement_tool_status: Deeprails::Models::DefendResponse::Event::improvement_tool_status,
|
|
172
|
+
status: Deeprails::Models::DefendResponse::Event::status
|
|
155
173
|
}
|
|
156
174
|
|
|
157
175
|
type evaluation =
|
|
158
176
|
{
|
|
177
|
+
analysis_of_failures: String,
|
|
159
178
|
attempt: String,
|
|
160
179
|
created_at: Time,
|
|
161
180
|
error_message: String,
|
|
@@ -163,6 +182,8 @@ module Deeprails
|
|
|
163
182
|
evaluation_status: String,
|
|
164
183
|
evaluation_total_cost: Float,
|
|
165
184
|
guardrail_metrics: ::Array[String],
|
|
185
|
+
improvement_tool_status: Deeprails::Models::DefendResponse::Event::Evaluation::improvement_tool_status,
|
|
186
|
+
key_improvements: ::Array[String],
|
|
166
187
|
model_input: ::Hash[Symbol, top],
|
|
167
188
|
model_output: String,
|
|
168
189
|
modified_at: Time,
|
|
@@ -172,6 +193,10 @@ module Deeprails
|
|
|
172
193
|
}
|
|
173
194
|
|
|
174
195
|
class Evaluation < Deeprails::Internal::Type::BaseModel
|
|
196
|
+
attr_reader analysis_of_failures: String?
|
|
197
|
+
|
|
198
|
+
def analysis_of_failures=: (String) -> String
|
|
199
|
+
|
|
175
200
|
attr_reader attempt: String?
|
|
176
201
|
|
|
177
202
|
def attempt=: (String) -> String
|
|
@@ -200,6 +225,16 @@ module Deeprails
|
|
|
200
225
|
|
|
201
226
|
def guardrail_metrics=: (::Array[String]) -> ::Array[String]
|
|
202
227
|
|
|
228
|
+
attr_reader improvement_tool_status: Deeprails::Models::DefendResponse::Event::Evaluation::improvement_tool_status?
|
|
229
|
+
|
|
230
|
+
def improvement_tool_status=: (
|
|
231
|
+
Deeprails::Models::DefendResponse::Event::Evaluation::improvement_tool_status
|
|
232
|
+
) -> Deeprails::Models::DefendResponse::Event::Evaluation::improvement_tool_status
|
|
233
|
+
|
|
234
|
+
attr_reader key_improvements: ::Array[String]?
|
|
235
|
+
|
|
236
|
+
def key_improvements=: (::Array[String]) -> ::Array[String]
|
|
237
|
+
|
|
203
238
|
attr_reader model_input: ::Hash[Symbol, top]?
|
|
204
239
|
|
|
205
240
|
def model_input=: (::Hash[Symbol, top]) -> ::Hash[Symbol, top]
|
|
@@ -225,6 +260,7 @@ module Deeprails
|
|
|
225
260
|
def run_mode=: (String) -> String
|
|
226
261
|
|
|
227
262
|
def initialize: (
|
|
263
|
+
?analysis_of_failures: String,
|
|
228
264
|
?attempt: String,
|
|
229
265
|
?created_at: Time,
|
|
230
266
|
?error_message: String,
|
|
@@ -232,6 +268,8 @@ module Deeprails
|
|
|
232
268
|
?evaluation_status: String,
|
|
233
269
|
?evaluation_total_cost: Float,
|
|
234
270
|
?guardrail_metrics: ::Array[String],
|
|
271
|
+
?improvement_tool_status: Deeprails::Models::DefendResponse::Event::Evaluation::improvement_tool_status,
|
|
272
|
+
?key_improvements: ::Array[String],
|
|
235
273
|
?model_input: ::Hash[Symbol, top],
|
|
236
274
|
?model_output: String,
|
|
237
275
|
?modified_at: Time,
|
|
@@ -241,6 +279,7 @@ module Deeprails
|
|
|
241
279
|
) -> void
|
|
242
280
|
|
|
243
281
|
def to_hash: -> {
|
|
282
|
+
analysis_of_failures: String,
|
|
244
283
|
attempt: String,
|
|
245
284
|
created_at: Time,
|
|
246
285
|
error_message: String,
|
|
@@ -248,6 +287,8 @@ module Deeprails
|
|
|
248
287
|
evaluation_status: String,
|
|
249
288
|
evaluation_total_cost: Float,
|
|
250
289
|
guardrail_metrics: ::Array[String],
|
|
290
|
+
improvement_tool_status: Deeprails::Models::DefendResponse::Event::Evaluation::improvement_tool_status,
|
|
291
|
+
key_improvements: ::Array[String],
|
|
251
292
|
model_input: ::Hash[Symbol, top],
|
|
252
293
|
model_output: String,
|
|
253
294
|
modified_at: Time,
|
|
@@ -255,10 +296,63 @@ module Deeprails
|
|
|
255
296
|
progress: Integer,
|
|
256
297
|
run_mode: String
|
|
257
298
|
}
|
|
299
|
+
|
|
300
|
+
type improvement_tool_status =
|
|
301
|
+
:improved
|
|
302
|
+
| :improvement_failed
|
|
303
|
+
| :no_improvement_required
|
|
304
|
+
| :improvement_required
|
|
305
|
+
|
|
306
|
+
module ImprovementToolStatus
|
|
307
|
+
extend Deeprails::Internal::Type::Enum
|
|
308
|
+
|
|
309
|
+
IMPROVED: :improved
|
|
310
|
+
IMPROVEMENT_FAILED: :improvement_failed
|
|
311
|
+
NO_IMPROVEMENT_REQUIRED: :no_improvement_required
|
|
312
|
+
IMPROVEMENT_REQUIRED: :improvement_required
|
|
313
|
+
|
|
314
|
+
def self?.values: -> ::Array[Deeprails::Models::DefendResponse::Event::Evaluation::improvement_tool_status]
|
|
315
|
+
end
|
|
316
|
+
end
|
|
317
|
+
|
|
318
|
+
type improvement_tool_status =
|
|
319
|
+
:improved
|
|
320
|
+
| :improvement_failed
|
|
321
|
+
| :no_improvement_required
|
|
322
|
+
| :improvement_required
|
|
323
|
+
|
|
324
|
+
module ImprovementToolStatus
|
|
325
|
+
extend Deeprails::Internal::Type::Enum
|
|
326
|
+
|
|
327
|
+
IMPROVED: :improved
|
|
328
|
+
IMPROVEMENT_FAILED: :improvement_failed
|
|
329
|
+
NO_IMPROVEMENT_REQUIRED: :no_improvement_required
|
|
330
|
+
IMPROVEMENT_REQUIRED: :improvement_required
|
|
331
|
+
|
|
332
|
+
def self?.values: -> ::Array[Deeprails::Models::DefendResponse::Event::improvement_tool_status]
|
|
333
|
+
end
|
|
334
|
+
|
|
335
|
+
type status = :completed | :failed | :in_progress
|
|
336
|
+
|
|
337
|
+
module Status
|
|
338
|
+
extend Deeprails::Internal::Type::Enum
|
|
339
|
+
|
|
340
|
+
COMPLETED: :completed
|
|
341
|
+
FAILED: :failed
|
|
342
|
+
IN_PROGRESS: :in_progress
|
|
343
|
+
|
|
344
|
+
def self?.values: -> ::Array[Deeprails::Models::DefendResponse::Event::status]
|
|
258
345
|
end
|
|
259
346
|
end
|
|
260
347
|
|
|
261
|
-
type file =
|
|
348
|
+
type file =
|
|
349
|
+
{
|
|
350
|
+
file_id: String,
|
|
351
|
+
file_name: String,
|
|
352
|
+
file_size: Integer,
|
|
353
|
+
presigned_url: String,
|
|
354
|
+
presigned_url_expires_at: Time
|
|
355
|
+
}
|
|
262
356
|
|
|
263
357
|
class File < Deeprails::Internal::Type::BaseModel
|
|
264
358
|
attr_reader file_id: String?
|
|
@@ -273,16 +367,28 @@ module Deeprails
|
|
|
273
367
|
|
|
274
368
|
def file_size=: (Integer) -> Integer
|
|
275
369
|
|
|
370
|
+
attr_reader presigned_url: String?
|
|
371
|
+
|
|
372
|
+
def presigned_url=: (String) -> String
|
|
373
|
+
|
|
374
|
+
attr_reader presigned_url_expires_at: Time?
|
|
375
|
+
|
|
376
|
+
def presigned_url_expires_at=: (Time) -> Time
|
|
377
|
+
|
|
276
378
|
def initialize: (
|
|
277
379
|
?file_id: String,
|
|
278
380
|
?file_name: String,
|
|
279
|
-
?file_size: Integer
|
|
381
|
+
?file_size: Integer,
|
|
382
|
+
?presigned_url: String,
|
|
383
|
+
?presigned_url_expires_at: Time
|
|
280
384
|
) -> void
|
|
281
385
|
|
|
282
386
|
def to_hash: -> {
|
|
283
387
|
file_id: String,
|
|
284
388
|
file_name: String,
|
|
285
|
-
file_size: Integer
|
|
389
|
+
file_size: Integer,
|
|
390
|
+
presigned_url: String,
|
|
391
|
+
presigned_url_expires_at: Time
|
|
286
392
|
}
|
|
287
393
|
end
|
|
288
394
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
module Deeprails
|
|
2
2
|
module Models
|
|
3
3
|
type defend_retrieve_event_params =
|
|
4
|
-
{ workflow_id: String
|
|
4
|
+
{ workflow_id: String, event_id: String }
|
|
5
|
+
& Deeprails::Internal::Type::request_parameters
|
|
5
6
|
|
|
6
7
|
class DefendRetrieveEventParams < Deeprails::Internal::Type::BaseModel
|
|
7
8
|
extend Deeprails::Internal::Type::RequestParameters::Converter
|
|
@@ -9,13 +10,17 @@ module Deeprails
|
|
|
9
10
|
|
|
10
11
|
attr_accessor workflow_id: String
|
|
11
12
|
|
|
13
|
+
attr_accessor event_id: String
|
|
14
|
+
|
|
12
15
|
def initialize: (
|
|
13
16
|
workflow_id: String,
|
|
17
|
+
event_id: String,
|
|
14
18
|
?request_options: Deeprails::request_opts
|
|
15
19
|
) -> void
|
|
16
20
|
|
|
17
21
|
def to_hash: -> {
|
|
18
22
|
workflow_id: String,
|
|
23
|
+
event_id: String,
|
|
19
24
|
request_options: Deeprails::RequestOptions
|
|
20
25
|
}
|
|
21
26
|
end
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
module Deeprails
|
|
2
2
|
module Models
|
|
3
3
|
type defend_retrieve_workflow_params =
|
|
4
|
-
{ limit: Integer }
|
|
4
|
+
{ workflow_id: String, limit: Integer }
|
|
5
|
+
& Deeprails::Internal::Type::request_parameters
|
|
5
6
|
|
|
6
7
|
class DefendRetrieveWorkflowParams < Deeprails::Internal::Type::BaseModel
|
|
7
8
|
extend Deeprails::Internal::Type::RequestParameters::Converter
|
|
8
9
|
include Deeprails::Internal::Type::RequestParameters
|
|
9
10
|
|
|
11
|
+
attr_accessor workflow_id: String
|
|
12
|
+
|
|
10
13
|
attr_reader limit: Integer?
|
|
11
14
|
|
|
12
15
|
def limit=: (Integer) -> Integer
|
|
13
16
|
|
|
14
17
|
def initialize: (
|
|
18
|
+
workflow_id: String,
|
|
15
19
|
?limit: Integer,
|
|
16
20
|
?request_options: Deeprails::request_opts
|
|
17
21
|
) -> void
|
|
18
22
|
|
|
19
23
|
def to_hash: -> {
|
|
24
|
+
workflow_id: String,
|
|
20
25
|
limit: Integer,
|
|
21
26
|
request_options: Deeprails::RequestOptions
|
|
22
27
|
}
|