Class: Deeprails::Resources::Defend
- Inherits:
-
Object
- Object
- Deeprails::Resources::Defend
- Defined in:
- lib/deeprails/resources/defend.rb
Instance Method Summary collapse
-
#create_workflow(improvement_action:, name:, threshold_type:, automatic_hallucination_tolerance_levels: nil, custom_hallucination_threshold_values: nil, description: nil, file_search: nil, max_improvement_attempts: nil, web_search: nil, request_options: {}) ⇒ Deeprails::Models::DefendCreateResponse
Some parameter documentations has been truncated, see Models::DefendCreateWorkflowParams for more details.
-
#initialize(client:) ⇒ Defend
constructor
private
A new instance of Defend.
-
#retrieve_event(event_id, workflow_id:, request_options: {}) ⇒ Deeprails::Models::WorkflowEventDetailResponse
Use this endpoint to retrieve a specific event of a guardrail workflow.
-
#retrieve_workflow(workflow_id, limit: nil, request_options: {}) ⇒ Deeprails::Models::DefendResponse
Some parameter documentations has been truncated, see Models::DefendRetrieveWorkflowParams for more details.
-
#submit_event(workflow_id, model_input:, model_output:, model_used:, run_mode:, nametag: nil, request_options: {}) ⇒ Deeprails::Models::WorkflowEventResponse
Some parameter documentations has been truncated, see Models::DefendSubmitEventParams for more details.
-
#update_workflow(workflow_id, description: nil, name: nil, request_options: {}) ⇒ Deeprails::Models::DefendUpdateResponse
Use this endpoint to update an existing defend workflow if its details change.
Constructor Details
#initialize(client:) ⇒ Defend
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Defend.
167 168 169 |
# File 'lib/deeprails/resources/defend.rb', line 167 def initialize(client:) @client = client end |
Instance Method Details
#create_workflow(improvement_action:, name:, threshold_type:, automatic_hallucination_tolerance_levels: nil, custom_hallucination_threshold_values: nil, description: nil, file_search: nil, max_improvement_attempts: nil, web_search: nil, request_options: {}) ⇒ Deeprails::Models::DefendCreateResponse
Some parameter documentations has been truncated, see Models::DefendCreateWorkflowParams for more details.
Use this endpoint to create a new guardrail workflow by specifying guardrail thresholds, an improvement action, and optional extended capabilities.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/deeprails/resources/defend.rb', line 37 def create_workflow(params) parsed, = Deeprails::DefendCreateWorkflowParams.dump_request(params) @client.request( method: :post, path: "defend", body: parsed, model: Deeprails::DefendCreateResponse, options: ) end |
#retrieve_event(event_id, workflow_id:, request_options: {}) ⇒ Deeprails::Models::WorkflowEventDetailResponse
Use this endpoint to retrieve a specific event of a guardrail workflow
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/deeprails/resources/defend.rb', line 61 def retrieve_event(event_id, params) parsed, = Deeprails::DefendRetrieveEventParams.dump_request(params) workflow_id = parsed.delete(:workflow_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["defend/%1$s/events/%2$s", workflow_id, event_id], model: Deeprails::WorkflowEventDetailResponse, options: ) end |
#retrieve_workflow(workflow_id, limit: nil, request_options: {}) ⇒ Deeprails::Models::DefendResponse
Some parameter documentations has been truncated, see Models::DefendRetrieveWorkflowParams for more details.
Use this endpoint to retrieve the details for a specific defend workflow
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/deeprails/resources/defend.rb', line 91 def retrieve_workflow(workflow_id, params = {}) parsed, = Deeprails::DefendRetrieveWorkflowParams.dump_request(params) @client.request( method: :get, path: ["defend/%1$s", workflow_id], query: parsed, model: Deeprails::DefendResponse, options: ) end |
#submit_event(workflow_id, model_input:, model_output:, model_used:, run_mode:, nametag: nil, request_options: {}) ⇒ Deeprails::Models::WorkflowEventResponse
Some parameter documentations has been truncated, see Models::DefendSubmitEventParams for more details.
Use this endpoint to submit a model input and output pair to a workflow for evaluation
127 128 129 130 131 132 133 134 135 136 |
# File 'lib/deeprails/resources/defend.rb', line 127 def submit_event(workflow_id, params) parsed, = Deeprails::DefendSubmitEventParams.dump_request(params) @client.request( method: :post, path: ["defend/%1$s/events", workflow_id], body: parsed, model: Deeprails::WorkflowEventResponse, options: ) end |
#update_workflow(workflow_id, description: nil, name: nil, request_options: {}) ⇒ Deeprails::Models::DefendUpdateResponse
Use this endpoint to update an existing defend workflow if its details change.
153 154 155 156 157 158 159 160 161 162 |
# File 'lib/deeprails/resources/defend.rb', line 153 def update_workflow(workflow_id, params = {}) parsed, = Deeprails::DefendUpdateWorkflowParams.dump_request(params) @client.request( method: :put, path: ["defend/%1$s", workflow_id], body: parsed, model: Deeprails::DefendUpdateResponse, options: ) end |