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