@daocloud-proto/infery 0.0.0-dev-b70ac6c2 → 0.0.0-dev-f59c3dee
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/fetch.pb.ts
CHANGED
|
@@ -338,4 +338,21 @@ export function renderURLSearchParams<T extends RequestPayload>(
|
|
|
338
338
|
);
|
|
339
339
|
|
|
340
340
|
return new URLSearchParams(urlSearchParams).toString();
|
|
341
|
-
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export async function fetchRawReq(path: string, init?: InitReq): Promise<Response> {
|
|
344
|
+
const {pathPrefix, ...req} = init || {}
|
|
345
|
+
const url = pathPrefix ? `${pathPrefix}${path}` : path
|
|
346
|
+
const response = await fetch(url, req)
|
|
347
|
+
if (!response.ok) {
|
|
348
|
+
const text = await response.text()
|
|
349
|
+
let body: unknown = text
|
|
350
|
+
try {
|
|
351
|
+
body = JSON.parse(text)
|
|
352
|
+
} catch {
|
|
353
|
+
// Preserve a non-JSON error body when an intermediary does not use the gateway error schema.
|
|
354
|
+
}
|
|
355
|
+
throw body
|
|
356
|
+
}
|
|
357
|
+
return response
|
|
358
|
+
}
|
|
@@ -8,6 +8,15 @@ import * as InferyCommonCommon from "../../../common/common.pb"
|
|
|
8
8
|
import * as fm from "../../../fetch.pb"
|
|
9
9
|
import * as GoogleProtobufTimestamp from "../../../google/protobuf/timestamp.pb"
|
|
10
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
|
+
|
|
11
20
|
export enum Maturity {
|
|
12
21
|
MATURITY_UNSPECIFIED = "MATURITY_UNSPECIFIED",
|
|
13
22
|
MATURITY_PRODUCTION = "MATURITY_PRODUCTION",
|
|
@@ -76,18 +85,17 @@ export type InferenceTemplate = {
|
|
|
76
85
|
spec?: InferenceTemplateSpec
|
|
77
86
|
}
|
|
78
87
|
|
|
79
|
-
export type ModelServingReference = {
|
|
80
|
-
name?: string
|
|
81
|
-
configurationRevision?: string
|
|
82
|
-
}
|
|
83
88
|
|
|
84
|
-
|
|
89
|
+
type BaseExportInferenceTemplateRequest = {
|
|
85
90
|
workspace?: number
|
|
86
|
-
|
|
91
|
+
modelServingName?: string
|
|
87
92
|
templateName?: string
|
|
88
93
|
maturity?: Maturity
|
|
89
94
|
}
|
|
90
95
|
|
|
96
|
+
export type ExportInferenceTemplateRequest = BaseExportInferenceTemplateRequest
|
|
97
|
+
& OneOf<{ version: string }>
|
|
98
|
+
|
|
91
99
|
export type ParseInferenceTemplateRequest = {
|
|
92
100
|
workspace?: number
|
|
93
101
|
manifest?: InferenceTemplateManifest
|
|
@@ -153,8 +161,8 @@ export type DeleteInferenceTemplateRequest = {
|
|
|
153
161
|
}
|
|
154
162
|
|
|
155
163
|
export class InferenceTemplateManagement {
|
|
156
|
-
static ExportInferenceTemplate(req: ExportInferenceTemplateRequest, initReq?: fm.InitReq): Promise<
|
|
157
|
-
return fm.
|
|
164
|
+
static ExportInferenceTemplate(req: ExportInferenceTemplateRequest, initReq?: fm.InitReq): Promise<Response> {
|
|
165
|
+
return fm.fetchRawReq(`/apis/infery.io/v1alpha1/workspaces/${req["workspace"]}/inference-templates:export?${fm.renderURLSearchParams(req, ["workspace"])}`, {...initReq, method: "GET"})
|
|
158
166
|
}
|
|
159
167
|
static ParseInferenceTemplate(req: ParseInferenceTemplateRequest, initReq?: fm.InitReq): Promise<ParseInferenceTemplateResponse> {
|
|
160
168
|
return fm.fetchReq<ParseInferenceTemplateRequest, ParseInferenceTemplateResponse>(`/apis/infery.io/v1alpha1/workspaces/${req["workspace"]}/inference-templates:parse`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
|