@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.
- package/LICENSE +191 -0
- package/dist/index.gen.cjs +6 -0
- package/dist/index.gen.d.ts +6 -0
- package/dist/index.gen.js +6 -0
- package/dist/v1/api.gen.cjs +271 -0
- package/dist/v1/api.gen.d.ts +137 -0
- package/dist/v1/api.gen.js +271 -0
- package/dist/v1/content.gen.cjs +13 -0
- package/dist/v1/content.gen.d.ts +5 -0
- package/dist/v1/content.gen.js +13 -0
- package/dist/v1/index.gen.cjs +22 -0
- package/dist/v1/index.gen.d.ts +5 -0
- package/dist/v1/index.gen.js +22 -0
- package/dist/v1/marshalling.gen.cjs +258 -0
- package/dist/v1/marshalling.gen.d.ts +14 -0
- package/dist/v1/marshalling.gen.js +258 -0
- package/dist/v1/types.gen.d.ts +577 -0
- package/dist/v1/validation-rules.gen.cjs +65 -0
- package/dist/v1/validation-rules.gen.d.ts +57 -0
- package/dist/v1/validation-rules.gen.js +65 -0
- package/dist/v1beta1/api.gen.cjs +301 -0
- package/dist/v1beta1/api.gen.d.ts +148 -0
- package/dist/v1beta1/api.gen.js +301 -0
- package/dist/v1beta1/content.gen.cjs +8 -0
- package/dist/v1beta1/content.gen.d.ts +3 -0
- package/dist/v1beta1/content.gen.js +8 -0
- package/dist/v1beta1/index.gen.cjs +25 -0
- package/dist/v1beta1/index.gen.d.ts +5 -0
- package/dist/v1beta1/index.gen.js +25 -0
- package/dist/v1beta1/marshalling.gen.cjs +271 -0
- package/dist/v1beta1/marshalling.gen.d.ts +18 -0
- package/dist/v1beta1/marshalling.gen.js +271 -0
- package/dist/v1beta1/types.gen.d.ts +622 -0
- package/dist/v1beta1/validation-rules.gen.cjs +56 -0
- package/dist/v1beta1/validation-rules.gen.d.ts +50 -0
- package/dist/v1beta1/validation-rules.gen.js +56 -0
- package/package.json +51 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
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
|
+
};
|
|
12
|
+
};
|
|
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 {};
|
|
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
|
+
publicNetwork: data.public_network ? unmarshalEndpointPublicNetworkDetails(data.public_network) : void 0,
|
|
32
|
+
url: data.url
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const unmarshalModelSupportedQuantization = (data) => {
|
|
36
|
+
if (!isJSONObject(data)) {
|
|
37
|
+
throw new TypeError(
|
|
38
|
+
`Unmarshalling the type 'ModelSupportedQuantization' failed as data isn't a dictionary.`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
allowed: data.allowed,
|
|
43
|
+
maxContextSize: data.max_context_size,
|
|
44
|
+
quantizationBits: data.quantization_bits
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const unmarshalModelSupportedNode = (data) => {
|
|
48
|
+
if (!isJSONObject(data)) {
|
|
49
|
+
throw new TypeError(
|
|
50
|
+
`Unmarshalling the type 'ModelSupportedNode' failed as data isn't a dictionary.`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
nodeTypeName: data.node_type_name,
|
|
55
|
+
quantizations: unmarshalArrayOfObject(
|
|
56
|
+
data.quantizations,
|
|
57
|
+
unmarshalModelSupportedQuantization
|
|
58
|
+
)
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const unmarshalModelSupportInfo = (data) => {
|
|
62
|
+
if (!isJSONObject(data)) {
|
|
63
|
+
throw new TypeError(
|
|
64
|
+
`Unmarshalling the type 'ModelSupportInfo' failed as data isn't a dictionary.`
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
nodes: unmarshalArrayOfObject(data.nodes, unmarshalModelSupportedNode)
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const unmarshalDeploymentQuantization = (data) => {
|
|
72
|
+
if (!isJSONObject(data)) {
|
|
73
|
+
throw new TypeError(
|
|
74
|
+
`Unmarshalling the type 'DeploymentQuantization' failed as data isn't a dictionary.`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
bits: data.bits
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
const unmarshalDeployment = (data) => {
|
|
82
|
+
if (!isJSONObject(data)) {
|
|
83
|
+
throw new TypeError(
|
|
84
|
+
`Unmarshalling the type 'Deployment' failed as data isn't a dictionary.`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
createdAt: unmarshalDate(data.created_at),
|
|
89
|
+
endpoints: unmarshalArrayOfObject(data.endpoints, unmarshalEndpoint),
|
|
90
|
+
errorMessage: data.error_message,
|
|
91
|
+
id: data.id,
|
|
92
|
+
maxSize: data.max_size,
|
|
93
|
+
minSize: data.min_size,
|
|
94
|
+
modelId: data.model_id,
|
|
95
|
+
modelName: data.model_name,
|
|
96
|
+
name: data.name,
|
|
97
|
+
nodeTypeName: data.node_type_name,
|
|
98
|
+
projectId: data.project_id,
|
|
99
|
+
quantization: data.quantization ? unmarshalDeploymentQuantization(data.quantization) : void 0,
|
|
100
|
+
region: data.region,
|
|
101
|
+
size: data.size,
|
|
102
|
+
status: data.status,
|
|
103
|
+
tags: data.tags,
|
|
104
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
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
|
+
};
|
|
132
|
+
};
|
|
133
|
+
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
|
+
};
|
|
143
|
+
};
|
|
144
|
+
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
|
+
};
|
|
154
|
+
};
|
|
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
|
+
};
|
|
175
|
+
};
|
|
176
|
+
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
|
+
};
|
|
186
|
+
};
|
|
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
|
+
])
|
|
208
|
+
});
|
|
209
|
+
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
|
|
220
|
+
});
|
|
221
|
+
const marshalCreateEndpointRequest = (request, defaults) => ({
|
|
222
|
+
deployment_id: request.deploymentId,
|
|
223
|
+
endpoint: marshalEndpointSpec(request.endpoint)
|
|
224
|
+
});
|
|
225
|
+
const marshalModelSource = (request, defaults) => ({
|
|
226
|
+
url: request.url,
|
|
227
|
+
...resolveOneOf([{ param: "secret", value: request.secret }])
|
|
228
|
+
});
|
|
229
|
+
const marshalCreateModelRequest = (request, defaults) => ({
|
|
230
|
+
name: request.name || randomName("model"),
|
|
231
|
+
project_id: request.projectId ?? defaults.defaultProjectId,
|
|
232
|
+
source: marshalModelSource(request.source)
|
|
233
|
+
});
|
|
234
|
+
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
|
|
241
|
+
});
|
|
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
|
+
unmarshalModelSupportInfo
|
|
258
|
+
};
|