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
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Deeprails
|
|
4
|
+
module Models
|
|
5
|
+
# @see Deeprails::Resources::Defend#submit_and_stream_event_streaming
|
|
6
|
+
class DefendSubmitAndStreamEventParams < Deeprails::Internal::Type::BaseModel
|
|
7
|
+
extend Deeprails::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include Deeprails::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute workflow_id
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
required :workflow_id, String
|
|
14
|
+
|
|
15
|
+
# @!attribute model_input
|
|
16
|
+
# The input provided to the model (e.g., prompt, messages).
|
|
17
|
+
#
|
|
18
|
+
# @return [Hash{Symbol=>Object}]
|
|
19
|
+
required :model_input, Deeprails::Internal::Type::HashOf[Deeprails::Internal::Type::Unknown]
|
|
20
|
+
|
|
21
|
+
# @!attribute model_output
|
|
22
|
+
# The output generated by the model to be evaluated.
|
|
23
|
+
#
|
|
24
|
+
# @return [String]
|
|
25
|
+
required :model_output, String
|
|
26
|
+
|
|
27
|
+
# @!attribute model_used
|
|
28
|
+
# The model that generated the output (e.g., "gpt-4", "claude-3").
|
|
29
|
+
#
|
|
30
|
+
# @return [String]
|
|
31
|
+
required :model_used, String
|
|
32
|
+
|
|
33
|
+
# @!attribute run_mode
|
|
34
|
+
# The evaluation run mode. Streaming is supported on all run modes except
|
|
35
|
+
# precision_max and precision_max_codex. Note: super_fast does not support Web
|
|
36
|
+
# Search or File Search — if your workflow has these enabled, use a different run
|
|
37
|
+
# mode or disable the capability on the workflow.
|
|
38
|
+
#
|
|
39
|
+
# @return [Symbol, Deeprails::Models::DefendSubmitAndStreamEventParams::RunMode]
|
|
40
|
+
required :run_mode, enum: -> { Deeprails::DefendSubmitAndStreamEventParams::RunMode }
|
|
41
|
+
|
|
42
|
+
# @!attribute stream
|
|
43
|
+
# Enable SSE streaming for real-time token feedback. Supported on all run modes
|
|
44
|
+
# except precision_max and precision_max_codex.
|
|
45
|
+
#
|
|
46
|
+
# @return [Boolean, nil]
|
|
47
|
+
optional :stream, Deeprails::Internal::Type::Boolean
|
|
48
|
+
|
|
49
|
+
# @!attribute nametag
|
|
50
|
+
# Optional tag to identify this event.
|
|
51
|
+
#
|
|
52
|
+
# @return [String, nil]
|
|
53
|
+
optional :nametag, String
|
|
54
|
+
|
|
55
|
+
# @!method initialize(workflow_id:, model_input:, model_output:, model_used:, run_mode:, stream: nil, nametag: nil, request_options: {})
|
|
56
|
+
# Some parameter documentations has been truncated, see
|
|
57
|
+
# {Deeprails::Models::DefendSubmitAndStreamEventParams} for more details.
|
|
58
|
+
#
|
|
59
|
+
# @param workflow_id [String]
|
|
60
|
+
#
|
|
61
|
+
# @param model_input [Hash{Symbol=>Object}] The input provided to the model (e.g., prompt, messages).
|
|
62
|
+
#
|
|
63
|
+
# @param model_output [String] The output generated by the model to be evaluated.
|
|
64
|
+
#
|
|
65
|
+
# @param model_used [String] The model that generated the output (e.g., "gpt-4", "claude-3").
|
|
66
|
+
#
|
|
67
|
+
# @param run_mode [Symbol, Deeprails::Models::DefendSubmitAndStreamEventParams::RunMode] The evaluation run mode. Streaming is supported on all run modes except precisio
|
|
68
|
+
#
|
|
69
|
+
# @param stream [Boolean] Enable SSE streaming for real-time token feedback. Supported on all run modes ex
|
|
70
|
+
#
|
|
71
|
+
# @param nametag [String] Optional tag to identify this event.
|
|
72
|
+
#
|
|
73
|
+
# @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}]
|
|
74
|
+
|
|
75
|
+
# The evaluation run mode. Streaming is supported on all run modes except
|
|
76
|
+
# precision_max and precision_max_codex. Note: super_fast does not support Web
|
|
77
|
+
# Search or File Search — if your workflow has these enabled, use a different run
|
|
78
|
+
# mode or disable the capability on the workflow.
|
|
79
|
+
module RunMode
|
|
80
|
+
extend Deeprails::Internal::Type::Enum
|
|
81
|
+
|
|
82
|
+
SUPER_FAST = :super_fast
|
|
83
|
+
FAST = :fast
|
|
84
|
+
PRECISION = :precision
|
|
85
|
+
PRECISION_CODEX = :precision_codex
|
|
86
|
+
|
|
87
|
+
# @!method self.values
|
|
88
|
+
# @return [Array<Symbol>]
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -7,10 +7,15 @@ module Deeprails
|
|
|
7
7
|
extend Deeprails::Internal::Type::RequestParameters::Converter
|
|
8
8
|
include Deeprails::Internal::Type::RequestParameters
|
|
9
9
|
|
|
10
|
+
# @!attribute workflow_id
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
required :workflow_id, String
|
|
14
|
+
|
|
10
15
|
# @!attribute model_input
|
|
11
16
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
12
|
-
# contain
|
|
13
|
-
#
|
|
17
|
+
# contain a `user_prompt` field. For the ground_truth_adherence guardrail metric,
|
|
18
|
+
# `ground_truth` should be provided.
|
|
14
19
|
#
|
|
15
20
|
# @return [Deeprails::Models::DefendSubmitEventParams::ModelInput]
|
|
16
21
|
required :model_input, -> { Deeprails::DefendSubmitEventParams::ModelInput }
|
|
@@ -30,8 +35,11 @@ module Deeprails
|
|
|
30
35
|
# @!attribute run_mode
|
|
31
36
|
# Run mode for the workflow event. The run mode allows the user to optimize for
|
|
32
37
|
# speed, accuracy, and cost by determining which models are used to evaluate the
|
|
33
|
-
# event. Available run modes
|
|
34
|
-
# `
|
|
38
|
+
# event. Available run modes (fastest to most thorough): `super_fast`, `fast`,
|
|
39
|
+
# `precision`, `precision_codex`, `precision_max`, and `precision_max_codex`.
|
|
40
|
+
# Defaults to `fast`. Note: `super_fast` does not support Web Search or File
|
|
41
|
+
# Search — if your workflow has these capabilities enabled, use a different run
|
|
42
|
+
# mode or edit the workflow to disable them.
|
|
35
43
|
#
|
|
36
44
|
# @return [Symbol, Deeprails::Models::DefendSubmitEventParams::RunMode]
|
|
37
45
|
required :run_mode, enum: -> { Deeprails::DefendSubmitEventParams::RunMode }
|
|
@@ -42,10 +50,12 @@ module Deeprails
|
|
|
42
50
|
# @return [String, nil]
|
|
43
51
|
optional :nametag, String
|
|
44
52
|
|
|
45
|
-
# @!method initialize(model_input:, model_output:, model_used:, run_mode:, nametag: nil, request_options: {})
|
|
53
|
+
# @!method initialize(workflow_id:, model_input:, model_output:, model_used:, run_mode:, nametag: nil, request_options: {})
|
|
46
54
|
# Some parameter documentations has been truncated, see
|
|
47
55
|
# {Deeprails::Models::DefendSubmitEventParams} for more details.
|
|
48
56
|
#
|
|
57
|
+
# @param workflow_id [String]
|
|
58
|
+
#
|
|
49
59
|
# @param model_input [Deeprails::Models::DefendSubmitEventParams::ModelInput] A dictionary of inputs sent to the LLM to generate output. The dictionary must c
|
|
50
60
|
#
|
|
51
61
|
# @param model_output [String] Output generated by the LLM to be evaluated.
|
|
@@ -59,6 +69,23 @@ module Deeprails
|
|
|
59
69
|
# @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}]
|
|
60
70
|
|
|
61
71
|
class ModelInput < Deeprails::Internal::Type::BaseModel
|
|
72
|
+
# @!attribute user_prompt
|
|
73
|
+
# The user prompt used to generate the output.
|
|
74
|
+
#
|
|
75
|
+
# @return [String]
|
|
76
|
+
required :user_prompt, String
|
|
77
|
+
|
|
78
|
+
# @!attribute context
|
|
79
|
+
# Any structured information that directly relates to the model’s input and
|
|
80
|
+
# expected output—e.g., the recent turn-by-turn history between an AI tutor and a
|
|
81
|
+
# student, facts or state passed through an agentic workflow, or other
|
|
82
|
+
# domain-specific signals your system already knows and wants the model to
|
|
83
|
+
# condition on.
|
|
84
|
+
#
|
|
85
|
+
# @return [Array<Deeprails::Models::DefendSubmitEventParams::ModelInput::Context>, nil]
|
|
86
|
+
optional :context,
|
|
87
|
+
-> { Deeprails::Internal::Type::ArrayOf[Deeprails::DefendSubmitEventParams::ModelInput::Context] }
|
|
88
|
+
|
|
62
89
|
# @!attribute ground_truth
|
|
63
90
|
# The ground truth for evaluating the Ground Truth Adherence guardrail.
|
|
64
91
|
#
|
|
@@ -71,35 +98,58 @@ module Deeprails
|
|
|
71
98
|
# @return [String, nil]
|
|
72
99
|
optional :system_prompt, String
|
|
73
100
|
|
|
74
|
-
# @!
|
|
75
|
-
#
|
|
101
|
+
# @!method initialize(user_prompt:, context: nil, ground_truth: nil, system_prompt: nil)
|
|
102
|
+
# Some parameter documentations has been truncated, see
|
|
103
|
+
# {Deeprails::Models::DefendSubmitEventParams::ModelInput} for more details.
|
|
76
104
|
#
|
|
77
|
-
# @return [String, nil]
|
|
78
|
-
optional :user_prompt, String
|
|
79
|
-
|
|
80
|
-
# @!method initialize(ground_truth: nil, system_prompt: nil, user_prompt: nil)
|
|
81
105
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
82
|
-
# contain
|
|
83
|
-
#
|
|
106
|
+
# contain a `user_prompt` field. For the ground_truth_adherence guardrail metric,
|
|
107
|
+
# `ground_truth` should be provided.
|
|
108
|
+
#
|
|
109
|
+
# @param user_prompt [String] The user prompt used to generate the output.
|
|
110
|
+
#
|
|
111
|
+
# @param context [Array<Deeprails::Models::DefendSubmitEventParams::ModelInput::Context>] Any structured information that directly relates to the model’s input and expect
|
|
84
112
|
#
|
|
85
113
|
# @param ground_truth [String] The ground truth for evaluating the Ground Truth Adherence guardrail.
|
|
86
114
|
#
|
|
87
115
|
# @param system_prompt [String] The system prompt used to generate the output.
|
|
88
|
-
|
|
89
|
-
|
|
116
|
+
|
|
117
|
+
class Context < Deeprails::Internal::Type::BaseModel
|
|
118
|
+
# @!attribute content
|
|
119
|
+
# The content of the message.
|
|
120
|
+
#
|
|
121
|
+
# @return [String, nil]
|
|
122
|
+
optional :content, String
|
|
123
|
+
|
|
124
|
+
# @!attribute role
|
|
125
|
+
# The role of the speaker.
|
|
126
|
+
#
|
|
127
|
+
# @return [String, nil]
|
|
128
|
+
optional :role, String
|
|
129
|
+
|
|
130
|
+
# @!method initialize(content: nil, role: nil)
|
|
131
|
+
# @param content [String] The content of the message.
|
|
132
|
+
#
|
|
133
|
+
# @param role [String] The role of the speaker.
|
|
134
|
+
end
|
|
90
135
|
end
|
|
91
136
|
|
|
92
137
|
# Run mode for the workflow event. The run mode allows the user to optimize for
|
|
93
138
|
# speed, accuracy, and cost by determining which models are used to evaluate the
|
|
94
|
-
# event. Available run modes
|
|
95
|
-
# `
|
|
139
|
+
# event. Available run modes (fastest to most thorough): `super_fast`, `fast`,
|
|
140
|
+
# `precision`, `precision_codex`, `precision_max`, and `precision_max_codex`.
|
|
141
|
+
# Defaults to `fast`. Note: `super_fast` does not support Web Search or File
|
|
142
|
+
# Search — if your workflow has these capabilities enabled, use a different run
|
|
143
|
+
# mode or edit the workflow to disable them.
|
|
96
144
|
module RunMode
|
|
97
145
|
extend Deeprails::Internal::Type::Enum
|
|
98
146
|
|
|
99
|
-
|
|
147
|
+
SUPER_FAST = :super_fast
|
|
148
|
+
FAST = :fast
|
|
100
149
|
PRECISION = :precision
|
|
101
|
-
|
|
102
|
-
|
|
150
|
+
PRECISION_CODEX = :precision_codex
|
|
151
|
+
PRECISION_MAX = :precision_max
|
|
152
|
+
PRECISION_MAX_CODEX = :precision_max_codex
|
|
103
153
|
|
|
104
154
|
# @!method self.values
|
|
105
155
|
# @return [Array<Symbol>]
|
|
@@ -23,7 +23,13 @@ module Deeprails
|
|
|
23
23
|
# @return [String]
|
|
24
24
|
required :workflow_id, String
|
|
25
25
|
|
|
26
|
-
# @!
|
|
26
|
+
# @!attribute name
|
|
27
|
+
# The name of the workflow.
|
|
28
|
+
#
|
|
29
|
+
# @return [String, nil]
|
|
30
|
+
optional :name, String
|
|
31
|
+
|
|
32
|
+
# @!method initialize(modified_at:, status:, workflow_id:, name: nil)
|
|
27
33
|
# Some parameter documentations has been truncated, see
|
|
28
34
|
# {Deeprails::Models::DefendUpdateResponse} for more details.
|
|
29
35
|
#
|
|
@@ -32,6 +38,8 @@ module Deeprails
|
|
|
32
38
|
# @param status [Symbol, Deeprails::Models::DefendUpdateResponse::Status] Status of the selected workflow. May be `inactive` or `active`. Inactive workf
|
|
33
39
|
#
|
|
34
40
|
# @param workflow_id [String] A unique workflow ID.
|
|
41
|
+
#
|
|
42
|
+
# @param name [String] The name of the workflow.
|
|
35
43
|
|
|
36
44
|
# Status of the selected workflow. May be `inactive` or `active`. Inactive
|
|
37
45
|
# workflows will not accept events.
|
|
@@ -7,24 +7,157 @@ module Deeprails
|
|
|
7
7
|
extend Deeprails::Internal::Type::RequestParameters::Converter
|
|
8
8
|
include Deeprails::Internal::Type::RequestParameters
|
|
9
9
|
|
|
10
|
+
# @!attribute workflow_id
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
required :workflow_id, String
|
|
14
|
+
|
|
15
|
+
# @!attribute automatic_hallucination_tolerance_levels
|
|
16
|
+
# New mapping of guardrail metrics to hallucination tolerance levels (either
|
|
17
|
+
# `low`, `medium`, or `high`) to be used when `threshold_type` is set to
|
|
18
|
+
# `automatic`. Possible metrics are `completeness`, `instruction_adherence`,
|
|
19
|
+
# `context_adherence`, `ground_truth_adherence`, or `comprehensive_safety`.
|
|
20
|
+
#
|
|
21
|
+
# @return [Hash{Symbol=>Symbol, Deeprails::Models::DefendUpdateWorkflowParams::AutomaticHallucinationToleranceLevel}, nil]
|
|
22
|
+
optional :automatic_hallucination_tolerance_levels,
|
|
23
|
+
-> { Deeprails::Internal::Type::HashOf[enum: Deeprails::DefendUpdateWorkflowParams::AutomaticHallucinationToleranceLevel] }
|
|
24
|
+
|
|
25
|
+
# @!attribute context_awareness
|
|
26
|
+
# Whether to enable context awareness for this workflow's evaluations.
|
|
27
|
+
#
|
|
28
|
+
# @return [Boolean, nil]
|
|
29
|
+
optional :context_awareness, Deeprails::Internal::Type::Boolean
|
|
30
|
+
|
|
31
|
+
# @!attribute custom_hallucination_threshold_values
|
|
32
|
+
# New mapping of guardrail metrics to floating point threshold values to be used
|
|
33
|
+
# when `threshold_type` is set to `custom`. Possible metrics are `correctness`,
|
|
34
|
+
# `completeness`, `instruction_adherence`, `context_adherence`,
|
|
35
|
+
# `ground_truth_adherence`, or `comprehensive_safety`.
|
|
36
|
+
#
|
|
37
|
+
# @return [Hash{Symbol=>Float}, nil]
|
|
38
|
+
optional :custom_hallucination_threshold_values, Deeprails::Internal::Type::HashOf[Float]
|
|
39
|
+
|
|
10
40
|
# @!attribute description
|
|
11
|
-
#
|
|
41
|
+
# New description for the workflow.
|
|
12
42
|
#
|
|
13
43
|
# @return [String, nil]
|
|
14
44
|
optional :description, String
|
|
15
45
|
|
|
46
|
+
# @!attribute file_search
|
|
47
|
+
# An array of file IDs to search in the workflow's evaluations. Files must be
|
|
48
|
+
# uploaded via the DeepRails API first.
|
|
49
|
+
#
|
|
50
|
+
# @return [Array<String>, nil]
|
|
51
|
+
optional :file_search, Deeprails::Internal::Type::ArrayOf[String]
|
|
52
|
+
|
|
53
|
+
# @!attribute improvement_action
|
|
54
|
+
# The new action used to improve outputs that fail one or more guardrail metrics
|
|
55
|
+
# for the workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs
|
|
56
|
+
# the user's input prompt with minor induced variance. FixIt attempts to directly
|
|
57
|
+
# address the shortcomings of the output using the guardrail failure rationale. Do
|
|
58
|
+
# Nothing does not attempt any improvement.
|
|
59
|
+
#
|
|
60
|
+
# @return [Symbol, Deeprails::Models::DefendUpdateWorkflowParams::ImprovementAction, nil]
|
|
61
|
+
optional :improvement_action, enum: -> { Deeprails::DefendUpdateWorkflowParams::ImprovementAction }
|
|
62
|
+
|
|
63
|
+
# @!attribute max_improvement_attempts
|
|
64
|
+
# Max. number of improvement action attempts until a given event passes the
|
|
65
|
+
# guardrails. Defaults to 10.
|
|
66
|
+
#
|
|
67
|
+
# @return [Integer, nil]
|
|
68
|
+
optional :max_improvement_attempts, Integer
|
|
69
|
+
|
|
16
70
|
# @!attribute name
|
|
17
|
-
#
|
|
71
|
+
# New name for the workflow.
|
|
18
72
|
#
|
|
19
73
|
# @return [String, nil]
|
|
20
74
|
optional :name, String
|
|
21
75
|
|
|
22
|
-
# @!
|
|
23
|
-
#
|
|
76
|
+
# @!attribute threshold_type
|
|
77
|
+
# New type of thresholds to use for the workflow, either `automatic` or `custom`.
|
|
78
|
+
# Automatic thresholds are assigned internally after the user specifies a
|
|
79
|
+
# qualitative tolerance for the metrics, whereas custom metrics allow the user to
|
|
80
|
+
# set the threshold for each metric as a floating point number between 0.0 and
|
|
81
|
+
# 1.0.
|
|
82
|
+
#
|
|
83
|
+
# @return [Symbol, Deeprails::Models::DefendUpdateWorkflowParams::ThresholdType, nil]
|
|
84
|
+
optional :threshold_type, enum: -> { Deeprails::DefendUpdateWorkflowParams::ThresholdType }
|
|
85
|
+
|
|
86
|
+
# @!attribute web_search
|
|
87
|
+
# Whether to enable web search for this workflow's evaluations.
|
|
88
|
+
#
|
|
89
|
+
# @return [Boolean, nil]
|
|
90
|
+
optional :web_search, Deeprails::Internal::Type::Boolean
|
|
91
|
+
|
|
92
|
+
# @!method initialize(workflow_id:, automatic_hallucination_tolerance_levels: nil, context_awareness: nil, custom_hallucination_threshold_values: nil, description: nil, file_search: nil, improvement_action: nil, max_improvement_attempts: nil, name: nil, threshold_type: nil, web_search: nil, request_options: {})
|
|
93
|
+
# Some parameter documentations has been truncated, see
|
|
94
|
+
# {Deeprails::Models::DefendUpdateWorkflowParams} for more details.
|
|
95
|
+
#
|
|
96
|
+
# @param workflow_id [String]
|
|
24
97
|
#
|
|
25
|
-
# @param
|
|
98
|
+
# @param automatic_hallucination_tolerance_levels [Hash{Symbol=>Symbol, Deeprails::Models::DefendUpdateWorkflowParams::AutomaticHallucinationToleranceLevel}] New mapping of guardrail metrics to hallucination tolerance levels
|
|
99
|
+
#
|
|
100
|
+
# @param context_awareness [Boolean] Whether to enable context awareness for this workflow's evaluations.
|
|
101
|
+
#
|
|
102
|
+
# @param custom_hallucination_threshold_values [Hash{Symbol=>Float}] New mapping of guardrail metrics to floating point threshold values to be used w
|
|
103
|
+
#
|
|
104
|
+
# @param description [String] New description for the workflow.
|
|
105
|
+
#
|
|
106
|
+
# @param file_search [Array<String>] An array of file IDs to search in the workflow's evaluations. Files must be uplo
|
|
107
|
+
#
|
|
108
|
+
# @param improvement_action [Symbol, Deeprails::Models::DefendUpdateWorkflowParams::ImprovementAction] The new action used to improve outputs that fail one or more guardrail metrics f
|
|
109
|
+
#
|
|
110
|
+
# @param max_improvement_attempts [Integer] Max. number of improvement action attempts until a given event passes the guardr
|
|
111
|
+
#
|
|
112
|
+
# @param name [String] New name for the workflow.
|
|
113
|
+
#
|
|
114
|
+
# @param threshold_type [Symbol, Deeprails::Models::DefendUpdateWorkflowParams::ThresholdType] New type of thresholds to use for the workflow, either `automatic` or `custom`.
|
|
115
|
+
#
|
|
116
|
+
# @param web_search [Boolean] Whether to enable web search for this workflow's evaluations.
|
|
26
117
|
#
|
|
27
118
|
# @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}]
|
|
119
|
+
|
|
120
|
+
module AutomaticHallucinationToleranceLevel
|
|
121
|
+
extend Deeprails::Internal::Type::Enum
|
|
122
|
+
|
|
123
|
+
LOW = :low
|
|
124
|
+
MEDIUM = :medium
|
|
125
|
+
HIGH = :high
|
|
126
|
+
|
|
127
|
+
# @!method self.values
|
|
128
|
+
# @return [Array<Symbol>]
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# The new action used to improve outputs that fail one or more guardrail metrics
|
|
132
|
+
# for the workflow events. May be `regen`, `fixit`, or `do_nothing`. ReGen runs
|
|
133
|
+
# the user's input prompt with minor induced variance. FixIt attempts to directly
|
|
134
|
+
# address the shortcomings of the output using the guardrail failure rationale. Do
|
|
135
|
+
# Nothing does not attempt any improvement.
|
|
136
|
+
module ImprovementAction
|
|
137
|
+
extend Deeprails::Internal::Type::Enum
|
|
138
|
+
|
|
139
|
+
REGEN = :regen
|
|
140
|
+
FIXIT = :fixit
|
|
141
|
+
DO_NOTHING = :do_nothing
|
|
142
|
+
|
|
143
|
+
# @!method self.values
|
|
144
|
+
# @return [Array<Symbol>]
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# New type of thresholds to use for the workflow, either `automatic` or `custom`.
|
|
148
|
+
# Automatic thresholds are assigned internally after the user specifies a
|
|
149
|
+
# qualitative tolerance for the metrics, whereas custom metrics allow the user to
|
|
150
|
+
# set the threshold for each metric as a floating point number between 0.0 and
|
|
151
|
+
# 1.0.
|
|
152
|
+
module ThresholdType
|
|
153
|
+
extend Deeprails::Internal::Type::Enum
|
|
154
|
+
|
|
155
|
+
AUTOMATIC = :automatic
|
|
156
|
+
CUSTOM = :custom
|
|
157
|
+
|
|
158
|
+
# @!method self.values
|
|
159
|
+
# @return [Array<Symbol>]
|
|
160
|
+
end
|
|
28
161
|
end
|
|
29
162
|
end
|
|
30
163
|
end
|
|
@@ -23,6 +23,17 @@ module Deeprails
|
|
|
23
23
|
# @return [String]
|
|
24
24
|
required :name, String
|
|
25
25
|
|
|
26
|
+
# @!attribute context_awareness
|
|
27
|
+
# Context includes any structured information that directly relates to the model’s
|
|
28
|
+
# input and expected output—e.g., the recent turn-by-turn history between an AI
|
|
29
|
+
# tutor and a student, facts or state passed through an agentic workflow, or other
|
|
30
|
+
# domain-specific signals your system already knows and wants the model to
|
|
31
|
+
# condition on. This field determines whether to enable context awareness for this
|
|
32
|
+
# monitor's evaluations. Defaults to false.
|
|
33
|
+
#
|
|
34
|
+
# @return [Boolean, nil]
|
|
35
|
+
optional :context_awareness, Deeprails::Internal::Type::Boolean
|
|
36
|
+
|
|
26
37
|
# @!attribute description
|
|
27
38
|
# Description of the new monitor.
|
|
28
39
|
#
|
|
@@ -42,7 +53,7 @@ module Deeprails
|
|
|
42
53
|
# @return [Boolean, nil]
|
|
43
54
|
optional :web_search, Deeprails::Internal::Type::Boolean
|
|
44
55
|
|
|
45
|
-
# @!method initialize(guardrail_metrics:, name:, description: nil, file_search: nil, web_search: nil, request_options: {})
|
|
56
|
+
# @!method initialize(guardrail_metrics:, name:, context_awareness: nil, description: nil, file_search: nil, web_search: nil, request_options: {})
|
|
46
57
|
# Some parameter documentations has been truncated, see
|
|
47
58
|
# {Deeprails::Models::MonitorCreateParams} for more details.
|
|
48
59
|
#
|
|
@@ -50,6 +61,8 @@ module Deeprails
|
|
|
50
61
|
#
|
|
51
62
|
# @param name [String] Name of the new monitor.
|
|
52
63
|
#
|
|
64
|
+
# @param context_awareness [Boolean] Context includes any structured information that directly relates to the model’s
|
|
65
|
+
#
|
|
53
66
|
# @param description [String] Description of the new monitor.
|
|
54
67
|
#
|
|
55
68
|
# @param file_search [Array<String>] An array of file IDs to search in the monitor's evaluations. Files must be uploa
|
|
@@ -5,7 +5,8 @@ module Deeprails
|
|
|
5
5
|
# @see Deeprails::Resources::Monitor#retrieve
|
|
6
6
|
class MonitorDetailResponse < Deeprails::Internal::Type::BaseModel
|
|
7
7
|
# @!attribute capabilities
|
|
8
|
-
# An array of capabilities associated with this monitor.
|
|
8
|
+
# An array of extended AI capabilities associated with this monitor. Can be
|
|
9
|
+
# `web_search`, `file_search`, and/or `context_awareness`.
|
|
9
10
|
#
|
|
10
11
|
# @return [Array<Deeprails::Models::MonitorDetailResponse::Capability>]
|
|
11
12
|
required :capabilities,
|
|
@@ -74,7 +75,7 @@ module Deeprails
|
|
|
74
75
|
# Some parameter documentations has been truncated, see
|
|
75
76
|
# {Deeprails::Models::MonitorDetailResponse} for more details.
|
|
76
77
|
#
|
|
77
|
-
# @param capabilities [Array<Deeprails::Models::MonitorDetailResponse::Capability>] An array of capabilities associated with this monitor.
|
|
78
|
+
# @param capabilities [Array<Deeprails::Models::MonitorDetailResponse::Capability>] An array of extended AI capabilities associated with this monitor. Can be `web\_
|
|
78
79
|
#
|
|
79
80
|
# @param created_at [Time] The time the monitor was created in UTC.
|
|
80
81
|
#
|
|
@@ -114,8 +115,9 @@ module Deeprails
|
|
|
114
115
|
|
|
115
116
|
# @!attribute model_input
|
|
116
117
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
117
|
-
# contain
|
|
118
|
-
#
|
|
118
|
+
# contain a `user_prompt` field. For ground_truth_adherence guardrail metric,
|
|
119
|
+
# `ground_truth` should be provided. When `context_awareness` is enabled,
|
|
120
|
+
# `context` should be provided.
|
|
119
121
|
#
|
|
120
122
|
# @return [Deeprails::Models::MonitorDetailResponse::Evaluation::ModelInput]
|
|
121
123
|
required :model_input, -> { Deeprails::MonitorDetailResponse::Evaluation::ModelInput }
|
|
@@ -129,6 +131,7 @@ module Deeprails
|
|
|
129
131
|
# @!attribute run_mode
|
|
130
132
|
# Run mode for the evaluation. The run mode allows the user to optimize for speed,
|
|
131
133
|
# accuracy, and cost by determining which models are used to evaluate the event.
|
|
134
|
+
# Note: `super_fast` do not support Web Search or File Search capabilities.
|
|
132
135
|
#
|
|
133
136
|
# @return [Symbol, Deeprails::Models::MonitorDetailResponse::Evaluation::RunMode]
|
|
134
137
|
required :run_mode, enum: -> { Deeprails::MonitorDetailResponse::Evaluation::RunMode }
|
|
@@ -223,6 +226,23 @@ module Deeprails
|
|
|
223
226
|
|
|
224
227
|
# @see Deeprails::Models::MonitorDetailResponse::Evaluation#model_input
|
|
225
228
|
class ModelInput < Deeprails::Internal::Type::BaseModel
|
|
229
|
+
# @!attribute user_prompt
|
|
230
|
+
# The user prompt used to generate the output.
|
|
231
|
+
#
|
|
232
|
+
# @return [String]
|
|
233
|
+
required :user_prompt, String
|
|
234
|
+
|
|
235
|
+
# @!attribute context
|
|
236
|
+
# Any structured information that directly relates to the model’s input and
|
|
237
|
+
# expected output—e.g., the recent turn-by-turn history between an AI tutor and a
|
|
238
|
+
# student, facts or state passed through an agentic workflow, or other
|
|
239
|
+
# domain-specific signals your system already knows and wants the model to
|
|
240
|
+
# condition on.
|
|
241
|
+
#
|
|
242
|
+
# @return [Array<Deeprails::Models::MonitorDetailResponse::Evaluation::ModelInput::Context>, nil]
|
|
243
|
+
optional :context,
|
|
244
|
+
-> { Deeprails::Internal::Type::ArrayOf[Deeprails::MonitorDetailResponse::Evaluation::ModelInput::Context] }
|
|
245
|
+
|
|
226
246
|
# @!attribute ground_truth
|
|
227
247
|
# The ground truth for evaluating Ground Truth Adherence guardrail.
|
|
228
248
|
#
|
|
@@ -235,35 +255,58 @@ module Deeprails
|
|
|
235
255
|
# @return [String, nil]
|
|
236
256
|
optional :system_prompt, String
|
|
237
257
|
|
|
238
|
-
# @!
|
|
239
|
-
#
|
|
258
|
+
# @!method initialize(user_prompt:, context: nil, ground_truth: nil, system_prompt: nil)
|
|
259
|
+
# Some parameter documentations has been truncated, see
|
|
260
|
+
# {Deeprails::Models::MonitorDetailResponse::Evaluation::ModelInput} for more
|
|
261
|
+
# details.
|
|
240
262
|
#
|
|
241
|
-
# @return [String, nil]
|
|
242
|
-
optional :user_prompt, String
|
|
243
|
-
|
|
244
|
-
# @!method initialize(ground_truth: nil, system_prompt: nil, user_prompt: nil)
|
|
245
263
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
246
|
-
# contain
|
|
247
|
-
#
|
|
264
|
+
# contain a `user_prompt` field. For ground_truth_adherence guardrail metric,
|
|
265
|
+
# `ground_truth` should be provided. When `context_awareness` is enabled,
|
|
266
|
+
# `context` should be provided.
|
|
267
|
+
#
|
|
268
|
+
# @param user_prompt [String] The user prompt used to generate the output.
|
|
269
|
+
#
|
|
270
|
+
# @param context [Array<Deeprails::Models::MonitorDetailResponse::Evaluation::ModelInput::Context>] Any structured information that directly relates to the model’s input and expect
|
|
248
271
|
#
|
|
249
272
|
# @param ground_truth [String] The ground truth for evaluating Ground Truth Adherence guardrail.
|
|
250
273
|
#
|
|
251
274
|
# @param system_prompt [String] The system prompt used to generate the output.
|
|
252
|
-
|
|
253
|
-
|
|
275
|
+
|
|
276
|
+
class Context < Deeprails::Internal::Type::BaseModel
|
|
277
|
+
# @!attribute content
|
|
278
|
+
# The content of the message.
|
|
279
|
+
#
|
|
280
|
+
# @return [String, nil]
|
|
281
|
+
optional :content, String
|
|
282
|
+
|
|
283
|
+
# @!attribute role
|
|
284
|
+
# The role of the speaker.
|
|
285
|
+
#
|
|
286
|
+
# @return [String, nil]
|
|
287
|
+
optional :role, String
|
|
288
|
+
|
|
289
|
+
# @!method initialize(content: nil, role: nil)
|
|
290
|
+
# @param content [String] The content of the message.
|
|
291
|
+
#
|
|
292
|
+
# @param role [String] The role of the speaker.
|
|
293
|
+
end
|
|
254
294
|
end
|
|
255
295
|
|
|
256
296
|
# Run mode for the evaluation. The run mode allows the user to optimize for speed,
|
|
257
297
|
# accuracy, and cost by determining which models are used to evaluate the event.
|
|
298
|
+
# Note: `super_fast` do not support Web Search or File Search capabilities.
|
|
258
299
|
#
|
|
259
300
|
# @see Deeprails::Models::MonitorDetailResponse::Evaluation#run_mode
|
|
260
301
|
module RunMode
|
|
261
302
|
extend Deeprails::Internal::Type::Enum
|
|
262
303
|
|
|
263
|
-
|
|
304
|
+
SUPER_FAST = :super_fast
|
|
305
|
+
FAST = :fast
|
|
264
306
|
PRECISION = :precision
|
|
265
|
-
|
|
266
|
-
|
|
307
|
+
PRECISION_CODEX = :precision_codex
|
|
308
|
+
PRECISION_MAX = :precision_max
|
|
309
|
+
PRECISION_MAX_CODEX = :precision_max_codex
|
|
267
310
|
|
|
268
311
|
# @!method self.values
|
|
269
312
|
# @return [Array<Symbol>]
|
|
@@ -5,7 +5,8 @@ module Deeprails
|
|
|
5
5
|
# @see Deeprails::Resources::Monitor#retrieve_event
|
|
6
6
|
class MonitorEventDetailResponse < Deeprails::Internal::Type::BaseModel
|
|
7
7
|
# @!attribute capabilities
|
|
8
|
-
# The capabilities associated with the monitor event.
|
|
8
|
+
# The extended AI capabilities associated with the monitor event. Can be
|
|
9
|
+
# `web_search`, `file_search`, and/or `context_awareness`.
|
|
9
10
|
#
|
|
10
11
|
# @return [Array<Deeprails::Models::MonitorEventDetailResponse::Capability>, nil]
|
|
11
12
|
optional :capabilities,
|
|
@@ -84,7 +85,10 @@ module Deeprails
|
|
|
84
85
|
optional :timestamp, Time
|
|
85
86
|
|
|
86
87
|
# @!method initialize(capabilities: nil, eval_time: nil, evaluation_result: nil, event_id: nil, files: nil, guardrail_metrics: nil, model_input: nil, model_output: nil, monitor_id: nil, nametag: nil, run_mode: nil, status: nil, timestamp: nil)
|
|
87
|
-
#
|
|
88
|
+
# Some parameter documentations has been truncated, see
|
|
89
|
+
# {Deeprails::Models::MonitorEventDetailResponse} for more details.
|
|
90
|
+
#
|
|
91
|
+
# @param capabilities [Array<Deeprails::Models::MonitorEventDetailResponse::Capability>] The extended AI capabilities associated with the monitor event. Can be `web_sear
|
|
88
92
|
#
|
|
89
93
|
# @param eval_time [String] The time spent on the evaluation in seconds.
|
|
90
94
|
#
|
|
@@ -154,10 +158,12 @@ module Deeprails
|
|
|
154
158
|
module RunMode
|
|
155
159
|
extend Deeprails::Internal::Type::Enum
|
|
156
160
|
|
|
157
|
-
|
|
161
|
+
SUPER_FAST = :super_fast
|
|
162
|
+
FAST = :fast
|
|
158
163
|
PRECISION = :precision
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
PRECISION_CODEX = :precision_codex
|
|
165
|
+
PRECISION_MAX = :precision_max
|
|
166
|
+
PRECISION_MAX_CODEX = :precision_max_codex
|
|
161
167
|
|
|
162
168
|
# @!method self.values
|
|
163
169
|
# @return [Array<Symbol>]
|
|
@@ -12,8 +12,14 @@ module Deeprails
|
|
|
12
12
|
# @return [String]
|
|
13
13
|
required :monitor_id, String
|
|
14
14
|
|
|
15
|
-
# @!
|
|
15
|
+
# @!attribute event_id
|
|
16
|
+
#
|
|
17
|
+
# @return [String]
|
|
18
|
+
required :event_id, String
|
|
19
|
+
|
|
20
|
+
# @!method initialize(monitor_id:, event_id:, request_options: {})
|
|
16
21
|
# @param monitor_id [String]
|
|
22
|
+
# @param event_id [String]
|
|
17
23
|
# @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}]
|
|
18
24
|
end
|
|
19
25
|
end
|