mulmocast 2.6.11 → 2.6.12
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/README.md +2 -2
- package/lib/agents/image_genai_agent.d.ts +1 -0
- package/lib/agents/image_genai_agent.js +15 -3
- package/lib/types/provider2agent.d.ts +10 -0
- package/lib/types/provider2agent.js +15 -8
- package/lib/utils/ffmpeg_utils.d.ts +4 -2
- package/lib/utils/ffmpeg_utils.js +1 -1
- package/package.json +4 -5
- package/scripts/test/test_genai.json +4 -9
- package/scripts/test/test_images_imagen_deprecated.json +55 -0
- package/scripts/test/test_vertexai.json +18 -18
- package/scripts/test/test_vertexai_simple.json +1 -1
package/README.md
CHANGED
|
@@ -139,7 +139,7 @@ BROWSERLESS_API_TOKEN=your_browserless_api_token # to access web in mulmo tool
|
|
|
139
139
|
|
|
140
140
|
### Google Vertex AI
|
|
141
141
|
|
|
142
|
-
For enterprise/production environments or to
|
|
142
|
+
For enterprise/production environments, or to use Veo movie models that are only available on Vertex AI, use Vertex AI with Application Default Credentials (ADC):
|
|
143
143
|
|
|
144
144
|
```bash
|
|
145
145
|
# Install gcloud CLI and authenticate
|
|
@@ -151,7 +151,7 @@ Configure in MulmoScript:
|
|
|
151
151
|
{
|
|
152
152
|
"imageParams": {
|
|
153
153
|
"provider": "google",
|
|
154
|
-
"model": "
|
|
154
|
+
"model": "gemini-2.5-flash-image",
|
|
155
155
|
"vertexai_project": "your-project-id",
|
|
156
156
|
"vertexai_location": "us-central1"
|
|
157
157
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AgentFunction, AgentFunctionInfo } from "graphai";
|
|
2
2
|
import type { AgentBufferResult, ImageAgentInputs, ImageAgentParams, GenAIImageAgentConfig } from "../types/agent.js";
|
|
3
|
+
export declare const buildDeprecatedGoogleImageModelMessage: (model: string) => string | null;
|
|
3
4
|
export declare const imageGenAIAgent: AgentFunction<ImageAgentParams, AgentBufferResult, ImageAgentInputs, GenAIImageAgentConfig>;
|
|
4
5
|
declare const imageGenAIAgentInfo: AgentFunctionInfo;
|
|
5
6
|
export default imageGenAIAgentInfo;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import { GraphAILogger } from "graphai";
|
|
3
|
-
import { provider2ImageAgent } from "../types/provider2agent.js";
|
|
4
|
-
import { apiKeyMissingError, agentIncorrectAPIKeyError, agentGenerationError, agentInvalidResponseError, imageAction, imageFileTarget, hasCause, getGenAIErrorReason, resultify, } from "../utils/error_cause.js";
|
|
3
|
+
import { provider2ImageAgent, deprecatedGoogleImageModelHints, vertexAIGlobalOnlyImageModels, } from "../types/provider2agent.js";
|
|
4
|
+
import { apiKeyMissingError, agentIncorrectAPIKeyError, agentGenerationError, agentInvalidResponseError, imageAction, imageFileTarget, unsupportedModelTarget, hasCause, getGenAIErrorReason, resultify, } from "../utils/error_cause.js";
|
|
5
5
|
import { getAspectRatio } from "../utils/utils.js";
|
|
6
6
|
import { ASPECT_RATIOS, PRO_ASPECT_RATIOS } from "../types/const.js";
|
|
7
7
|
import { GoogleGenAI, PersonGeneration } from "@google/genai";
|
|
8
|
+
const isDeprecatedGoogleImageModel = (model) => model in deprecatedGoogleImageModelHints;
|
|
9
|
+
export const buildDeprecatedGoogleImageModelMessage = (model) => {
|
|
10
|
+
if (!isDeprecatedGoogleImageModel(model))
|
|
11
|
+
return null;
|
|
12
|
+
return `Google image model "${model}" is no longer available. ${deprecatedGoogleImageModelHints[model]}`;
|
|
13
|
+
};
|
|
8
14
|
const getGeminiContents = (prompt, referenceImages) => {
|
|
9
15
|
const contents = [{ text: prompt }];
|
|
10
16
|
const images = [...(referenceImages ?? [])];
|
|
@@ -58,11 +64,17 @@ const errorProcess = (error) => {
|
|
|
58
64
|
export const imageGenAIAgent = async ({ namedInputs, params, config, }) => {
|
|
59
65
|
const { prompt, referenceImages } = namedInputs;
|
|
60
66
|
const model = params.model ?? provider2ImageAgent["google"].defaultModel;
|
|
67
|
+
const deprecatedMessage = buildDeprecatedGoogleImageModelMessage(model);
|
|
68
|
+
if (deprecatedMessage) {
|
|
69
|
+
throw new Error(deprecatedMessage, {
|
|
70
|
+
cause: agentGenerationError("imageGenAIAgent", imageAction, unsupportedModelTarget),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
61
73
|
const apiKey = config?.apiKey;
|
|
62
74
|
const ai = params.vertexai_project
|
|
63
75
|
? (() => {
|
|
64
76
|
const location = params.vertexai_location ?? "us-central1";
|
|
65
|
-
if (model
|
|
77
|
+
if (vertexAIGlobalOnlyImageModels.has(model) && location !== "global") {
|
|
66
78
|
GraphAILogger.warn(`imageGenAIAgent: model "${model}" on Vertex AI is only available in location "global", but got "${location}". Set imageParams.vertexai_location to "global".`);
|
|
67
79
|
}
|
|
68
80
|
return new GoogleGenAI({ vertexai: true, project: params.vertexai_project, location });
|
|
@@ -47,6 +47,16 @@ export declare const deprecatedOpenAIImageModelHints: {
|
|
|
47
47
|
readonly "dall-e-3": "Use 'gpt-image-1' or another supported model.";
|
|
48
48
|
};
|
|
49
49
|
export type DeprecatedOpenAIImageModel = keyof typeof deprecatedOpenAIImageModelHints;
|
|
50
|
+
export declare const deprecatedGoogleImageModelHints: {
|
|
51
|
+
readonly "imagen-3.0-generate-002": "Use 'gemini-2.5-flash-image' or 'gemini-3-pro-image-preview' instead.";
|
|
52
|
+
readonly "imagen-4.0-generate-001": "Use 'gemini-2.5-flash-image' or 'gemini-3-pro-image-preview' instead.";
|
|
53
|
+
readonly "imagen-4.0-ultra-generate-001": "Use 'gemini-2.5-flash-image' or 'gemini-3-pro-image-preview' instead.";
|
|
54
|
+
readonly "imagen-4.0-fast-generate-001": "Use 'gemini-2.5-flash-image' or 'gemini-3-pro-image-preview' instead.";
|
|
55
|
+
readonly "imagen-4.0-generate-preview-06-06": "Use 'gemini-2.5-flash-image' or 'gemini-3-pro-image-preview' instead.";
|
|
56
|
+
readonly "imagen-4.0-ultra-generate-preview-06-06": "Use 'gemini-2.5-flash-image' or 'gemini-3-pro-image-preview' instead.";
|
|
57
|
+
};
|
|
58
|
+
export type DeprecatedGoogleImageModel = keyof typeof deprecatedGoogleImageModelHints;
|
|
59
|
+
export declare const vertexAIGlobalOnlyImageModels: ReadonlySet<string>;
|
|
50
60
|
export declare const provider2ImageAgent: {
|
|
51
61
|
openai: {
|
|
52
62
|
agentName: string;
|
|
@@ -50,6 +50,20 @@ export const deprecatedOpenAIImageModelHints = {
|
|
|
50
50
|
"dall-e-2": supportedOpenAIImageReplacementHint,
|
|
51
51
|
"dall-e-3": supportedOpenAIImageReplacementHint,
|
|
52
52
|
};
|
|
53
|
+
const supportedGoogleImageReplacementHint = "Use 'gemini-2.5-flash-image' or 'gemini-3-pro-image-preview' instead.";
|
|
54
|
+
export const deprecatedGoogleImageModelHints = {
|
|
55
|
+
"imagen-3.0-generate-002": supportedGoogleImageReplacementHint,
|
|
56
|
+
"imagen-4.0-generate-001": supportedGoogleImageReplacementHint,
|
|
57
|
+
"imagen-4.0-ultra-generate-001": supportedGoogleImageReplacementHint,
|
|
58
|
+
"imagen-4.0-fast-generate-001": supportedGoogleImageReplacementHint,
|
|
59
|
+
"imagen-4.0-generate-preview-06-06": supportedGoogleImageReplacementHint,
|
|
60
|
+
"imagen-4.0-ultra-generate-preview-06-06": supportedGoogleImageReplacementHint,
|
|
61
|
+
};
|
|
62
|
+
// Google image models that on Vertex AI are only published under location "global"
|
|
63
|
+
// (regional endpoints like us-central1 return 404 NOT_FOUND).
|
|
64
|
+
// See https://cloud.google.com/vertex-ai/generative-ai/docs/models/gemini/3-pro-image
|
|
65
|
+
// and https://cloud.google.com/vertex-ai/generative-ai/docs/models/gemini/3-1-flash-image
|
|
66
|
+
export const vertexAIGlobalOnlyImageModels = new Set(["gemini-3-pro-image-preview", "gemini-3.1-flash-image-preview"]);
|
|
53
67
|
export const provider2ImageAgent = {
|
|
54
68
|
openai: {
|
|
55
69
|
agentName: "imageOpenaiAgent",
|
|
@@ -61,14 +75,7 @@ export const provider2ImageAgent = {
|
|
|
61
75
|
google: {
|
|
62
76
|
agentName: "imageGenAIAgent",
|
|
63
77
|
defaultModel: "gemini-2.5-flash-image",
|
|
64
|
-
models: [
|
|
65
|
-
"imagen-4.0-generate-001",
|
|
66
|
-
"imagen-4.0-ultra-generate-001",
|
|
67
|
-
"imagen-4.0-fast-generate-001",
|
|
68
|
-
"gemini-2.5-flash-image",
|
|
69
|
-
"gemini-3.1-flash-image-preview",
|
|
70
|
-
"gemini-3-pro-image-preview",
|
|
71
|
-
],
|
|
78
|
+
models: ["gemini-2.5-flash-image", "gemini-3.1-flash-image-preview", "gemini-3-pro-image-preview"],
|
|
72
79
|
keyName: "GEMINI_API_KEY",
|
|
73
80
|
},
|
|
74
81
|
replicate: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import ffmpeg from "fluent-ffmpeg";
|
|
1
|
+
import ffmpeg from "@modernized/fluent-ffmpeg";
|
|
2
|
+
type FfmpegCommand = ReturnType<typeof ffmpeg>;
|
|
2
3
|
export type FfmpegContext = {
|
|
3
|
-
command:
|
|
4
|
+
command: FfmpegCommand;
|
|
4
5
|
inputCount: number;
|
|
5
6
|
filterComplex: string[];
|
|
6
7
|
};
|
|
@@ -29,3 +30,4 @@ export declare const extractImageFromMovie: (movieFile: string, imagePath: strin
|
|
|
29
30
|
export declare const trimMusic: (inputFile: string, startTime: number, duration: number) => Promise<Buffer>;
|
|
30
31
|
export declare const createSilentAudio: (filePath: string, durationSec: number) => Promise<void>;
|
|
31
32
|
export declare const pcmToMp3: (rawPcm: Buffer, sampleRate?: number) => Promise<Buffer>;
|
|
33
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mulmocast",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.node.js",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"homepage": "https://github.com/receptron/mulmocast-cli#readme",
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"@google-cloud/text-to-speech": "^6.4.1",
|
|
92
|
-
"@google/genai": "^
|
|
92
|
+
"@google/genai": "^2.0.1",
|
|
93
93
|
"@graphai/anthropic_agent": "^2.0.12",
|
|
94
94
|
"@graphai/browserless_agent": "^2.0.2",
|
|
95
95
|
"@graphai/gemini_agent": "^2.0.5",
|
|
@@ -102,12 +102,12 @@
|
|
|
102
102
|
"@inquirer/input": "^5.0.12",
|
|
103
103
|
"@inquirer/select": "^5.1.4",
|
|
104
104
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
105
|
+
"@modernized/fluent-ffmpeg": "^0.1.4",
|
|
105
106
|
"@mozilla/readability": "^0.6.0",
|
|
106
|
-
"@tavily/core": "^0.
|
|
107
|
+
"@tavily/core": "^0.7.3",
|
|
107
108
|
"archiver": "^7.0.1",
|
|
108
109
|
"clipboardy": "^5.3.1",
|
|
109
110
|
"dotenv": "^17.4.2",
|
|
110
|
-
"fluent-ffmpeg": "^2.1.3",
|
|
111
111
|
"graphai": "^2.0.16",
|
|
112
112
|
"jsdom": "^29.1.1",
|
|
113
113
|
"marked": "^18.0.3",
|
|
@@ -123,7 +123,6 @@
|
|
|
123
123
|
"@eslint/js": "^10.0.1",
|
|
124
124
|
"@receptron/test_utils": "^2.0.3",
|
|
125
125
|
"@types/archiver": "^7.0.0",
|
|
126
|
-
"@types/fluent-ffmpeg": "^2.1.28",
|
|
127
126
|
"@types/jsdom": "^28.0.1",
|
|
128
127
|
"@types/yargs": "^17.0.35",
|
|
129
128
|
"cross-env": "^10.1.0",
|
|
@@ -34,16 +34,11 @@
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
|
-
"id": "
|
|
38
|
-
"text": "image generated by
|
|
39
|
-
"imagePrompt": "a
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"id": "imagen_4_ultra",
|
|
43
|
-
"text": "image generated by imagen-4",
|
|
44
|
-
"imagePrompt": "a woman is walking through a busy Tokyo street at night, she is wearing dark sunglasses",
|
|
37
|
+
"id": "gemini_2_5_flash_image_alt",
|
|
38
|
+
"text": "image generated by gemini-2.5-flash-image with a different prompt (used by image_animation_showcase to give the carousel/grid four distinct images)",
|
|
39
|
+
"imagePrompt": "a beautiful mountain landscape at sunrise with snow-capped peaks",
|
|
45
40
|
"imageParams": {
|
|
46
|
-
"model": "
|
|
41
|
+
"model": "gemini-2.5-flash-image"
|
|
47
42
|
}
|
|
48
43
|
},
|
|
49
44
|
{
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$mulmocast": {
|
|
3
|
+
"version": "1.1"
|
|
4
|
+
},
|
|
5
|
+
"lang": "en",
|
|
6
|
+
"title": "Test Deprecated Google Imagen Models",
|
|
7
|
+
"imageParams": {
|
|
8
|
+
"provider": "google",
|
|
9
|
+
"style": "Photorealistic-style"
|
|
10
|
+
},
|
|
11
|
+
"beats": [
|
|
12
|
+
{
|
|
13
|
+
"text": "imagen-3.0-generate-002 is deprecated; mulmocast rejects this with a migration hint before calling the Gemini API",
|
|
14
|
+
"imagePrompt": "Blue sky, a flock of birds",
|
|
15
|
+
"imageParams": {
|
|
16
|
+
"model": "imagen-3.0-generate-002"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"text": "imagen-4.0-generate-001 is deprecated; mulmocast rejects this with a migration hint before calling the Gemini API",
|
|
21
|
+
"imagePrompt": "Blue sky, a flock of birds",
|
|
22
|
+
"imageParams": {
|
|
23
|
+
"model": "imagen-4.0-generate-001"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"text": "imagen-4.0-ultra-generate-001 is deprecated; mulmocast rejects this with a migration hint before calling the Gemini API",
|
|
28
|
+
"imagePrompt": "Blue sky, a flock of birds",
|
|
29
|
+
"imageParams": {
|
|
30
|
+
"model": "imagen-4.0-ultra-generate-001"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"text": "imagen-4.0-fast-generate-001 is deprecated; mulmocast rejects this with a migration hint before calling the Gemini API",
|
|
35
|
+
"imagePrompt": "Blue sky, a flock of birds",
|
|
36
|
+
"imageParams": {
|
|
37
|
+
"model": "imagen-4.0-fast-generate-001"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"text": "imagen-4.0-generate-preview-06-06 is deprecated; mulmocast rejects this with a migration hint before calling the Gemini API",
|
|
42
|
+
"imagePrompt": "Blue sky, a flock of birds",
|
|
43
|
+
"imageParams": {
|
|
44
|
+
"model": "imagen-4.0-generate-preview-06-06"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"text": "imagen-4.0-ultra-generate-preview-06-06 is deprecated; mulmocast rejects this with a migration hint before calling the Gemini API",
|
|
49
|
+
"imagePrompt": "Blue sky, a flock of birds",
|
|
50
|
+
"imageParams": {
|
|
51
|
+
"model": "imagen-4.0-ultra-generate-preview-06-06"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$mulmocast": { "version": "1.1" },
|
|
3
3
|
"lang": "en",
|
|
4
|
-
"title": "Vertex AI Test (TTS + Image + Movie)",
|
|
4
|
+
"title": "Vertex AI Test (TTS + Image + Movie) — image variants",
|
|
5
5
|
"description": "Replace YOUR_PROJECT_ID with your Google Cloud project ID",
|
|
6
6
|
"speechParams": {
|
|
7
7
|
"speakers": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"imageParams": {
|
|
20
20
|
"provider": "google",
|
|
21
|
-
"model": "
|
|
21
|
+
"model": "gemini-2.5-flash-image",
|
|
22
22
|
"vertexai_project": "YOUR_PROJECT_ID",
|
|
23
23
|
"vertexai_location": "us-central1"
|
|
24
24
|
},
|
|
@@ -30,37 +30,37 @@
|
|
|
30
30
|
},
|
|
31
31
|
"beats": [
|
|
32
32
|
{
|
|
33
|
-
"id": "
|
|
33
|
+
"id": "gcp_tts_gemini_flash_image",
|
|
34
34
|
"speaker": "GCP",
|
|
35
|
-
"text": "TTS: Google Cloud TTS en-US-Studio-O. Image:
|
|
35
|
+
"text": "TTS: Google Cloud TTS en-US-Studio-O. Image: Gemini 2.5 Flash Image.",
|
|
36
36
|
"imagePrompt": "A beautiful mountain landscape at sunrise"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
"id": "
|
|
39
|
+
"id": "gemini_tts_gemini_flash_image",
|
|
40
40
|
"speaker": "Gemini",
|
|
41
|
-
"text": "TTS: Gemini 2.5 Pro TTS Kore. Image:
|
|
41
|
+
"text": "TTS: Gemini 2.5 Pro TTS Kore. Image: Gemini 2.5 Flash Image.",
|
|
42
42
|
"imagePrompt": "A futuristic city with flying cars"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
|
-
"id": "
|
|
45
|
+
"id": "gemini_pro_image_override",
|
|
46
46
|
"speaker": "GCP",
|
|
47
|
-
"text": "TTS: Google Cloud TTS en-US-Studio-O. Image:
|
|
47
|
+
"text": "TTS: Google Cloud TTS en-US-Studio-O. Image: Gemini 3 Pro Image override.",
|
|
48
48
|
"imagePrompt": "A woman walking through Tokyo at night with neon lights",
|
|
49
49
|
"imageParams": {
|
|
50
|
-
"model": "
|
|
50
|
+
"model": "gemini-3-pro-image-preview",
|
|
51
51
|
"vertexai_project": "YOUR_PROJECT_ID",
|
|
52
|
-
"vertexai_location": "
|
|
52
|
+
"vertexai_location": "global"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
|
-
"id": "
|
|
56
|
+
"id": "gemini_3_1_flash_image_override",
|
|
57
57
|
"speaker": "Gemini",
|
|
58
|
-
"text": "TTS: Gemini 2.5 Pro TTS Kore. Image:
|
|
58
|
+
"text": "TTS: Gemini 2.5 Pro TTS Kore. Image: Gemini 3.1 Flash Image override.",
|
|
59
59
|
"imagePrompt": "A cat sitting on a windowsill watching rain",
|
|
60
60
|
"imageParams": {
|
|
61
|
-
"model": "
|
|
61
|
+
"model": "gemini-3.1-flash-image-preview",
|
|
62
62
|
"vertexai_project": "YOUR_PROJECT_ID",
|
|
63
|
-
"vertexai_location": "
|
|
63
|
+
"vertexai_location": "global"
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
{
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
{
|
|
85
85
|
"id": "image_to_movie_veo2",
|
|
86
86
|
"speaker": "GCP",
|
|
87
|
-
"text": "TTS: Google Cloud TTS en-US-Studio-O. Image:
|
|
87
|
+
"text": "TTS: Google Cloud TTS en-US-Studio-O. Image: Gemini 2.5 Flash Image. Movie: Veo 2 with image reference.",
|
|
88
88
|
"imagePrompt": "A woman standing in a busy Tokyo street at night",
|
|
89
89
|
"moviePrompt": "The woman takes a selfie with her phone",
|
|
90
90
|
"duration": 5
|
|
@@ -92,12 +92,12 @@
|
|
|
92
92
|
{
|
|
93
93
|
"id": "image_to_movie_veo3_override",
|
|
94
94
|
"speaker": "Gemini",
|
|
95
|
-
"text": "TTS: Gemini 2.5 Pro TTS Kore. Image:
|
|
95
|
+
"text": "TTS: Gemini 2.5 Pro TTS Kore. Image: Gemini 3.1 Flash Image override. Movie: Veo 3 override with image reference.",
|
|
96
96
|
"imagePrompt": "A robot standing in a futuristic laboratory",
|
|
97
97
|
"imageParams": {
|
|
98
|
-
"model": "
|
|
98
|
+
"model": "gemini-3.1-flash-image-preview",
|
|
99
99
|
"vertexai_project": "YOUR_PROJECT_ID",
|
|
100
|
-
"vertexai_location": "
|
|
100
|
+
"vertexai_location": "global"
|
|
101
101
|
},
|
|
102
102
|
"moviePrompt": "The robot turns its head and waves at the camera",
|
|
103
103
|
"movieParams": {
|