@scaleway/sdk-inference 1.2.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.
@@ -1,271 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const randomName = require("@scaleway/random-name");
4
- const sdkClient = require("@scaleway/sdk-client");
5
- const unmarshalEndpointPrivateNetworkDetails = (data) => {
6
- if (!sdkClient.isJSONObject(data)) {
7
- throw new TypeError(
8
- `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`
9
- );
10
- }
11
- return {
12
- privateNetworkId: data.private_network_id
13
- };
14
- };
15
- const unmarshalEndpointPublicAccessDetails = (data) => {
16
- if (!sdkClient.isJSONObject(data)) {
17
- throw new TypeError(
18
- `Unmarshalling the type 'EndpointPublicAccessDetails' failed as data isn't a dictionary.`
19
- );
20
- }
21
- return {};
22
- };
23
- const unmarshalEndpoint = (data) => {
24
- if (!sdkClient.isJSONObject(data)) {
25
- throw new TypeError(
26
- `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`
27
- );
28
- }
29
- return {
30
- disableAuth: data.disable_auth,
31
- id: data.id,
32
- privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
33
- publicAccess: data.public_access ? unmarshalEndpointPublicAccessDetails(data.public_access) : void 0,
34
- url: data.url
35
- };
36
- };
37
- const unmarshalDeployment = (data) => {
38
- if (!sdkClient.isJSONObject(data)) {
39
- throw new TypeError(
40
- `Unmarshalling the type 'Deployment' failed as data isn't a dictionary.`
41
- );
42
- }
43
- return {
44
- createdAt: sdkClient.unmarshalDate(data.created_at),
45
- endpoints: sdkClient.unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
46
- errorMessage: data.error_message,
47
- id: data.id,
48
- maxSize: data.max_size,
49
- minSize: data.min_size,
50
- modelId: data.model_id,
51
- modelName: data.model_name,
52
- name: data.name,
53
- nodeType: data.node_type,
54
- projectId: data.project_id,
55
- region: data.region,
56
- size: data.size,
57
- status: data.status,
58
- tags: data.tags,
59
- updatedAt: sdkClient.unmarshalDate(data.updated_at)
60
- };
61
- };
62
- const unmarshalModelS3Model = (data) => {
63
- if (!sdkClient.isJSONObject(data)) {
64
- throw new TypeError(
65
- `Unmarshalling the type 'ModelS3Model' failed as data isn't a dictionary.`
66
- );
67
- }
68
- return {
69
- nodeType: data.node_type,
70
- pythonDependencies: data.python_dependencies,
71
- s3Url: data.s3_url,
72
- tritonServerVersion: data.triton_server_version
73
- };
74
- };
75
- const unmarshalModel = (data) => {
76
- if (!sdkClient.isJSONObject(data)) {
77
- throw new TypeError(
78
- `Unmarshalling the type 'Model' failed as data isn't a dictionary.`
79
- );
80
- }
81
- return {
82
- compatibleNodeTypes: data.compatible_node_types,
83
- createdAt: sdkClient.unmarshalDate(data.created_at),
84
- description: data.description,
85
- hasEula: data.has_eula,
86
- id: data.id,
87
- isPublic: data.is_public,
88
- name: data.name,
89
- projectId: data.project_id,
90
- provider: data.provider,
91
- quantizationLevel: data.quantization_level,
92
- region: data.region,
93
- s3Model: data.s3_model ? unmarshalModelS3Model(data.s3_model) : void 0,
94
- tags: data.tags,
95
- updatedAt: sdkClient.unmarshalDate(data.updated_at)
96
- };
97
- };
98
- const unmarshalACLRule = (data) => {
99
- if (!sdkClient.isJSONObject(data)) {
100
- throw new TypeError(
101
- `Unmarshalling the type 'ACLRule' failed as data isn't a dictionary.`
102
- );
103
- }
104
- return {
105
- description: data.description,
106
- id: data.id,
107
- ip: data.ip
108
- };
109
- };
110
- const unmarshalAddDeploymentACLRulesResponse = (data) => {
111
- if (!sdkClient.isJSONObject(data)) {
112
- throw new TypeError(
113
- `Unmarshalling the type 'AddDeploymentACLRulesResponse' failed as data isn't a dictionary.`
114
- );
115
- }
116
- return {
117
- rules: sdkClient.unmarshalArrayOfObject(data.rules, unmarshalACLRule)
118
- };
119
- };
120
- const unmarshalEula = (data) => {
121
- if (!sdkClient.isJSONObject(data)) {
122
- throw new TypeError(
123
- `Unmarshalling the type 'Eula' failed as data isn't a dictionary.`
124
- );
125
- }
126
- return {
127
- content: data.content
128
- };
129
- };
130
- const unmarshalListDeploymentACLRulesResponse = (data) => {
131
- if (!sdkClient.isJSONObject(data)) {
132
- throw new TypeError(
133
- `Unmarshalling the type 'ListDeploymentACLRulesResponse' failed as data isn't a dictionary.`
134
- );
135
- }
136
- return {
137
- rules: sdkClient.unmarshalArrayOfObject(data.rules, unmarshalACLRule),
138
- totalCount: data.total_count
139
- };
140
- };
141
- const unmarshalListDeploymentsResponse = (data) => {
142
- if (!sdkClient.isJSONObject(data)) {
143
- throw new TypeError(
144
- `Unmarshalling the type 'ListDeploymentsResponse' failed as data isn't a dictionary.`
145
- );
146
- }
147
- return {
148
- deployments: sdkClient.unmarshalArrayOfObject(data.deployments, unmarshalDeployment),
149
- totalCount: data.total_count
150
- };
151
- };
152
- const unmarshalListModelsResponse = (data) => {
153
- if (!sdkClient.isJSONObject(data)) {
154
- throw new TypeError(
155
- `Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary.`
156
- );
157
- }
158
- return {
159
- models: sdkClient.unmarshalArrayOfObject(data.models, unmarshalModel),
160
- totalCount: data.total_count
161
- };
162
- };
163
- const unmarshalNodeType = (data) => {
164
- if (!sdkClient.isJSONObject(data)) {
165
- throw new TypeError(
166
- `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`
167
- );
168
- }
169
- return {
170
- beta: data.beta,
171
- createdAt: sdkClient.unmarshalDate(data.created_at),
172
- description: data.description,
173
- disabled: data.disabled,
174
- gpus: data.gpus,
175
- memory: data.memory,
176
- name: data.name,
177
- region: data.region,
178
- stockStatus: data.stock_status,
179
- updatedAt: sdkClient.unmarshalDate(data.updated_at),
180
- vcpus: data.vcpus,
181
- vram: data.vram
182
- };
183
- };
184
- const unmarshalListNodeTypesResponse = (data) => {
185
- if (!sdkClient.isJSONObject(data)) {
186
- throw new TypeError(
187
- `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`
188
- );
189
- }
190
- return {
191
- nodeTypes: sdkClient.unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
192
- totalCount: data.total_count
193
- };
194
- };
195
- const unmarshalSetDeploymentACLRulesResponse = (data) => {
196
- if (!sdkClient.isJSONObject(data)) {
197
- throw new TypeError(
198
- `Unmarshalling the type 'SetDeploymentACLRulesResponse' failed as data isn't a dictionary.`
199
- );
200
- }
201
- return {
202
- rules: sdkClient.unmarshalArrayOfObject(data.rules, unmarshalACLRule)
203
- };
204
- };
205
- const marshalACLRuleRequest = (request, defaults) => ({
206
- description: request.description,
207
- ip: request.ip
208
- });
209
- const marshalAddDeploymentACLRulesRequest = (request, defaults) => ({
210
- acls: request.acls !== void 0 ? request.acls.map((elt) => marshalACLRuleRequest(elt)) : void 0
211
- });
212
- const marshalEndpointSpecPrivateNetwork = (request, defaults) => ({
213
- private_network_id: request.privateNetworkId
214
- });
215
- const marshalEndpointSpecPublic = (request, defaults) => ({});
216
- const marshalEndpointSpec = (request, defaults) => ({
217
- disable_auth: request.disableAuth,
218
- ...sdkClient.resolveOneOf([
219
- {
220
- param: "public",
221
- value: request.public !== void 0 ? marshalEndpointSpecPublic(request.public) : void 0
222
- },
223
- {
224
- param: "private_network",
225
- value: request.privateNetwork !== void 0 ? marshalEndpointSpecPrivateNetwork(request.privateNetwork) : void 0
226
- }
227
- ])
228
- });
229
- const marshalCreateDeploymentRequest = (request, defaults) => ({
230
- accept_eula: request.acceptEula,
231
- endpoints: request.endpoints.map((elt) => marshalEndpointSpec(elt)),
232
- max_size: request.maxSize,
233
- min_size: request.minSize,
234
- model_name: request.modelName,
235
- name: request.name || randomName("inference"),
236
- node_type: request.nodeType,
237
- project_id: request.projectId ?? defaults.defaultProjectId,
238
- tags: request.tags
239
- });
240
- const marshalCreateEndpointRequest = (request, defaults) => ({
241
- deployment_id: request.deploymentId,
242
- endpoint: marshalEndpointSpec(request.endpoint)
243
- });
244
- const marshalSetDeploymentACLRulesRequest = (request, defaults) => ({
245
- acls: request.acls !== void 0 ? request.acls.map((elt) => marshalACLRuleRequest(elt)) : void 0
246
- });
247
- const marshalUpdateDeploymentRequest = (request, defaults) => ({
248
- max_size: request.maxSize,
249
- min_size: request.minSize,
250
- name: request.name,
251
- tags: request.tags
252
- });
253
- const marshalUpdateEndpointRequest = (request, defaults) => ({
254
- disable_auth: request.disableAuth
255
- });
256
- exports.marshalAddDeploymentACLRulesRequest = marshalAddDeploymentACLRulesRequest;
257
- exports.marshalCreateDeploymentRequest = marshalCreateDeploymentRequest;
258
- exports.marshalCreateEndpointRequest = marshalCreateEndpointRequest;
259
- exports.marshalSetDeploymentACLRulesRequest = marshalSetDeploymentACLRulesRequest;
260
- exports.marshalUpdateDeploymentRequest = marshalUpdateDeploymentRequest;
261
- exports.marshalUpdateEndpointRequest = marshalUpdateEndpointRequest;
262
- exports.unmarshalAddDeploymentACLRulesResponse = unmarshalAddDeploymentACLRulesResponse;
263
- exports.unmarshalDeployment = unmarshalDeployment;
264
- exports.unmarshalEndpoint = unmarshalEndpoint;
265
- exports.unmarshalEula = unmarshalEula;
266
- exports.unmarshalListDeploymentACLRulesResponse = unmarshalListDeploymentACLRulesResponse;
267
- exports.unmarshalListDeploymentsResponse = unmarshalListDeploymentsResponse;
268
- exports.unmarshalListModelsResponse = unmarshalListModelsResponse;
269
- exports.unmarshalListNodeTypesResponse = unmarshalListNodeTypesResponse;
270
- exports.unmarshalModel = unmarshalModel;
271
- exports.unmarshalSetDeploymentACLRulesResponse = unmarshalSetDeploymentACLRulesResponse;
@@ -1,56 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const CreateDeploymentRequest = {
4
- maxSize: {
5
- greaterThanOrEqual: 1,
6
- lessThanOrEqual: 50
7
- },
8
- minSize: {
9
- greaterThanOrEqual: 1,
10
- lessThanOrEqual: 50
11
- },
12
- modelName: {
13
- maxLength: 255,
14
- minLength: 0,
15
- pattern: /^[A-Za-z0-9_-]+\/[A-Za-z0-9_.-]+(:\w+)?$/
16
- },
17
- name: {
18
- maxLength: 255,
19
- minLength: 1,
20
- pattern: /^[A-Za-z0-9-_]+$/
21
- },
22
- nodeType: {
23
- maxLength: 64,
24
- minLength: 1
25
- }
26
- };
27
- const ListDeploymentsRequest = {
28
- name: {
29
- maxLength: 255,
30
- minLength: 1
31
- }
32
- };
33
- const ListModelsRequest = {
34
- name: {
35
- maxLength: 255,
36
- minLength: 1
37
- }
38
- };
39
- const UpdateDeploymentRequest = {
40
- maxSize: {
41
- greaterThanOrEqual: 1,
42
- lessThanOrEqual: 50
43
- },
44
- minSize: {
45
- greaterThanOrEqual: 1,
46
- lessThanOrEqual: 50
47
- },
48
- name: {
49
- maxLength: 255,
50
- minLength: 1
51
- }
52
- };
53
- exports.CreateDeploymentRequest = CreateDeploymentRequest;
54
- exports.ListDeploymentsRequest = ListDeploymentsRequest;
55
- exports.ListModelsRequest = ListModelsRequest;
56
- exports.UpdateDeploymentRequest = UpdateDeploymentRequest;