deeprails 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +18 -0
 - data/README.md +1 -1
 - data/lib/deeprails/client.rb +0 -4
 - data/lib/deeprails/internal/transport/pooled_net_requester.rb +30 -24
 - data/lib/deeprails/models/defend_create_workflow_params.rb +4 -4
 - data/lib/deeprails/models/defend_response.rb +4 -4
 - data/lib/deeprails/models/defend_submit_event_params.rb +4 -4
 - data/lib/deeprails/models/monitor_detail_response.rb +378 -0
 - data/lib/deeprails/models/monitor_event_response.rb +41 -0
 - data/lib/deeprails/models/monitor_response.rb +83 -0
 - data/lib/deeprails/models/monitor_submit_event_params.rb +2 -2
 - data/lib/deeprails/models.rb +4 -6
 - data/lib/deeprails/resources/defend.rb +2 -2
 - data/lib/deeprails/resources/monitor.rb +8 -8
 - data/lib/deeprails/version.rb +1 -1
 - data/lib/deeprails.rb +3 -7
 - data/rbi/deeprails/client.rbi +0 -3
 - data/rbi/deeprails/models/defend_create_workflow_params.rbi +6 -6
 - data/rbi/deeprails/models/defend_response.rbi +6 -6
 - data/rbi/deeprails/models/defend_submit_event_params.rbi +5 -5
 - data/rbi/deeprails/models/monitor_detail_response.rbi +730 -0
 - data/rbi/deeprails/models/monitor_event_response.rbi +64 -0
 - data/rbi/deeprails/models/monitor_response.rbi +142 -0
 - data/rbi/deeprails/models/monitor_submit_event_params.rbi +3 -3
 - data/rbi/deeprails/models.rbi +4 -6
 - data/rbi/deeprails/resources/defend.rbi +3 -3
 - data/rbi/deeprails/resources/monitor.rbi +5 -5
 - data/sig/deeprails/client.rbs +0 -2
 - data/sig/deeprails/models/defend_create_workflow_params.rbs +5 -5
 - data/sig/deeprails/models/defend_response.rbs +5 -5
 - data/sig/deeprails/models/monitor_detail_response.rbs +335 -0
 - data/sig/deeprails/models/monitor_event_response.rbs +37 -0
 - data/sig/deeprails/models/monitor_response.rbs +73 -0
 - data/sig/deeprails/models.rbs +4 -6
 - data/sig/deeprails/resources/defend.rbs +1 -1
 - data/sig/deeprails/resources/monitor.rbs +4 -4
 - metadata +11 -23
 - data/lib/deeprails/models/api_response.rb +0 -116
 - data/lib/deeprails/models/evaluate_create_params.rb +0 -134
 - data/lib/deeprails/models/evaluate_retrieve_params.rb +0 -14
 - data/lib/deeprails/models/evaluation.rb +0 -233
 - data/lib/deeprails/models/monitor_retrieve_response.rb +0 -183
 - data/lib/deeprails/models/monitor_submit_event_response.rb +0 -74
 - data/lib/deeprails/resources/evaluate.rb +0 -70
 - data/rbi/deeprails/models/api_response.rbi +0 -201
 - data/rbi/deeprails/models/evaluate_create_params.rbi +0 -280
 - data/rbi/deeprails/models/evaluate_retrieve_params.rbi +0 -27
 - data/rbi/deeprails/models/evaluation.rbi +0 -402
 - data/rbi/deeprails/models/monitor_retrieve_response.rbi +0 -333
 - data/rbi/deeprails/models/monitor_submit_event_response.rbi +0 -131
 - data/rbi/deeprails/resources/evaluate.rbi +0 -66
 - data/sig/deeprails/models/api_response.rbs +0 -100
 - data/sig/deeprails/models/evaluate_create_params.rbs +0 -122
 - data/sig/deeprails/models/evaluate_retrieve_params.rbs +0 -15
 - data/sig/deeprails/models/evaluation.rbs +0 -204
 - data/sig/deeprails/models/monitor_retrieve_response.rbs +0 -167
 - data/sig/deeprails/models/monitor_submit_event_response.rbs +0 -70
 - data/sig/deeprails/resources/evaluate.rbs +0 -22
 
| 
         @@ -0,0 +1,83 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # frozen_string_literal: true
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module Deeprails
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Models
         
     | 
| 
      
 5 
     | 
    
         
            +
                # @see Deeprails::Resources::Monitor#create
         
     | 
| 
      
 6 
     | 
    
         
            +
                class MonitorResponse < Deeprails::Internal::Type::BaseModel
         
     | 
| 
      
 7 
     | 
    
         
            +
                  # @!attribute monitor_id
         
     | 
| 
      
 8 
     | 
    
         
            +
                  #   A unique monitor ID.
         
     | 
| 
      
 9 
     | 
    
         
            +
                  #
         
     | 
| 
      
 10 
     | 
    
         
            +
                  #   @return [String]
         
     | 
| 
      
 11 
     | 
    
         
            +
                  required :monitor_id, String
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  # @!attribute name
         
     | 
| 
      
 14 
     | 
    
         
            +
                  #   Name of the monitor.
         
     | 
| 
      
 15 
     | 
    
         
            +
                  #
         
     | 
| 
      
 16 
     | 
    
         
            +
                  #   @return [String]
         
     | 
| 
      
 17 
     | 
    
         
            +
                  required :name, String
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  # @!attribute created_at
         
     | 
| 
      
 20 
     | 
    
         
            +
                  #   The time the monitor was created in UTC.
         
     | 
| 
      
 21 
     | 
    
         
            +
                  #
         
     | 
| 
      
 22 
     | 
    
         
            +
                  #   @return [Time, nil]
         
     | 
| 
      
 23 
     | 
    
         
            +
                  optional :created_at, Time
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  # @!attribute description
         
     | 
| 
      
 26 
     | 
    
         
            +
                  #   Description of the monitor.
         
     | 
| 
      
 27 
     | 
    
         
            +
                  #
         
     | 
| 
      
 28 
     | 
    
         
            +
                  #   @return [String, nil]
         
     | 
| 
      
 29 
     | 
    
         
            +
                  optional :description, String
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  # @!attribute monitor_status
         
     | 
| 
      
 32 
     | 
    
         
            +
                  #   Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
         
     | 
| 
      
 33 
     | 
    
         
            +
                  #   longer record and evaluate events.
         
     | 
| 
      
 34 
     | 
    
         
            +
                  #
         
     | 
| 
      
 35 
     | 
    
         
            +
                  #   @return [Symbol, Deeprails::Models::MonitorResponse::MonitorStatus, nil]
         
     | 
| 
      
 36 
     | 
    
         
            +
                  optional :monitor_status, enum: -> { Deeprails::MonitorResponse::MonitorStatus }
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                  # @!attribute updated_at
         
     | 
| 
      
 39 
     | 
    
         
            +
                  #   The most recent time the monitor was modified in UTC.
         
     | 
| 
      
 40 
     | 
    
         
            +
                  #
         
     | 
| 
      
 41 
     | 
    
         
            +
                  #   @return [Time, nil]
         
     | 
| 
      
 42 
     | 
    
         
            +
                  optional :updated_at, Time
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                  # @!attribute user_id
         
     | 
| 
      
 45 
     | 
    
         
            +
                  #   User ID of the user who created the monitor.
         
     | 
| 
      
 46 
     | 
    
         
            +
                  #
         
     | 
| 
      
 47 
     | 
    
         
            +
                  #   @return [String, nil]
         
     | 
| 
      
 48 
     | 
    
         
            +
                  optional :user_id, String
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                  # @!method initialize(monitor_id:, name:, created_at: nil, description: nil, monitor_status: nil, updated_at: nil, user_id: nil)
         
     | 
| 
      
 51 
     | 
    
         
            +
                  #   Some parameter documentations has been truncated, see
         
     | 
| 
      
 52 
     | 
    
         
            +
                  #   {Deeprails::Models::MonitorResponse} for more details.
         
     | 
| 
      
 53 
     | 
    
         
            +
                  #
         
     | 
| 
      
 54 
     | 
    
         
            +
                  #   @param monitor_id [String] A unique monitor ID.
         
     | 
| 
      
 55 
     | 
    
         
            +
                  #
         
     | 
| 
      
 56 
     | 
    
         
            +
                  #   @param name [String] Name of the monitor.
         
     | 
| 
      
 57 
     | 
    
         
            +
                  #
         
     | 
| 
      
 58 
     | 
    
         
            +
                  #   @param created_at [Time] The time the monitor was created in UTC.
         
     | 
| 
      
 59 
     | 
    
         
            +
                  #
         
     | 
| 
      
 60 
     | 
    
         
            +
                  #   @param description [String] Description of the monitor.
         
     | 
| 
      
 61 
     | 
    
         
            +
                  #
         
     | 
| 
      
 62 
     | 
    
         
            +
                  #   @param monitor_status [Symbol, Deeprails::Models::MonitorResponse::MonitorStatus] Status of the monitor. Can be `active` or `inactive`. Inactive monitors no lon
         
     | 
| 
      
 63 
     | 
    
         
            +
                  #
         
     | 
| 
      
 64 
     | 
    
         
            +
                  #   @param updated_at [Time] The most recent time the monitor was modified in UTC.
         
     | 
| 
      
 65 
     | 
    
         
            +
                  #
         
     | 
| 
      
 66 
     | 
    
         
            +
                  #   @param user_id [String] User ID of the user who created the monitor.
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                  # Status of the monitor. Can be `active` or `inactive`. Inactive monitors no
         
     | 
| 
      
 69 
     | 
    
         
            +
                  # longer record and evaluate events.
         
     | 
| 
      
 70 
     | 
    
         
            +
                  #
         
     | 
| 
      
 71 
     | 
    
         
            +
                  # @see Deeprails::Models::MonitorResponse#monitor_status
         
     | 
| 
      
 72 
     | 
    
         
            +
                  module MonitorStatus
         
     | 
| 
      
 73 
     | 
    
         
            +
                    extend Deeprails::Internal::Type::Enum
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                    ACTIVE = :active
         
     | 
| 
      
 76 
     | 
    
         
            +
                    INACTIVE = :inactive
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                    # @!method self.values
         
     | 
| 
      
 79 
     | 
    
         
            +
                    #   @return [Array<Symbol>]
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
                end
         
     | 
| 
      
 82 
     | 
    
         
            +
              end
         
     | 
| 
      
 83 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -19,7 +19,7 @@ module Deeprails 
     | 
|
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         
             
                  # @!attribute model_input
         
     | 
| 
       21 
21 
     | 
    
         
             
                  #   A dictionary of inputs sent to the LLM to generate output. The dictionary must
         
     | 
| 
       22 
     | 
    
         
            -
                  #   contain at least a `user_prompt` or `system_prompt` field. For
         
     | 
| 
      
 22 
     | 
    
         
            +
                  #   contain at least a `user_prompt` field or a `system_prompt` field. For
         
     | 
| 
       23 
23 
     | 
    
         
             
                  #   ground_truth_adherence guardrail metric, `ground_truth` should be provided.
         
     | 
| 
       24 
24 
     | 
    
         
             
                  #
         
     | 
| 
       25 
25 
     | 
    
         
             
                  #   @return [Deeprails::Models::MonitorSubmitEventParams::ModelInput]
         
     | 
| 
         @@ -105,7 +105,7 @@ module Deeprails 
     | 
|
| 
       105 
105 
     | 
    
         | 
| 
       106 
106 
     | 
    
         
             
                    # @!method initialize(ground_truth: nil, system_prompt: nil, user_prompt: nil)
         
     | 
| 
       107 
107 
     | 
    
         
             
                    #   A dictionary of inputs sent to the LLM to generate output. The dictionary must
         
     | 
| 
       108 
     | 
    
         
            -
                    #   contain at least a `user_prompt` or `system_prompt` field. For
         
     | 
| 
      
 108 
     | 
    
         
            +
                    #   contain at least a `user_prompt` field or a `system_prompt` field. For
         
     | 
| 
       109 
109 
     | 
    
         
             
                    #   ground_truth_adherence guardrail metric, `ground_truth` should be provided.
         
     | 
| 
       110 
110 
     | 
    
         
             
                    #
         
     | 
| 
       111 
111 
     | 
    
         
             
                    #   @param ground_truth [String] The ground truth for evaluating Ground Truth Adherence guardrail.
         
     | 
    
        data/lib/deeprails/models.rb
    CHANGED
    
    | 
         @@ -39,8 +39,6 @@ module Deeprails 
     | 
|
| 
       39 
39 
     | 
    
         
             
                mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
         
     | 
| 
       40 
40 
     | 
    
         
             
              end
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
              APIResponse = Deeprails::Models::APIResponse
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
42 
     | 
    
         
             
              DefendCreateWorkflowParams = Deeprails::Models::DefendCreateWorkflowParams
         
     | 
| 
       45 
43 
     | 
    
         | 
| 
       46 
44 
     | 
    
         
             
              DefendResponse = Deeprails::Models::DefendResponse
         
     | 
| 
         @@ -53,13 +51,13 @@ module Deeprails 
     | 
|
| 
       53 
51 
     | 
    
         | 
| 
       54 
52 
     | 
    
         
             
              DefendUpdateWorkflowParams = Deeprails::Models::DefendUpdateWorkflowParams
         
     | 
| 
       55 
53 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
               
     | 
| 
      
 54 
     | 
    
         
            +
              MonitorCreateParams = Deeprails::Models::MonitorCreateParams
         
     | 
| 
       57 
55 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
               
     | 
| 
      
 56 
     | 
    
         
            +
              MonitorDetailResponse = Deeprails::Models::MonitorDetailResponse
         
     | 
| 
       59 
57 
     | 
    
         | 
| 
       60 
     | 
    
         
            -
               
     | 
| 
      
 58 
     | 
    
         
            +
              MonitorEventResponse = Deeprails::Models::MonitorEventResponse
         
     | 
| 
       61 
59 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
               
     | 
| 
      
 60 
     | 
    
         
            +
              MonitorResponse = Deeprails::Models::MonitorResponse
         
     | 
| 
       63 
61 
     | 
    
         | 
| 
       64 
62 
     | 
    
         
             
              MonitorRetrieveParams = Deeprails::Models::MonitorRetrieveParams
         
     | 
| 
       65 
63 
     | 
    
         | 
| 
         @@ -9,7 +9,7 @@ module Deeprails 
     | 
|
| 
       9 
9 
     | 
    
         
             
                  # Use this endpoint to create a new guardrail workflow with optional guardrail
         
     | 
| 
       10 
10 
     | 
    
         
             
                  # thresholds and improvement actions
         
     | 
| 
       11 
11 
     | 
    
         
             
                  #
         
     | 
| 
       12 
     | 
    
         
            -
                  # @overload create_workflow(improvement_action:, name:, type:, automatic_hallucination_tolerance_levels: nil, custom_hallucination_threshold_values: nil, description: nil,  
     | 
| 
      
 12 
     | 
    
         
            +
                  # @overload create_workflow(improvement_action:, name:, type:, automatic_hallucination_tolerance_levels: nil, custom_hallucination_threshold_values: nil, description: nil, max_improvement_attempts: nil, request_options: {})
         
     | 
| 
       13 
13 
     | 
    
         
             
                  #
         
     | 
| 
       14 
14 
     | 
    
         
             
                  # @param improvement_action [Symbol, Deeprails::Models::DefendCreateWorkflowParams::ImprovementAction] The action used to improve outputs that fail one or guardrail metrics for the wo
         
     | 
| 
       15 
15 
     | 
    
         
             
                  #
         
     | 
| 
         @@ -23,7 +23,7 @@ module Deeprails 
     | 
|
| 
       23 
23 
     | 
    
         
             
                  #
         
     | 
| 
       24 
24 
     | 
    
         
             
                  # @param description [String] Description for the workflow.
         
     | 
| 
       25 
25 
     | 
    
         
             
                  #
         
     | 
| 
       26 
     | 
    
         
            -
                  # @param  
     | 
| 
      
 26 
     | 
    
         
            +
                  # @param max_improvement_attempts [Integer] Max. number of improvement action retries until a given event passes the guardra
         
     | 
| 
       27 
27 
     | 
    
         
             
                  #
         
     | 
| 
       28 
28 
     | 
    
         
             
                  # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
         
     | 
| 
       29 
29 
     | 
    
         
             
                  #
         
     | 
| 
         @@ -14,7 +14,7 @@ module Deeprails 
     | 
|
| 
       14 
14 
     | 
    
         
             
                  #
         
     | 
| 
       15 
15 
     | 
    
         
             
                  # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
         
     | 
| 
       16 
16 
     | 
    
         
             
                  #
         
     | 
| 
       17 
     | 
    
         
            -
                  # @return [Deeprails::Models:: 
     | 
| 
      
 17 
     | 
    
         
            +
                  # @return [Deeprails::Models::MonitorResponse]
         
     | 
| 
       18 
18 
     | 
    
         
             
                  #
         
     | 
| 
       19 
19 
     | 
    
         
             
                  # @see Deeprails::Models::MonitorCreateParams
         
     | 
| 
       20 
20 
     | 
    
         
             
                  def create(params)
         
     | 
| 
         @@ -23,7 +23,7 @@ module Deeprails 
     | 
|
| 
       23 
23 
     | 
    
         
             
                      method: :post,
         
     | 
| 
       24 
24 
     | 
    
         
             
                      path: "monitor",
         
     | 
| 
       25 
25 
     | 
    
         
             
                      body: parsed,
         
     | 
| 
       26 
     | 
    
         
            -
                      model: Deeprails:: 
     | 
| 
      
 26 
     | 
    
         
            +
                      model: Deeprails::MonitorResponse,
         
     | 
| 
       27 
27 
     | 
    
         
             
                      options: options
         
     | 
| 
       28 
28 
     | 
    
         
             
                    )
         
     | 
| 
       29 
29 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -39,7 +39,7 @@ module Deeprails 
     | 
|
| 
       39 
39 
     | 
    
         
             
                  #
         
     | 
| 
       40 
40 
     | 
    
         
             
                  # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
         
     | 
| 
       41 
41 
     | 
    
         
             
                  #
         
     | 
| 
       42 
     | 
    
         
            -
                  # @return [Deeprails::Models:: 
     | 
| 
      
 42 
     | 
    
         
            +
                  # @return [Deeprails::Models::MonitorDetailResponse]
         
     | 
| 
       43 
43 
     | 
    
         
             
                  #
         
     | 
| 
       44 
44 
     | 
    
         
             
                  # @see Deeprails::Models::MonitorRetrieveParams
         
     | 
| 
       45 
45 
     | 
    
         
             
                  def retrieve(monitor_id, params = {})
         
     | 
| 
         @@ -48,7 +48,7 @@ module Deeprails 
     | 
|
| 
       48 
48 
     | 
    
         
             
                      method: :get,
         
     | 
| 
       49 
49 
     | 
    
         
             
                      path: ["monitor/%1$s", monitor_id],
         
     | 
| 
       50 
50 
     | 
    
         
             
                      query: parsed,
         
     | 
| 
       51 
     | 
    
         
            -
                      model: Deeprails:: 
     | 
| 
      
 51 
     | 
    
         
            +
                      model: Deeprails::MonitorDetailResponse,
         
     | 
| 
       52 
52 
     | 
    
         
             
                      options: options
         
     | 
| 
       53 
53 
     | 
    
         
             
                    )
         
     | 
| 
       54 
54 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -71,7 +71,7 @@ module Deeprails 
     | 
|
| 
       71 
71 
     | 
    
         
             
                  #
         
     | 
| 
       72 
72 
     | 
    
         
             
                  # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
         
     | 
| 
       73 
73 
     | 
    
         
             
                  #
         
     | 
| 
       74 
     | 
    
         
            -
                  # @return [Deeprails::Models:: 
     | 
| 
      
 74 
     | 
    
         
            +
                  # @return [Deeprails::Models::MonitorResponse]
         
     | 
| 
       75 
75 
     | 
    
         
             
                  #
         
     | 
| 
       76 
76 
     | 
    
         
             
                  # @see Deeprails::Models::MonitorUpdateParams
         
     | 
| 
       77 
77 
     | 
    
         
             
                  def update(monitor_id, params = {})
         
     | 
| 
         @@ -80,7 +80,7 @@ module Deeprails 
     | 
|
| 
       80 
80 
     | 
    
         
             
                      method: :put,
         
     | 
| 
       81 
81 
     | 
    
         
             
                      path: ["monitor/%1$s", monitor_id],
         
     | 
| 
       82 
82 
     | 
    
         
             
                      body: parsed,
         
     | 
| 
       83 
     | 
    
         
            -
                      model: Deeprails:: 
     | 
| 
      
 83 
     | 
    
         
            +
                      model: Deeprails::MonitorResponse,
         
     | 
| 
       84 
84 
     | 
    
         
             
                      options: options
         
     | 
| 
       85 
85 
     | 
    
         
             
                    )
         
     | 
| 
       86 
86 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -109,7 +109,7 @@ module Deeprails 
     | 
|
| 
       109 
109 
     | 
    
         
             
                  #
         
     | 
| 
       110 
110 
     | 
    
         
             
                  # @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
         
     | 
| 
       111 
111 
     | 
    
         
             
                  #
         
     | 
| 
       112 
     | 
    
         
            -
                  # @return [Deeprails::Models:: 
     | 
| 
      
 112 
     | 
    
         
            +
                  # @return [Deeprails::Models::MonitorEventResponse]
         
     | 
| 
       113 
113 
     | 
    
         
             
                  #
         
     | 
| 
       114 
114 
     | 
    
         
             
                  # @see Deeprails::Models::MonitorSubmitEventParams
         
     | 
| 
       115 
115 
     | 
    
         
             
                  def submit_event(monitor_id, params)
         
     | 
| 
         @@ -118,7 +118,7 @@ module Deeprails 
     | 
|
| 
       118 
118 
     | 
    
         
             
                      method: :post,
         
     | 
| 
       119 
119 
     | 
    
         
             
                      path: ["monitor/%1$s/events", monitor_id],
         
     | 
| 
       120 
120 
     | 
    
         
             
                      body: parsed,
         
     | 
| 
       121 
     | 
    
         
            -
                      model: Deeprails:: 
     | 
| 
      
 121 
     | 
    
         
            +
                      model: Deeprails::MonitorEventResponse,
         
     | 
| 
       122 
122 
     | 
    
         
             
                      options: options
         
     | 
| 
       123 
123 
     | 
    
         
             
                    )
         
     | 
| 
       124 
124 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/deeprails/version.rb
    CHANGED
    
    
    
        data/lib/deeprails.rb
    CHANGED
    
    | 
         @@ -50,24 +50,20 @@ require_relative "deeprails/errors" 
     | 
|
| 
       50 
50 
     | 
    
         
             
            require_relative "deeprails/internal/transport/base_client"
         
     | 
| 
       51 
51 
     | 
    
         
             
            require_relative "deeprails/internal/transport/pooled_net_requester"
         
     | 
| 
       52 
52 
     | 
    
         
             
            require_relative "deeprails/client"
         
     | 
| 
       53 
     | 
    
         
            -
            require_relative "deeprails/models/api_response"
         
     | 
| 
       54 
53 
     | 
    
         
             
            require_relative "deeprails/models/defend_create_workflow_params"
         
     | 
| 
       55 
54 
     | 
    
         
             
            require_relative "deeprails/models/defend_response"
         
     | 
| 
       56 
55 
     | 
    
         
             
            require_relative "deeprails/models/defend_retrieve_event_params"
         
     | 
| 
       57 
56 
     | 
    
         
             
            require_relative "deeprails/models/defend_retrieve_workflow_params"
         
     | 
| 
       58 
57 
     | 
    
         
             
            require_relative "deeprails/models/defend_submit_event_params"
         
     | 
| 
       59 
58 
     | 
    
         
             
            require_relative "deeprails/models/defend_update_workflow_params"
         
     | 
| 
       60 
     | 
    
         
            -
            require_relative "deeprails/models/evaluate_create_params"
         
     | 
| 
       61 
     | 
    
         
            -
            require_relative "deeprails/models/evaluate_retrieve_params"
         
     | 
| 
       62 
     | 
    
         
            -
            require_relative "deeprails/models/evaluation"
         
     | 
| 
       63 
59 
     | 
    
         
             
            require_relative "deeprails/models/monitor_create_params"
         
     | 
| 
      
 60 
     | 
    
         
            +
            require_relative "deeprails/models/monitor_detail_response"
         
     | 
| 
      
 61 
     | 
    
         
            +
            require_relative "deeprails/models/monitor_event_response"
         
     | 
| 
      
 62 
     | 
    
         
            +
            require_relative "deeprails/models/monitor_response"
         
     | 
| 
       64 
63 
     | 
    
         
             
            require_relative "deeprails/models/monitor_retrieve_params"
         
     | 
| 
       65 
     | 
    
         
            -
            require_relative "deeprails/models/monitor_retrieve_response"
         
     | 
| 
       66 
64 
     | 
    
         
             
            require_relative "deeprails/models/monitor_submit_event_params"
         
     | 
| 
       67 
     | 
    
         
            -
            require_relative "deeprails/models/monitor_submit_event_response"
         
     | 
| 
       68 
65 
     | 
    
         
             
            require_relative "deeprails/models/monitor_update_params"
         
     | 
| 
       69 
66 
     | 
    
         
             
            require_relative "deeprails/models/workflow_event_response"
         
     | 
| 
       70 
67 
     | 
    
         
             
            require_relative "deeprails/models"
         
     | 
| 
       71 
68 
     | 
    
         
             
            require_relative "deeprails/resources/defend"
         
     | 
| 
       72 
     | 
    
         
            -
            require_relative "deeprails/resources/evaluate"
         
     | 
| 
       73 
69 
     | 
    
         
             
            require_relative "deeprails/resources/monitor"
         
     | 
    
        data/rbi/deeprails/client.rbi
    CHANGED
    
    | 
         @@ -19,9 +19,6 @@ module Deeprails 
     | 
|
| 
       19 
19 
     | 
    
         
             
                sig { returns(Deeprails::Resources::Monitor) }
         
     | 
| 
       20 
20 
     | 
    
         
             
                attr_reader :monitor
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
                sig { returns(Deeprails::Resources::Evaluate) }
         
     | 
| 
       23 
     | 
    
         
            -
                attr_reader :evaluate
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
22 
     | 
    
         
             
                # @api private
         
     | 
| 
       26 
23 
     | 
    
         
             
                sig { override.returns(T::Hash[String, String]) }
         
     | 
| 
       27 
24 
     | 
    
         
             
                private def auth_headers
         
     | 
| 
         @@ -88,10 +88,10 @@ module Deeprails 
     | 
|
| 
       88 
88 
     | 
    
         
             
                  # Max. number of improvement action retries until a given event passes the
         
     | 
| 
       89 
89 
     | 
    
         
             
                  # guardrails. Defaults to 10.
         
     | 
| 
       90 
90 
     | 
    
         
             
                  sig { returns(T.nilable(Integer)) }
         
     | 
| 
       91 
     | 
    
         
            -
                  attr_reader : 
     | 
| 
      
 91 
     | 
    
         
            +
                  attr_reader :max_improvement_attempts
         
     | 
| 
       92 
92 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
                  sig { params( 
     | 
| 
       94 
     | 
    
         
            -
                  attr_writer : 
     | 
| 
      
 93 
     | 
    
         
            +
                  sig { params(max_improvement_attempts: Integer).void }
         
     | 
| 
      
 94 
     | 
    
         
            +
                  attr_writer :max_improvement_attempts
         
     | 
| 
       95 
95 
     | 
    
         | 
| 
       96 
96 
     | 
    
         
             
                  sig do
         
     | 
| 
       97 
97 
     | 
    
         
             
                    params(
         
     | 
| 
         @@ -106,7 +106,7 @@ module Deeprails 
     | 
|
| 
       106 
106 
     | 
    
         
             
                        ],
         
     | 
| 
       107 
107 
     | 
    
         
             
                      custom_hallucination_threshold_values: T::Hash[Symbol, Float],
         
     | 
| 
       108 
108 
     | 
    
         
             
                      description: String,
         
     | 
| 
       109 
     | 
    
         
            -
                       
     | 
| 
      
 109 
     | 
    
         
            +
                      max_improvement_attempts: Integer,
         
     | 
| 
       110 
110 
     | 
    
         
             
                      request_options: Deeprails::RequestOptions::OrHash
         
     | 
| 
       111 
111 
     | 
    
         
             
                    ).returns(T.attached_class)
         
     | 
| 
       112 
112 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -138,7 +138,7 @@ module Deeprails 
     | 
|
| 
       138 
138 
     | 
    
         
             
                    description: nil,
         
     | 
| 
       139 
139 
     | 
    
         
             
                    # Max. number of improvement action retries until a given event passes the
         
     | 
| 
       140 
140 
     | 
    
         
             
                    # guardrails. Defaults to 10.
         
     | 
| 
       141 
     | 
    
         
            -
                     
     | 
| 
      
 141 
     | 
    
         
            +
                    max_improvement_attempts: nil,
         
     | 
| 
       142 
142 
     | 
    
         
             
                    request_options: {}
         
     | 
| 
       143 
143 
     | 
    
         
             
                  )
         
     | 
| 
       144 
144 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -157,7 +157,7 @@ module Deeprails 
     | 
|
| 
       157 
157 
     | 
    
         
             
                          ],
         
     | 
| 
       158 
158 
     | 
    
         
             
                        custom_hallucination_threshold_values: T::Hash[Symbol, Float],
         
     | 
| 
       159 
159 
     | 
    
         
             
                        description: String,
         
     | 
| 
       160 
     | 
    
         
            -
                         
     | 
| 
      
 160 
     | 
    
         
            +
                        max_improvement_attempts: Integer,
         
     | 
| 
       161 
161 
     | 
    
         
             
                        request_options: Deeprails::RequestOptions
         
     | 
| 
       162 
162 
     | 
    
         
             
                      }
         
     | 
| 
       163 
163 
     | 
    
         
             
                    )
         
     | 
| 
         @@ -53,10 +53,10 @@ module Deeprails 
     | 
|
| 
       53 
53 
     | 
    
         
             
                  # Max. number of improvement action retries until a given event passes the
         
     | 
| 
       54 
54 
     | 
    
         
             
                  # guardrails.
         
     | 
| 
       55 
55 
     | 
    
         
             
                  sig { returns(T.nilable(Integer)) }
         
     | 
| 
       56 
     | 
    
         
            -
                  attr_reader : 
     | 
| 
      
 56 
     | 
    
         
            +
                  attr_reader :max_improvement_attempts
         
     | 
| 
       57 
57 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
                  sig { params( 
     | 
| 
       59 
     | 
    
         
            -
                  attr_writer : 
     | 
| 
      
 58 
     | 
    
         
            +
                  sig { params(max_improvement_attempts: Integer).void }
         
     | 
| 
      
 59 
     | 
    
         
            +
                  attr_writer :max_improvement_attempts
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
       61 
61 
     | 
    
         
             
                  # The most recent time the workflow was modified in UTC.
         
     | 
| 
       62 
62 
     | 
    
         
             
                  sig { returns(T.nilable(Time)) }
         
     | 
| 
         @@ -90,7 +90,7 @@ module Deeprails 
     | 
|
| 
       90 
90 
     | 
    
         
             
                      description: String,
         
     | 
| 
       91 
91 
     | 
    
         
             
                      improvement_action:
         
     | 
| 
       92 
92 
     | 
    
         
             
                        Deeprails::DefendResponse::ImprovementAction::OrSymbol,
         
     | 
| 
       93 
     | 
    
         
            -
                       
     | 
| 
      
 93 
     | 
    
         
            +
                      max_improvement_attempts: Integer,
         
     | 
| 
       94 
94 
     | 
    
         
             
                      modified_at: Time,
         
     | 
| 
       95 
95 
     | 
    
         
             
                      status: Deeprails::DefendResponse::Status::OrSymbol,
         
     | 
| 
       96 
96 
     | 
    
         
             
                      success_rate: Float
         
     | 
| 
         @@ -113,7 +113,7 @@ module Deeprails 
     | 
|
| 
       113 
113 
     | 
    
         
             
                    improvement_action: nil,
         
     | 
| 
       114 
114 
     | 
    
         
             
                    # Max. number of improvement action retries until a given event passes the
         
     | 
| 
       115 
115 
     | 
    
         
             
                    # guardrails.
         
     | 
| 
       116 
     | 
    
         
            -
                     
     | 
| 
      
 116 
     | 
    
         
            +
                    max_improvement_attempts: nil,
         
     | 
| 
       117 
117 
     | 
    
         
             
                    # The most recent time the workflow was modified in UTC.
         
     | 
| 
       118 
118 
     | 
    
         
             
                    modified_at: nil,
         
     | 
| 
       119 
119 
     | 
    
         
             
                    # Status of the selected workflow. May be `inactive` or `active`. Inactive
         
     | 
| 
         @@ -133,7 +133,7 @@ module Deeprails 
     | 
|
| 
       133 
133 
     | 
    
         
             
                        description: String,
         
     | 
| 
       134 
134 
     | 
    
         
             
                        improvement_action:
         
     | 
| 
       135 
135 
     | 
    
         
             
                          Deeprails::DefendResponse::ImprovementAction::TaggedSymbol,
         
     | 
| 
       136 
     | 
    
         
            -
                         
     | 
| 
      
 136 
     | 
    
         
            +
                        max_improvement_attempts: Integer,
         
     | 
| 
       137 
137 
     | 
    
         
             
                        modified_at: Time,
         
     | 
| 
       138 
138 
     | 
    
         
             
                        status: Deeprails::DefendResponse::Status::TaggedSymbol,
         
     | 
| 
       139 
139 
     | 
    
         
             
                        success_rate: Float
         
     | 
| 
         @@ -15,7 +15,7 @@ module Deeprails 
     | 
|
| 
       15 
15 
     | 
    
         
             
                    end
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                  # A dictionary of inputs sent to the LLM to generate output. The dictionary must
         
     | 
| 
       18 
     | 
    
         
            -
                  # contain at least `user_prompt` or `system_prompt` field. For the
         
     | 
| 
      
 18 
     | 
    
         
            +
                  # contain at least a `user_prompt` field or a `system_prompt` field. For the
         
     | 
| 
       19 
19 
     | 
    
         
             
                  # ground_truth_adherence guardrail metric, `ground_truth` should be provided.
         
     | 
| 
       20 
20 
     | 
    
         
             
                  sig { returns(Deeprails::DefendSubmitEventParams::ModelInput) }
         
     | 
| 
       21 
21 
     | 
    
         
             
                  attr_reader :model_input
         
     | 
| 
         @@ -61,7 +61,7 @@ module Deeprails 
     | 
|
| 
       61 
61 
     | 
    
         
             
                  end
         
     | 
| 
       62 
62 
     | 
    
         
             
                  def self.new(
         
     | 
| 
       63 
63 
     | 
    
         
             
                    # A dictionary of inputs sent to the LLM to generate output. The dictionary must
         
     | 
| 
       64 
     | 
    
         
            -
                    # contain at least `user_prompt` or `system_prompt` field. For the
         
     | 
| 
      
 64 
     | 
    
         
            +
                    # contain at least a `user_prompt` field or a `system_prompt` field. For the
         
     | 
| 
       65 
65 
     | 
    
         
             
                    # ground_truth_adherence guardrail metric, `ground_truth` should be provided.
         
     | 
| 
       66 
66 
     | 
    
         
             
                    model_input:,
         
     | 
| 
       67 
67 
     | 
    
         
             
                    # Output generated by the LLM to be evaluated.
         
     | 
| 
         @@ -103,7 +103,7 @@ module Deeprails 
     | 
|
| 
       103 
103 
     | 
    
         
             
                        )
         
     | 
| 
       104 
104 
     | 
    
         
             
                      end
         
     | 
| 
       105 
105 
     | 
    
         | 
| 
       106 
     | 
    
         
            -
                    # The ground truth for evaluating Ground Truth Adherence guardrail.
         
     | 
| 
      
 106 
     | 
    
         
            +
                    # The ground truth for evaluating the Ground Truth Adherence guardrail.
         
     | 
| 
       107 
107 
     | 
    
         
             
                    sig { returns(T.nilable(String)) }
         
     | 
| 
       108 
108 
     | 
    
         
             
                    attr_reader :ground_truth
         
     | 
| 
       109 
109 
     | 
    
         | 
| 
         @@ -125,7 +125,7 @@ module Deeprails 
     | 
|
| 
       125 
125 
     | 
    
         
             
                    attr_writer :user_prompt
         
     | 
| 
       126 
126 
     | 
    
         | 
| 
       127 
127 
     | 
    
         
             
                    # A dictionary of inputs sent to the LLM to generate output. The dictionary must
         
     | 
| 
       128 
     | 
    
         
            -
                    # contain at least `user_prompt` or `system_prompt` field. For the
         
     | 
| 
      
 128 
     | 
    
         
            +
                    # contain at least a `user_prompt` field or a `system_prompt` field. For the
         
     | 
| 
       129 
129 
     | 
    
         
             
                    # ground_truth_adherence guardrail metric, `ground_truth` should be provided.
         
     | 
| 
       130 
130 
     | 
    
         
             
                    sig do
         
     | 
| 
       131 
131 
     | 
    
         
             
                      params(
         
     | 
| 
         @@ -135,7 +135,7 @@ module Deeprails 
     | 
|
| 
       135 
135 
     | 
    
         
             
                      ).returns(T.attached_class)
         
     | 
| 
       136 
136 
     | 
    
         
             
                    end
         
     | 
| 
       137 
137 
     | 
    
         
             
                    def self.new(
         
     | 
| 
       138 
     | 
    
         
            -
                      # The ground truth for evaluating Ground Truth Adherence guardrail.
         
     | 
| 
      
 138 
     | 
    
         
            +
                      # The ground truth for evaluating the Ground Truth Adherence guardrail.
         
     | 
| 
       139 
139 
     | 
    
         
             
                      ground_truth: nil,
         
     | 
| 
       140 
140 
     | 
    
         
             
                      # The system prompt used to generate the output.
         
     | 
| 
       141 
141 
     | 
    
         
             
                      system_prompt: nil,
         
     |