@scaleway/sdk-inference 2.2.2 → 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,254 +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(data.quantizations, unmarshalModelSupportedQuantization)
92
- };
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
+ };
93
61
  };
94
- const unmarshalModelSupportInfo = (data) => {
95
- if (!isJSONObject(data)) {
96
- throw new TypeError(
97
- `Unmarshalling the type 'ModelSupportInfo' failed as data isn't a dictionary.`
98
- );
99
- }
100
- return {
101
- nodes: unmarshalArrayOfObject(data.nodes, unmarshalModelSupportedNode)
102
- };
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) };
103
65
  };
104
66
  const unmarshalModel = (data) => {
105
- if (!isJSONObject(data)) {
106
- throw new TypeError(
107
- `Unmarshalling the type 'Model' failed as data isn't a dictionary.`
108
- );
109
- }
110
- return {
111
- createdAt: unmarshalDate(data.created_at),
112
- description: data.description,
113
- errorMessage: data.error_message,
114
- hasEula: data.has_eula,
115
- id: data.id,
116
- name: data.name,
117
- nodesSupport: unmarshalArrayOfObject(data.nodes_support, unmarshalModelSupportInfo),
118
- parameterSizeBits: data.parameter_size_bits,
119
- projectId: data.project_id,
120
- region: data.region,
121
- sizeBytes: data.size_bytes,
122
- status: data.status,
123
- tags: data.tags,
124
- updatedAt: unmarshalDate(data.updated_at)
125
- };
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
+ };
126
84
  };
127
85
  const unmarshalListDeploymentsResponse = (data) => {
128
- if (!isJSONObject(data)) {
129
- throw new TypeError(
130
- `Unmarshalling the type 'ListDeploymentsResponse' failed as data isn't a dictionary.`
131
- );
132
- }
133
- return {
134
- deployments: unmarshalArrayOfObject(data.deployments, unmarshalDeployment),
135
- totalCount: data.total_count
136
- };
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
+ };
137
91
  };
138
92
  const unmarshalListModelsResponse = (data) => {
139
- if (!isJSONObject(data)) {
140
- throw new TypeError(
141
- `Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary.`
142
- );
143
- }
144
- return {
145
- models: unmarshalArrayOfObject(data.models, unmarshalModel),
146
- totalCount: data.total_count
147
- };
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
+ };
148
98
  };
149
- const unmarshalNodeType = (data) => {
150
- if (!isJSONObject(data)) {
151
- throw new TypeError(
152
- `Unmarshalling the type 'NodeType' failed as data isn't a dictionary.`
153
- );
154
- }
155
- return {
156
- beta: data.beta,
157
- createdAt: unmarshalDate(data.created_at),
158
- description: data.description,
159
- disabled: data.disabled,
160
- gpus: data.gpus,
161
- memory: data.memory,
162
- name: data.name,
163
- region: data.region,
164
- stockStatus: data.stock_status,
165
- updatedAt: unmarshalDate(data.updated_at),
166
- vcpus: data.vcpus,
167
- vram: data.vram
168
- };
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
+ };
169
115
  };
170
116
  const unmarshalListNodeTypesResponse = (data) => {
171
- if (!isJSONObject(data)) {
172
- throw new TypeError(
173
- `Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary.`
174
- );
175
- }
176
- return {
177
- nodeTypes: unmarshalArrayOfObject(data.node_types, unmarshalNodeType),
178
- totalCount: data.total_count
179
- };
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
+ };
180
122
  };
181
- const marshalEndpointPrivateNetworkDetails = (request, defaults) => ({
182
- private_network_id: request.privateNetworkId
183
- });
184
- const marshalEndpointPublicNetworkDetails = (request, defaults) => ({});
185
- const marshalDeploymentQuantization = (request, defaults) => ({
186
- bits: request.bits
187
- });
188
- const marshalEndpointSpec = (request, defaults) => ({
189
- disable_auth: request.disableAuth,
190
- ...resolveOneOf([
191
- {
192
- param: "public_network",
193
- value: request.publicNetwork !== void 0 ? marshalEndpointPublicNetworkDetails(request.publicNetwork) : void 0
194
- },
195
- {
196
- param: "private_network",
197
- value: request.privateNetwork !== void 0 ? marshalEndpointPrivateNetworkDetails(request.privateNetwork) : void 0
198
- }
199
- ])
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
+ }])
200
135
  });
201
136
  const marshalCreateDeploymentRequest = (request, defaults) => ({
202
- accept_eula: request.acceptEula,
203
- endpoints: request.endpoints.map((elt) => marshalEndpointSpec(elt)),
204
- max_size: request.maxSize,
205
- min_size: request.minSize,
206
- model_id: request.modelId,
207
- name: request.name || randomName("inference"),
208
- node_type_name: request.nodeTypeName,
209
- project_id: request.projectId ?? defaults.defaultProjectId,
210
- quantization: request.quantization !== void 0 ? marshalDeploymentQuantization(request.quantization) : void 0,
211
- 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
212
147
  });
213
148
  const marshalCreateEndpointRequest = (request, defaults) => ({
214
- deployment_id: request.deploymentId,
215
- endpoint: marshalEndpointSpec(request.endpoint)
149
+ deployment_id: request.deploymentId,
150
+ endpoint: marshalEndpointSpec(request.endpoint, defaults)
216
151
  });
217
- const marshalModelSource = (request, defaults) => ({
218
- url: request.url,
219
- ...resolveOneOf([
220
- {
221
- param: "secret",
222
- value: request.secret
223
- }
224
- ])
152
+ var marshalModelSource = (request, defaults) => ({
153
+ url: request.url,
154
+ ...resolveOneOf([{
155
+ param: "secret",
156
+ value: request.secret
157
+ }])
225
158
  });
226
159
  const marshalCreateModelRequest = (request, defaults) => ({
227
- name: request.name || randomName("model"),
228
- project_id: request.projectId ?? defaults.defaultProjectId,
229
- source: marshalModelSource(request.source)
160
+ name: request.name || randomName("model"),
161
+ project_id: request.projectId ?? defaults.defaultProjectId,
162
+ source: marshalModelSource(request.source, defaults)
230
163
  });
231
164
  const marshalUpdateDeploymentRequest = (request, defaults) => ({
232
- max_size: request.maxSize,
233
- min_size: request.minSize,
234
- model_id: request.modelId,
235
- name: request.name,
236
- quantization: request.quantization !== void 0 ? marshalDeploymentQuantization(request.quantization) : void 0,
237
- 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
238
171
  });
239
- const marshalUpdateEndpointRequest = (request, defaults) => ({
240
- disable_auth: request.disableAuth
241
- });
242
- export {
243
- marshalCreateDeploymentRequest,
244
- marshalCreateEndpointRequest,
245
- marshalCreateModelRequest,
246
- marshalUpdateDeploymentRequest,
247
- marshalUpdateEndpointRequest,
248
- unmarshalDeployment,
249
- unmarshalEndpoint,
250
- unmarshalListDeploymentsResponse,
251
- unmarshalListModelsResponse,
252
- unmarshalListNodeTypesResponse,
253
- unmarshalModel
254
- };
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 };