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 @@
{
".": "0.19.0"
".": "0.20.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
configured_endpoints: 18
openapi_spec_hash: 8cd3908ccce472dcb5480c14b290b460
config_hash: 6dcf08c4324405f152d1da9fc11ab04a
configured_endpoints: 19
openapi_spec_hash: 6a7cafc3d32e6701301e925175ab6614
config_hash: 00442fdab71911b02ab1e10f9ec05b79
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## 0.20.0 (2025-12-17)

Full Changelog: [v0.19.0...v0.20.0](https://github.com/openlayer-ai/openlayer-ts/compare/v0.19.0...v0.20.0)

### Features

* **api:** add test evaluation method ([0de80ed](https://github.com/openlayer-ai/openlayer-ts/commit/0de80ed7f4373ac25cedb6216be143ea54a37845))
* **api:** api update ([a68f1ff](https://github.com/openlayer-ai/openlayer-ts/commit/a68f1ffe52342d421c9ce976ddb138d6fabc5819))


### Bug Fixes

* **mcp:** correct code tool API endpoint ([4526c6d](https://github.com/openlayer-ai/openlayer-ts/commit/4526c6d310cd8c00c58f45000da627aac87471c4))
* **mcp:** return correct lines on typescript errors ([ca8957b](https://github.com/openlayer-ai/openlayer-ts/commit/ca8957b57beabbd8877aff07a0fd56030960cd0c))


### Chores

* **client:** fix logger property type ([393ea60](https://github.com/openlayer-ai/openlayer-ts/commit/393ea6033378bce745d0bc32d2798e45df3dc584))
* **internal:** codegen related update ([db610ae](https://github.com/openlayer-ai/openlayer-ts/commit/db610aee6fa6b72f21f5474fc561a92d0fe1859d))
* **internal:** codegen related update ([ee2b679](https://github.com/openlayer-ai/openlayer-ts/commit/ee2b679da0f1136a640c261786d7c59b43f01685))
* **internal:** upgrade eslint ([ba4b81f](https://github.com/openlayer-ai/openlayer-ts/commit/ba4b81f6819bec7107a162829b13f637576cd2e1))

## 0.19.0 (2025-10-22)

Full Changelog: [v0.18.0...v0.19.0](https://github.com/openlayer-ai/openlayer-ts/compare/v0.18.0...v0.19.0)
Expand Down
10 changes: 10 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,13 @@ Types:
Methods:

- <code title="post /storage/presigned-url">client.storage.presignedURL.<a href="./src/resources/storage/presigned-url.ts">create</a>({ ...params }) -> PresignedURLCreateResponse</code>

# Tests

Types:

- <code><a href="./src/resources/tests.ts">TestEvaluateResponse</a></code>

Methods:

- <code title="post /tests/{testId}/evaluate">client.tests.<a href="./src/resources/tests.ts">evaluate</a>(testID, { ...params }) -> TestEvaluateResponse</code>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openlayer",
"version": "0.19.0",
"version": "0.20.0",
"description": "The official TypeScript library for the Openlayer API",
"author": "Openlayer <support@openlayer.com>",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -44,7 +44,7 @@
"@types/node": "^20.17.6",
"@typescript-eslint/eslint-plugin": "8.31.1",
"@typescript-eslint/parser": "8.31.1",
"eslint": "^9.20.1",
"eslint": "^9.39.1",
"eslint-plugin-prettier": "^5.4.1",
"eslint-plugin-unused-imports": "^4.1.4",
"iconv-lite": "^0.6.3",
Expand Down
11 changes: 10 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import * as Errors from './core/error';
import * as Uploads from './core/uploads';
import * as API from './resources/index';
import { APIPromise } from './core/api-promise';
import { TestEvaluateParams, TestEvaluateResponse, Tests } from './resources/tests';
import { CommitRetrieveResponse, Commits } from './resources/commits/commits';
import {
InferencePipelineRetrieveParams,
Expand Down Expand Up @@ -130,7 +131,7 @@ export class Openlayer {
baseURL: string;
maxRetries: number;
timeout: number;
logger: Logger | undefined;
logger: Logger;
logLevel: LogLevel | undefined;
fetchOptions: MergedRequestInit | undefined;

Expand Down Expand Up @@ -724,12 +725,14 @@ export class Openlayer {
commits: API.Commits = new API.Commits(this);
inferencePipelines: API.InferencePipelines = new API.InferencePipelines(this);
storage: API.Storage = new API.Storage(this);
tests: API.Tests = new API.Tests(this);
}

Openlayer.Projects = Projects;
Openlayer.Commits = Commits;
Openlayer.InferencePipelines = InferencePipelines;
Openlayer.Storage = Storage;
Openlayer.Tests = Tests;

export declare namespace Openlayer {
export type RequestOptions = Opts.RequestOptions;
Expand All @@ -753,4 +756,10 @@ export declare namespace Openlayer {
};

export { Storage as Storage };

export {
Tests as Tests,
type TestEvaluateResponse as TestEvaluateResponse,
type TestEvaluateParams as TestEvaluateParams,
};
}
1 change: 1 addition & 0 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ export {
type ProjectListParams,
} from './projects/projects';
export { Storage } from './storage/storage';
export { Tests, type TestEvaluateResponse, type TestEvaluateParams } from './tests';
72 changes: 72 additions & 0 deletions src/resources/projects/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ export interface TestCreateResponse {
*/
archived?: boolean;

/**
* Whether to apply the test to all pipelines (data sources) or to a specific set
* of pipelines. Only applies to tests that use production data.
*/
defaultToAllPipelines?: boolean | null;

/**
* The delay window in seconds. Only applies to tests that use production data.
*/
Expand All @@ -199,6 +205,24 @@ export interface TestCreateResponse {
*/
evaluationWindow?: number | null;

/**
* Array of pipelines (data sources) to which the test should not be applied. Only
* applies to tests that use production data.
*/
excludePipelines?: Array<string> | null;

/**
* Whether to include historical data in the test result. Only applies to tests
* that use production data.
*/
includeHistoricalData?: boolean | null;

/**
* Array of pipelines (data sources) to which the test should be applied. Only
* applies to tests that use production data.
*/
includePipelines?: Array<string> | null;

/**
* Whether the test uses an ML model.
*/
Expand Down Expand Up @@ -431,6 +455,12 @@ export namespace TestListResponse {
*/
archived?: boolean;

/**
* Whether to apply the test to all pipelines (data sources) or to a specific set
* of pipelines. Only applies to tests that use production data.
*/
defaultToAllPipelines?: boolean | null;

/**
* The delay window in seconds. Only applies to tests that use production data.
*/
Expand All @@ -442,6 +472,24 @@ export namespace TestListResponse {
*/
evaluationWindow?: number | null;

/**
* Array of pipelines (data sources) to which the test should not be applied. Only
* applies to tests that use production data.
*/
excludePipelines?: Array<string> | null;

/**
* Whether to include historical data in the test result. Only applies to tests
* that use production data.
*/
includeHistoricalData?: boolean | null;

/**
* Array of pipelines (data sources) to which the test should be applied. Only
* applies to tests that use production data.
*/
includePipelines?: Array<string> | null;

/**
* Whether the test uses an ML model.
*/
Expand Down Expand Up @@ -619,6 +667,12 @@ export interface TestCreateParams {
*/
archived?: boolean;

/**
* Whether to apply the test to all pipelines (data sources) or to a specific set
* of pipelines. Only applies to tests that use production data.
*/
defaultToAllPipelines?: boolean | null;

/**
* The delay window in seconds. Only applies to tests that use production data.
*/
Expand All @@ -630,6 +684,24 @@ export interface TestCreateParams {
*/
evaluationWindow?: number | null;

/**
* Array of pipelines (data sources) to which the test should not be applied. Only
* applies to tests that use production data.
*/
excludePipelines?: Array<string> | null;

/**
* Whether to include historical data in the test result. Only applies to tests
* that use production data.
*/
includeHistoricalData?: boolean | null;

/**
* Array of pipelines (data sources) to which the test should be applied. Only
* applies to tests that use production data.
*/
includePipelines?: Array<string> | null;

/**
* Whether the test uses an ML model.
*/
Expand Down
100 changes: 100 additions & 0 deletions src/resources/tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../core/resource';
import { APIPromise } from '../core/api-promise';
import { RequestOptions } from '../internal/request-options';
import { path } from '../internal/utils/path';

export class Tests extends APIResource {
/**
* Triggers one-off evaluation of a specific monitoring test for a custom timestamp
* range. This allows evaluating tests for historical data or custom time periods
* outside the regular evaluation window schedule. It also allows overwriting the
* existing test results.
*
* @example
* ```ts
* const response = await client.tests.evaluate(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { endTimestamp: 1700006400, startTimestamp: 1699920000 },
* );
* ```
*/
evaluate(
testID: string,
body: TestEvaluateParams,
options?: RequestOptions,
): APIPromise<TestEvaluateResponse> {
return this._client.post(path`/tests/${testID}/evaluate`, { body, ...options });
}
}

export interface TestEvaluateResponse {
message: string;

/**
* Number of inference pipelines the test was queued for evaluation on
*/
pipelineCount: number;

/**
* The end timestamp you requested (in seconds)
*/
requestedEndTimestamp: number;

/**
* The start timestamp you requested (in seconds)
*/
requestedStartTimestamp: number;

/**
* Array of background task information for each pipeline evaluation
*/
tasks: Array<TestEvaluateResponse.Task>;
}

export namespace TestEvaluateResponse {
export interface Task {
/**
* ID of the inference pipeline this task is for
*/
pipelineId: string;

/**
* ID of the background task
*/
taskResultId: string;

/**
* URL to check the status of this background task
*/
taskResultUrl: string;
}
}

export interface TestEvaluateParams {
/**
* End timestamp in seconds (Unix epoch)
*/
endTimestamp: number;

/**
* Start timestamp in seconds (Unix epoch)
*/
startTimestamp: number;

/**
* ID of the inference pipeline to evaluate. If not provided, all inference
* pipelines the test applies to will be evaluated.
*/
inferencePipelineId?: string;

/**
* Whether to overwrite existing test results
*/
overwriteResults?: boolean;
}

export declare namespace Tests {
export { type TestEvaluateResponse as TestEvaluateResponse, type TestEvaluateParams as TestEvaluateParams };
}
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '0.19.0'; // x-release-please-version
export const VERSION = '0.20.0'; // x-release-please-version
4 changes: 4 additions & 0 deletions tests/api-resources/projects/tests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ describe('resource tests', () => {
],
type: 'integrity',
archived: false,
defaultToAllPipelines: true,
delayWindow: 0,
evaluationWindow: 3600,
excludePipelines: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],
includeHistoricalData: true,
includePipelines: ['182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'],
usesMlModel: false,
usesProductionData: false,
usesReferenceDataset: false,
Expand Down
33 changes: 33 additions & 0 deletions tests/api-resources/tests.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import Openlayer from 'openlayer';

const client = new Openlayer({
apiKey: 'My API Key',
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
});

describe('resource tests', () => {
test('evaluate: only required params', async () => {
const responsePromise = client.tests.evaluate('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
endTimestamp: 1700006400,
startTimestamp: 1699920000,
});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
expect(response).not.toBeInstanceOf(Response);
const dataAndResponse = await responsePromise.withResponse();
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});

test('evaluate: required and optional params', async () => {
const response = await client.tests.evaluate('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
endTimestamp: 1700006400,
startTimestamp: 1699920000,
inferencePipelineId: '123e4567-e89b-12d3-a456-426614174000',
overwriteResults: false,
});
});
});
Loading
Loading