@mcoda/shared 0.1.102 → 0.1.103
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const GENERATIVE_OPERATIONS: readonly ["chat.completions", "images.generations", "audio.generations"];
|
|
1
|
+
export declare const GENERATIVE_OPERATIONS: readonly ["chat.completions", "images.generations", "audio.generations", "videos.generations"];
|
|
2
2
|
export type GenerativeOperation = (typeof GENERATIVE_OPERATIONS)[number];
|
|
3
|
-
export declare const GENERATIVE_MODALITIES: readonly ["text", "image", "audio"];
|
|
3
|
+
export declare const GENERATIVE_MODALITIES: readonly ["text", "image", "audio", "video"];
|
|
4
4
|
export type GenerativeModality = (typeof GENERATIVE_MODALITIES)[number];
|
|
5
5
|
export type GenerativeOperationPath = `/${string}`;
|
|
6
6
|
export type GenerativeOperationMethod = "POST";
|
|
@@ -9,13 +9,14 @@ export declare const GENERATIVE_REQUEST_PARAMETER_ALLOWLISTS: {
|
|
|
9
9
|
readonly "chat.completions": readonly ["model", "messages", "stream", "temperature", "top_p", "max_tokens", "stop", "response_format", "tools", "tool_choice"];
|
|
10
10
|
readonly "images.generations": readonly ["model", "prompt", "n", "size", "response_format", "seed", "steps", "negative_prompt"];
|
|
11
11
|
readonly "audio.generations": readonly ["model", "prompt", "duration_seconds", "response_format", "n", "seed", "steps", "negative_prompt", "sample_rate"];
|
|
12
|
+
readonly "videos.generations": readonly ["model", "prompt", "duration_seconds", "fps", "video_frames", "response_format", "n", "size", "seed", "steps", "high_noise_steps", "negative_prompt"];
|
|
12
13
|
};
|
|
13
14
|
export type GenerativeRequestParameterByOperation = {
|
|
14
15
|
[Operation in GenerativeOperation]: (typeof GENERATIVE_REQUEST_PARAMETER_ALLOWLISTS)[Operation][number];
|
|
15
16
|
};
|
|
16
17
|
export type GenerativeRequestParameter<Operation extends GenerativeOperation = GenerativeOperation> = GenerativeRequestParameterByOperation[Operation];
|
|
17
18
|
export type GenerativeRequestParameterAllowlist<Operation extends GenerativeOperation = GenerativeOperation> = readonly GenerativeRequestParameter<Operation>[];
|
|
18
|
-
export declare const GENERATIVE_OPERATION_LIMIT_KEYS: readonly ["maxRequestBytes", "maxOutputBytes", "maxPromptChars", "maxNegativePromptChars", "maxN", "maxWidth", "maxHeight", "maxPixels", "minDurationSeconds", "maxDurationSeconds", "maxSampleRate", "maxSteps"];
|
|
19
|
+
export declare const GENERATIVE_OPERATION_LIMIT_KEYS: readonly ["maxRequestBytes", "maxOutputBytes", "maxPromptChars", "maxNegativePromptChars", "maxN", "minWidth", "maxWidth", "minHeight", "maxHeight", "maxPixels", "minDurationSeconds", "maxDurationSeconds", "maxSampleRate", "minFps", "maxFps", "minVideoFrames", "maxVideoFrames", "maxSteps", "maxHighNoiseSteps"];
|
|
19
20
|
export type GenerativeOperationLimitKey = (typeof GENERATIVE_OPERATION_LIMIT_KEYS)[number];
|
|
20
21
|
export interface GenerativeOperationLimits {
|
|
21
22
|
maxRequestBytes?: number;
|
|
@@ -23,13 +24,20 @@ export interface GenerativeOperationLimits {
|
|
|
23
24
|
maxPromptChars?: number;
|
|
24
25
|
maxNegativePromptChars?: number;
|
|
25
26
|
maxN?: number;
|
|
27
|
+
minWidth?: number;
|
|
26
28
|
maxWidth?: number;
|
|
29
|
+
minHeight?: number;
|
|
27
30
|
maxHeight?: number;
|
|
28
31
|
maxPixels?: number;
|
|
29
32
|
minDurationSeconds?: number;
|
|
30
33
|
maxDurationSeconds?: number;
|
|
31
34
|
maxSampleRate?: number;
|
|
35
|
+
minFps?: number;
|
|
36
|
+
maxFps?: number;
|
|
37
|
+
minVideoFrames?: number;
|
|
38
|
+
maxVideoFrames?: number;
|
|
32
39
|
maxSteps?: number;
|
|
40
|
+
maxHighNoiseSteps?: number;
|
|
33
41
|
}
|
|
34
42
|
export interface SelfHostedGenerativeOperation<Operation extends GenerativeOperation = GenerativeOperation> {
|
|
35
43
|
operation: Operation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerativeOperation.d.ts","sourceRoot":"","sources":["../../src/llm/GenerativeOperation.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"GenerativeOperation.d.ts","sourceRoot":"","sources":["../../src/llm/GenerativeOperation.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,gGAKxB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzE,eAAO,MAAM,qBAAqB,8CAA+C,CAAC;AAElF,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,MAAM,MAAM,uBAAuB,GAAG,IAAI,MAAM,EAAE,CAAC;AACnD,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAE/C,eAAO,MAAM,kCAAkC,EAAE,QAAQ,CACvD,MAAM,CAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAMrD,CAAC;AAEF,eAAO,MAAM,uCAAuC;;;;;CAgDe,CAAC;AAEpE,MAAM,MAAM,qCAAqC,GAAG;KACjD,SAAS,IAAI,mBAAmB,GAC/B,CAAC,OAAO,uCAAuC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;CACtE,CAAC;AAEF,MAAM,MAAM,0BAA0B,CACpC,SAAS,SAAS,mBAAmB,GAAG,mBAAmB,IACzD,qCAAqC,CAAC,SAAS,CAAC,CAAC;AAErD,MAAM,MAAM,mCAAmC,CAC7C,SAAS,SAAS,mBAAmB,GAAG,mBAAmB,IACzD,SAAS,0BAA0B,CAAC,SAAS,CAAC,EAAE,CAAC;AAErD,eAAO,MAAM,+BAA+B,yTAoBlC,CAAC;AAEX,MAAM,MAAM,2BAA2B,GAAG,CAAC,OAAO,+BAA+B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3F,MAAM,WAAW,yBAA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AAO,GAAG,mBAAmB,GAAG,SAAS,CAG5F;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CAG1F;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,GACb,kBAAkB,EAAE,GAAG,SAAS,CAUlC;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,uBAAuB,CAc1F;AAED,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,OAAO,GACb,uBAAuB,GAAG,SAAS,CAErC;AAmFD,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,OAAO,GACb,6BAA6B,GAAG,SAAS,CA6C3C"}
|
|
@@ -2,12 +2,14 @@ export const GENERATIVE_OPERATIONS = [
|
|
|
2
2
|
"chat.completions",
|
|
3
3
|
"images.generations",
|
|
4
4
|
"audio.generations",
|
|
5
|
+
"videos.generations",
|
|
5
6
|
];
|
|
6
|
-
export const GENERATIVE_MODALITIES = ["text", "image", "audio"];
|
|
7
|
+
export const GENERATIVE_MODALITIES = ["text", "image", "audio", "video"];
|
|
7
8
|
export const GENERATIVE_OPERATION_DEFAULT_PATHS = {
|
|
8
9
|
"chat.completions": "/v1/chat/completions",
|
|
9
10
|
"images.generations": "/v1/images/generations",
|
|
10
11
|
"audio.generations": "/v1/audio/generations",
|
|
12
|
+
"videos.generations": "/v1/videos/generations",
|
|
11
13
|
};
|
|
12
14
|
export const GENERATIVE_REQUEST_PARAMETER_ALLOWLISTS = {
|
|
13
15
|
"chat.completions": [
|
|
@@ -43,6 +45,20 @@ export const GENERATIVE_REQUEST_PARAMETER_ALLOWLISTS = {
|
|
|
43
45
|
"negative_prompt",
|
|
44
46
|
"sample_rate",
|
|
45
47
|
],
|
|
48
|
+
"videos.generations": [
|
|
49
|
+
"model",
|
|
50
|
+
"prompt",
|
|
51
|
+
"duration_seconds",
|
|
52
|
+
"fps",
|
|
53
|
+
"video_frames",
|
|
54
|
+
"response_format",
|
|
55
|
+
"n",
|
|
56
|
+
"size",
|
|
57
|
+
"seed",
|
|
58
|
+
"steps",
|
|
59
|
+
"high_noise_steps",
|
|
60
|
+
"negative_prompt",
|
|
61
|
+
],
|
|
46
62
|
};
|
|
47
63
|
export const GENERATIVE_OPERATION_LIMIT_KEYS = [
|
|
48
64
|
"maxRequestBytes",
|
|
@@ -50,13 +66,20 @@ export const GENERATIVE_OPERATION_LIMIT_KEYS = [
|
|
|
50
66
|
"maxPromptChars",
|
|
51
67
|
"maxNegativePromptChars",
|
|
52
68
|
"maxN",
|
|
69
|
+
"minWidth",
|
|
53
70
|
"maxWidth",
|
|
71
|
+
"minHeight",
|
|
54
72
|
"maxHeight",
|
|
55
73
|
"maxPixels",
|
|
56
74
|
"minDurationSeconds",
|
|
57
75
|
"maxDurationSeconds",
|
|
58
76
|
"maxSampleRate",
|
|
77
|
+
"minFps",
|
|
78
|
+
"maxFps",
|
|
79
|
+
"minVideoFrames",
|
|
80
|
+
"maxVideoFrames",
|
|
59
81
|
"maxSteps",
|
|
82
|
+
"maxHighNoiseSteps",
|
|
60
83
|
];
|
|
61
84
|
const OPERATION_ALIASES = {
|
|
62
85
|
chat: "chat.completions",
|
|
@@ -80,6 +103,15 @@ const OPERATION_ALIASES = {
|
|
|
80
103
|
"audio-generation": "audio.generations",
|
|
81
104
|
"audio-generations": "audio.generations",
|
|
82
105
|
"/v1/audio/generations": "audio.generations",
|
|
106
|
+
video: "videos.generations",
|
|
107
|
+
videos: "videos.generations",
|
|
108
|
+
"video.generation": "videos.generations",
|
|
109
|
+
"videos.generation": "videos.generations",
|
|
110
|
+
"videos.generations": "videos.generations",
|
|
111
|
+
"video-generation": "videos.generations",
|
|
112
|
+
"video-generations": "videos.generations",
|
|
113
|
+
"/v1/video/generations": "videos.generations",
|
|
114
|
+
"/v1/videos/generations": "videos.generations",
|
|
83
115
|
};
|
|
84
116
|
const MODALITY_ALIASES = {
|
|
85
117
|
text: "text",
|
|
@@ -87,11 +119,14 @@ const MODALITY_ALIASES = {
|
|
|
87
119
|
image: "image",
|
|
88
120
|
images: "image",
|
|
89
121
|
audio: "audio",
|
|
122
|
+
video: "video",
|
|
123
|
+
videos: "video",
|
|
90
124
|
};
|
|
91
125
|
const REQUEST_PARAMETER_SETS = {
|
|
92
126
|
"chat.completions": new Set(GENERATIVE_REQUEST_PARAMETER_ALLOWLISTS["chat.completions"]),
|
|
93
127
|
"images.generations": new Set(GENERATIVE_REQUEST_PARAMETER_ALLOWLISTS["images.generations"]),
|
|
94
128
|
"audio.generations": new Set(GENERATIVE_REQUEST_PARAMETER_ALLOWLISTS["audio.generations"]),
|
|
129
|
+
"videos.generations": new Set(GENERATIVE_REQUEST_PARAMETER_ALLOWLISTS["videos.generations"]),
|
|
95
130
|
};
|
|
96
131
|
const LIMIT_KEY_SET = new Set(GENERATIVE_OPERATION_LIMIT_KEYS);
|
|
97
132
|
const STRICT_ORIGIN_RELATIVE_PATH = /^\/[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)*$/;
|