@scaleway/sdk-inference 2.2.1 → 2.3.0

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,257 +1,173 @@
1
+ import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
1
2
  import randomName from "@scaleway/random-name";
2
- import { resolveOneOf, isJSONObject, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
3
- const unmarshalEndpointPrivateNetworkDetails = (data) => {
4
- if (!isJSONObject(data)) {
5
- throw new TypeError(
6
- `Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`
7
- );
8
- }
9
- return {
10
- privateNetworkId: data.private_network_id
11
- };
3
+ var unmarshalEndpointPrivateNetworkDetails = (data) => {
4
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary.`);
5
+ return { privateNetworkId: data.private_network_id };
12
6
  };
13
- const unmarshalEndpointPublicNetworkDetails = (data) => {
14
- if (!isJSONObject(data)) {
15
- throw new TypeError(
16
- `Unmarshalling the type 'EndpointPublicNetworkDetails' failed as data isn't a dictionary.`
17
- );
18
- }
19
- return {};
7
+ var unmarshalEndpointPublicNetworkDetails = (data) => {
8
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'EndpointPublicNetworkDetails' failed as data isn't a dictionary.`);
9
+ return {};
20
10
  };
21
11
  const unmarshalEndpoint = (data) => {
22
- if (!isJSONObject(data)) {
23
- throw new TypeError(
24
- `Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`
25
- );
26
- }
27
- return {
28
- disableAuth: data.disable_auth,
29
- id: data.id,
30
- privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
31
- publicNetwork: data.public_network ? unmarshalEndpointPublicNetworkDetails(data.public_network) : void 0,
32
- url: data.url
33
- };
12
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Endpoint' failed as data isn't a dictionary.`);
13
+ return {
14
+ disableAuth: data.disable_auth,
15
+ id: data.id,
16
+ privateNetwork: data.private_network ? unmarshalEndpointPrivateNetworkDetails(data.private_network) : void 0,
17
+ publicNetwork: data.public_network ? unmarshalEndpointPublicNetworkDetails(data.public_network) : void 0,
18
+ url: data.url
19
+ };
34
20
  };
35
- const unmarshalDeploymentQuantization = (data) => {
36
- if (!isJSONObject(data)) {
37
- throw new TypeError(
38
- `Unmarshalling the type 'DeploymentQuantization' failed as data isn't a dictionary.`
39
- );
40
- }
41
- return {
42
- bits: data.bits
43
- };
21
+ var unmarshalDeploymentQuantization = (data) => {
22
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DeploymentQuantization' failed as data isn't a dictionary.`);
23
+ return { bits: data.bits };
44
24
  };
45
25
  const unmarshalDeployment = (data) => {
46
- if (!isJSONObject(data)) {
47
- throw new TypeError(
48
- `Unmarshalling the type 'Deployment' failed as data isn't a dictionary.`
49
- );
50
- }
51
- return {
52
- createdAt: unmarshalDate(data.created_at),
53
- endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
54
- errorMessage: data.error_message,
55
- id: data.id,
56
- maxSize: data.max_size,
57
- minSize: data.min_size,
58
- modelId: data.model_id,
59
- modelName: data.model_name,
60
- name: data.name,
61
- nodeTypeName: data.node_type_name,
62
- projectId: data.project_id,
63
- quantization: data.quantization ? unmarshalDeploymentQuantization(data.quantization) : void 0,
64
- region: data.region,
65
- size: data.size,
66
- status: data.status,
67
- tags: data.tags,
68
- updatedAt: unmarshalDate(data.updated_at)
69
- };
26
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Deployment' failed as data isn't a dictionary.`);
27
+ return {
28
+ createdAt: unmarshalDate(data.created_at),
29
+ endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
30
+ errorMessage: data.error_message,
31
+ id: data.id,
32
+ maxSize: data.max_size,
33
+ minSize: data.min_size,
34
+ modelId: data.model_id,
35
+ modelName: data.model_name,
36
+ name: data.name,
37
+ nodeTypeName: data.node_type_name,
38
+ projectId: data.project_id,
39
+ quantization: data.quantization ? unmarshalDeploymentQuantization(data.quantization) : void 0,
40
+ region: data.region,
41
+ size: data.size,
42
+ status: data.status,
43
+ tags: data.tags,
44
+ updatedAt: unmarshalDate(data.updated_at)
45
+ };
70
46
  };
71
- const unmarshalModelSupportedQuantization = (data) => {
72
- if (!isJSONObject(data)) {
73
- throw new TypeError(
74
- `Unmarshalling the type 'ModelSupportedQuantization' failed as data isn't a dictionary.`
75
- );
76
- }
77
- return {
78
- allowed: data.allowed,
79
- maxContextSize: data.max_context_size,
80
- quantizationBits: data.quantization_bits
81
- };
47
+ var unmarshalModelSupportedQuantization = (data) => {
48
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ModelSupportedQuantization' failed as data isn't a dictionary.`);
49
+ return {
50
+ allowed: data.allowed,
51
+ maxContextSize: data.max_context_size,
52
+ quantizationBits: data.quantization_bits
53
+ };
82
54
  };
83
- const unmarshalModelSupportedNode = (data) => {
84
- if (!isJSONObject(data)) {
85
- throw new TypeError(
86
- `Unmarshalling the type 'ModelSupportedNode' failed as data isn't a dictionary.`
87
- );
88
- }
89
- return {
90
- nodeTypeName: data.node_type_name,
91
- quantizations: unmarshalArrayOfObject(
92
- data.quantizations,
93
- unmarshalModelSupportedQuantization
94
- )
95
- };
55
+ var unmarshalModelSupportedNode = (data) => {
56
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ModelSupportedNode' failed as data isn't a dictionary.`);
57
+ return {
58
+ nodeTypeName: data.node_type_name,
59
+ quantizations: unmarshalArrayOfObject(data.quantizations, unmarshalModelSupportedQuantization)
60
+ };
96
61
  };
97
- const unmarshalModelSupportInfo = (data) => {
98
- if (!isJSONObject(data)) {
99
- throw new TypeError(
100
- `Unmarshalling the type 'ModelSupportInfo' failed as data isn't a dictionary.`
101
- );
102
- }
103
- return {
104
- nodes: unmarshalArrayOfObject(data.nodes, unmarshalModelSupportedNode)
105
- };
62
+ var unmarshalModelSupportInfo = (data) => {
63
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ModelSupportInfo' failed as data isn't a dictionary.`);
64
+ return { nodes: unmarshalArrayOfObject(data.nodes, unmarshalModelSupportedNode) };
106
65
  };
107
66
  const unmarshalModel = (data) => {
108
- if (!isJSONObject(data)) {
109
- throw new TypeError(
110
- `Unmarshalling the type 'Model' failed as data isn't a dictionary.`
111
- );
112
- }
113
- return {
114
- createdAt: unmarshalDate(data.created_at),
115
- description: data.description,
116
- errorMessage: data.error_message,
117
- hasEula: data.has_eula,
118
- id: data.id,
119
- name: data.name,
120
- nodesSupport: unmarshalArrayOfObject(
121
- data.nodes_support,
122
- unmarshalModelSupportInfo
123
- ),
124
- parameterSizeBits: data.parameter_size_bits,
125
- projectId: data.project_id,
126
- region: data.region,
127
- sizeBytes: data.size_bytes,
128
- status: data.status,
129
- tags: data.tags,
130
- updatedAt: unmarshalDate(data.updated_at)
131
- };
67
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Model' failed as data isn't a dictionary.`);
68
+ return {
69
+ createdAt: unmarshalDate(data.created_at),
70
+ description: data.description,
71
+ errorMessage: data.error_message,
72
+ hasEula: data.has_eula,
73
+ id: data.id,
74
+ name: data.name,
75
+ nodesSupport: unmarshalArrayOfObject(data.nodes_support, unmarshalModelSupportInfo),
76
+ parameterSizeBits: data.parameter_size_bits,
77
+ projectId: data.project_id,
78
+ region: data.region,
79
+ sizeBytes: data.size_bytes,
80
+ status: data.status,
81
+ tags: data.tags,
82
+ updatedAt: unmarshalDate(data.updated_at)
83
+ };
132
84
  };
133
85
  const unmarshalListDeploymentsResponse = (data) => {
134
- if (!isJSONObject(data)) {
135
- throw new TypeError(
136
- `Unmarshalling the type 'ListDeploymentsResponse' failed as data isn't a dictionary.`
137
- );
138
- }
139
- return {
140
- deployments: unmarshalArrayOfObject(data.deployments, unmarshalDeployment),
141
- totalCount: data.total_count
142
- };
86
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDeploymentsResponse' failed as data isn't a dictionary.`);
87
+ return {
88
+ deployments: unmarshalArrayOfObject(data.deployments, unmarshalDeployment),
89
+ totalCount: data.total_count
90
+ };
143
91
  };
144
92
  const unmarshalListModelsResponse = (data) => {
145
- if (!isJSONObject(data)) {
146
- throw new TypeError(
147
- `Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary.`
148
- );
149
- }
150
- return {
151
- models: unmarshalArrayOfObject(data.models, unmarshalModel),
152
- totalCount: data.total_count
153
- };
93
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary.`);
94
+ return {
95
+ models: unmarshalArrayOfObject(data.models, unmarshalModel),
96
+ totalCount: data.total_count
97
+ };
154
98
  };
155
- const unmarshalNodeType = (data) => {
156
- if (!isJSONObject(data)) {
157
- throw new TypeError(
158
- `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`
159
- );
160
- }
161
- return {
162
- beta: data.beta,
163
- createdAt: unmarshalDate(data.created_at),
164
- description: data.description,
165
- disabled: data.disabled,
166
- gpus: data.gpus,
167
- memory: data.memory,
168
- name: data.name,
169
- region: data.region,
170
- stockStatus: data.stock_status,
171
- updatedAt: unmarshalDate(data.updated_at),
172
- vcpus: data.vcpus,
173
- vram: data.vram
174
- };
99
+ var unmarshalNodeType = (data) => {
100
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`);
101
+ return {
102
+ beta: data.beta,
103
+ createdAt: unmarshalDate(data.created_at),
104
+ description: data.description,
105
+ disabled: data.disabled,
106
+ gpus: data.gpus,
107
+ memory: data.memory,
108
+ name: data.name,
109
+ region: data.region,
110
+ stockStatus: data.stock_status,
111
+ updatedAt: unmarshalDate(data.updated_at),
112
+ vcpus: data.vcpus,
113
+ vram: data.vram
114
+ };
175
115
  };
176
116
  const unmarshalListNodeTypesResponse = (data) => {
177
- if (!isJSONObject(data)) {
178
- throw new TypeError(
179
- `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`
180
- );
181
- }
182
- return {
183
- nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
184
- totalCount: data.total_count
185
- };
117
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`);
118
+ return {
119
+ nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
120
+ totalCount: data.total_count
121
+ };
186
122
  };
187
- const marshalEndpointPrivateNetworkDetails = (request, defaults) => ({
188
- private_network_id: request.privateNetworkId
189
- });
190
- const marshalEndpointPublicNetworkDetails = (request, defaults) => ({});
191
- const marshalDeploymentQuantization = (request, defaults) => ({
192
- bits: request.bits
193
- });
194
- const marshalEndpointSpec = (request, defaults) => ({
195
- disable_auth: request.disableAuth,
196
- ...resolveOneOf([
197
- {
198
- param: "public_network",
199
- value: request.publicNetwork !== void 0 ? marshalEndpointPublicNetworkDetails(request.publicNetwork) : void 0
200
- },
201
- {
202
- param: "private_network",
203
- value: request.privateNetwork !== void 0 ? marshalEndpointPrivateNetworkDetails(
204
- request.privateNetwork
205
- ) : void 0
206
- }
207
- ])
123
+ var marshalEndpointPrivateNetworkDetails = (request, defaults) => ({ private_network_id: request.privateNetworkId });
124
+ var marshalEndpointPublicNetworkDetails = (request, defaults) => ({});
125
+ var marshalDeploymentQuantization = (request, defaults) => ({ bits: request.bits });
126
+ var marshalEndpointSpec = (request, defaults) => ({
127
+ disable_auth: request.disableAuth,
128
+ ...resolveOneOf([{
129
+ param: "public_network",
130
+ value: request.publicNetwork !== void 0 ? marshalEndpointPublicNetworkDetails(request.publicNetwork, defaults) : void 0
131
+ }, {
132
+ param: "private_network",
133
+ value: request.privateNetwork !== void 0 ? marshalEndpointPrivateNetworkDetails(request.privateNetwork, defaults) : void 0
134
+ }])
208
135
  });
209
136
  const marshalCreateDeploymentRequest = (request, defaults) => ({
210
- accept_eula: request.acceptEula,
211
- endpoints: request.endpoints.map((elt) => marshalEndpointSpec(elt)),
212
- max_size: request.maxSize,
213
- min_size: request.minSize,
214
- model_id: request.modelId,
215
- name: request.name || randomName("inference"),
216
- node_type_name: request.nodeTypeName,
217
- project_id: request.projectId ?? defaults.defaultProjectId,
218
- quantization: request.quantization !== void 0 ? marshalDeploymentQuantization(request.quantization) : void 0,
219
- tags: request.tags
137
+ accept_eula: request.acceptEula,
138
+ endpoints: request.endpoints.map((elt) => marshalEndpointSpec(elt, defaults)),
139
+ max_size: request.maxSize,
140
+ min_size: request.minSize,
141
+ model_id: request.modelId,
142
+ name: request.name || randomName("inference"),
143
+ node_type_name: request.nodeTypeName,
144
+ project_id: request.projectId ?? defaults.defaultProjectId,
145
+ quantization: request.quantization !== void 0 ? marshalDeploymentQuantization(request.quantization, defaults) : void 0,
146
+ tags: request.tags
220
147
  });
221
148
  const marshalCreateEndpointRequest = (request, defaults) => ({
222
- deployment_id: request.deploymentId,
223
- endpoint: marshalEndpointSpec(request.endpoint)
149
+ deployment_id: request.deploymentId,
150
+ endpoint: marshalEndpointSpec(request.endpoint, defaults)
224
151
  });
225
- const marshalModelSource = (request, defaults) => ({
226
- url: request.url,
227
- ...resolveOneOf([{ param: "secret", value: request.secret }])
152
+ var marshalModelSource = (request, defaults) => ({
153
+ url: request.url,
154
+ ...resolveOneOf([{
155
+ param: "secret",
156
+ value: request.secret
157
+ }])
228
158
  });
229
159
  const marshalCreateModelRequest = (request, defaults) => ({
230
- name: request.name || randomName("model"),
231
- project_id: request.projectId ?? defaults.defaultProjectId,
232
- source: marshalModelSource(request.source)
160
+ name: request.name || randomName("model"),
161
+ project_id: request.projectId ?? defaults.defaultProjectId,
162
+ source: marshalModelSource(request.source, defaults)
233
163
  });
234
164
  const marshalUpdateDeploymentRequest = (request, defaults) => ({
235
- max_size: request.maxSize,
236
- min_size: request.minSize,
237
- model_id: request.modelId,
238
- name: request.name,
239
- quantization: request.quantization !== void 0 ? marshalDeploymentQuantization(request.quantization) : void 0,
240
- tags: request.tags
165
+ max_size: request.maxSize,
166
+ min_size: request.minSize,
167
+ model_id: request.modelId,
168
+ name: request.name,
169
+ quantization: request.quantization !== void 0 ? marshalDeploymentQuantization(request.quantization, defaults) : void 0,
170
+ tags: request.tags
241
171
  });
242
- const marshalUpdateEndpointRequest = (request, defaults) => ({
243
- disable_auth: request.disableAuth
244
- });
245
- export {
246
- marshalCreateDeploymentRequest,
247
- marshalCreateEndpointRequest,
248
- marshalCreateModelRequest,
249
- marshalUpdateDeploymentRequest,
250
- marshalUpdateEndpointRequest,
251
- unmarshalDeployment,
252
- unmarshalEndpoint,
253
- unmarshalListDeploymentsResponse,
254
- unmarshalListModelsResponse,
255
- unmarshalListNodeTypesResponse,
256
- unmarshalModel
257
- };
172
+ const marshalUpdateEndpointRequest = (request, defaults) => ({ disable_auth: request.disableAuth });
173
+ export { marshalCreateDeploymentRequest, marshalCreateEndpointRequest, marshalCreateModelRequest, marshalUpdateDeploymentRequest, marshalUpdateEndpointRequest, unmarshalDeployment, unmarshalEndpoint, unmarshalListDeploymentsResponse, unmarshalListModelsResponse, unmarshalListNodeTypesResponse, unmarshalModel };
@@ -1,66 +1,58 @@
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
+ var validation_rules_gen_exports = /* @__PURE__ */ __exportAll({
3
+ CreateDeploymentRequest: () => CreateDeploymentRequest,
4
+ CreateModelRequest: () => CreateModelRequest,
5
+ DeploymentQuantization: () => DeploymentQuantization,
6
+ ListDeploymentsRequest: () => ListDeploymentsRequest,
7
+ ListModelsRequest: () => ListModelsRequest,
8
+ UpdateDeploymentRequest: () => UpdateDeploymentRequest
9
+ });
1
10
  const CreateDeploymentRequest = {
2
- maxSize: {
3
- greaterThanOrEqual: 1,
4
- lessThanOrEqual: 50
5
- },
6
- minSize: {
7
- greaterThanOrEqual: 1,
8
- lessThanOrEqual: 50
9
- },
10
- name: {
11
- maxLength: 255,
12
- minLength: 1,
13
- pattern: /^[A-Za-z0-9-_]+$/
14
- },
15
- nodeTypeName: {
16
- maxLength: 64,
17
- minLength: 1
18
- }
19
- };
20
- const CreateModelRequest = {
21
- name: {
22
- maxLength: 255,
23
- minLength: 1,
24
- pattern: /^[A-Za-z0-9-_/.:]+$/
25
- }
26
- };
27
- const DeploymentQuantization = {
28
- bits: {
29
- lessThanOrEqual: 32
30
- }
31
- };
32
- const ListDeploymentsRequest = {
33
- name: {
34
- maxLength: 255,
35
- minLength: 1
36
- }
37
- };
38
- const ListModelsRequest = {
39
- name: {
40
- maxLength: 255,
41
- minLength: 1
42
- }
11
+ maxSize: {
12
+ greaterThanOrEqual: 1,
13
+ lessThanOrEqual: 50
14
+ },
15
+ minSize: {
16
+ greaterThanOrEqual: 1,
17
+ lessThanOrEqual: 50
18
+ },
19
+ name: {
20
+ maxLength: 255,
21
+ minLength: 1,
22
+ pattern: /^[A-Za-z0-9-_]+$/
23
+ },
24
+ nodeTypeName: {
25
+ maxLength: 64,
26
+ minLength: 1
27
+ }
43
28
  };
29
+ const CreateModelRequest = { name: {
30
+ maxLength: 255,
31
+ minLength: 1,
32
+ pattern: /^[A-Za-z0-9-_/.:]+$/
33
+ } };
34
+ const DeploymentQuantization = { bits: { lessThanOrEqual: 32 } };
35
+ const ListDeploymentsRequest = { name: {
36
+ maxLength: 255,
37
+ minLength: 1
38
+ } };
39
+ const ListModelsRequest = { name: {
40
+ maxLength: 255,
41
+ minLength: 1
42
+ } };
44
43
  const UpdateDeploymentRequest = {
45
- maxSize: {
46
- greaterThanOrEqual: 1,
47
- lessThanOrEqual: 50
48
- },
49
- minSize: {
50
- greaterThanOrEqual: 1,
51
- lessThanOrEqual: 50
52
- },
53
- name: {
54
- maxLength: 255,
55
- minLength: 1,
56
- pattern: /^[A-Za-z0-9-_]+$/
57
- }
58
- };
59
- export {
60
- CreateDeploymentRequest,
61
- CreateModelRequest,
62
- DeploymentQuantization,
63
- ListDeploymentsRequest,
64
- ListModelsRequest,
65
- UpdateDeploymentRequest
44
+ maxSize: {
45
+ greaterThanOrEqual: 1,
46
+ lessThanOrEqual: 50
47
+ },
48
+ minSize: {
49
+ greaterThanOrEqual: 1,
50
+ lessThanOrEqual: 50
51
+ },
52
+ name: {
53
+ maxLength: 255,
54
+ minLength: 1,
55
+ pattern: /^[A-Za-z0-9-_]+$/
56
+ }
66
57
  };
58
+ export { validation_rules_gen_exports };