mulmocast 0.1.3 → 0.1.4
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/lib/actions/audio.js +5 -13
- package/lib/actions/image_agents.d.ts +27 -3
- package/lib/actions/image_agents.js +5 -2
- package/lib/actions/images.d.ts +9 -1
- package/lib/actions/images.js +22 -11
- package/lib/agents/image_google_agent.js +2 -2
- package/lib/agents/image_openai_agent.js +2 -2
- package/lib/agents/movie_replicate_agent.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/methods/mulmo_presentation_style.d.ts +1 -1
- package/lib/methods/mulmo_presentation_style.js +17 -17
- package/lib/types/schema.d.ts +243 -222
- package/lib/types/schema.js +10 -8
- package/lib/utils/const.d.ts +0 -1
- package/lib/utils/const.js +0 -1
- package/lib/utils/context.d.ts +12 -11
- package/lib/utils/preprocess.d.ts +7 -6
- package/lib/utils/provider2agent.d.ts +72 -0
- package/lib/utils/provider2agent.js +81 -0
- package/lib/utils/utils.d.ts +6 -11
- package/lib/utils/utils.js +5 -26
- package/package.json +1 -1
package/lib/types/schema.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { htmlLLMProvider, provider2TTSAgent, provider2ImageAgent, provider2MovieAgent, defaultProviders } from "../utils/provider2agent.js";
|
|
2
3
|
export const langSchema = z.string();
|
|
3
4
|
const URLStringSchema = z.string().url();
|
|
4
5
|
export const localizedTextSchema = z
|
|
@@ -20,7 +21,7 @@ export const speechOptionsSchema = z
|
|
|
20
21
|
})
|
|
21
22
|
.strict();
|
|
22
23
|
const speakerIdSchema = z.string();
|
|
23
|
-
export const text2SpeechProviderSchema = z.enum(
|
|
24
|
+
export const text2SpeechProviderSchema = z.enum(Object.keys(provider2TTSAgent)).default(defaultProviders.tts);
|
|
24
25
|
export const speakerDataSchema = z
|
|
25
26
|
.object({
|
|
26
27
|
displayName: z.record(langSchema, z.string()).optional(),
|
|
@@ -165,19 +166,19 @@ export const mulmoFillOptionSchema = z
|
|
|
165
166
|
style: z.enum(["aspectFit", "aspectFill"]).default("aspectFit"),
|
|
166
167
|
})
|
|
167
168
|
.describe("How to handle aspect ratio differences between image and canvas");
|
|
168
|
-
export const text2ImageProviderSchema = z.enum(
|
|
169
|
+
export const text2ImageProviderSchema = z.enum(Object.keys(provider2ImageAgent)).default(defaultProviders.text2image);
|
|
169
170
|
// NOTE: This is for UI only. (until we figure out how to use it in mulmoImageParamsSchema)
|
|
170
171
|
export const mulmoOpenAIImageModelSchema = z
|
|
171
172
|
.object({
|
|
172
173
|
provider: z.literal("openai"),
|
|
173
|
-
model: z.enum(["
|
|
174
|
+
model: z.enum(provider2ImageAgent["openai"].models).optional(),
|
|
174
175
|
})
|
|
175
176
|
.strict();
|
|
176
177
|
// NOTE: This is for UI only. (until we figure out how to use it in mulmoImageParamsSchema)
|
|
177
178
|
export const mulmoGoogleImageModelSchema = z
|
|
178
179
|
.object({
|
|
179
180
|
provider: z.literal("google"),
|
|
180
|
-
model: z.enum(["
|
|
181
|
+
model: z.enum(provider2ImageAgent["google"].models).optional(),
|
|
181
182
|
})
|
|
182
183
|
.strict();
|
|
183
184
|
export const mulmoImageParamsSchema = z
|
|
@@ -238,6 +239,7 @@ export const mulmoBeatSchema = z
|
|
|
238
239
|
audioParams: beatAudioParamsSchema.optional(), // beat specific parameters
|
|
239
240
|
movieParams: z
|
|
240
241
|
.object({
|
|
242
|
+
model: z.string().optional(),
|
|
241
243
|
fillOption: mulmoFillOptionSchema.optional(),
|
|
242
244
|
speed: z.number().optional().describe("Speed of the video. 1.0 is normal speed. 0.5 is half speed. 2.0 is double speed."),
|
|
243
245
|
})
|
|
@@ -271,20 +273,20 @@ export const mulmoSpeechParamsSchema = z
|
|
|
271
273
|
speakers: speakerDictionarySchema,
|
|
272
274
|
})
|
|
273
275
|
.strict();
|
|
274
|
-
export const text2HtmlImageProviderSchema = z.enum(
|
|
275
|
-
export const text2MovieProviderSchema = z.enum(
|
|
276
|
+
export const text2HtmlImageProviderSchema = z.enum(htmlLLMProvider).default(defaultProviders.text2Html);
|
|
277
|
+
export const text2MovieProviderSchema = z.enum(Object.keys(provider2MovieAgent)).default(defaultProviders.text2movie);
|
|
276
278
|
// NOTE: This is UI only. (until we figure out how to use it in mulmoMovieParamsSchema)
|
|
277
279
|
export const mulmoGoogleMovieModelSchema = z
|
|
278
280
|
.object({
|
|
279
281
|
provider: z.literal("google"),
|
|
280
|
-
model: z.enum(
|
|
282
|
+
model: z.enum(provider2MovieAgent.google.models).optional(),
|
|
281
283
|
})
|
|
282
284
|
.strict();
|
|
283
285
|
// NOTE: This is UI only. (until we figure out how to use it in mulmoMovieParamsSchema)
|
|
284
286
|
export const mulmoReplicateMovieModelSchema = z
|
|
285
287
|
.object({
|
|
286
288
|
provider: z.literal("replicate"),
|
|
287
|
-
model: z.enum(
|
|
289
|
+
model: z.enum(provider2MovieAgent.replicate.models).optional(),
|
|
288
290
|
})
|
|
289
291
|
.strict();
|
|
290
292
|
export const mulmoTransitionSchema = z.object({
|
package/lib/utils/const.d.ts
CHANGED
package/lib/utils/const.js
CHANGED
package/lib/utils/context.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
49
49
|
height: number;
|
|
50
50
|
};
|
|
51
51
|
speechParams: {
|
|
52
|
-
provider:
|
|
52
|
+
provider: string;
|
|
53
53
|
speakers: Record<string, {
|
|
54
54
|
voiceId: string;
|
|
55
55
|
displayName?: Record<string, string> | undefined;
|
|
@@ -57,7 +57,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
57
57
|
speed?: number | undefined;
|
|
58
58
|
instruction?: string | undefined;
|
|
59
59
|
} | undefined;
|
|
60
|
-
provider?:
|
|
60
|
+
provider?: string | undefined;
|
|
61
61
|
}>;
|
|
62
62
|
};
|
|
63
63
|
beats: {
|
|
@@ -196,7 +196,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
196
196
|
imagePrompt?: string | undefined;
|
|
197
197
|
description?: string | undefined;
|
|
198
198
|
imageParams?: {
|
|
199
|
-
provider:
|
|
199
|
+
provider: string;
|
|
200
200
|
style?: string | undefined;
|
|
201
201
|
model?: string | undefined;
|
|
202
202
|
moderation?: string | undefined;
|
|
@@ -225,6 +225,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
225
225
|
} | undefined;
|
|
226
226
|
movieParams?: {
|
|
227
227
|
speed?: number | undefined;
|
|
228
|
+
model?: string | undefined;
|
|
228
229
|
fillOption?: {
|
|
229
230
|
style: "aspectFit" | "aspectFill";
|
|
230
231
|
} | undefined;
|
|
@@ -252,7 +253,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
252
253
|
title?: string | undefined;
|
|
253
254
|
description?: string | undefined;
|
|
254
255
|
imageParams?: {
|
|
255
|
-
provider:
|
|
256
|
+
provider: string;
|
|
256
257
|
style?: string | undefined;
|
|
257
258
|
model?: string | undefined;
|
|
258
259
|
moderation?: string | undefined;
|
|
@@ -277,7 +278,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
277
278
|
}> | undefined;
|
|
278
279
|
} | undefined;
|
|
279
280
|
movieParams?: {
|
|
280
|
-
provider?:
|
|
281
|
+
provider?: string | undefined;
|
|
281
282
|
model?: string | undefined;
|
|
282
283
|
fillOption?: {
|
|
283
284
|
style: "aspectFit" | "aspectFill";
|
|
@@ -288,7 +289,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
288
289
|
} | undefined;
|
|
289
290
|
} | undefined;
|
|
290
291
|
htmlImageParams?: {
|
|
291
|
-
provider:
|
|
292
|
+
provider: string;
|
|
292
293
|
model?: string | undefined;
|
|
293
294
|
} | undefined;
|
|
294
295
|
textSlideParams?: {
|
|
@@ -363,7 +364,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
363
364
|
height: number;
|
|
364
365
|
};
|
|
365
366
|
speechParams: {
|
|
366
|
-
provider:
|
|
367
|
+
provider: string;
|
|
367
368
|
speakers: Record<string, {
|
|
368
369
|
voiceId: string;
|
|
369
370
|
displayName?: Record<string, string> | undefined;
|
|
@@ -371,11 +372,11 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
371
372
|
speed?: number | undefined;
|
|
372
373
|
instruction?: string | undefined;
|
|
373
374
|
} | undefined;
|
|
374
|
-
provider?:
|
|
375
|
+
provider?: string | undefined;
|
|
375
376
|
}>;
|
|
376
377
|
};
|
|
377
378
|
imageParams?: {
|
|
378
|
-
provider:
|
|
379
|
+
provider: string;
|
|
379
380
|
style?: string | undefined;
|
|
380
381
|
model?: string | undefined;
|
|
381
382
|
moderation?: string | undefined;
|
|
@@ -400,7 +401,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
400
401
|
}> | undefined;
|
|
401
402
|
} | undefined;
|
|
402
403
|
movieParams?: {
|
|
403
|
-
provider?:
|
|
404
|
+
provider?: string | undefined;
|
|
404
405
|
model?: string | undefined;
|
|
405
406
|
fillOption?: {
|
|
406
407
|
style: "aspectFit" | "aspectFill";
|
|
@@ -411,7 +412,7 @@ export declare const initializeContextFromFiles: (files: FileObject, raiseError:
|
|
|
411
412
|
} | undefined;
|
|
412
413
|
} | undefined;
|
|
413
414
|
htmlImageParams?: {
|
|
414
|
-
provider:
|
|
415
|
+
provider: string;
|
|
415
416
|
model?: string | undefined;
|
|
416
417
|
} | undefined;
|
|
417
418
|
textSlideParams?: {
|
|
@@ -44,7 +44,7 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
44
44
|
height: number;
|
|
45
45
|
};
|
|
46
46
|
speechParams: {
|
|
47
|
-
provider:
|
|
47
|
+
provider: string;
|
|
48
48
|
speakers: Record<string, {
|
|
49
49
|
voiceId: string;
|
|
50
50
|
displayName?: Record<string, string> | undefined;
|
|
@@ -52,7 +52,7 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
52
52
|
speed?: number | undefined;
|
|
53
53
|
instruction?: string | undefined;
|
|
54
54
|
} | undefined;
|
|
55
|
-
provider?:
|
|
55
|
+
provider?: string | undefined;
|
|
56
56
|
}>;
|
|
57
57
|
};
|
|
58
58
|
beats: {
|
|
@@ -191,7 +191,7 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
191
191
|
imagePrompt?: string | undefined;
|
|
192
192
|
description?: string | undefined;
|
|
193
193
|
imageParams?: {
|
|
194
|
-
provider:
|
|
194
|
+
provider: string;
|
|
195
195
|
style?: string | undefined;
|
|
196
196
|
model?: string | undefined;
|
|
197
197
|
moderation?: string | undefined;
|
|
@@ -220,6 +220,7 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
220
220
|
} | undefined;
|
|
221
221
|
movieParams?: {
|
|
222
222
|
speed?: number | undefined;
|
|
223
|
+
model?: string | undefined;
|
|
223
224
|
fillOption?: {
|
|
224
225
|
style: "aspectFit" | "aspectFill";
|
|
225
226
|
} | undefined;
|
|
@@ -247,7 +248,7 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
247
248
|
title?: string | undefined;
|
|
248
249
|
description?: string | undefined;
|
|
249
250
|
imageParams?: {
|
|
250
|
-
provider:
|
|
251
|
+
provider: string;
|
|
251
252
|
style?: string | undefined;
|
|
252
253
|
model?: string | undefined;
|
|
253
254
|
moderation?: string | undefined;
|
|
@@ -272,7 +273,7 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
272
273
|
}> | undefined;
|
|
273
274
|
} | undefined;
|
|
274
275
|
movieParams?: {
|
|
275
|
-
provider?:
|
|
276
|
+
provider?: string | undefined;
|
|
276
277
|
model?: string | undefined;
|
|
277
278
|
fillOption?: {
|
|
278
279
|
style: "aspectFit" | "aspectFill";
|
|
@@ -283,7 +284,7 @@ export declare const createOrUpdateStudioData: (_mulmoScript: MulmoScript, curre
|
|
|
283
284
|
} | undefined;
|
|
284
285
|
} | undefined;
|
|
285
286
|
htmlImageParams?: {
|
|
286
|
-
provider:
|
|
287
|
+
provider: string;
|
|
287
288
|
model?: string | undefined;
|
|
288
289
|
} | undefined;
|
|
289
290
|
textSlideParams?: {
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare const defaultProviders: {
|
|
2
|
+
tts: string;
|
|
3
|
+
text2image: string;
|
|
4
|
+
text2movie: string;
|
|
5
|
+
text2Html: string;
|
|
6
|
+
llm: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const provider2TTSAgent: {
|
|
9
|
+
nijivoice: {
|
|
10
|
+
agentName: string;
|
|
11
|
+
hasLimitedConcurrency: boolean;
|
|
12
|
+
};
|
|
13
|
+
openai: {
|
|
14
|
+
agentName: string;
|
|
15
|
+
hasLimitedConcurrency: boolean;
|
|
16
|
+
};
|
|
17
|
+
google: {
|
|
18
|
+
agentName: string;
|
|
19
|
+
hasLimitedConcurrency: boolean;
|
|
20
|
+
};
|
|
21
|
+
elevenlabs: {
|
|
22
|
+
agentName: string;
|
|
23
|
+
hasLimitedConcurrency: boolean;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export declare const provider2ImageAgent: {
|
|
27
|
+
openai: {
|
|
28
|
+
agentName: string;
|
|
29
|
+
defaultModel: string;
|
|
30
|
+
models: string[];
|
|
31
|
+
};
|
|
32
|
+
google: {
|
|
33
|
+
agentName: string;
|
|
34
|
+
defaultModel: string;
|
|
35
|
+
models: string[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export declare const provider2MovieAgent: {
|
|
39
|
+
replicate: {
|
|
40
|
+
agentName: string;
|
|
41
|
+
models: string[];
|
|
42
|
+
};
|
|
43
|
+
google: {
|
|
44
|
+
agentName: string;
|
|
45
|
+
models: string[];
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export declare const provider2LLMAgent: {
|
|
49
|
+
readonly openai: {
|
|
50
|
+
readonly agentName: "openAIAgent";
|
|
51
|
+
readonly defaultModel: "gpt-4o";
|
|
52
|
+
readonly max_tokens: 8192;
|
|
53
|
+
};
|
|
54
|
+
readonly anthropic: {
|
|
55
|
+
readonly agentName: "anthropicAgent";
|
|
56
|
+
readonly defaultModel: "claude-3-7-sonnet-20250219";
|
|
57
|
+
readonly max_tokens: 8192;
|
|
58
|
+
};
|
|
59
|
+
readonly gemini: {
|
|
60
|
+
readonly agentName: "geminiAgent";
|
|
61
|
+
readonly defaultModel: "gemini-1.5-flash";
|
|
62
|
+
readonly max_tokens: 8192;
|
|
63
|
+
};
|
|
64
|
+
readonly groq: {
|
|
65
|
+
readonly agentName: "groqAgent";
|
|
66
|
+
readonly defaultModel: "llama3-8b-8192";
|
|
67
|
+
readonly max_tokens: 4096;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
export declare const llm: (keyof typeof provider2LLMAgent)[];
|
|
71
|
+
export type LLM = keyof typeof provider2LLMAgent;
|
|
72
|
+
export declare const htmlLLMProvider: string[];
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export const defaultProviders = {
|
|
2
|
+
tts: "openai",
|
|
3
|
+
text2image: "openai",
|
|
4
|
+
text2movie: "google",
|
|
5
|
+
text2Html: "openai",
|
|
6
|
+
llm: "openai",
|
|
7
|
+
};
|
|
8
|
+
export const provider2TTSAgent = {
|
|
9
|
+
nijivoice: {
|
|
10
|
+
agentName: "ttsNijivoiceAgent",
|
|
11
|
+
hasLimitedConcurrency: true,
|
|
12
|
+
},
|
|
13
|
+
openai: {
|
|
14
|
+
agentName: "ttsOpenaiAgent",
|
|
15
|
+
hasLimitedConcurrency: false,
|
|
16
|
+
},
|
|
17
|
+
google: {
|
|
18
|
+
agentName: "ttsGoogleAgent",
|
|
19
|
+
hasLimitedConcurrency: false,
|
|
20
|
+
},
|
|
21
|
+
elevenlabs: {
|
|
22
|
+
agentName: "ttsElevenlabsAgent",
|
|
23
|
+
hasLimitedConcurrency: true,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export const provider2ImageAgent = {
|
|
27
|
+
openai: {
|
|
28
|
+
agentName: "imageOpenaiAgent",
|
|
29
|
+
defaultModel: "gpt-image-1",
|
|
30
|
+
models: ["dall-e-3", "gpt-image-1"],
|
|
31
|
+
},
|
|
32
|
+
google: {
|
|
33
|
+
agentName: "imageGoogleAgent",
|
|
34
|
+
defaultModel: "imagen-3.0-fast-generate-001",
|
|
35
|
+
models: ["imagen-3.0-fast-generate-001", "imagen-3.0-generate-002", "imagen-3.0-capability-001"],
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
export const provider2MovieAgent = {
|
|
39
|
+
replicate: {
|
|
40
|
+
agentName: "movieReplicateAgent",
|
|
41
|
+
models: [
|
|
42
|
+
"bytedance/seedance-1-lite",
|
|
43
|
+
"bytedance/seedance-1-pro",
|
|
44
|
+
"kwaivgi/kling-v1.6-pro",
|
|
45
|
+
"kwaivgi/kling-v2.1",
|
|
46
|
+
"google/veo-2",
|
|
47
|
+
"google/veo-3",
|
|
48
|
+
"google/veo-3-fast",
|
|
49
|
+
"minimax/video-01",
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
google: {
|
|
53
|
+
agentName: "movieGoogleAgent",
|
|
54
|
+
models: ["veo-2.0-generate-001"],
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
// : Record<LLM, { agent: string; defaultModel: string; max_tokens: number }>
|
|
58
|
+
export const provider2LLMAgent = {
|
|
59
|
+
openai: {
|
|
60
|
+
agentName: "openAIAgent",
|
|
61
|
+
defaultModel: "gpt-4o",
|
|
62
|
+
max_tokens: 8192,
|
|
63
|
+
},
|
|
64
|
+
anthropic: {
|
|
65
|
+
agentName: "anthropicAgent",
|
|
66
|
+
defaultModel: "claude-3-7-sonnet-20250219",
|
|
67
|
+
max_tokens: 8192,
|
|
68
|
+
},
|
|
69
|
+
gemini: {
|
|
70
|
+
agentName: "geminiAgent",
|
|
71
|
+
defaultModel: "gemini-1.5-flash",
|
|
72
|
+
max_tokens: 8192,
|
|
73
|
+
},
|
|
74
|
+
groq: {
|
|
75
|
+
agentName: "groqAgent",
|
|
76
|
+
defaultModel: "llama3-8b-8192",
|
|
77
|
+
max_tokens: 4096,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
export const llm = Object.keys(provider2LLMAgent);
|
|
81
|
+
export const htmlLLMProvider = ["openai", "anthropic"];
|
package/lib/utils/utils.d.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { MulmoBeat, MulmoStudioMultiLingualData } from "../types/index.js";
|
|
2
1
|
import type { ConfigDataDictionary, DefaultConfigData } from "graphai";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
defaultModel: string;
|
|
8
|
-
max_tokens: number;
|
|
9
|
-
}>;
|
|
2
|
+
import { MulmoBeat, MulmoStudioMultiLingualData } from "../types/index.js";
|
|
3
|
+
import { llm } from "./provider2agent.js";
|
|
4
|
+
import type { LLM } from "./provider2agent.js";
|
|
5
|
+
export { LLM, llm };
|
|
10
6
|
export declare const llmPair: (_llm?: LLM, _model?: string) => {
|
|
11
|
-
agent:
|
|
7
|
+
agent: "openAIAgent" | "anthropicAgent" | "geminiAgent" | "groqAgent";
|
|
12
8
|
model: string;
|
|
13
|
-
max_tokens:
|
|
9
|
+
max_tokens: 8192 | 4096;
|
|
14
10
|
};
|
|
15
11
|
export declare const chunkArray: <T>(array: T[], size?: number) => T[][];
|
|
16
12
|
export declare const isHttp: (fileOrUrl: string) => boolean;
|
|
@@ -26,4 +22,3 @@ type CleanableObject = {
|
|
|
26
22
|
[key: string]: CleanableValue;
|
|
27
23
|
};
|
|
28
24
|
export declare const deepClean: <T extends CleanableValue>(input: T) => T | undefined;
|
|
29
|
-
export {};
|
package/lib/utils/utils.js
CHANGED
|
@@ -1,32 +1,11 @@
|
|
|
1
1
|
import * as crypto from "crypto";
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
openai: {
|
|
5
|
-
agent: "openAIAgent",
|
|
6
|
-
defaultModel: "gpt-4o",
|
|
7
|
-
max_tokens: 8192,
|
|
8
|
-
},
|
|
9
|
-
anthropic: {
|
|
10
|
-
agent: "anthropicAgent",
|
|
11
|
-
defaultModel: "claude-3-7-sonnet-20250219",
|
|
12
|
-
max_tokens: 8192,
|
|
13
|
-
},
|
|
14
|
-
gemini: {
|
|
15
|
-
agent: "geminiAgent",
|
|
16
|
-
defaultModel: "gemini-1.5-flash",
|
|
17
|
-
max_tokens: 8192,
|
|
18
|
-
},
|
|
19
|
-
groq: {
|
|
20
|
-
agent: "groqAgent",
|
|
21
|
-
defaultModel: "llama3-8b-8192",
|
|
22
|
-
max_tokens: 4096,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
2
|
+
import { provider2LLMAgent, llm } from "./provider2agent.js";
|
|
3
|
+
export { llm };
|
|
25
4
|
export const llmPair = (_llm, _model) => {
|
|
26
5
|
const llmKey = _llm ?? "openai";
|
|
27
|
-
const agent =
|
|
28
|
-
const model = _model ??
|
|
29
|
-
const max_tokens =
|
|
6
|
+
const agent = provider2LLMAgent[llmKey]?.agentName ?? provider2LLMAgent.openai.agentName;
|
|
7
|
+
const model = _model ?? provider2LLMAgent[llmKey]?.defaultModel ?? provider2LLMAgent.openai.defaultModel;
|
|
8
|
+
const max_tokens = provider2LLMAgent[llmKey]?.max_tokens ?? provider2LLMAgent.openai.max_tokens;
|
|
30
9
|
return { agent, model, max_tokens };
|
|
31
10
|
};
|
|
32
11
|
export const chunkArray = (array, size = 3) => {
|