forked from triggerdotdev/trigger.dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.ts
More file actions
58 lines (53 loc) · 1.59 KB
/
utils.ts
File metadata and controls
58 lines (53 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { CallbackTimeout } from "./types";
export const createPredictionProperties = (
params: Partial<{
version: string;
stream: boolean;
}>
) => {
return [
...(params.version ? [{ label: "Model Version", text: params.version }] : []),
...streamingProperty(params),
];
};
export const createDeploymentProperties = (
params: Partial<{
deployment_owner: string;
deployment_name: string;
stream: boolean;
}>
) => {
return [
...(params.deployment_owner
? [{ label: "Deployment Owner", text: params.deployment_owner }]
: []),
...(params.deployment_name ? [{ label: "Deployment Name", text: params.deployment_name }] : []),
...streamingProperty(params),
];
};
export const modelProperties = (
params: Partial<{
model_owner: string;
model_name: string;
version_id: string;
destination: string;
}>
) => {
return [
...(params.model_owner ? [{ label: "Model Owner", text: params.model_owner }] : []),
...(params.model_name ? [{ label: "Model Name", text: params.model_name }] : []),
...(params.version_id ? [{ label: "Model Version", text: params.version_id }] : []),
...(params.destination ? [{ label: "Destination Model", text: params.destination }] : []),
];
};
export const streamingProperty = (params: { stream?: boolean }) => {
return [{ label: "Streaming Enabled", text: String(!!params.stream) }];
};
export const callbackProperties = (options: CallbackTimeout) => {
return [
{
label: "Callback Timeout",
text: options.timeoutInSeconds ? `${options.timeoutInSeconds}s` : "default",
},
];
};