Skip to content

Commit 8b8c71e

Browse files
docs: add examples to tsdocs
1 parent fc5eda1 commit 8b8c71e

File tree

8 files changed

+144
-0
lines changed

8 files changed

+144
-0
lines changed

src/resources/inference-pipelines/data.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,26 @@ import * as Core from '../../core';
66
export class Data extends APIResource {
77
/**
88
* Publish an inference data point to an inference pipeline.
9+
*
10+
* @example
11+
* ```ts
12+
* const response =
13+
* await client.inferencePipelines.data.stream(
14+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
15+
* {
16+
* config: { outputColumnName: 'output' },
17+
* rows: [
18+
* {
19+
* user_query: 'bar',
20+
* output: 'bar',
21+
* tokens: 'bar',
22+
* cost: 'bar',
23+
* timestamp: 'bar',
24+
* },
25+
* ],
26+
* },
27+
* );
28+
* ```
929
*/
1030
stream(
1131
inferencePipelineId: string,

src/resources/inference-pipelines/inference-pipelines.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ export class InferencePipelines extends APIResource {
1717

1818
/**
1919
* Retrieve inference pipeline.
20+
*
21+
* @example
22+
* ```ts
23+
* const inferencePipeline =
24+
* await client.inferencePipelines.retrieve(
25+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
26+
* );
27+
* ```
2028
*/
2129
retrieve(
2230
inferencePipelineId: string,
@@ -40,6 +48,14 @@ export class InferencePipelines extends APIResource {
4048

4149
/**
4250
* Update inference pipeline.
51+
*
52+
* @example
53+
* ```ts
54+
* const inferencePipeline =
55+
* await client.inferencePipelines.update(
56+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
57+
* );
58+
* ```
4359
*/
4460
update(
4561
inferencePipelineId: string,
@@ -63,6 +79,13 @@ export class InferencePipelines extends APIResource {
6379

6480
/**
6581
* Delete inference pipeline.
82+
*
83+
* @example
84+
* ```ts
85+
* await client.inferencePipelines.delete(
86+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
87+
* );
88+
* ```
6689
*/
6790
delete(inferencePipelineId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
6891
return this._client.delete(`/inference-pipelines/${inferencePipelineId}`, {

src/resources/inference-pipelines/rows.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ import * as Core from '../../core';
66
export class Rows extends APIResource {
77
/**
88
* Update an inference data point in an inference pipeline.
9+
*
10+
* @example
11+
* ```ts
12+
* const row = await client.inferencePipelines.rows.update(
13+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
14+
* { inferenceId: 'inferenceId', row: {} },
15+
* );
16+
* ```
917
*/
1018
update(
1119
inferencePipelineId: string,

src/resources/inference-pipelines/test-results.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ import * as Core from '../../core';
77
export class TestResults extends APIResource {
88
/**
99
* List the latest test results for an inference pipeline.
10+
*
11+
* @example
12+
* ```ts
13+
* const testResults =
14+
* await client.inferencePipelines.testResults.list(
15+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
16+
* );
17+
* ```
1018
*/
1119
list(
1220
inferencePipelineId: string,

src/resources/projects/commits.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ import * as Core from '../../core';
77
export class Commits extends APIResource {
88
/**
99
* Create a new commit (project version) in a project.
10+
*
11+
* @example
12+
* ```ts
13+
* const commit = await client.projects.commits.create(
14+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
15+
* {
16+
* commit: { message: 'Updated the prompt.' },
17+
* storageUri: 's3://...',
18+
* },
19+
* );
20+
* ```
1021
*/
1122
create(
1223
projectId: string,
@@ -18,6 +29,13 @@ export class Commits extends APIResource {
1829

1930
/**
2031
* List the commits (project versions) in a project.
32+
*
33+
* @example
34+
* ```ts
35+
* const commits = await client.projects.commits.list(
36+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
37+
* );
38+
* ```
2139
*/
2240
list(
2341
projectId: string,

src/resources/projects/inference-pipelines.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ import * as Core from '../../core';
77
export class InferencePipelines extends APIResource {
88
/**
99
* Create an inference pipeline in a project.
10+
*
11+
* @example
12+
* ```ts
13+
* const inferencePipeline =
14+
* await client.projects.inferencePipelines.create(
15+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
16+
* {
17+
* description: 'This pipeline is used for production.',
18+
* name: 'production',
19+
* },
20+
* );
21+
* ```
1022
*/
1123
create(
1224
projectId: string,
@@ -18,6 +30,14 @@ export class InferencePipelines extends APIResource {
1830

1931
/**
2032
* List the inference pipelines in a project.
33+
*
34+
* @example
35+
* ```ts
36+
* const inferencePipelines =
37+
* await client.projects.inferencePipelines.list(
38+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
39+
* );
40+
* ```
2141
*/
2242
list(
2343
projectId: string,

src/resources/projects/projects.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,26 @@ export class Projects extends APIResource {
3939

4040
/**
4141
* Create a project in your workspace.
42+
*
43+
* @example
44+
* ```ts
45+
* const project = await client.projects.create({
46+
* name: 'My Project',
47+
* taskType: 'llm-base',
48+
* });
49+
* ```
4250
*/
4351
create(body: ProjectCreateParams, options?: Core.RequestOptions): Core.APIPromise<ProjectCreateResponse> {
4452
return this._client.post('/projects', { body, ...options });
4553
}
4654

4755
/**
4856
* List your workspace's projects.
57+
*
58+
* @example
59+
* ```ts
60+
* const projects = await client.projects.list();
61+
* ```
4962
*/
5063
list(query?: ProjectListParams, options?: Core.RequestOptions): Core.APIPromise<ProjectListResponse>;
5164
list(options?: Core.RequestOptions): Core.APIPromise<ProjectListResponse>;

src/resources/projects/tests.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ import * as Core from '../../core';
77
export class Tests extends APIResource {
88
/**
99
* Create a test.
10+
*
11+
* @example
12+
* ```ts
13+
* const test = await client.projects.tests.create(
14+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
15+
* {
16+
* description:
17+
* 'This test checks for duplicate rows in the dataset.',
18+
* name: 'No duplicate rows',
19+
* subtype: 'duplicateRowCount',
20+
* thresholds: [{}],
21+
* type: 'integrity',
22+
* },
23+
* );
24+
* ```
1025
*/
1126
create(
1227
projectId: string,
@@ -18,6 +33,18 @@ export class Tests extends APIResource {
1833

1934
/**
2035
* Update tests.
36+
*
37+
* @example
38+
* ```ts
39+
* const test = await client.projects.tests.update(
40+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
41+
* {
42+
* payloads: [
43+
* { id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
44+
* ],
45+
* },
46+
* );
47+
* ```
2148
*/
2249
update(
2350
projectId: string,
@@ -29,6 +56,13 @@ export class Tests extends APIResource {
2956

3057
/**
3158
* List tests under a project.
59+
*
60+
* @example
61+
* ```ts
62+
* const tests = await client.projects.tests.list(
63+
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
64+
* );
65+
* ```
3266
*/
3367
list(
3468
projectId: string,

0 commit comments

Comments
 (0)