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.2.2"
".": "0.3.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 8
configured_endpoints: 9
10 changes: 10 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ Methods:

- <code title="post /inference-pipelines/{inferencePipelineId}/data-stream">client.inferencePipelines.data.<a href="./src/resources/inference-pipelines/data.ts">stream</a>(inferencePipelineId, { ...params }) -> DataStreamResponse</code>

## Rows

Types:

- <code><a href="./src/resources/inference-pipelines/rows.ts">RowStreamResponse</a></code>

Methods:

- <code title="put /inference-pipelines/{inferencePipelineId}/rows">client.inferencePipelines.rows.<a href="./src/resources/inference-pipelines/rows.ts">stream</a>(inferencePipelineId, { ...params }) -> RowStreamResponse</code>

## TestResults

Types:
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": "openlayer",
"version": "0.2.2",
"version": "0.3.0",
"description": "The official TypeScript library for the Openlayer API",
"author": "Openlayer <support@openlayer.com>",
"types": "dist/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions src/resources/inference-pipelines/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

export { DataStreamResponse, DataStreamParams, Data } from './data';
export { InferencePipelines } from './inference-pipelines';
export { RowStreamResponse, RowStreamParams, Rows } from './rows';
export { TestResultListResponse, TestResultListParams, TestResults } from './test-results';
5 changes: 5 additions & 0 deletions src/resources/inference-pipelines/inference-pipelines.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@

import { APIResource } from '../../resource';
import * as DataAPI from './data';
import * as RowsAPI from './rows';
import * as TestResultsAPI from './test-results';

export class InferencePipelines extends APIResource {
data: DataAPI.Data = new DataAPI.Data(this._client);
rows: RowsAPI.Rows = new RowsAPI.Rows(this._client);
testResults: TestResultsAPI.TestResults = new TestResultsAPI.TestResults(this._client);
}

export namespace InferencePipelines {
export import Data = DataAPI.Data;
export import DataStreamResponse = DataAPI.DataStreamResponse;
export import DataStreamParams = DataAPI.DataStreamParams;
export import Rows = RowsAPI.Rows;
export import RowStreamResponse = RowsAPI.RowStreamResponse;
export import RowStreamParams = RowsAPI.RowStreamParams;
export import TestResults = TestResultsAPI.TestResults;
export import TestResultListResponse = TestResultsAPI.TestResultListResponse;
export import TestResultListParams = TestResultsAPI.TestResultListParams;
Expand Down
81 changes: 81 additions & 0 deletions src/resources/inference-pipelines/rows.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../resource';
import * as Core from '../../core';
import * as RowsAPI from './rows';

export class Rows extends APIResource {
/**
* Update an inference data point in an inference pipeline.
*/
stream(
inferencePipelineId: string,
params: RowStreamParams,
options?: Core.RequestOptions,
): Core.APIPromise<RowStreamResponse> {
const { inferenceId, ...body } = params;
return this._client.put(`/inference-pipelines/${inferencePipelineId}/rows`, {
query: { inferenceId },
body,
...options,
});
}
}

export interface RowStreamResponse {
success: true;
}

export interface RowStreamParams {
/**
* Query param: Specify the inference id as a query param.
*/
inferenceId: string;

/**
* Body param:
*/
row: unknown;

/**
* Body param:
*/
config?: RowStreamParams.Config | null;
}

export namespace RowStreamParams {
export interface Config {
/**
* Name of the column with the ground truths.
*/
groundTruthColumnName?: string | null;

/**
* Name of the column with human feedback.
*/
humanFeedbackColumnName?: string | null;

/**
* Name of the column with the inference ids. This is useful if you want to update
* rows at a later point in time. If not provided, a unique id is generated by
* Openlayer.
*/
inferenceIdColumnName?: string | null;

/**
* Name of the column with the latencies.
*/
latencyColumnName?: string | null;

/**
* Name of the column with the timestamps. Timestamps must be in UNIX sec format.
* If not provided, the upload timestamp is used.
*/
timestampColumnName?: string | null;
}
}

export namespace Rows {
export import RowStreamResponse = RowsAPI.RowStreamResponse;
export import RowStreamParams = RowsAPI.RowStreamParams;
}
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.2.2'; // x-release-please-version
export const VERSION = '0.3.0'; // x-release-please-version
39 changes: 39 additions & 0 deletions tests/api-resources/inference-pipelines/rows.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import Openlayer from 'openlayer';
import { Response } from 'node-fetch';

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

describe('resource rows', () => {
test('stream: only required params', async () => {
const responsePromise = openlayer.inferencePipelines.rows.stream('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
inferenceId: 'inferenceId',
row: {},
});
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('stream: required and optional params', async () => {
const response = await openlayer.inferencePipelines.rows.stream('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
inferenceId: 'inferenceId',
row: {},
config: {
inferenceIdColumnName: 'id',
latencyColumnName: 'latency',
timestampColumnName: 'timestamp',
groundTruthColumnName: 'ground_truth',
humanFeedbackColumnName: 'human_feedback',
},
});
});
});