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.0.0"
".": "1.1.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: ce7e997e94b56d2c2403f39c42b96a98
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/deeprails-inc%2Fdeeprails-5f0bb342de09a42c51e94feacb97cb4c11c513120637868e4bd0cdaedff14c0c.yml
openapi_spec_hash: 616b686ef84ded4978605efdbb72183e
config_hash: 63c6f27e0ba2846cf2d04e70777b3b21
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 1.1.0 (2025-10-08)

Full Changelog: [v1.0.0...v1.1.0](https://github.com/deeprails/deeprails-typescript-sdk/compare/v1.0.0...v1.1.0)

### Features

* **api:** adding code samples ([df17733](https://github.com/deeprails/deeprails-typescript-sdk/commit/df1773357e9cb9a183ec41fabd9980dc436ca20c))
* **api:** manual updates ([8a5bb06](https://github.com/deeprails/deeprails-typescript-sdk/commit/8a5bb0669951aa87771073158032e029fd78c332))


### Chores

* configure new SDK language ([1726711](https://github.com/deeprails/deeprails-typescript-sdk/commit/17267115aacd1b5cadfcae447f39daa397318328))
* configure new SDK language ([1cccec5](https://github.com/deeprails/deeprails-typescript-sdk/commit/1cccec57666d11ac0b3e3e7de455aaa35c9a9c41))

## 1.0.0 (2025-10-07)

Full Changelog: [v0.0.1...v1.0.0](https://github.com/deeprails/deeprails-typescript-sdk/compare/v0.0.1...v1.0.0)
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This library provides convenient access to the Deeprails REST API from server-side TypeScript or JavaScript.

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 @@ -26,7 +26,7 @@ const client = new Deeprails({

const defendResponse = await client.defend.createWorkflow({
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 All @@ -48,7 +48,7 @@ const client = new Deeprails({

const params: Deeprails.DefendCreateWorkflowParams = {
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 All @@ -68,7 +68,7 @@ a subclass of `APIError` will be thrown:
const defendResponse = await client.defend
.createWorkflow({
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 @@ -112,7 +112,7 @@ const client = new Deeprails({
});

// Or, configure per-request:
await client.defend.createWorkflow({ improvement_action: 'fixit', metrics: { completeness: 0.85, instruction_adherence: 0.75 }, name: 'Push Alert Workflow', type: 'custom' }, {
await client.defend.createWorkflow({ improvement_action: 'fixit', metrics: { completeness: 0.8, instruction_adherence: 0.75 }, name: 'Push Alert Workflow', type: 'custom' }, {
maxRetries: 5,
});
```
Expand All @@ -129,7 +129,7 @@ const client = new Deeprails({
});

// Override per-request:
await client.defend.createWorkflow({ improvement_action: 'fixit', metrics: { completeness: 0.85, instruction_adherence: 0.75 }, name: 'Push Alert Workflow', type: 'custom' }, {
await client.defend.createWorkflow({ improvement_action: 'fixit', metrics: { completeness: 0.8, instruction_adherence: 0.75 }, name: 'Push Alert Workflow', type: 'custom' }, {
timeout: 5 * 1000,
});
```
Expand All @@ -155,7 +155,7 @@ const client = new Deeprails();
const response = await client.defend
.createWorkflow({
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 All @@ -166,7 +166,7 @@ console.log(response.statusText); // access the underlying Response object
const { data: defendResponse, response: raw } = await client.defend
.createWorkflow({
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deeprails",
"version": "1.0.0",
"version": "1.1.0",
"description": "The official TypeScript library for the Deeprails API",
"author": {
"name": "DeepRails",
Expand Down
28 changes: 9 additions & 19 deletions src/resources/defend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import { path } from '../internal/utils/path';

export class Defend extends APIResource {
/**
* 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
*/
createWorkflow(body: DefendCreateWorkflowParams, options?: RequestOptions): APIPromise<DefendResponse> {
return this._client.post('/defend', { body, ...options });
}

/**
* Retrieve a specific event of a guardrail workflow.
* Use this endpoint to retrieve a specific event of a guardrail workflow
*/
retrieveEvent(
eventID: string,
Expand All @@ -27,14 +27,15 @@ export class Defend extends APIResource {
}

/**
* Retrieve the details for a specific guardrail workflow.
* Use this endpoint to retrieve the details for a specific defend workflow
*/
retrieveWorkflow(workflowID: string, options?: RequestOptions): APIPromise<DefendResponse> {
return this._client.get(path`/defend/${workflowID}`, options);
}

/**
* 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
*/
submitEvent(
workflowID: string,
Expand All @@ -45,7 +46,7 @@ export class Defend extends APIResource {
}

/**
* Update an existing guardrail workflow.
* Use this endpoint to update an existing guardrail workflow
*/
updateWorkflow(
workflowID: string,
Expand All @@ -56,9 +57,6 @@ export class Defend extends APIResource {
}
}

/**
* Response payload for guardrail workflow operations.
*/
export interface DefendResponse {
/**
* Name of the workflow.
Expand All @@ -83,7 +81,7 @@ export interface DefendResponse {
/**
* 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 @@ -112,9 +110,6 @@ export interface DefendResponse {
success_rate?: number;
}

/**
* Response payload for workflow event operations.
*/
export interface WorkflowEventResponse {
/**
* A unique workflow event ID.
Expand Down Expand Up @@ -149,7 +144,7 @@ export interface DefendCreateWorkflowParams {
/**
* 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 @@ -260,11 +255,6 @@ export interface DefendUpdateWorkflowParams {
* Name of the workflow.
*/
name?: string;

/**
* Type of thresholds to use for the workflow, either `automatic` or `custom`.
*/
type?: 'automatic' | 'custom';
}

export declare namespace Defend {
Expand Down
2 changes: 1 addition & 1 deletion src/resources/evaluate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class Evaluate extends APIResource {
}

/**
* Retrieve the evaluation record for a given evaluation ID.
* Use this endpoint to retrieve the evaluation record for a given evaluation ID
*/
retrieve(evalID: string, options?: RequestOptions): APIPromise<Evaluation> {
return this._client.get(path`/evaluate/${evalID}`, options);
Expand Down
30 changes: 8 additions & 22 deletions src/resources/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ import { path } from '../internal/utils/path';

export class Monitor extends APIResource {
/**
* 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
*/
create(body: MonitorCreateParams, options?: RequestOptions): APIPromise<APIResponse> {
return this._client.post('/monitor', { body, ...options });
}

/**
* Retrieve the details and evaluations associated with a specific monitor.
* Use this endpoint to retrieve the details and evaluations associated with a
* specific monitor
*/
retrieve(
monitorID: string,
Expand All @@ -26,7 +28,8 @@ export class Monitor extends APIResource {
}

/**
* Update the name, description, or status of an existing monitor.
* Use this endpoint to update the name, description, or status of an existing
* monitor
*/
update(
monitorID: string,
Expand All @@ -37,7 +40,8 @@ export class Monitor extends APIResource {
}

/**
* 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
*/
submitEvent(
monitorID: string,
Expand All @@ -57,9 +61,6 @@ export interface APIResponse {
*/
success: boolean;

/**
* Response payload for creating or updating a monitor.
*/
data?: APIResponse.Data;

/**
Expand All @@ -70,9 +71,6 @@ export interface APIResponse {
}

export namespace APIResponse {
/**
* Response payload for creating or updating a monitor.
*/
export interface Data {
/**
* A unique monitor ID.
Expand Down Expand Up @@ -121,9 +119,6 @@ export interface MonitorRetrieveResponse {
*/
success: boolean;

/**
* Detailed response payload for retrieving a monitor and its evaluations.
*/
data?: MonitorRetrieveResponse.Data;

/**
Expand All @@ -134,9 +129,6 @@ export interface MonitorRetrieveResponse {
}

export namespace MonitorRetrieveResponse {
/**
* Detailed response payload for retrieving a monitor and its evaluations.
*/
export interface Data {
/**
* A unique monitor ID.
Expand Down Expand Up @@ -232,9 +224,6 @@ export interface MonitorSubmitEventResponse {
*/
success: boolean;

/**
* Response payload for monitor event operations.
*/
data?: MonitorSubmitEventResponse.Data;

/**
Expand All @@ -245,9 +234,6 @@ export interface MonitorSubmitEventResponse {
}

export namespace MonitorSubmitEventResponse {
/**
* Response payload for monitor event operations.
*/
export interface Data {
/**
* A unique evaluation ID associated with this event.
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '1.0.0'; // x-release-please-version
export const VERSION = '1.1.0'; // x-release-please-version
2 changes: 1 addition & 1 deletion tests/api-resources/defend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('resource defend', () => {
await expect(
client.defend.updateWorkflow(
'workflow_id',
{ description: 'description', name: 'name', type: 'automatic' },
{ description: 'description', name: 'name' },
{ path: '/_stainless_unknown_path' },
),
).rejects.toThrow(Deeprails.NotFoundError);
Expand Down