Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 11
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/deeprails-inc%2Fdeeprails-96512c1b797f0943ff15a6f7af701c2c68c90f2db3a99bcad64a092924c39167.yml
openapi_spec_hash: 19d817d155ec2593b8af64e69a63375b
config_hash: 3e459e308a3ae2c9963655281c3987bc
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/deeprails-inc%2Fdeeprails-5f0bb342de09a42c51e94feacb97cb4c11c513120637868e4bd0cdaedff14c0c.yml
openapi_spec_hash: 616b686ef84ded4978605efdbb72183e
config_hash: 63c6f27e0ba2846cf2d04e70777b3b21
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Changelog

## 0.2.0 (2025-10-07)
## 0.2.0 (2025-10-08)

Full Changelog: [v0.1.0...v0.2.0](https://github.com/deeprails/deeprails-ruby-sdk/compare/v0.1.0...v0.2.0)

### Features

* **api:** manual updates ([40308c3](https://github.com/deeprails/deeprails-ruby-sdk/commit/40308c3e3ebfb15a6ab606a13f75e97656daff19))
* **api:** adding code samples ([9597e09](https://github.com/deeprails/deeprails-ruby-sdk/commit/9597e09967d659172d52c3935b3dd8f3e0018783))


### Chores

* sync repo ([a33597d](https://github.com/deeprails/deeprails-ruby-sdk/commit/a33597d5677081f50207f926f9950d9914700fb3))

## 0.1.0 (2025-10-07)

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
begin
defend = deeprails.defend.create_workflow(
improvement_action: "fixit",
metrics: {completeness: 0.85, instruction_adherence: 0.75},
metrics: {completeness: 0.8, instruction_adherence: 0.75},
name: "Push Alert Workflow",
type: "custom"
)
Expand Down Expand Up @@ -96,7 +96,7 @@ deeprails = Deeprails::Client.new(
# Or, configure per-request:
deeprails.defend.create_workflow(
improvement_action: "fixit",
metrics: {completeness: 0.85, instruction_adherence: 0.75},
metrics: {completeness: 0.8, instruction_adherence: 0.75},
name: "Push Alert Workflow",
type: "custom",
request_options: {max_retries: 5}
Expand All @@ -116,7 +116,7 @@ deeprails = Deeprails::Client.new(
# Or, configure per-request:
deeprails.defend.create_workflow(
improvement_action: "fixit",
metrics: {completeness: 0.85, instruction_adherence: 0.75},
metrics: {completeness: 0.8, instruction_adherence: 0.75},
name: "Push Alert Workflow",
type: "custom",
request_options: {timeout: 5}
Expand Down Expand Up @@ -153,7 +153,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
defend_response =
deeprails.defend.create_workflow(
improvement_action: "fixit",
metrics: {completeness: 0.85, instruction_adherence: 0.75},
metrics: {completeness: 0.8, instruction_adherence: 0.75},
name: "Push Alert Workflow",
type: "custom",
request_options: {
Expand Down
5 changes: 1 addition & 4 deletions lib/deeprails/models/api_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class APIResponse < Deeprails::Internal::Type::BaseModel
required :success, Deeprails::Internal::Type::Boolean

# @!attribute data
# Response payload for creating or updating a monitor.
#
# @return [Deeprails::Models::APIResponse::Data, nil]
optional :data, -> { Deeprails::APIResponse::Data }
Expand All @@ -31,7 +30,7 @@ class APIResponse < Deeprails::Internal::Type::BaseModel
#
# @param success [Boolean] Represents whether the request was completed successfully.
#
# @param data [Deeprails::Models::APIResponse::Data] Response payload for creating or updating a monitor.
# @param data [Deeprails::Models::APIResponse::Data]
#
# @param message [String] The accompanying message for the request. Includes error details when applicable

Expand Down Expand Up @@ -84,8 +83,6 @@ class Data < Deeprails::Internal::Type::BaseModel
# Some parameter documentations has been truncated, see
# {Deeprails::Models::APIResponse::Data} for more details.
#
# Response payload for creating or updating a monitor.
#
# @param monitor_id [String] A unique monitor ID.
#
# @param name [String] Name of the monitor.
Expand Down
4 changes: 2 additions & 2 deletions lib/deeprails/models/defend_create_workflow_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class DefendCreateWorkflowParams < Deeprails::Internal::Type::BaseModel
# @!attribute improvement_action
# The action used to improve outputs that fail one or guardrail metrics for the
# workflow events. May be `regenerate`, `fixit`, or null which represents “do
# nothing”. ReGen runs the user's exact input prompt with minor induced variance.
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
# Fixit attempts to directly address the shortcomings of the output using the
# guardrail failure rationale. Do nothing does not attempt any improvement.
#
Expand Down Expand Up @@ -87,7 +87,7 @@ class DefendCreateWorkflowParams < Deeprails::Internal::Type::BaseModel

# The action used to improve outputs that fail one or guardrail metrics for the
# workflow events. May be `regenerate`, `fixit`, or null which represents “do
# nothing”. ReGen runs the user's exact input prompt with minor induced variance.
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
# Fixit attempts to directly address the shortcomings of the output using the
# guardrail failure rationale. Do nothing does not attempt any improvement.
module ImprovementAction
Expand Down
6 changes: 2 additions & 4 deletions lib/deeprails/models/defend_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DefendResponse < Deeprails::Internal::Type::BaseModel
# @!attribute improvement_action
# The action used to improve outputs that fail one or more guardrail metrics for
# the workflow events. May be `regenerate`, `fixit`, or null which represents “do
# nothing”. ReGen runs the user's exact input prompt with minor induced variance.
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
# Fixit attempts to directly address the shortcomings of the output using the
# guardrail failure rationale. Do nothing does not attempt any improvement.
#
Expand Down Expand Up @@ -68,8 +68,6 @@ class DefendResponse < Deeprails::Internal::Type::BaseModel
# Some parameter documentations has been truncated, see
# {Deeprails::Models::DefendResponse} for more details.
#
# Response payload for guardrail workflow operations.
#
# @param name [String] Name of the workflow.
#
# @param workflow_id [String] A unique workflow ID.
Expand All @@ -90,7 +88,7 @@ class DefendResponse < Deeprails::Internal::Type::BaseModel

# The action used to improve outputs that fail one or more guardrail metrics for
# the workflow events. May be `regenerate`, `fixit`, or null which represents “do
# nothing”. ReGen runs the user's exact input prompt with minor induced variance.
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
# Fixit attempts to directly address the shortcomings of the output using the
# guardrail failure rationale. Do nothing does not attempt any improvement.
#
Expand Down
21 changes: 1 addition & 20 deletions lib/deeprails/models/defend_update_workflow_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,12 @@ class DefendUpdateWorkflowParams < Deeprails::Internal::Type::BaseModel
# @return [String, nil]
optional :name, String

# @!attribute type
# Type of thresholds to use for the workflow, either `automatic` or `custom`.
#
# @return [Symbol, Deeprails::Models::DefendUpdateWorkflowParams::Type, nil]
optional :type, enum: -> { Deeprails::DefendUpdateWorkflowParams::Type }

# @!method initialize(description: nil, name: nil, type: nil, request_options: {})
# @!method initialize(description: nil, name: nil, request_options: {})
# @param description [String] Description for the workflow.
#
# @param name [String] Name of the workflow.
#
# @param type [Symbol, Deeprails::Models::DefendUpdateWorkflowParams::Type] Type of thresholds to use for the workflow, either `automatic` or `custom`.
#
# @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}]

# Type of thresholds to use for the workflow, either `automatic` or `custom`.
module Type
extend Deeprails::Internal::Type::Enum

AUTOMATIC = :automatic
CUSTOM = :custom

# @!method self.values
# @return [Array<Symbol>]
end
end
end
end
5 changes: 1 addition & 4 deletions lib/deeprails/models/monitor_retrieve_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class MonitorRetrieveResponse < Deeprails::Internal::Type::BaseModel
required :success, Deeprails::Internal::Type::Boolean

# @!attribute data
# Detailed response payload for retrieving a monitor and its evaluations.
#
# @return [Deeprails::Models::MonitorRetrieveResponse::Data, nil]
optional :data, -> { Deeprails::Models::MonitorRetrieveResponse::Data }
Expand All @@ -31,7 +30,7 @@ class MonitorRetrieveResponse < Deeprails::Internal::Type::BaseModel
#
# @param success [Boolean] Represents whether the request was completed successfully.
#
# @param data [Deeprails::Models::MonitorRetrieveResponse::Data] Detailed response payload for retrieving a monitor and its evaluations.
# @param data [Deeprails::Models::MonitorRetrieveResponse::Data]
#
# @param message [String] The accompanying message for the request. Includes error details when applicable

Expand Down Expand Up @@ -99,8 +98,6 @@ class Data < Deeprails::Internal::Type::BaseModel
# Some parameter documentations has been truncated, see
# {Deeprails::Models::MonitorRetrieveResponse::Data} for more details.
#
# Detailed response payload for retrieving a monitor and its evaluations.
#
# @param monitor_id [String] A unique monitor ID.
#
# @param monitor_status [Symbol, Deeprails::Models::MonitorRetrieveResponse::Data::MonitorStatus] Status of the monitor. Can be `active` or `inactive`. Inactive monitors no lon
Expand Down
7 changes: 2 additions & 5 deletions lib/deeprails/models/monitor_submit_event_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class MonitorSubmitEventResponse < Deeprails::Internal::Type::BaseModel
required :success, Deeprails::Internal::Type::Boolean

# @!attribute data
# Response payload for monitor event operations.
#
# @return [Deeprails::Models::MonitorSubmitEventResponse::Data, nil]
optional :data, -> { Deeprails::Models::MonitorSubmitEventResponse::Data }
Expand All @@ -31,9 +30,9 @@ class MonitorSubmitEventResponse < Deeprails::Internal::Type::BaseModel
#
# @param success [Boolean] Represents whether the request was completed successfully.
#
# @param data [Deeprails::Models::MonitorSubmitEventResponse::Data] Response payload for monitor event operations.
# @param data [Deeprails::Models::MonitorSubmitEventResponse::Data]
#
# @param message [String] The accompanying message for the request. Includes error details when applicabl
# @param message [String] The accompanying message for the request. Includes error details when applicable

# @see Deeprails::Models::MonitorSubmitEventResponse#data
class Data < Deeprails::Internal::Type::BaseModel
Expand Down Expand Up @@ -62,8 +61,6 @@ class Data < Deeprails::Internal::Type::BaseModel
optional :created_at, Time

# @!method initialize(evaluation_id:, event_id:, monitor_id:, created_at: nil)
# Response payload for monitor event operations.
#
# @param evaluation_id [String] A unique evaluation ID associated with this event.
#
# @param event_id [String] A unique monitor event ID.
Expand Down
2 changes: 0 additions & 2 deletions lib/deeprails/models/workflow_event_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class WorkflowEventResponse < Deeprails::Internal::Type::BaseModel
# Some parameter documentations has been truncated, see
# {Deeprails::Models::WorkflowEventResponse} for more details.
#
# Response payload for workflow event operations.
#
# @param event_id [String] A unique workflow event ID.
#
# @param workflow_id [String] Workflow ID associated with the event.
Expand Down
17 changes: 8 additions & 9 deletions lib/deeprails/resources/defend.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class Defend
# Some parameter documentations has been truncated, see
# {Deeprails::Models::DefendCreateWorkflowParams} for more details.
#
# Create a new guardrail workflow with optional guardrail thresholds and
# improvement actions.
# Use this endpoint to create a new guardrail workflow with optional guardrail
# thresholds and improvement actions
#
# @overload create_workflow(improvement_action:, metrics:, name:, type:, automatic_tolerance: nil, description: nil, max_retries: nil, request_options: {})
#
Expand Down Expand Up @@ -41,7 +41,7 @@ def create_workflow(params)
)
end

# Retrieve a specific event of a guardrail workflow.
# Use this endpoint to retrieve a specific event of a guardrail workflow
#
# @overload retrieve_event(event_id, workflow_id:, request_options: {})
#
Expand All @@ -68,7 +68,7 @@ def retrieve_event(event_id, params)
)
end

# Retrieve the details for a specific guardrail workflow.
# Use this endpoint to retrieve the details for a specific defend workflow
#
# @overload retrieve_workflow(workflow_id, request_options: {})
#
Expand All @@ -91,7 +91,8 @@ def retrieve_workflow(workflow_id, params = {})
# Some parameter documentations has been truncated, see
# {Deeprails::Models::DefendSubmitEventParams} for more details.
#
# Submit a model input and output pair to a workflow for evaluation.
# Use this endpoint to submit a model input and output pair to a workflow for
# evaluation
#
# @overload submit_event(workflow_id, model_input:, model_output:, model_used:, nametag:, run_mode:, request_options: {})
#
Expand Down Expand Up @@ -123,18 +124,16 @@ def submit_event(workflow_id, params)
)
end

# Update an existing guardrail workflow.
# Use this endpoint to update an existing guardrail workflow
#
# @overload update_workflow(workflow_id, description: nil, name: nil, type: nil, request_options: {})
# @overload update_workflow(workflow_id, description: nil, name: nil, request_options: {})
#
# @param workflow_id [String] The ID of the workflow to edit.
#
# @param description [String] Description for the workflow.
#
# @param name [String] Name of the workflow.
#
# @param type [Symbol, Deeprails::Models::DefendUpdateWorkflowParams::Type] Type of thresholds to use for the workflow, either `automatic` or `custom`.
#
# @param request_options [Deeprails::RequestOptions, Hash{Symbol=>Object}, nil]
#
# @return [Deeprails::Models::DefendResponse]
Expand Down
2 changes: 1 addition & 1 deletion lib/deeprails/resources/evaluate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def create(params)
)
end

# Retrieve the evaluation record for a given evaluation ID.
# Use this endpoint to retrieve the evaluation record for a given evaluation ID
#
# @overload retrieve(eval_id, request_options: {})
#
Expand Down
12 changes: 8 additions & 4 deletions lib/deeprails/resources/monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
module Deeprails
module Resources
class Monitor
# Create a new monitor to evaluate model inputs and outputs using guardrails.
# Use this endpoint to create a new monitor to evaluate model inputs and outputs
# using guardrails
#
# @overload create(name:, description: nil, request_options: {})
#
Expand All @@ -27,7 +28,8 @@ def create(params)
)
end

# Retrieve the details and evaluations associated with a specific monitor.
# Use this endpoint to retrieve the details and evaluations associated with a
# specific monitor
#
# @overload retrieve(monitor_id, limit: nil, request_options: {})
#
Expand All @@ -54,7 +56,8 @@ def retrieve(monitor_id, params = {})
# Some parameter documentations has been truncated, see
# {Deeprails::Models::MonitorUpdateParams} for more details.
#
# Update the name, description, or status of an existing monitor.
# Use this endpoint to update the name, description, or status of an existing
# monitor
#
# @overload update(monitor_id, description: nil, monitor_status: nil, name: nil, request_options: {})
#
Expand Down Expand Up @@ -85,7 +88,8 @@ def update(monitor_id, params = {})
# Some parameter documentations has been truncated, see
# {Deeprails::Models::MonitorSubmitEventParams} for more details.
#
# Submit a model input and output pair to a monitor for evaluation.
# Use this endpoint to submit a model input and output pair to a monitor for
# evaluation
#
# @overload submit_event(monitor_id, guardrail_metrics:, model_input:, model_output:, model_used: nil, nametag: nil, run_mode: nil, request_options: {})
#
Expand Down
3 changes: 0 additions & 3 deletions rbi/deeprails/models/api_response.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module Deeprails
sig { returns(T::Boolean) }
attr_accessor :success

# Response payload for creating or updating a monitor.
sig { returns(T.nilable(Deeprails::APIResponse::Data)) }
attr_reader :data

Expand All @@ -38,7 +37,6 @@ module Deeprails
def self.new(
# Represents whether the request was completed successfully.
success:,
# Response payload for creating or updating a monitor.
data: nil,
# The accompanying message for the request. Includes error details when
# applicable.
Expand Down Expand Up @@ -117,7 +115,6 @@ module Deeprails
sig { params(user_id: String).void }
attr_writer :user_id

# Response payload for creating or updating a monitor.
sig do
params(
monitor_id: String,
Expand Down
6 changes: 3 additions & 3 deletions rbi/deeprails/models/defend_create_workflow_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Deeprails

# The action used to improve outputs that fail one or guardrail metrics for the
# workflow events. May be `regenerate`, `fixit`, or null which represents “do
# nothing”. ReGen runs the user's exact input prompt with minor induced variance.
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
# Fixit attempts to directly address the shortcomings of the output using the
# guardrail failure rationale. Do nothing does not attempt any improvement.
sig do
Expand Down Expand Up @@ -101,7 +101,7 @@ module Deeprails
def self.new(
# The action used to improve outputs that fail one or guardrail metrics for the
# workflow events. May be `regenerate`, `fixit`, or null which represents “do
# nothing”. ReGen runs the user's exact input prompt with minor induced variance.
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
# Fixit attempts to directly address the shortcomings of the output using the
# guardrail failure rationale. Do nothing does not attempt any improvement.
improvement_action:,
Expand Down Expand Up @@ -154,7 +154,7 @@ module Deeprails

# The action used to improve outputs that fail one or guardrail metrics for the
# workflow events. May be `regenerate`, `fixit`, or null which represents “do
# nothing”. ReGen runs the user's exact input prompt with minor induced variance.
# nothing”. Regenerate runs the user's input prompt with minor induced variance.
# Fixit attempts to directly address the shortcomings of the output using the
# guardrail failure rationale. Do nothing does not attempt any improvement.
module ImprovementAction
Expand Down
Loading