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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.2.0"
".": "1.3.0"
}
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: 378b32bd00c62c80fac853ee818a8f25
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: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 1.3.0 (2025-10-08)

Full Changelog: [v1.2.0...v1.3.0](https://github.com/deeprails/deeprails-sdk-python/compare/v1.2.0...v1.3.0)

### Features

* **api:** adding code samples ([c7f7565](https://github.com/deeprails/deeprails-sdk-python/commit/c7f7565abd00233d22d9c11a5b2c977414e03439))
* **api:** manual updates ([145946a](https://github.com/deeprails/deeprails-sdk-python/commit/145946a049fb29bff01df6763248330f4d0030ad))

## 1.2.0 (2025-10-07)

Full Changelog: [v1.1.0...v1.2.0](https://github.com/deeprails/deeprails-sdk-python/compare/v1.1.0...v1.2.0)
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and offers both synchronous and asynchronous clients powered by [httpx](https://

## Documentation

The full API of this library can be found in [api.md](api.md).
The REST API documentation can be found on [docs.deeprails.com](https://docs.deeprails.com). The full API of this library can be found in [api.md](api.md).

## Installation

Expand All @@ -33,7 +33,7 @@ client = Deeprails(
defend_response = client.defend.create_workflow(
improvement_action="fixit",
metrics={
"completeness": 0.85,
"completeness": 0.8,
"instruction_adherence": 0.75,
},
name="Push Alert Workflow",
Expand Down Expand Up @@ -65,7 +65,7 @@ async def main() -> None:
defend_response = await client.defend.create_workflow(
improvement_action="fixit",
metrics={
"completeness": 0.85,
"completeness": 0.8,
"instruction_adherence": 0.75,
},
name="Push Alert Workflow",
Expand Down Expand Up @@ -106,7 +106,7 @@ async def main() -> None:
defend_response = await client.defend.create_workflow(
improvement_action="fixit",
metrics={
"completeness": 0.85,
"completeness": 0.8,
"instruction_adherence": 0.75,
},
name="Push Alert Workflow",
Expand Down Expand Up @@ -166,7 +166,7 @@ try:
client.defend.create_workflow(
improvement_action="fixit",
metrics={
"completeness": 0.85,
"completeness": 0.8,
"instruction_adherence": 0.75,
},
name="Push Alert Workflow",
Expand Down Expand Up @@ -217,7 +217,7 @@ client = Deeprails(
client.with_options(max_retries=5).defend.create_workflow(
improvement_action="fixit",
metrics={
"completeness": 0.85,
"completeness": 0.8,
"instruction_adherence": 0.75,
},
name="Push Alert Workflow",
Expand Down Expand Up @@ -248,7 +248,7 @@ client = Deeprails(
client.with_options(timeout=5.0).defend.create_workflow(
improvement_action="fixit",
metrics={
"completeness": 0.85,
"completeness": 0.8,
"instruction_adherence": 0.75,
},
name="Push Alert Workflow",
Expand Down Expand Up @@ -297,7 +297,7 @@ client = Deeprails()
response = client.defend.with_raw_response.create_workflow(
improvement_action="fixit",
metrics={
"completeness": 0.85,
"completeness": 0.8,
"instruction_adherence": 0.75,
},
name="Push Alert Workflow",
Expand All @@ -323,7 +323,7 @@ To stream the response body, use `.with_streaming_response` instead, which requi
with client.defend.with_streaming_response.create_workflow(
improvement_action="fixit",
metrics={
"completeness": 0.85,
"completeness": 0.8,
"instruction_adherence": 0.75,
},
name="Push Alert Workflow",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "deeprails"
version = "1.2.0"
version = "1.3.0"
description = "The official Python library for the deeprails API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/deeprails/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "deeprails"
__version__ = "1.2.0" # x-release-please-version
__version__ = "1.3.0" # x-release-please-version
38 changes: 16 additions & 22 deletions src/deeprails/resources/defend.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ def create_workflow(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DefendResponse:
"""
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

Args:
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 @@ -136,7 +136,7 @@ def retrieve_event(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WorkflowEventResponse:
"""
Retrieve a specific event of a guardrail workflow.
Use this endpoint to retrieve a specific event of a guardrail workflow

Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -171,7 +171,7 @@ def retrieve_workflow(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DefendResponse:
"""
Retrieve the details for a specific guardrail workflow.
Use this endpoint to retrieve the details for a specific defend workflow

Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -209,7 +209,8 @@ def submit_event(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WorkflowEventResponse:
"""
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

Args:
model_input: A dictionary of inputs sent to the LLM to generate output. This must contain a
Expand Down Expand Up @@ -261,7 +262,6 @@ def update_workflow(
*,
description: str | Omit = omit,
name: str | Omit = omit,
type: Literal["automatic", "custom"] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -270,15 +270,13 @@ def update_workflow(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DefendResponse:
"""
Update an existing guardrail workflow.
Use this endpoint to update an existing guardrail workflow

Args:
description: Description for the workflow.

name: Name of the workflow.

type: Type of thresholds to use for the workflow, either `automatic` or `custom`.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -295,7 +293,6 @@ def update_workflow(
{
"description": description,
"name": name,
"type": type,
},
defend_update_workflow_params.DefendUpdateWorkflowParams,
),
Expand Down Expand Up @@ -344,13 +341,13 @@ async def create_workflow(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DefendResponse:
"""
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

Args:
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 @@ -417,7 +414,7 @@ async def retrieve_event(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WorkflowEventResponse:
"""
Retrieve a specific event of a guardrail workflow.
Use this endpoint to retrieve a specific event of a guardrail workflow

Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -452,7 +449,7 @@ async def retrieve_workflow(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DefendResponse:
"""
Retrieve the details for a specific guardrail workflow.
Use this endpoint to retrieve the details for a specific defend workflow

Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -490,7 +487,8 @@ async def submit_event(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WorkflowEventResponse:
"""
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

Args:
model_input: A dictionary of inputs sent to the LLM to generate output. This must contain a
Expand Down Expand Up @@ -542,7 +540,6 @@ async def update_workflow(
*,
description: str | Omit = omit,
name: str | Omit = omit,
type: Literal["automatic", "custom"] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand All @@ -551,15 +548,13 @@ async def update_workflow(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DefendResponse:
"""
Update an existing guardrail workflow.
Use this endpoint to update an existing guardrail workflow

Args:
description: Description for the workflow.

name: Name of the workflow.

type: Type of thresholds to use for the workflow, either `automatic` or `custom`.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -576,7 +571,6 @@ async def update_workflow(
{
"description": description,
"name": name,
"type": type,
},
defend_update_workflow_params.DefendUpdateWorkflowParams,
),
Expand Down
4 changes: 2 additions & 2 deletions src/deeprails/resources/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def retrieve(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Evaluation:
"""
Retrieve the evaluation record for a given evaluation ID.
Use this endpoint to retrieve the evaluation record for a given evaluation ID
Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -264,7 +264,7 @@ async def retrieve(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Evaluation:
"""
Retrieve the evaluation record for a given evaluation ID.
Use this endpoint to retrieve the evaluation record for a given evaluation ID
Args:
extra_headers: Send extra headers
Expand Down
24 changes: 16 additions & 8 deletions src/deeprails/resources/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def create(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> APIResponse:
"""
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

Args:
name: Name of the new monitor.
Expand Down Expand Up @@ -102,7 +103,8 @@ def retrieve(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> MonitorRetrieveResponse:
"""
Retrieve the details and evaluations associated with a specific monitor.
Use this endpoint to retrieve the details and evaluations associated with a
specific monitor

Args:
limit: Limit the returned events associated with this monitor. Defaults to 10.
Expand Down Expand Up @@ -144,7 +146,8 @@ def update(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> APIResponse:
"""
Update the name, description, or status of an existing monitor.
Use this endpoint to update the name, description, or status of an existing
monitor

Args:
description: Description of the monitor.
Expand Down Expand Up @@ -207,7 +210,8 @@ def submit_event(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> MonitorSubmitEventResponse:
"""
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

Args:
guardrail_metrics: An array of guardrail metrics that the model input and output pair will be
Expand Down Expand Up @@ -293,7 +297,8 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> APIResponse:
"""
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

Args:
name: Name of the new monitor.
Expand Down Expand Up @@ -336,7 +341,8 @@ async def retrieve(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> MonitorRetrieveResponse:
"""
Retrieve the details and evaluations associated with a specific monitor.
Use this endpoint to retrieve the details and evaluations associated with a
specific monitor

Args:
limit: Limit the returned events associated with this monitor. Defaults to 10.
Expand Down Expand Up @@ -378,7 +384,8 @@ async def update(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> APIResponse:
"""
Update the name, description, or status of an existing monitor.
Use this endpoint to update the name, description, or status of an existing
monitor

Args:
description: Description of the monitor.
Expand Down Expand Up @@ -441,7 +448,8 @@ async def submit_event(
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> MonitorSubmitEventResponse:
"""
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

Args:
guardrail_metrics: An array of guardrail metrics that the model input and output pair will be
Expand Down
1 change: 0 additions & 1 deletion src/deeprails/types/api_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class APIResponse(BaseModel):
"""Represents whether the request was completed successfully."""

data: Optional[Data] = None
"""Response payload for creating or updating a monitor."""

message: Optional[str] = None
"""The accompanying message for the request.
Expand Down
2 changes: 1 addition & 1 deletion src/deeprails/types/defend_create_workflow_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DefendCreateWorkflowParams(TypedDict, total=False):
"""
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
Loading