@scaleway/sdk-inference 1.3.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # @scaleway/sdk-inference
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@scaleway/sdk-inference.svg)](https://www.npmjs.com/package/@scaleway/sdk-inference)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@scaleway/sdk-inference.svg)](https://www.npmjs.com/package/@scaleway/sdk-inference)
5
+ [![license](https://img.shields.io/npm/l/@scaleway/sdk-inference.svg)](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE)
6
+
7
+ Scaleway SDK for Inference API.
8
+
9
+ > **Note**
10
+ > This is an automatically generated package that is part of the [Scaleway SDK for JavaScript](https://github.com/scaleway/scaleway-sdk-js).
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @scaleway/sdk-inference @scaleway/sdk-client
16
+ ```
17
+
18
+ or with pnpm:
19
+
20
+ ```bash
21
+ pnpm add @scaleway/sdk-inference @scaleway/sdk-client
22
+ ```
23
+
24
+ or with yarn:
25
+
26
+ ```bash
27
+ yarn add @scaleway/sdk-inference @scaleway/sdk-client
28
+ ```
29
+
30
+ ## Getting Started
31
+
32
+ You'll need a pair of access and secret keys to connect to Scaleway API. Please check the [documentation](https://www.scaleway.com/en/docs/identity-and-access-management/iam/how-to/create-api-keys/) on how to retrieve them.
33
+
34
+ ### Basic Usage
35
+
36
+ ```typescript
37
+ import { createClient } from '@scaleway/sdk-client'
38
+ import { Inference } from '@scaleway/sdk-inference'
39
+
40
+ const client = createClient({
41
+ accessKey: 'SCWXXXXXXXXXXXXXXXXX',
42
+ secretKey: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
43
+ defaultProjectId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
44
+ defaultRegion: 'fr-par',
45
+ defaultZone: 'fr-par-1',
46
+ })
47
+
48
+ const api = new Inference.v1.API(client)
49
+
50
+ // Use the API
51
+ // Example: await api.listServers()
52
+ ```
53
+
54
+ ### Using Configuration Loader
55
+
56
+ For a simpler setup, you can load credentials from the configuration file or environment variables:
57
+
58
+ ```typescript
59
+ import { createClient } from '@scaleway/sdk-client'
60
+ import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader'
61
+ import { Inference } from '@scaleway/sdk-inference'
62
+
63
+ const profile = loadProfileFromConfigurationFile()
64
+ const client = createClient(profile)
65
+ const api = new Inference.v1.API(client)
66
+ ```
67
+
68
+ ## Documentation
69
+
70
+ - 📚 [Scaleway SDK Reference Documentation](https://scaleway.github.io/scaleway-sdk-js)
71
+ - 🌐 [Scaleway Inference API Documentation](https://www.scaleway.com/en/developers/api/inference/)
72
+ - 📖 [Main Repository](https://github.com/scaleway/scaleway-sdk-js)
73
+ - 💡 [Example Projects](https://github.com/scaleway/scaleway-sdk-js/tree/master/examples)
74
+
75
+ ## Features
76
+
77
+ - ✅ Full TypeScript support with complete type definitions
78
+ - ✅ Promise-based API
79
+ - ✅ Automatic pagination helpers
80
+ - ✅ Built-in error handling
81
+ - ✅ Compatible with Node.js ≥ 20
82
+
83
+ ## Support
84
+
85
+ We love feedback! Feel free to reach us on:
86
+ - [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
87
+ - [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
88
+
89
+ ## Contributing
90
+
91
+ This repository is at its early stage and is still in active development. If you are looking for a way to contribute, please read [CONTRIBUTING.md](https://github.com/scaleway/scaleway-sdk-js/blob/master/CONTRIBUTING.md).
92
+
93
+ ## License
94
+
95
+ This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
96
+
@@ -1,5 +1,5 @@
1
- import { API as ParentAPI } from '@scaleway/sdk-client';
2
1
  import type { ApiLocality, WaitForOptions } from '@scaleway/sdk-client';
2
+ import { API as ParentAPI } from '@scaleway/sdk-client';
3
3
  import type { CreateDeploymentRequest, CreateEndpointRequest, CreateModelRequest, DeleteDeploymentRequest, DeleteEndpointRequest, DeleteModelRequest, Deployment, Endpoint, GetDeploymentCertificateRequest, GetDeploymentRequest, GetModelRequest, ListDeploymentsRequest, ListDeploymentsResponse, ListModelsRequest, ListModelsResponse, ListNodeTypesRequest, ListNodeTypesResponse, Model, UpdateDeploymentRequest, UpdateEndpointRequest } from './types.gen.js';
4
4
  /**
5
5
  * Managed Inference API.
@@ -10,7 +10,9 @@ class API extends API$1 {
10
10
  * type ∈ {'zone','region','global','unspecified'}
11
11
  */
12
12
  static LOCALITY = toApiLocality({
13
- regions: ["fr-par"]
13
+ regions: [
14
+ "fr-par"
15
+ ]
14
16
  });
15
17
  pageOfListDeployments = (request = {}) => this.client.fetch(
16
18
  {
@@ -21,10 +23,7 @@ class API extends API$1 {
21
23
  ["order_by", request.orderBy],
22
24
  ["organization_id", request.organizationId],
23
25
  ["page", request.page],
24
- [
25
- "page_size",
26
- request.pageSize ?? this.client.settings.defaultPageSize
27
- ],
26
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
28
27
  ["project_id", request.projectId],
29
28
  ["tags", request.tags]
30
29
  )
@@ -59,9 +58,7 @@ class API extends API$1 {
59
58
  * @returns A Promise of Deployment
60
59
  */
61
60
  waitForDeployment = (request, options) => waitForResource(
62
- options?.stop ?? ((res) => Promise.resolve(
63
- !DEPLOYMENT_TRANSIENT_STATUSES.includes(res.status)
64
- )),
61
+ options?.stop ?? ((res) => Promise.resolve(!DEPLOYMENT_TRANSIENT_STATUSES.includes(res.status))),
65
62
  this.getDeployment,
66
63
  request,
67
64
  options
@@ -120,12 +117,16 @@ class API extends API$1 {
120
117
  * @param request - The request {@link GetDeploymentCertificateRequest}
121
118
  * @returns A Promise of Blob
122
119
  */
123
- getDeploymentCertificate = (request) => this.client.fetch({
124
- method: "GET",
125
- path: `/inference/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}/certificate`,
126
- urlParams: urlParams(["dl", 1]),
127
- responseType: "blob"
128
- });
120
+ getDeploymentCertificate = (request) => this.client.fetch(
121
+ {
122
+ method: "GET",
123
+ path: `/inference/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${validatePathParam("deploymentId", request.deploymentId)}/certificate`,
124
+ urlParams: urlParams(
125
+ ["dl", 1]
126
+ ),
127
+ responseType: "blob"
128
+ }
129
+ );
129
130
  /**
130
131
  * Create an endpoint. Create a new Endpoint related to a specific deployment.
131
132
  *
@@ -165,10 +166,12 @@ class API extends API$1 {
165
166
  *
166
167
  * @param request - The request {@link DeleteEndpointRequest}
167
168
  */
168
- deleteEndpoint = (request) => this.client.fetch({
169
- method: "DELETE",
170
- path: `/inference/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam("endpointId", request.endpointId)}`
171
- });
169
+ deleteEndpoint = (request) => this.client.fetch(
170
+ {
171
+ method: "DELETE",
172
+ path: `/inference/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints/${validatePathParam("endpointId", request.endpointId)}`
173
+ }
174
+ );
172
175
  pageOfListModels = (request = {}) => this.client.fetch(
173
176
  {
174
177
  method: "GET",
@@ -177,10 +180,7 @@ class API extends API$1 {
177
180
  ["name", request.name],
178
181
  ["order_by", request.orderBy],
179
182
  ["page", request.page],
180
- [
181
- "page_size",
182
- request.pageSize ?? this.client.settings.defaultPageSize
183
- ],
183
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
184
184
  ["project_id", request.projectId],
185
185
  ["tags", request.tags]
186
186
  )
@@ -215,9 +215,7 @@ class API extends API$1 {
215
215
  * @returns A Promise of Model
216
216
  */
217
217
  waitForModel = (request, options) => waitForResource(
218
- options?.stop ?? ((res) => Promise.resolve(
219
- !MODEL_TRANSIENT_STATUSES.includes(res.status)
220
- )),
218
+ options?.stop ?? ((res) => Promise.resolve(!MODEL_TRANSIENT_STATUSES.includes(res.status))),
221
219
  this.getModel,
222
220
  request,
223
221
  options
@@ -244,10 +242,12 @@ class API extends API$1 {
244
242
  *
245
243
  * @param request - The request {@link DeleteModelRequest}
246
244
  */
247
- deleteModel = (request) => this.client.fetch({
248
- method: "DELETE",
249
- path: `/inference/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/models/${validatePathParam("modelId", request.modelId)}`
250
- });
245
+ deleteModel = (request) => this.client.fetch(
246
+ {
247
+ method: "DELETE",
248
+ path: `/inference/v1/regions/${validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/models/${validatePathParam("modelId", request.modelId)}`
249
+ }
250
+ );
251
251
  pageOfListNodeTypes = (request) => this.client.fetch(
252
252
  {
253
253
  method: "GET",
@@ -255,10 +255,7 @@ class API extends API$1 {
255
255
  urlParams: urlParams(
256
256
  ["include_disabled_types", request.includeDisabledTypes],
257
257
  ["page", request.page],
258
- [
259
- "page_size",
260
- request.pageSize ?? this.client.settings.defaultPageSize
261
- ]
258
+ ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
262
259
  )
263
260
  },
264
261
  unmarshalListNodeTypesResponse
@@ -1,5 +1,5 @@
1
- export { API } from './api.gen.js';
1
+ export { API, } from './api.gen.js';
2
2
  export * from './content.gen.js';
3
3
  export * from './marshalling.gen.js';
4
- export type { CreateDeploymentRequest, CreateEndpointRequest, CreateModelRequest, DeleteDeploymentRequest, DeleteEndpointRequest, DeleteModelRequest, Deployment, DeploymentQuantization, DeploymentStatus, Endpoint, EndpointPrivateNetworkDetails, EndpointPublicNetworkDetails, EndpointSpec, GetDeploymentCertificateRequest, GetDeploymentRequest, GetModelRequest, ListDeploymentsRequest, ListDeploymentsRequestOrderBy, ListDeploymentsResponse, ListModelsRequest, ListModelsRequestOrderBy, ListModelsResponse, ListNodeTypesRequest, ListNodeTypesResponse, Model, ModelSource, ModelStatus, ModelSupportInfo, ModelSupportedNode, ModelSupportedQuantization, NodeType, NodeTypeStock, UpdateDeploymentRequest, UpdateEndpointRequest, } from './types.gen.js';
4
+ export type { CreateDeploymentRequest, CreateEndpointRequest, CreateModelRequest, DeleteDeploymentRequest, DeleteEndpointRequest, DeleteModelRequest, Deployment, DeploymentQuantization, DeploymentStatus, Endpoint, EndpointPrivateNetworkDetails, EndpointPublicNetworkDetails, EndpointSpec, GetDeploymentCertificateRequest, GetDeploymentRequest, GetModelRequest, ListDeploymentsRequest, ListDeploymentsRequestOrderBy, ListDeploymentsResponse, ListModelsRequest, ListModelsRequestOrderBy, ListModelsResponse, ListNodeTypesRequest, ListNodeTypesResponse, Model, ModelSource, ModelStatus, ModelSupportedNode, ModelSupportedQuantization, ModelSupportInfo, NodeType, NodeTypeStock, UpdateDeploymentRequest, UpdateEndpointRequest, } from './types.gen.js';
5
5
  export * as ValidationRules from './validation-rules.gen.js';
@@ -88,10 +88,7 @@ const unmarshalModelSupportedNode = (data) => {
88
88
  }
89
89
  return {
90
90
  nodeTypeName: data.node_type_name,
91
- quantizations: unmarshalArrayOfObject(
92
- data.quantizations,
93
- unmarshalModelSupportedQuantization
94
- )
91
+ quantizations: unmarshalArrayOfObject(data.quantizations, unmarshalModelSupportedQuantization)
95
92
  };
96
93
  };
97
94
  const unmarshalModelSupportInfo = (data) => {
@@ -117,10 +114,7 @@ const unmarshalModel = (data) => {
117
114
  hasEula: data.has_eula,
118
115
  id: data.id,
119
116
  name: data.name,
120
- nodesSupport: unmarshalArrayOfObject(
121
- data.nodes_support,
122
- unmarshalModelSupportInfo
123
- ),
117
+ nodesSupport: unmarshalArrayOfObject(data.nodes_support, unmarshalModelSupportInfo),
124
118
  parameterSizeBits: data.parameter_size_bits,
125
119
  projectId: data.project_id,
126
120
  region: data.region,
@@ -200,9 +194,7 @@ const marshalEndpointSpec = (request, defaults) => ({
200
194
  },
201
195
  {
202
196
  param: "private_network",
203
- value: request.privateNetwork !== void 0 ? marshalEndpointPrivateNetworkDetails(
204
- request.privateNetwork
205
- ) : void 0
197
+ value: request.privateNetwork !== void 0 ? marshalEndpointPrivateNetworkDetails(request.privateNetwork) : void 0
206
198
  }
207
199
  ])
208
200
  });
@@ -224,7 +216,12 @@ const marshalCreateEndpointRequest = (request, defaults) => ({
224
216
  });
225
217
  const marshalModelSource = (request, defaults) => ({
226
218
  url: request.url,
227
- ...resolveOneOf([{ param: "secret", value: request.secret }])
219
+ ...resolveOneOf([
220
+ {
221
+ param: "secret",
222
+ value: request.secret
223
+ }
224
+ ])
228
225
  });
229
226
  const marshalCreateModelRequest = (request, defaults) => ({
230
227
  name: request.name || randomName("model"),
@@ -53,5 +53,6 @@ export declare const UpdateDeploymentRequest: {
53
53
  name: {
54
54
  maxLength: number;
55
55
  minLength: number;
56
+ pattern: RegExp;
56
57
  };
57
58
  };
@@ -52,7 +52,8 @@ const UpdateDeploymentRequest = {
52
52
  },
53
53
  name: {
54
54
  maxLength: 255,
55
- minLength: 1
55
+ minLength: 1,
56
+ pattern: /^[A-Za-z0-9-_]+$/
56
57
  }
57
58
  };
58
59
  export {
package/package.json CHANGED
@@ -1,23 +1,20 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-inference",
3
- "version": "1.3.0",
3
+ "version": "2.1.1",
4
4
  "description": "Scaleway SDK inference",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
7
+ "README.md",
7
8
  "dist"
8
9
  ],
9
10
  "type": "module",
10
11
  "exports": {
11
12
  ".": {
12
13
  "types": "./dist/index.gen.d.ts",
13
- "import": "./dist/index.gen.js",
14
- "require": "./dist/index.gen.cjs",
15
14
  "default": "./dist/index.gen.js"
16
15
  },
17
16
  "./*": {
18
17
  "types": "./dist/*/index.gen.d.ts",
19
- "import": "./dist/*/index.gen.js",
20
- "require": "./dist/*/index.gen.cjs",
21
18
  "default": "./dist/*/index.gen.js"
22
19
  }
23
20
  },
@@ -26,17 +23,17 @@
26
23
  "directory": "packages_generated/inference"
27
24
  },
28
25
  "engines": {
29
- "node": ">=20.19.4"
26
+ "node": ">=20.19.6"
30
27
  },
31
28
  "dependencies": {
32
29
  "@scaleway/random-name": "5.1.2",
33
- "@scaleway/sdk-std": "1.2.0"
30
+ "@scaleway/sdk-std": "2.1.0"
34
31
  },
35
32
  "peerDependencies": {
36
- "@scaleway/sdk-client": "^1.3.3"
33
+ "@scaleway/sdk-client": "^2.1.0"
37
34
  },
38
35
  "devDependencies": {
39
- "@scaleway/sdk-client": "^1.3.3"
36
+ "@scaleway/sdk-client": "^2.1.0"
40
37
  },
41
38
  "scripts": {
42
39
  "package:check": "pnpm publint",
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index_gen = require("./v1/index.gen.cjs");
4
- const index_gen$1 = require("./v1beta1/index.gen.cjs");
5
- exports.Inferencev1 = index_gen;
6
- exports.Inferencev1beta1 = index_gen$1;
@@ -1,276 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const sdkClient = require("@scaleway/sdk-client");
4
- const content_gen = require("./content.gen.cjs");
5
- const marshalling_gen = require("./marshalling.gen.cjs");
6
- const jsonContentHeaders = {
7
- "Content-Type": "application/json; charset=utf-8"
8
- };
9
- class API extends sdkClient.API {
10
- /**
11
- * Locality of this API.
12
- * type ∈ {'zone','region','global','unspecified'}
13
- */
14
- static LOCALITY = sdkClient.toApiLocality({
15
- regions: ["fr-par"]
16
- });
17
- pageOfListDeployments = (request = {}) => this.client.fetch(
18
- {
19
- method: "GET",
20
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments`,
21
- urlParams: sdkClient.urlParams(
22
- ["name", request.name],
23
- ["order_by", request.orderBy],
24
- ["organization_id", request.organizationId],
25
- ["page", request.page],
26
- [
27
- "page_size",
28
- request.pageSize ?? this.client.settings.defaultPageSize
29
- ],
30
- ["project_id", request.projectId],
31
- ["tags", request.tags]
32
- )
33
- },
34
- marshalling_gen.unmarshalListDeploymentsResponse
35
- );
36
- /**
37
- * List inference deployments. List all your inference deployments.
38
- *
39
- * @param request - The request {@link ListDeploymentsRequest}
40
- * @returns A Promise of ListDeploymentsResponse
41
- */
42
- listDeployments = (request = {}) => sdkClient.enrichForPagination("deployments", this.pageOfListDeployments, request);
43
- /**
44
- * Get a deployment. Get the deployment for the given ID.
45
- *
46
- * @param request - The request {@link GetDeploymentRequest}
47
- * @returns A Promise of Deployment
48
- */
49
- getDeployment = (request) => this.client.fetch(
50
- {
51
- method: "GET",
52
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}`
53
- },
54
- marshalling_gen.unmarshalDeployment
55
- );
56
- /**
57
- * Waits for {@link Deployment} to be in a final state.
58
- *
59
- * @param request - The request {@link GetDeploymentRequest}
60
- * @param options - The waiting options
61
- * @returns A Promise of Deployment
62
- */
63
- waitForDeployment = (request, options) => sdkClient.waitForResource(
64
- options?.stop ?? ((res) => Promise.resolve(
65
- !content_gen.DEPLOYMENT_TRANSIENT_STATUSES.includes(res.status)
66
- )),
67
- this.getDeployment,
68
- request,
69
- options
70
- );
71
- /**
72
- * Create a deployment. Create a new inference deployment related to a specific model.
73
- *
74
- * @param request - The request {@link CreateDeploymentRequest}
75
- * @returns A Promise of Deployment
76
- */
77
- createDeployment = (request) => this.client.fetch(
78
- {
79
- body: JSON.stringify(
80
- marshalling_gen.marshalCreateDeploymentRequest(request, this.client.settings)
81
- ),
82
- headers: jsonContentHeaders,
83
- method: "POST",
84
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments`
85
- },
86
- marshalling_gen.unmarshalDeployment
87
- );
88
- /**
89
- * Update a deployment. Update an existing inference deployment.
90
- *
91
- * @param request - The request {@link UpdateDeploymentRequest}
92
- * @returns A Promise of Deployment
93
- */
94
- updateDeployment = (request) => this.client.fetch(
95
- {
96
- body: JSON.stringify(
97
- marshalling_gen.marshalUpdateDeploymentRequest(request, this.client.settings)
98
- ),
99
- headers: jsonContentHeaders,
100
- method: "PATCH",
101
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}`
102
- },
103
- marshalling_gen.unmarshalDeployment
104
- );
105
- /**
106
- * Delete a deployment. Delete an existing inference deployment.
107
- *
108
- * @param request - The request {@link DeleteDeploymentRequest}
109
- * @returns A Promise of Deployment
110
- */
111
- deleteDeployment = (request) => this.client.fetch(
112
- {
113
- method: "DELETE",
114
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}`
115
- },
116
- marshalling_gen.unmarshalDeployment
117
- );
118
- /**
119
- * Get the CA certificate. Get the CA certificate used for the deployment of private endpoints.
120
- The CA certificate will be returned as a PEM file.
121
- *
122
- * @param request - The request {@link GetDeploymentCertificateRequest}
123
- * @returns A Promise of Blob
124
- */
125
- getDeploymentCertificate = (request) => this.client.fetch({
126
- method: "GET",
127
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/deployments/${sdkClient.validatePathParam("deploymentId", request.deploymentId)}/certificate`,
128
- urlParams: sdkClient.urlParams(["dl", 1]),
129
- responseType: "blob"
130
- });
131
- /**
132
- * Create an endpoint. Create a new Endpoint related to a specific deployment.
133
- *
134
- * @param request - The request {@link CreateEndpointRequest}
135
- * @returns A Promise of Endpoint
136
- */
137
- createEndpoint = (request) => this.client.fetch(
138
- {
139
- body: JSON.stringify(
140
- marshalling_gen.marshalCreateEndpointRequest(request, this.client.settings)
141
- ),
142
- headers: jsonContentHeaders,
143
- method: "POST",
144
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints`
145
- },
146
- marshalling_gen.unmarshalEndpoint
147
- );
148
- /**
149
- * Update an endpoint. Update an existing Endpoint.
150
- *
151
- * @param request - The request {@link UpdateEndpointRequest}
152
- * @returns A Promise of Endpoint
153
- */
154
- updateEndpoint = (request) => this.client.fetch(
155
- {
156
- body: JSON.stringify(
157
- marshalling_gen.marshalUpdateEndpointRequest(request, this.client.settings)
158
- ),
159
- headers: jsonContentHeaders,
160
- method: "PATCH",
161
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints/${sdkClient.validatePathParam("endpointId", request.endpointId)}`
162
- },
163
- marshalling_gen.unmarshalEndpoint
164
- );
165
- /**
166
- * Delete an endpoint. Delete an existing Endpoint.
167
- *
168
- * @param request - The request {@link DeleteEndpointRequest}
169
- */
170
- deleteEndpoint = (request) => this.client.fetch({
171
- method: "DELETE",
172
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/endpoints/${sdkClient.validatePathParam("endpointId", request.endpointId)}`
173
- });
174
- pageOfListModels = (request = {}) => this.client.fetch(
175
- {
176
- method: "GET",
177
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/models`,
178
- urlParams: sdkClient.urlParams(
179
- ["name", request.name],
180
- ["order_by", request.orderBy],
181
- ["page", request.page],
182
- [
183
- "page_size",
184
- request.pageSize ?? this.client.settings.defaultPageSize
185
- ],
186
- ["project_id", request.projectId],
187
- ["tags", request.tags]
188
- )
189
- },
190
- marshalling_gen.unmarshalListModelsResponse
191
- );
192
- /**
193
- * List models. List all available models.
194
- *
195
- * @param request - The request {@link ListModelsRequest}
196
- * @returns A Promise of ListModelsResponse
197
- */
198
- listModels = (request = {}) => sdkClient.enrichForPagination("models", this.pageOfListModels, request);
199
- /**
200
- * Get a model. Get the model for the given ID.
201
- *
202
- * @param request - The request {@link GetModelRequest}
203
- * @returns A Promise of Model
204
- */
205
- getModel = (request) => this.client.fetch(
206
- {
207
- method: "GET",
208
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/models/${sdkClient.validatePathParam("modelId", request.modelId)}`
209
- },
210
- marshalling_gen.unmarshalModel
211
- );
212
- /**
213
- * Waits for {@link Model} to be in a final state.
214
- *
215
- * @param request - The request {@link GetModelRequest}
216
- * @param options - The waiting options
217
- * @returns A Promise of Model
218
- */
219
- waitForModel = (request, options) => sdkClient.waitForResource(
220
- options?.stop ?? ((res) => Promise.resolve(
221
- !content_gen.MODEL_TRANSIENT_STATUSES.includes(res.status)
222
- )),
223
- this.getModel,
224
- request,
225
- options
226
- );
227
- /**
228
- * Import a model. Import a new model to your model library.
229
- *
230
- * @param request - The request {@link CreateModelRequest}
231
- * @returns A Promise of Model
232
- */
233
- createModel = (request) => this.client.fetch(
234
- {
235
- body: JSON.stringify(
236
- marshalling_gen.marshalCreateModelRequest(request, this.client.settings)
237
- ),
238
- headers: jsonContentHeaders,
239
- method: "POST",
240
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/models`
241
- },
242
- marshalling_gen.unmarshalModel
243
- );
244
- /**
245
- * Delete a model. Delete an existing model from your model library.
246
- *
247
- * @param request - The request {@link DeleteModelRequest}
248
- */
249
- deleteModel = (request) => this.client.fetch({
250
- method: "DELETE",
251
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/models/${sdkClient.validatePathParam("modelId", request.modelId)}`
252
- });
253
- pageOfListNodeTypes = (request) => this.client.fetch(
254
- {
255
- method: "GET",
256
- path: `/inference/v1/regions/${sdkClient.validatePathParam("region", request.region ?? this.client.settings.defaultRegion)}/node-types`,
257
- urlParams: sdkClient.urlParams(
258
- ["include_disabled_types", request.includeDisabledTypes],
259
- ["page", request.page],
260
- [
261
- "page_size",
262
- request.pageSize ?? this.client.settings.defaultPageSize
263
- ]
264
- )
265
- },
266
- marshalling_gen.unmarshalListNodeTypesResponse
267
- );
268
- /**
269
- * List available node types. List all available node types. By default, the node types returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field.
270
- *
271
- * @param request - The request {@link ListNodeTypesRequest}
272
- * @returns A Promise of ListNodeTypesResponse
273
- */
274
- listNodeTypes = (request) => sdkClient.enrichForPagination("nodeTypes", this.pageOfListNodeTypes, request);
275
- }
276
- exports.API = API;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const DEPLOYMENT_TRANSIENT_STATUSES = [
4
- "creating",
5
- "deploying",
6
- "deleting",
7
- "scaling"
8
- ];
9
- const MODEL_TRANSIENT_STATUSES = [
10
- "preparing",
11
- "downloading"
12
- ];
13
- exports.DEPLOYMENT_TRANSIENT_STATUSES = DEPLOYMENT_TRANSIENT_STATUSES;
14
- exports.MODEL_TRANSIENT_STATUSES = MODEL_TRANSIENT_STATUSES;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const api_gen = require("./api.gen.cjs");
4
- const content_gen = require("./content.gen.cjs");
5
- const marshalling_gen = require("./marshalling.gen.cjs");
6
- const validationRules_gen = require("./validation-rules.gen.cjs");
7
- exports.API = api_gen.API;
8
- exports.DEPLOYMENT_TRANSIENT_STATUSES = content_gen.DEPLOYMENT_TRANSIENT_STATUSES;
9
- exports.MODEL_TRANSIENT_STATUSES = content_gen.MODEL_TRANSIENT_STATUSES;
10
- exports.marshalCreateDeploymentRequest = marshalling_gen.marshalCreateDeploymentRequest;
11
- exports.marshalCreateEndpointRequest = marshalling_gen.marshalCreateEndpointRequest;
12
- exports.marshalCreateModelRequest = marshalling_gen.marshalCreateModelRequest;
13
- exports.marshalUpdateDeploymentRequest = marshalling_gen.marshalUpdateDeploymentRequest;
14
- exports.marshalUpdateEndpointRequest = marshalling_gen.marshalUpdateEndpointRequest;
15
- exports.unmarshalDeployment = marshalling_gen.unmarshalDeployment;
16
- exports.unmarshalEndpoint = marshalling_gen.unmarshalEndpoint;
17
- exports.unmarshalListDeploymentsResponse = marshalling_gen.unmarshalListDeploymentsResponse;
18
- exports.unmarshalListModelsResponse = marshalling_gen.unmarshalListModelsResponse;
19
- exports.unmarshalListNodeTypesResponse = marshalling_gen.unmarshalListNodeTypesResponse;
20
- exports.unmarshalModel = marshalling_gen.unmarshalModel;
21
- exports.ValidationRules = validationRules_gen;