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
|
@@ -26,6 +26,18 @@ module Deeprails
|
|
|
26
26
|
sig { returns(String) }
|
|
27
27
|
attr_accessor :name
|
|
28
28
|
|
|
29
|
+
# Context includes any structured information that directly relates to the model’s
|
|
30
|
+
# input and expected output—e.g., the recent turn-by-turn history between an AI
|
|
31
|
+
# tutor and a student, facts or state passed through an agentic workflow, or other
|
|
32
|
+
# domain-specific signals your system already knows and wants the model to
|
|
33
|
+
# condition on. This field determines whether to enable context awareness for this
|
|
34
|
+
# monitor's evaluations. Defaults to false.
|
|
35
|
+
sig { returns(T.nilable(T::Boolean)) }
|
|
36
|
+
attr_reader :context_awareness
|
|
37
|
+
|
|
38
|
+
sig { params(context_awareness: T::Boolean).void }
|
|
39
|
+
attr_writer :context_awareness
|
|
40
|
+
|
|
29
41
|
# Description of the new monitor.
|
|
30
42
|
sig { returns(T.nilable(String)) }
|
|
31
43
|
attr_reader :description
|
|
@@ -53,6 +65,7 @@ module Deeprails
|
|
|
53
65
|
guardrail_metrics:
|
|
54
66
|
T::Array[Deeprails::MonitorCreateParams::GuardrailMetric::OrSymbol],
|
|
55
67
|
name: String,
|
|
68
|
+
context_awareness: T::Boolean,
|
|
56
69
|
description: String,
|
|
57
70
|
file_search: T::Array[String],
|
|
58
71
|
web_search: T::Boolean,
|
|
@@ -67,6 +80,13 @@ module Deeprails
|
|
|
67
80
|
guardrail_metrics:,
|
|
68
81
|
# Name of the new monitor.
|
|
69
82
|
name:,
|
|
83
|
+
# Context includes any structured information that directly relates to the model’s
|
|
84
|
+
# input and expected output—e.g., the recent turn-by-turn history between an AI
|
|
85
|
+
# tutor and a student, facts or state passed through an agentic workflow, or other
|
|
86
|
+
# domain-specific signals your system already knows and wants the model to
|
|
87
|
+
# condition on. This field determines whether to enable context awareness for this
|
|
88
|
+
# monitor's evaluations. Defaults to false.
|
|
89
|
+
context_awareness: nil,
|
|
70
90
|
# Description of the new monitor.
|
|
71
91
|
description: nil,
|
|
72
92
|
# An array of file IDs to search in the monitor's evaluations. Files must be
|
|
@@ -86,6 +106,7 @@ module Deeprails
|
|
|
86
106
|
Deeprails::MonitorCreateParams::GuardrailMetric::OrSymbol
|
|
87
107
|
],
|
|
88
108
|
name: String,
|
|
109
|
+
context_awareness: T::Boolean,
|
|
89
110
|
description: String,
|
|
90
111
|
file_search: T::Array[String],
|
|
91
112
|
web_search: T::Boolean,
|
|
@@ -8,7 +8,8 @@ module Deeprails
|
|
|
8
8
|
T.any(Deeprails::MonitorDetailResponse, Deeprails::Internal::AnyHash)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
# An array of capabilities associated with this monitor.
|
|
11
|
+
# An array of extended AI capabilities associated with this monitor. Can be
|
|
12
|
+
# `web_search`, `file_search`, and/or `context_awareness`.
|
|
12
13
|
sig { returns(T::Array[Deeprails::MonitorDetailResponse::Capability]) }
|
|
13
14
|
attr_accessor :capabilities
|
|
14
15
|
|
|
@@ -77,7 +78,8 @@ module Deeprails
|
|
|
77
78
|
).returns(T.attached_class)
|
|
78
79
|
end
|
|
79
80
|
def self.new(
|
|
80
|
-
# An array of capabilities associated with this monitor.
|
|
81
|
+
# An array of extended AI capabilities associated with this monitor. Can be
|
|
82
|
+
# `web_search`, `file_search`, and/or `context_awareness`.
|
|
81
83
|
capabilities:,
|
|
82
84
|
# The time the monitor was created in UTC.
|
|
83
85
|
created_at:,
|
|
@@ -170,8 +172,9 @@ module Deeprails
|
|
|
170
172
|
attr_accessor :evaluation_status
|
|
171
173
|
|
|
172
174
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
173
|
-
# contain
|
|
174
|
-
#
|
|
175
|
+
# contain a `user_prompt` field. For ground_truth_adherence guardrail metric,
|
|
176
|
+
# `ground_truth` should be provided. When `context_awareness` is enabled,
|
|
177
|
+
# `context` should be provided.
|
|
175
178
|
sig do
|
|
176
179
|
returns(Deeprails::MonitorDetailResponse::Evaluation::ModelInput)
|
|
177
180
|
end
|
|
@@ -191,6 +194,7 @@ module Deeprails
|
|
|
191
194
|
|
|
192
195
|
# Run mode for the evaluation. The run mode allows the user to optimize for speed,
|
|
193
196
|
# accuracy, and cost by determining which models are used to evaluate the event.
|
|
197
|
+
# Note: `super_fast` do not support Web Search or File Search capabilities.
|
|
194
198
|
sig do
|
|
195
199
|
returns(
|
|
196
200
|
Deeprails::MonitorDetailResponse::Evaluation::RunMode::TaggedSymbol
|
|
@@ -290,13 +294,15 @@ module Deeprails
|
|
|
290
294
|
# Status of the evaluation.
|
|
291
295
|
evaluation_status:,
|
|
292
296
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
293
|
-
# contain
|
|
294
|
-
#
|
|
297
|
+
# contain a `user_prompt` field. For ground_truth_adherence guardrail metric,
|
|
298
|
+
# `ground_truth` should be provided. When `context_awareness` is enabled,
|
|
299
|
+
# `context` should be provided.
|
|
295
300
|
model_input:,
|
|
296
301
|
# Output generated by the LLM to be evaluated.
|
|
297
302
|
model_output:,
|
|
298
303
|
# Run mode for the evaluation. The run mode allows the user to optimize for speed,
|
|
299
304
|
# accuracy, and cost by determining which models are used to evaluate the event.
|
|
305
|
+
# Note: `super_fast` do not support Web Search or File Search capabilities.
|
|
300
306
|
run_mode:,
|
|
301
307
|
# The time the evaluation was created in UTC.
|
|
302
308
|
created_at: nil,
|
|
@@ -403,6 +409,36 @@ module Deeprails
|
|
|
403
409
|
)
|
|
404
410
|
end
|
|
405
411
|
|
|
412
|
+
# The user prompt used to generate the output.
|
|
413
|
+
sig { returns(String) }
|
|
414
|
+
attr_accessor :user_prompt
|
|
415
|
+
|
|
416
|
+
# Any structured information that directly relates to the model’s input and
|
|
417
|
+
# expected output—e.g., the recent turn-by-turn history between an AI tutor and a
|
|
418
|
+
# student, facts or state passed through an agentic workflow, or other
|
|
419
|
+
# domain-specific signals your system already knows and wants the model to
|
|
420
|
+
# condition on.
|
|
421
|
+
sig do
|
|
422
|
+
returns(
|
|
423
|
+
T.nilable(
|
|
424
|
+
T::Array[
|
|
425
|
+
Deeprails::MonitorDetailResponse::Evaluation::ModelInput::Context
|
|
426
|
+
]
|
|
427
|
+
)
|
|
428
|
+
)
|
|
429
|
+
end
|
|
430
|
+
attr_reader :context
|
|
431
|
+
|
|
432
|
+
sig do
|
|
433
|
+
params(
|
|
434
|
+
context:
|
|
435
|
+
T::Array[
|
|
436
|
+
Deeprails::MonitorDetailResponse::Evaluation::ModelInput::Context::OrHash
|
|
437
|
+
]
|
|
438
|
+
).void
|
|
439
|
+
end
|
|
440
|
+
attr_writer :context
|
|
441
|
+
|
|
406
442
|
# The ground truth for evaluating Ground Truth Adherence guardrail.
|
|
407
443
|
sig { returns(T.nilable(String)) }
|
|
408
444
|
attr_reader :ground_truth
|
|
@@ -417,48 +453,96 @@ module Deeprails
|
|
|
417
453
|
sig { params(system_prompt: String).void }
|
|
418
454
|
attr_writer :system_prompt
|
|
419
455
|
|
|
420
|
-
# The user prompt used to generate the output.
|
|
421
|
-
sig { returns(T.nilable(String)) }
|
|
422
|
-
attr_reader :user_prompt
|
|
423
|
-
|
|
424
|
-
sig { params(user_prompt: String).void }
|
|
425
|
-
attr_writer :user_prompt
|
|
426
|
-
|
|
427
456
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
428
|
-
# contain
|
|
429
|
-
#
|
|
457
|
+
# contain a `user_prompt` field. For ground_truth_adherence guardrail metric,
|
|
458
|
+
# `ground_truth` should be provided. When `context_awareness` is enabled,
|
|
459
|
+
# `context` should be provided.
|
|
430
460
|
sig do
|
|
431
461
|
params(
|
|
462
|
+
user_prompt: String,
|
|
463
|
+
context:
|
|
464
|
+
T::Array[
|
|
465
|
+
Deeprails::MonitorDetailResponse::Evaluation::ModelInput::Context::OrHash
|
|
466
|
+
],
|
|
432
467
|
ground_truth: String,
|
|
433
|
-
system_prompt: String
|
|
434
|
-
user_prompt: String
|
|
468
|
+
system_prompt: String
|
|
435
469
|
).returns(T.attached_class)
|
|
436
470
|
end
|
|
437
471
|
def self.new(
|
|
472
|
+
# The user prompt used to generate the output.
|
|
473
|
+
user_prompt:,
|
|
474
|
+
# Any structured information that directly relates to the model’s input and
|
|
475
|
+
# expected output—e.g., the recent turn-by-turn history between an AI tutor and a
|
|
476
|
+
# student, facts or state passed through an agentic workflow, or other
|
|
477
|
+
# domain-specific signals your system already knows and wants the model to
|
|
478
|
+
# condition on.
|
|
479
|
+
context: nil,
|
|
438
480
|
# The ground truth for evaluating Ground Truth Adherence guardrail.
|
|
439
481
|
ground_truth: nil,
|
|
440
482
|
# The system prompt used to generate the output.
|
|
441
|
-
system_prompt: nil
|
|
442
|
-
# The user prompt used to generate the output.
|
|
443
|
-
user_prompt: nil
|
|
483
|
+
system_prompt: nil
|
|
444
484
|
)
|
|
445
485
|
end
|
|
446
486
|
|
|
447
487
|
sig do
|
|
448
488
|
override.returns(
|
|
449
489
|
{
|
|
490
|
+
user_prompt: String,
|
|
491
|
+
context:
|
|
492
|
+
T::Array[
|
|
493
|
+
Deeprails::MonitorDetailResponse::Evaluation::ModelInput::Context
|
|
494
|
+
],
|
|
450
495
|
ground_truth: String,
|
|
451
|
-
system_prompt: String
|
|
452
|
-
user_prompt: String
|
|
496
|
+
system_prompt: String
|
|
453
497
|
}
|
|
454
498
|
)
|
|
455
499
|
end
|
|
456
500
|
def to_hash
|
|
457
501
|
end
|
|
502
|
+
|
|
503
|
+
class Context < Deeprails::Internal::Type::BaseModel
|
|
504
|
+
OrHash =
|
|
505
|
+
T.type_alias do
|
|
506
|
+
T.any(
|
|
507
|
+
Deeprails::MonitorDetailResponse::Evaluation::ModelInput::Context,
|
|
508
|
+
Deeprails::Internal::AnyHash
|
|
509
|
+
)
|
|
510
|
+
end
|
|
511
|
+
|
|
512
|
+
# The content of the message.
|
|
513
|
+
sig { returns(T.nilable(String)) }
|
|
514
|
+
attr_reader :content
|
|
515
|
+
|
|
516
|
+
sig { params(content: String).void }
|
|
517
|
+
attr_writer :content
|
|
518
|
+
|
|
519
|
+
# The role of the speaker.
|
|
520
|
+
sig { returns(T.nilable(String)) }
|
|
521
|
+
attr_reader :role
|
|
522
|
+
|
|
523
|
+
sig { params(role: String).void }
|
|
524
|
+
attr_writer :role
|
|
525
|
+
|
|
526
|
+
sig do
|
|
527
|
+
params(content: String, role: String).returns(T.attached_class)
|
|
528
|
+
end
|
|
529
|
+
def self.new(
|
|
530
|
+
# The content of the message.
|
|
531
|
+
content: nil,
|
|
532
|
+
# The role of the speaker.
|
|
533
|
+
role: nil
|
|
534
|
+
)
|
|
535
|
+
end
|
|
536
|
+
|
|
537
|
+
sig { override.returns({ content: String, role: String }) }
|
|
538
|
+
def to_hash
|
|
539
|
+
end
|
|
540
|
+
end
|
|
458
541
|
end
|
|
459
542
|
|
|
460
543
|
# Run mode for the evaluation. The run mode allows the user to optimize for speed,
|
|
461
544
|
# accuracy, and cost by determining which models are used to evaluate the event.
|
|
545
|
+
# Note: `super_fast` do not support Web Search or File Search capabilities.
|
|
462
546
|
module RunMode
|
|
463
547
|
extend Deeprails::Internal::Type::Enum
|
|
464
548
|
|
|
@@ -471,9 +555,14 @@ module Deeprails
|
|
|
471
555
|
end
|
|
472
556
|
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
473
557
|
|
|
474
|
-
|
|
558
|
+
SUPER_FAST =
|
|
475
559
|
T.let(
|
|
476
|
-
:
|
|
560
|
+
:super_fast,
|
|
561
|
+
Deeprails::MonitorDetailResponse::Evaluation::RunMode::TaggedSymbol
|
|
562
|
+
)
|
|
563
|
+
FAST =
|
|
564
|
+
T.let(
|
|
565
|
+
:fast,
|
|
477
566
|
Deeprails::MonitorDetailResponse::Evaluation::RunMode::TaggedSymbol
|
|
478
567
|
)
|
|
479
568
|
PRECISION =
|
|
@@ -481,14 +570,19 @@ module Deeprails
|
|
|
481
570
|
:precision,
|
|
482
571
|
Deeprails::MonitorDetailResponse::Evaluation::RunMode::TaggedSymbol
|
|
483
572
|
)
|
|
484
|
-
|
|
573
|
+
PRECISION_CODEX =
|
|
574
|
+
T.let(
|
|
575
|
+
:precision_codex,
|
|
576
|
+
Deeprails::MonitorDetailResponse::Evaluation::RunMode::TaggedSymbol
|
|
577
|
+
)
|
|
578
|
+
PRECISION_MAX =
|
|
485
579
|
T.let(
|
|
486
|
-
:
|
|
580
|
+
:precision_max,
|
|
487
581
|
Deeprails::MonitorDetailResponse::Evaluation::RunMode::TaggedSymbol
|
|
488
582
|
)
|
|
489
|
-
|
|
583
|
+
PRECISION_MAX_CODEX =
|
|
490
584
|
T.let(
|
|
491
|
-
:
|
|
585
|
+
:precision_max_codex,
|
|
492
586
|
Deeprails::MonitorDetailResponse::Evaluation::RunMode::TaggedSymbol
|
|
493
587
|
)
|
|
494
588
|
|
|
@@ -11,7 +11,8 @@ module Deeprails
|
|
|
11
11
|
)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
# The capabilities associated with the monitor event.
|
|
14
|
+
# The extended AI capabilities associated with the monitor event. Can be
|
|
15
|
+
# `web_search`, `file_search`, and/or `context_awareness`.
|
|
15
16
|
sig do
|
|
16
17
|
returns(
|
|
17
18
|
T.nilable(T::Array[Deeprails::MonitorEventDetailResponse::Capability])
|
|
@@ -156,7 +157,8 @@ module Deeprails
|
|
|
156
157
|
).returns(T.attached_class)
|
|
157
158
|
end
|
|
158
159
|
def self.new(
|
|
159
|
-
# The capabilities associated with the monitor event.
|
|
160
|
+
# The extended AI capabilities associated with the monitor event. Can be
|
|
161
|
+
# `web_search`, `file_search`, and/or `context_awareness`.
|
|
160
162
|
capabilities: nil,
|
|
161
163
|
# The time spent on the evaluation in seconds.
|
|
162
164
|
eval_time: nil,
|
|
@@ -303,9 +305,14 @@ module Deeprails
|
|
|
303
305
|
end
|
|
304
306
|
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
305
307
|
|
|
306
|
-
|
|
308
|
+
SUPER_FAST =
|
|
307
309
|
T.let(
|
|
308
|
-
:
|
|
310
|
+
:super_fast,
|
|
311
|
+
Deeprails::MonitorEventDetailResponse::RunMode::TaggedSymbol
|
|
312
|
+
)
|
|
313
|
+
FAST =
|
|
314
|
+
T.let(
|
|
315
|
+
:fast,
|
|
309
316
|
Deeprails::MonitorEventDetailResponse::RunMode::TaggedSymbol
|
|
310
317
|
)
|
|
311
318
|
PRECISION =
|
|
@@ -313,14 +320,19 @@ module Deeprails
|
|
|
313
320
|
:precision,
|
|
314
321
|
Deeprails::MonitorEventDetailResponse::RunMode::TaggedSymbol
|
|
315
322
|
)
|
|
316
|
-
|
|
323
|
+
PRECISION_CODEX =
|
|
324
|
+
T.let(
|
|
325
|
+
:precision_codex,
|
|
326
|
+
Deeprails::MonitorEventDetailResponse::RunMode::TaggedSymbol
|
|
327
|
+
)
|
|
328
|
+
PRECISION_MAX =
|
|
317
329
|
T.let(
|
|
318
|
-
:
|
|
330
|
+
:precision_max,
|
|
319
331
|
Deeprails::MonitorEventDetailResponse::RunMode::TaggedSymbol
|
|
320
332
|
)
|
|
321
|
-
|
|
333
|
+
PRECISION_MAX_CODEX =
|
|
322
334
|
T.let(
|
|
323
|
-
:
|
|
335
|
+
:precision_max_codex,
|
|
324
336
|
Deeprails::MonitorEventDetailResponse::RunMode::TaggedSymbol
|
|
325
337
|
)
|
|
326
338
|
|
|
@@ -17,18 +17,26 @@ module Deeprails
|
|
|
17
17
|
sig { returns(String) }
|
|
18
18
|
attr_accessor :monitor_id
|
|
19
19
|
|
|
20
|
+
sig { returns(String) }
|
|
21
|
+
attr_accessor :event_id
|
|
22
|
+
|
|
20
23
|
sig do
|
|
21
24
|
params(
|
|
22
25
|
monitor_id: String,
|
|
26
|
+
event_id: String,
|
|
23
27
|
request_options: Deeprails::RequestOptions::OrHash
|
|
24
28
|
).returns(T.attached_class)
|
|
25
29
|
end
|
|
26
|
-
def self.new(monitor_id:, request_options: {})
|
|
30
|
+
def self.new(monitor_id:, event_id:, request_options: {})
|
|
27
31
|
end
|
|
28
32
|
|
|
29
33
|
sig do
|
|
30
34
|
override.returns(
|
|
31
|
-
{
|
|
35
|
+
{
|
|
36
|
+
monitor_id: String,
|
|
37
|
+
event_id: String,
|
|
38
|
+
request_options: Deeprails::RequestOptions
|
|
39
|
+
}
|
|
32
40
|
)
|
|
33
41
|
end
|
|
34
42
|
def to_hash
|
|
@@ -11,6 +11,9 @@ module Deeprails
|
|
|
11
11
|
T.any(Deeprails::MonitorRetrieveParams, Deeprails::Internal::AnyHash)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
+
sig { returns(String) }
|
|
15
|
+
attr_accessor :monitor_id
|
|
16
|
+
|
|
14
17
|
# Limit the number of returned evaluations associated with this monitor. Defaults
|
|
15
18
|
# to 10.
|
|
16
19
|
sig { returns(T.nilable(Integer)) }
|
|
@@ -21,11 +24,13 @@ module Deeprails
|
|
|
21
24
|
|
|
22
25
|
sig do
|
|
23
26
|
params(
|
|
27
|
+
monitor_id: String,
|
|
24
28
|
limit: Integer,
|
|
25
29
|
request_options: Deeprails::RequestOptions::OrHash
|
|
26
30
|
).returns(T.attached_class)
|
|
27
31
|
end
|
|
28
32
|
def self.new(
|
|
33
|
+
monitor_id:,
|
|
29
34
|
# Limit the number of returned evaluations associated with this monitor. Defaults
|
|
30
35
|
# to 10.
|
|
31
36
|
limit: nil,
|
|
@@ -35,7 +40,11 @@ module Deeprails
|
|
|
35
40
|
|
|
36
41
|
sig do
|
|
37
42
|
override.returns(
|
|
38
|
-
{
|
|
43
|
+
{
|
|
44
|
+
monitor_id: String,
|
|
45
|
+
limit: Integer,
|
|
46
|
+
request_options: Deeprails::RequestOptions
|
|
47
|
+
}
|
|
39
48
|
)
|
|
40
49
|
end
|
|
41
50
|
def to_hash
|
|
@@ -14,9 +14,12 @@ module Deeprails
|
|
|
14
14
|
)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
sig { returns(String) }
|
|
18
|
+
attr_accessor :monitor_id
|
|
19
|
+
|
|
17
20
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
18
|
-
# contain
|
|
19
|
-
#
|
|
21
|
+
# contain a `user_prompt` field. For ground_truth_adherence guardrail metric,
|
|
22
|
+
# `ground_truth` should be provided.
|
|
20
23
|
sig { returns(Deeprails::MonitorSubmitEventParams::ModelInput) }
|
|
21
24
|
attr_reader :model_input
|
|
22
25
|
|
|
@@ -40,8 +43,11 @@ module Deeprails
|
|
|
40
43
|
|
|
41
44
|
# Run mode for the monitor event. The run mode allows the user to optimize for
|
|
42
45
|
# speed, accuracy, and cost by determining which models are used to evaluate the
|
|
43
|
-
# event. Available run modes
|
|
44
|
-
# `
|
|
46
|
+
# event. Available run modes (fastest to most thorough): `super_fast`, `fast`,
|
|
47
|
+
# `precision`, `precision_codex`, `precision_max`, and `precision_max_codex`.
|
|
48
|
+
# Defaults to `fast`. Note: `super_fast` does not support Web Search or File
|
|
49
|
+
# Search — if your monitor has these capabilities enabled, use a different run
|
|
50
|
+
# mode or edit the monitor to disable them.
|
|
45
51
|
sig do
|
|
46
52
|
returns(
|
|
47
53
|
T.nilable(Deeprails::MonitorSubmitEventParams::RunMode::OrSymbol)
|
|
@@ -58,6 +64,7 @@ module Deeprails
|
|
|
58
64
|
|
|
59
65
|
sig do
|
|
60
66
|
params(
|
|
67
|
+
monitor_id: String,
|
|
61
68
|
model_input: Deeprails::MonitorSubmitEventParams::ModelInput::OrHash,
|
|
62
69
|
model_output: String,
|
|
63
70
|
nametag: String,
|
|
@@ -66,9 +73,10 @@ module Deeprails
|
|
|
66
73
|
).returns(T.attached_class)
|
|
67
74
|
end
|
|
68
75
|
def self.new(
|
|
76
|
+
monitor_id:,
|
|
69
77
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
70
|
-
# contain
|
|
71
|
-
#
|
|
78
|
+
# contain a `user_prompt` field. For ground_truth_adherence guardrail metric,
|
|
79
|
+
# `ground_truth` should be provided.
|
|
72
80
|
model_input:,
|
|
73
81
|
# Output generated by the LLM to be evaluated.
|
|
74
82
|
model_output:,
|
|
@@ -76,8 +84,11 @@ module Deeprails
|
|
|
76
84
|
nametag: nil,
|
|
77
85
|
# Run mode for the monitor event. The run mode allows the user to optimize for
|
|
78
86
|
# speed, accuracy, and cost by determining which models are used to evaluate the
|
|
79
|
-
# event. Available run modes
|
|
80
|
-
# `
|
|
87
|
+
# event. Available run modes (fastest to most thorough): `super_fast`, `fast`,
|
|
88
|
+
# `precision`, `precision_codex`, `precision_max`, and `precision_max_codex`.
|
|
89
|
+
# Defaults to `fast`. Note: `super_fast` does not support Web Search or File
|
|
90
|
+
# Search — if your monitor has these capabilities enabled, use a different run
|
|
91
|
+
# mode or edit the monitor to disable them.
|
|
81
92
|
run_mode: nil,
|
|
82
93
|
request_options: {}
|
|
83
94
|
)
|
|
@@ -86,6 +97,7 @@ module Deeprails
|
|
|
86
97
|
sig do
|
|
87
98
|
override.returns(
|
|
88
99
|
{
|
|
100
|
+
monitor_id: String,
|
|
89
101
|
model_input: Deeprails::MonitorSubmitEventParams::ModelInput,
|
|
90
102
|
model_output: String,
|
|
91
103
|
nametag: String,
|
|
@@ -106,6 +118,34 @@ module Deeprails
|
|
|
106
118
|
)
|
|
107
119
|
end
|
|
108
120
|
|
|
121
|
+
# The user prompt used to generate the output.
|
|
122
|
+
sig { returns(String) }
|
|
123
|
+
attr_accessor :user_prompt
|
|
124
|
+
|
|
125
|
+
# Any structured information that directly relates to the model’s input and
|
|
126
|
+
# expected output—e.g., the recent turn-by-turn history between an AI tutor and a
|
|
127
|
+
# student, facts or state passed through an agentic workflow, or other
|
|
128
|
+
# domain-specific signals your system already knows and wants the model to
|
|
129
|
+
# condition on.
|
|
130
|
+
sig do
|
|
131
|
+
returns(
|
|
132
|
+
T.nilable(
|
|
133
|
+
T::Array[Deeprails::MonitorSubmitEventParams::ModelInput::Context]
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
end
|
|
137
|
+
attr_reader :context
|
|
138
|
+
|
|
139
|
+
sig do
|
|
140
|
+
params(
|
|
141
|
+
context:
|
|
142
|
+
T::Array[
|
|
143
|
+
Deeprails::MonitorSubmitEventParams::ModelInput::Context::OrHash
|
|
144
|
+
]
|
|
145
|
+
).void
|
|
146
|
+
end
|
|
147
|
+
attr_writer :context
|
|
148
|
+
|
|
109
149
|
# The ground truth for evaluating Ground Truth Adherence guardrail.
|
|
110
150
|
sig { returns(T.nilable(String)) }
|
|
111
151
|
attr_reader :ground_truth
|
|
@@ -120,46 +160,99 @@ module Deeprails
|
|
|
120
160
|
sig { params(system_prompt: String).void }
|
|
121
161
|
attr_writer :system_prompt
|
|
122
162
|
|
|
123
|
-
# The user prompt used to generate the output.
|
|
124
|
-
sig { returns(T.nilable(String)) }
|
|
125
|
-
attr_reader :user_prompt
|
|
126
|
-
|
|
127
|
-
sig { params(user_prompt: String).void }
|
|
128
|
-
attr_writer :user_prompt
|
|
129
|
-
|
|
130
163
|
# A dictionary of inputs sent to the LLM to generate output. The dictionary must
|
|
131
|
-
# contain
|
|
132
|
-
#
|
|
164
|
+
# contain a `user_prompt` field. For ground_truth_adherence guardrail metric,
|
|
165
|
+
# `ground_truth` should be provided.
|
|
133
166
|
sig do
|
|
134
167
|
params(
|
|
168
|
+
user_prompt: String,
|
|
169
|
+
context:
|
|
170
|
+
T::Array[
|
|
171
|
+
Deeprails::MonitorSubmitEventParams::ModelInput::Context::OrHash
|
|
172
|
+
],
|
|
135
173
|
ground_truth: String,
|
|
136
|
-
system_prompt: String
|
|
137
|
-
user_prompt: String
|
|
174
|
+
system_prompt: String
|
|
138
175
|
).returns(T.attached_class)
|
|
139
176
|
end
|
|
140
177
|
def self.new(
|
|
178
|
+
# The user prompt used to generate the output.
|
|
179
|
+
user_prompt:,
|
|
180
|
+
# Any structured information that directly relates to the model’s input and
|
|
181
|
+
# expected output—e.g., the recent turn-by-turn history between an AI tutor and a
|
|
182
|
+
# student, facts or state passed through an agentic workflow, or other
|
|
183
|
+
# domain-specific signals your system already knows and wants the model to
|
|
184
|
+
# condition on.
|
|
185
|
+
context: nil,
|
|
141
186
|
# The ground truth for evaluating Ground Truth Adherence guardrail.
|
|
142
187
|
ground_truth: nil,
|
|
143
188
|
# The system prompt used to generate the output.
|
|
144
|
-
system_prompt: nil
|
|
145
|
-
# The user prompt used to generate the output.
|
|
146
|
-
user_prompt: nil
|
|
189
|
+
system_prompt: nil
|
|
147
190
|
)
|
|
148
191
|
end
|
|
149
192
|
|
|
150
193
|
sig do
|
|
151
194
|
override.returns(
|
|
152
|
-
{
|
|
195
|
+
{
|
|
196
|
+
user_prompt: String,
|
|
197
|
+
context:
|
|
198
|
+
T::Array[
|
|
199
|
+
Deeprails::MonitorSubmitEventParams::ModelInput::Context
|
|
200
|
+
],
|
|
201
|
+
ground_truth: String,
|
|
202
|
+
system_prompt: String
|
|
203
|
+
}
|
|
153
204
|
)
|
|
154
205
|
end
|
|
155
206
|
def to_hash
|
|
156
207
|
end
|
|
208
|
+
|
|
209
|
+
class Context < Deeprails::Internal::Type::BaseModel
|
|
210
|
+
OrHash =
|
|
211
|
+
T.type_alias do
|
|
212
|
+
T.any(
|
|
213
|
+
Deeprails::MonitorSubmitEventParams::ModelInput::Context,
|
|
214
|
+
Deeprails::Internal::AnyHash
|
|
215
|
+
)
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# The content of the message.
|
|
219
|
+
sig { returns(T.nilable(String)) }
|
|
220
|
+
attr_reader :content
|
|
221
|
+
|
|
222
|
+
sig { params(content: String).void }
|
|
223
|
+
attr_writer :content
|
|
224
|
+
|
|
225
|
+
# The role of the speaker.
|
|
226
|
+
sig { returns(T.nilable(String)) }
|
|
227
|
+
attr_reader :role
|
|
228
|
+
|
|
229
|
+
sig { params(role: String).void }
|
|
230
|
+
attr_writer :role
|
|
231
|
+
|
|
232
|
+
sig do
|
|
233
|
+
params(content: String, role: String).returns(T.attached_class)
|
|
234
|
+
end
|
|
235
|
+
def self.new(
|
|
236
|
+
# The content of the message.
|
|
237
|
+
content: nil,
|
|
238
|
+
# The role of the speaker.
|
|
239
|
+
role: nil
|
|
240
|
+
)
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
sig { override.returns({ content: String, role: String }) }
|
|
244
|
+
def to_hash
|
|
245
|
+
end
|
|
246
|
+
end
|
|
157
247
|
end
|
|
158
248
|
|
|
159
249
|
# Run mode for the monitor event. The run mode allows the user to optimize for
|
|
160
250
|
# speed, accuracy, and cost by determining which models are used to evaluate the
|
|
161
|
-
# event. Available run modes
|
|
162
|
-
# `
|
|
251
|
+
# event. Available run modes (fastest to most thorough): `super_fast`, `fast`,
|
|
252
|
+
# `precision`, `precision_codex`, `precision_max`, and `precision_max_codex`.
|
|
253
|
+
# Defaults to `fast`. Note: `super_fast` does not support Web Search or File
|
|
254
|
+
# Search — if your monitor has these capabilities enabled, use a different run
|
|
255
|
+
# mode or edit the monitor to disable them.
|
|
163
256
|
module RunMode
|
|
164
257
|
extend Deeprails::Internal::Type::Enum
|
|
165
258
|
|
|
@@ -169,9 +262,14 @@ module Deeprails
|
|
|
169
262
|
end
|
|
170
263
|
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
171
264
|
|
|
172
|
-
|
|
265
|
+
SUPER_FAST =
|
|
173
266
|
T.let(
|
|
174
|
-
:
|
|
267
|
+
:super_fast,
|
|
268
|
+
Deeprails::MonitorSubmitEventParams::RunMode::TaggedSymbol
|
|
269
|
+
)
|
|
270
|
+
FAST =
|
|
271
|
+
T.let(
|
|
272
|
+
:fast,
|
|
175
273
|
Deeprails::MonitorSubmitEventParams::RunMode::TaggedSymbol
|
|
176
274
|
)
|
|
177
275
|
PRECISION =
|
|
@@ -179,14 +277,19 @@ module Deeprails
|
|
|
179
277
|
:precision,
|
|
180
278
|
Deeprails::MonitorSubmitEventParams::RunMode::TaggedSymbol
|
|
181
279
|
)
|
|
182
|
-
|
|
280
|
+
PRECISION_CODEX =
|
|
281
|
+
T.let(
|
|
282
|
+
:precision_codex,
|
|
283
|
+
Deeprails::MonitorSubmitEventParams::RunMode::TaggedSymbol
|
|
284
|
+
)
|
|
285
|
+
PRECISION_MAX =
|
|
183
286
|
T.let(
|
|
184
|
-
:
|
|
287
|
+
:precision_max,
|
|
185
288
|
Deeprails::MonitorSubmitEventParams::RunMode::TaggedSymbol
|
|
186
289
|
)
|
|
187
|
-
|
|
290
|
+
PRECISION_MAX_CODEX =
|
|
188
291
|
T.let(
|
|
189
|
-
:
|
|
292
|
+
:precision_max_codex,
|
|
190
293
|
Deeprails::MonitorSubmitEventParams::RunMode::TaggedSymbol
|
|
191
294
|
)
|
|
192
295
|
|