@daocloud-proto/infery 0.0.0-stage → 0.1.0-rc1

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.
@@ -0,0 +1,116 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ /*
4
+ * This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
5
+ */
6
+
7
+ import * as GoogleProtobufStruct from "../google/protobuf/struct.pb"
8
+
9
+ export enum DBType {
10
+ DB_TYPE_UNSPECIFIED = "DB_TYPE_UNSPECIFIED",
11
+ MYSQL = "MYSQL",
12
+ POSTGRESQL = "POSTGRESQL",
13
+ SQLITE = "SQLITE",
14
+ }
15
+
16
+ export enum InferenceStack {
17
+ INFERENCE_STACK_UNSPECIFIED = "INFERENCE_STACK_UNSPECIFIED",
18
+ INFERENCE_STACK_LLM_D = "INFERENCE_STACK_LLM_D",
19
+ INFERENCE_STACK_DYNAMO = "INFERENCE_STACK_DYNAMO",
20
+ }
21
+
22
+ export enum DisaggregationMode {
23
+ DISAGGREGATION_MODE_UNSPECIFIED = "DISAGGREGATION_MODE_UNSPECIFIED",
24
+ DISAGGREGATION_MODE_AGGREGATED = "DISAGGREGATION_MODE_AGGREGATED",
25
+ DISAGGREGATION_MODE_DISAGGREGATED = "DISAGGREGATION_MODE_DISAGGREGATED",
26
+ DISAGGREGATION_MODE_EPD = "DISAGGREGATION_MODE_EPD",
27
+ }
28
+
29
+ export enum SearchIndexFieldBuilderType {
30
+ FIELD_TYPE_UNSPECIFIED = "FIELD_TYPE_UNSPECIFIED",
31
+ FILED = "FILED",
32
+ JSON_FILED_PATH = "JSON_FILED_PATH",
33
+ CONST = "CONST",
34
+ I18N_FIELD = "I18N_FIELD",
35
+ SUBQUERY = "SUBQUERY",
36
+ FUNC_REPLACE = "FUNC_REPLACE",
37
+ FUNC_CONCAT = "FUNC_CONCAT",
38
+ }
39
+
40
+ export type FormState = {
41
+ ui?: GoogleProtobufStruct.Struct
42
+ form?: GoogleProtobufStruct.Struct
43
+ }
44
+
45
+ export type NoParamsQuery = {
46
+ }
47
+
48
+ export type Pagination = {
49
+ total?: number
50
+ page?: number
51
+ pageSize?: number
52
+ sort?: string
53
+ search?: string
54
+ }
55
+
56
+ export type I18nName = {
57
+ zhCn?: string
58
+ enUs?: string
59
+ }
60
+
61
+ export type SearchIndexFieldBuilderFuncCall = {
62
+ fields?: SearchIndexFieldBuilder[]
63
+ }
64
+
65
+ export type SearchIndexFieldBuilder = {
66
+ type?: SearchIndexFieldBuilderType
67
+ fieldName?: string
68
+ jsonFieldPath?: string[]
69
+ constValue?: string
70
+ funcCall?: SearchIndexFieldBuilderFuncCall
71
+ }
72
+
73
+ export type SearchIndex = {
74
+ searchKey?: string
75
+ fieldBuilder?: SearchIndexFieldBuilder
76
+ }
77
+
78
+ export type AuthResourceAction = {
79
+ resourceType?: string
80
+ action?: string
81
+ }
82
+
83
+ export type Auth = {
84
+ skipAuth?: boolean
85
+ user?: AuthResourceAction
86
+ }
87
+
88
+ export type AuditObject = {
89
+ nameKey?: string
90
+ namespaceKey?: string
91
+ clusterKey?: string
92
+ }
93
+
94
+ export type AuditObjectKind = {
95
+ kindName?: string
96
+ kindGroup?: string
97
+ kindVersion?: string
98
+ kindKey?: string
99
+ }
100
+
101
+ export type Audit = {
102
+ object?: AuditObject
103
+ objectKind?: AuditObjectKind
104
+ action?: string
105
+ actionKey?: string
106
+ customObject?: boolean
107
+ extraExplainKeys?: string[]
108
+ }
109
+
110
+ export type AuditObject = {
111
+ namespace?: string
112
+ name?: string
113
+ kind?: string
114
+ group?: string
115
+ version?: string
116
+ }
@@ -0,0 +1,10 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ /*
4
+ * This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
5
+ */
6
+ export type RPCError = {
7
+ id?: string
8
+ message?: string
9
+ targets?: string[]
10
+ }
@@ -0,0 +1,23 @@
1
+ // auto generated by tools/gen-error-ts/main.go
2
+ export enum ErrorCode {
3
+ // EN: internal server error: %v
4
+ SYSTEM_INTERNAL_ERROR = "SYSTEM-INTERNAL_ERROR",
5
+ // EN: resource not found: %v
6
+ SYSTEM_NOT_FOUND_ERROR = "SYSTEM-NOT_FOUND_ERROR",
7
+ // EN: request params error: %v
8
+ SYSTEM_PARAMS_ERROR = "SYSTEM-PARAMS_ERROR",
9
+ // EN: not implemented: %v
10
+ SYSTEM_UNIMPLEMENTED = "SYSTEM-UNIMPLEMENTED",
11
+ // EN: upstream service unavailable: %v
12
+ SYSTEM_UPSTREAM_UNAVAILABLE = "SYSTEM-UPSTREAM_UNAVAILABLE",
13
+ // EN: Requested resource conflicted error: %v
14
+ USER_CONFLICT_ERROR = "USER-CONFLICT_ERROR",
15
+ // EN: Failed precondition error: %v
16
+ USER_FAILED_PRECONDITION_ERROR = "USER-FAILED_PRECONDITION_ERROR",
17
+ // EN: out of page: %v
18
+ USER_OUT_OF_PAGE = "USER-OUT_OF_PAGE",
19
+ // EN: permission denied: %v
20
+ USER_PERMISSION_DENIED = "USER-PERMISSION_DENIED",
21
+ // EN: unauthorized request
22
+ USER_UNAUTHORIZED = "USER-UNAUTHORIZED",
23
+ }
package/fetch.pb.ts ADDED
@@ -0,0 +1,341 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ /*
4
+ * This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
5
+ */
6
+
7
+ /**
8
+ * base64 encoder and decoder
9
+ * Copied and adapted from https://github.com/protobufjs/protobuf.js/blob/master/lib/base64/index.js
10
+ */
11
+ // Base64 encoding table
12
+ const b64 = new Array(64);
13
+
14
+ // Base64 decoding table
15
+ const s64 = new Array(123);
16
+
17
+ // 65..90, 97..122, 48..57, 43, 47
18
+ for (let i = 0; i < 64;)
19
+ s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++;
20
+
21
+ export function b64Encode(buffer: Uint8Array, start: number, end: number): string {
22
+ let parts: string[] = null;
23
+ const chunk = [];
24
+ let i = 0, // output index
25
+ j = 0, // goto index
26
+ t; // temporary
27
+ while (start < end) {
28
+ const b = buffer[start++];
29
+ switch (j) {
30
+ case 0:
31
+ chunk[i++] = b64[b >> 2];
32
+ t = (b & 3) << 4;
33
+ j = 1;
34
+ break;
35
+ case 1:
36
+ chunk[i++] = b64[t | b >> 4];
37
+ t = (b & 15) << 2;
38
+ j = 2;
39
+ break;
40
+ case 2:
41
+ chunk[i++] = b64[t | b >> 6];
42
+ chunk[i++] = b64[b & 63];
43
+ j = 0;
44
+ break;
45
+ }
46
+ if (i > 8191) {
47
+ (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
48
+ i = 0;
49
+ }
50
+ }
51
+ if (j) {
52
+ chunk[i++] = b64[t];
53
+ chunk[i++] = 61;
54
+ if (j === 1)
55
+ chunk[i++] = 61;
56
+ }
57
+ if (parts) {
58
+ if (i)
59
+ parts.push(String.fromCharCode.apply(String, chunk.slice(0, i)));
60
+ return parts.join("");
61
+ }
62
+ return String.fromCharCode.apply(String, chunk.slice(0, i));
63
+ }
64
+
65
+ const invalidEncoding = "invalid encoding";
66
+
67
+ export function b64Decode(s: string): Uint8Array {
68
+ const buffer = [];
69
+ let offset = 0;
70
+ let j = 0, // goto index
71
+ t; // temporary
72
+ for (let i = 0; i < s.length;) {
73
+ let c = s.charCodeAt(i++);
74
+ if (c === 61 && j > 1)
75
+ break;
76
+ if ((c = s64[c]) === undefined)
77
+ throw Error(invalidEncoding);
78
+ switch (j) {
79
+ case 0:
80
+ t = c;
81
+ j = 1;
82
+ break;
83
+ case 1:
84
+ buffer[offset++] = t << 2 | (c & 48) >> 4;
85
+ t = c;
86
+ j = 2;
87
+ break;
88
+ case 2:
89
+ buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2;
90
+ t = c;
91
+ j = 3;
92
+ break;
93
+ case 3:
94
+ buffer[offset++] = (t & 3) << 6 | c;
95
+ j = 0;
96
+ break;
97
+ }
98
+ }
99
+ if (j === 1)
100
+ throw Error(invalidEncoding);
101
+ return new Uint8Array(buffer);
102
+ }
103
+
104
+ function b64Test(s: string): boolean {
105
+ return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s);
106
+ }
107
+
108
+ export interface InitReq extends RequestInit {
109
+ pathPrefix?: string
110
+ }
111
+
112
+ export function replacer(key: any, value: any): any {
113
+ if(value && value.constructor === Uint8Array) {
114
+ return b64Encode(value, 0, value.length);
115
+ }
116
+
117
+ return value;
118
+ }
119
+
120
+ export function fetchReq<I, O>(path: string, init?: InitReq): Promise<O> {
121
+ const {pathPrefix, ...req} = init || {}
122
+
123
+ const url = pathPrefix ? `${pathPrefix}${path}` : path
124
+
125
+ return fetch(url, req).then(r => r.json().then((body: O) => {
126
+ if (!r.ok) { throw body; }
127
+ return body;
128
+ })) as Promise<O>
129
+ }
130
+
131
+ // NotifyStreamEntityArrival is a callback that will be called on streaming entity arrival
132
+ export type NotifyStreamEntityArrival<T> = (resp: T) => void
133
+
134
+ /**
135
+ * fetchStreamingRequest is able to handle grpc-gateway server side streaming call
136
+ * it takes NotifyStreamEntityArrival that lets users respond to entity arrival during the call
137
+ * all entities will be returned as an array after the call finishes.
138
+ **/
139
+ export async function fetchStreamingRequest<S, R>(path: string, callback?: NotifyStreamEntityArrival<R>, init?: InitReq) {
140
+ const {pathPrefix, ...req} = init || {}
141
+ const url = pathPrefix ?`${pathPrefix}${path}` : path
142
+ const result = await fetch(url, req)
143
+ // needs to use the .ok to check the status of HTTP status code
144
+ // http other than 200 will not throw an error, instead the .ok will become false.
145
+ // see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#
146
+ if (!result.ok) {
147
+ const resp = await result.json()
148
+ const errMsg = resp.error && resp.error.message ? resp.error.message : ""
149
+ throw new Error(errMsg)
150
+ }
151
+
152
+ if (!result.body) {
153
+ throw new Error("response doesnt have a body")
154
+ }
155
+
156
+ await result.body
157
+ .pipeThrough(new TextDecoderStream())
158
+ .pipeThrough<R>(getNewLineDelimitedJSONDecodingStream<R>())
159
+ .pipeTo(getNotifyEntityArrivalSink((e: R) => {
160
+ if (callback) {
161
+ callback(e)
162
+ }
163
+ }))
164
+
165
+ // wait for the streaming to finish and return the success respond
166
+ return
167
+ }
168
+
169
+ /**
170
+ * JSONStringStreamController represents the transform controller that's able to transform the incoming
171
+ * new line delimited json content stream into entities and able to push the entity to the down stream
172
+ */
173
+ interface JSONStringStreamController<T> extends TransformStreamDefaultController {
174
+ buf?: string
175
+ pos?: number
176
+ enqueue: (s: T) => void
177
+ }
178
+
179
+ /**
180
+ * getNewLineDelimitedJSONDecodingStream returns a TransformStream that's able to handle new line delimited json stream content into parsed entities
181
+ */
182
+ function getNewLineDelimitedJSONDecodingStream<T>(): TransformStream<string, T> {
183
+ return new TransformStream({
184
+ start(controller: JSONStringStreamController<T>) {
185
+ controller.buf = ''
186
+ controller.pos = 0
187
+ },
188
+
189
+ transform(chunk: string, controller: JSONStringStreamController<T>) {
190
+ if (controller.buf === undefined) {
191
+ controller.buf = ''
192
+ }
193
+ if (controller.pos === undefined) {
194
+ controller.pos = 0
195
+ }
196
+ controller.buf += chunk
197
+ while (controller.pos < controller.buf.length) {
198
+ if (controller.buf[controller.pos] === '\n') {
199
+ const line = controller.buf.substring(0, controller.pos)
200
+ const response = JSON.parse(line)
201
+ controller.enqueue(response.result)
202
+ controller.buf = controller.buf.substring(controller.pos + 1)
203
+ controller.pos = 0
204
+ } else {
205
+ ++controller.pos
206
+ }
207
+ }
208
+ }
209
+ })
210
+
211
+ }
212
+
213
+ /**
214
+ * getNotifyEntityArrivalSink takes the NotifyStreamEntityArrival callback and return
215
+ * a sink that will call the callback on entity arrival
216
+ * @param notifyCallback
217
+ */
218
+ function getNotifyEntityArrivalSink<T>(notifyCallback: NotifyStreamEntityArrival<T>) {
219
+ return new WritableStream<T>({
220
+ write(entity: T) {
221
+ notifyCallback(entity)
222
+ }
223
+ })
224
+ }
225
+
226
+ type Primitive = string | boolean | number;
227
+ type RequestPayload = Record<string, unknown>;
228
+ type FlattenedRequestPayload = Record<string, Primitive | Array<Primitive>>;
229
+
230
+ /**
231
+ * Checks if given value is a plain object
232
+ * Logic copied and adapted from below source:
233
+ * https://github.com/char0n/ramda-adjunct/blob/master/src/isPlainObj.js
234
+ * @param {unknown} value
235
+ * @return {boolean}
236
+ */
237
+ function isPlainObject(value: unknown): boolean {
238
+ const isObject =
239
+ Object.prototype.toString.call(value).slice(8, -1) === "Object";
240
+ const isObjLike = value !== null && isObject;
241
+
242
+ if (!isObjLike || !isObject) {
243
+ return false;
244
+ }
245
+
246
+ const proto = Object.getPrototypeOf(value);
247
+
248
+ const hasObjectConstructor =
249
+ typeof proto === "object" &&
250
+ proto.constructor === Object.prototype.constructor;
251
+
252
+ return hasObjectConstructor;
253
+ }
254
+
255
+ /**
256
+ * Checks if given value is of a primitive type
257
+ * @param {unknown} value
258
+ * @return {boolean}
259
+ */
260
+ function isPrimitive(value: unknown): boolean {
261
+ return ["string", "number", "boolean"].some(t => typeof value === t);
262
+ }
263
+
264
+ /**
265
+ * Checks if given primitive is zero-value
266
+ * @param {Primitive} value
267
+ * @return {boolean}
268
+ */
269
+ function isZeroValuePrimitive(value: Primitive): boolean {
270
+ return value === false || value === 0 || value === "";
271
+ }
272
+
273
+ /**
274
+ * Flattens a deeply nested request payload and returns an object
275
+ * with only primitive values and non-empty array of primitive values
276
+ * as per https://github.com/googleapis/googleapis/blob/master/google/api/http.proto
277
+ * @param {RequestPayload} requestPayload
278
+ * @param {String} path
279
+ * @return {FlattenedRequestPayload>}
280
+ */
281
+ function flattenRequestPayload<T extends RequestPayload>(
282
+ requestPayload: T,
283
+ path: string = ""
284
+ ): FlattenedRequestPayload {
285
+ return Object.keys(requestPayload).reduce(
286
+ (acc: T, key: string): T => {
287
+ const value = requestPayload[key];
288
+ const newPath = path ? [path, key].join(".") : key;
289
+
290
+ const isNonEmptyPrimitiveArray =
291
+ Array.isArray(value) &&
292
+ value.every(v => isPrimitive(v)) &&
293
+ value.length > 0;
294
+
295
+ const isNonZeroValuePrimitive =
296
+ isPrimitive(value) && !isZeroValuePrimitive(value as Primitive);
297
+
298
+ let objectToMerge = {};
299
+
300
+ if (isPlainObject(value)) {
301
+ objectToMerge = flattenRequestPayload(value as RequestPayload, newPath);
302
+ } else if (isNonZeroValuePrimitive || isNonEmptyPrimitiveArray) {
303
+ objectToMerge = { [newPath]: value };
304
+ }
305
+
306
+ return { ...acc, ...objectToMerge };
307
+ },
308
+ {} as T
309
+ ) as FlattenedRequestPayload;
310
+ }
311
+
312
+ /**
313
+ * Renders a deeply nested request payload into a string of URL search
314
+ * parameters by first flattening the request payload and then removing keys
315
+ * which are already present in the URL path.
316
+ * @param {RequestPayload} requestPayload
317
+ * @param {string[]} urlPathParams
318
+ * @return {string}
319
+ */
320
+ export function renderURLSearchParams<T extends RequestPayload>(
321
+ requestPayload: T,
322
+ urlPathParams: string[] = []
323
+ ): string {
324
+ const flattenedRequestPayload = flattenRequestPayload(requestPayload);
325
+
326
+ const urlSearchParams = Object.keys(flattenedRequestPayload).reduce(
327
+ (acc: string[][], key: string): string[][] => {
328
+ // key should not be present in the url path as a parameter
329
+ const value = flattenedRequestPayload[key];
330
+ if (urlPathParams.find(f => f === key)) {
331
+ return acc;
332
+ }
333
+ return Array.isArray(value)
334
+ ? [...acc, ...value.map(m => [key, m.toString()])]
335
+ : (acc = [...acc, [key, value.toString()]]);
336
+ },
337
+ [] as string[][]
338
+ );
339
+
340
+ return new URLSearchParams(urlSearchParams).toString();
341
+ }
@@ -0,0 +1,181 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ /*
4
+ * This file is a generated Typescript file for GRPC Gateway, DO NOT MODIFY
5
+ */
6
+
7
+ import * as InferyCommonCommon from "../../../common/common.pb"
8
+ import * as fm from "../../../fetch.pb"
9
+ import * as GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
10
+
11
+ type Absent<T, K extends keyof T> = { [k in Exclude<keyof T, K>]?: undefined };
12
+ type OneOf<T> =
13
+ | { [k in keyof T]?: undefined }
14
+ | (
15
+ keyof T extends infer K ?
16
+ (K extends string & keyof T ? { [k in K]: T[K] } & Absent<T, K>
17
+ : never)
18
+ : never);
19
+
20
+ export enum Maturity {
21
+ MATURITY_UNSPECIFIED = "MATURITY_UNSPECIFIED",
22
+ MATURITY_PRODUCTION = "MATURITY_PRODUCTION",
23
+ MATURITY_PREVIEW = "MATURITY_PREVIEW",
24
+ }
25
+
26
+ export enum TemplateSource {
27
+ TEMPLATE_SOURCE_UNSPECIFIED = "TEMPLATE_SOURCE_UNSPECIFIED",
28
+ TEMPLATE_SOURCE_BUILTIN = "TEMPLATE_SOURCE_BUILTIN",
29
+ TEMPLATE_SOURCE_WORKSPACE = "TEMPLATE_SOURCE_WORKSPACE",
30
+ }
31
+
32
+ export enum InferenceEngine {
33
+ INFERENCE_ENGINE_UNSPECIFIED = "INFERENCE_ENGINE_UNSPECIFIED",
34
+ INFERENCE_ENGINE_VLLM = "INFERENCE_ENGINE_VLLM",
35
+ INFERENCE_ENGINE_SGLANG = "INFERENCE_ENGINE_SGLANG",
36
+ }
37
+
38
+
39
+ type BaseParallelSpec = {
40
+ tp?: number
41
+ dp?: number
42
+ ep?: boolean
43
+ gpuPerNode?: number
44
+ }
45
+
46
+ export type ParallelSpec = BaseParallelSpec
47
+ & OneOf<{ pp: number }>
48
+
49
+ export type RoleSpec = {
50
+ replicas?: number
51
+ nodes?: number
52
+ parallel?: ParallelSpec
53
+ supportedGpus?: {[key: string]: string}
54
+ hardwareVendor?: string
55
+ }
56
+
57
+ export type RoleConfig = {
58
+ decode?: RoleSpec
59
+ prefill?: RoleSpec
60
+ encoder?: RoleSpec
61
+ }
62
+
63
+ export type Catalog = {
64
+ maturity?: Maturity
65
+ hardwareVendor?: string
66
+ supportedGpus?: {[key: string]: string}
67
+ guide?: InferyCommonCommon.I18nName
68
+ }
69
+
70
+ export type InferenceTemplateSpec = {
71
+ modelName?: string
72
+ engine?: InferenceEngine
73
+ stack?: InferyCommonCommon.InferenceStack
74
+ disaggregationMode?: InferyCommonCommon.DisaggregationMode
75
+ catalog?: Catalog
76
+ role?: RoleConfig
77
+ }
78
+
79
+ export type InferenceTemplateMetadata = {
80
+ name?: string
81
+ createTime?: GoogleProtobufTimestamp.Timestamp
82
+ source?: TemplateSource
83
+ }
84
+
85
+ export type InferenceTemplateManifest = {
86
+ content?: string
87
+ }
88
+
89
+ export type InferenceTemplate = {
90
+ metadata?: InferenceTemplateMetadata
91
+ spec?: InferenceTemplateSpec
92
+ }
93
+
94
+ export type ParseInferenceTemplateRequest = {
95
+ workspace?: number
96
+ manifest?: InferenceTemplateManifest
97
+ }
98
+
99
+ export type ParseInferenceTemplateResponse = {
100
+ name?: string
101
+ maturity?: Maturity
102
+ guide?: InferyCommonCommon.I18nName
103
+ }
104
+
105
+ export type CreateInferenceTemplateRequest = {
106
+ workspace?: number
107
+ name?: string
108
+ manifest?: InferenceTemplateManifest
109
+ maturity?: Maturity
110
+ guide?: InferyCommonCommon.I18nName
111
+ }
112
+
113
+ export type ListInferenceTemplatesRequest = {
114
+ workspace?: number
115
+ stack?: InferyCommonCommon.InferenceStack[]
116
+ disaggregationMode?: InferyCommonCommon.DisaggregationMode[]
117
+ maturity?: Maturity[]
118
+ page?: InferyCommonCommon.Pagination
119
+ source?: TemplateSource[]
120
+ }
121
+
122
+ export type ListInferenceTemplatesResponse = {
123
+ items?: InferenceTemplate[]
124
+ page?: InferyCommonCommon.Pagination
125
+ }
126
+
127
+ export type GetInferenceTemplateFiltersRequest = {
128
+ workspace?: number
129
+ }
130
+
131
+ export type GetInferenceTemplateFiltersResponse = {
132
+ hardwareVendors?: string[]
133
+ stacks?: InferyCommonCommon.InferenceStack[]
134
+ disaggregationModes?: InferyCommonCommon.DisaggregationMode[]
135
+ maturities?: Maturity[]
136
+ }
137
+
138
+ export type GetInferenceTemplateRequest = {
139
+ workspace?: number
140
+ name?: string
141
+ }
142
+
143
+ export type GetInferenceTemplateResponse = {
144
+ inferenceTemplate?: InferenceTemplate
145
+ manifest?: InferenceTemplateManifest
146
+ }
147
+
148
+ export type UpdateInferenceTemplateRequest = {
149
+ workspace?: number
150
+ name?: string
151
+ manifest?: InferenceTemplateManifest
152
+ }
153
+
154
+ export type DeleteInferenceTemplateRequest = {
155
+ workspace?: number
156
+ name?: string
157
+ }
158
+
159
+ export class InferenceTemplateManagement {
160
+ static ParseInferenceTemplate(req: ParseInferenceTemplateRequest, initReq?: fm.InitReq): Promise<ParseInferenceTemplateResponse> {
161
+ return fm.fetchReq<ParseInferenceTemplateRequest, ParseInferenceTemplateResponse>(`/apis/infery.io/v1alpha1/workspaces/${req["workspace"]}/inference-templates:parse`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
162
+ }
163
+ static CreateInferenceTemplate(req: CreateInferenceTemplateRequest, initReq?: fm.InitReq): Promise<InferenceTemplate> {
164
+ return fm.fetchReq<CreateInferenceTemplateRequest, InferenceTemplate>(`/apis/infery.io/v1alpha1/workspaces/${req["workspace"]}/inference-templates`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
165
+ }
166
+ static ListInferenceTemplates(req: ListInferenceTemplatesRequest, initReq?: fm.InitReq): Promise<ListInferenceTemplatesResponse> {
167
+ return fm.fetchReq<ListInferenceTemplatesRequest, ListInferenceTemplatesResponse>(`/apis/infery.io/v1alpha1/workspaces/${req["workspace"]}/inference-templates?${fm.renderURLSearchParams(req, ["workspace"])}`, {...initReq, method: "GET"})
168
+ }
169
+ static GetInferenceTemplateFilters(req: GetInferenceTemplateFiltersRequest, initReq?: fm.InitReq): Promise<GetInferenceTemplateFiltersResponse> {
170
+ return fm.fetchReq<GetInferenceTemplateFiltersRequest, GetInferenceTemplateFiltersResponse>(`/apis/infery.io/v1alpha1/workspaces/${req["workspace"]}/inference-templates:filters?${fm.renderURLSearchParams(req, ["workspace"])}`, {...initReq, method: "GET"})
171
+ }
172
+ static GetInferenceTemplate(req: GetInferenceTemplateRequest, initReq?: fm.InitReq): Promise<GetInferenceTemplateResponse> {
173
+ return fm.fetchReq<GetInferenceTemplateRequest, GetInferenceTemplateResponse>(`/apis/infery.io/v1alpha1/workspaces/${req["workspace"]}/inference-templates/${req["name"]}?${fm.renderURLSearchParams(req, ["workspace", "name"])}`, {...initReq, method: "GET"})
174
+ }
175
+ static UpdateInferenceTemplate(req: UpdateInferenceTemplateRequest, initReq?: fm.InitReq): Promise<InferenceTemplate> {
176
+ return fm.fetchReq<UpdateInferenceTemplateRequest, InferenceTemplate>(`/apis/infery.io/v1alpha1/workspaces/${req["workspace"]}/inference-templates/${req["name"]}`, {...initReq, method: "PUT", body: JSON.stringify(req, fm.replacer)})
177
+ }
178
+ static DeleteInferenceTemplate(req: DeleteInferenceTemplateRequest, initReq?: fm.InitReq): Promise<InferenceTemplate> {
179
+ return fm.fetchReq<DeleteInferenceTemplateRequest, InferenceTemplate>(`/apis/infery.io/v1alpha1/workspaces/${req["workspace"]}/inference-templates/${req["name"]}`, {...initReq, method: "DELETE"})
180
+ }
181
+ }