mulmocast 2.6.10 → 2.6.11

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,5 +1,6 @@
1
1
  import { AgentFunction, AgentFunctionInfo } from "graphai";
2
2
  import type { AgentBufferResult, OpenAIImageAgentParams, OpenAIImageAgentInputs, OpenAIImageAgentConfig } from "../types/agent.js";
3
+ export declare const buildDeprecatedModelMessage: (model: string) => string | null;
3
4
  export declare const imageOpenaiAgent: AgentFunction<OpenAIImageAgentParams, AgentBufferResult, OpenAIImageAgentInputs, OpenAIImageAgentConfig>;
4
5
  declare const imageOpenaiAgentInfo: AgentFunctionInfo;
5
6
  export default imageOpenaiAgentInfo;
@@ -3,8 +3,14 @@ import path from "path";
3
3
  import { GraphAILogger } from "graphai";
4
4
  import { toFile, AuthenticationError, RateLimitError, APIError } from "openai";
5
5
  import { createOpenAIClient } from "../utils/openai_client.js";
6
- import { provider2ImageAgent, gptImages } from "../types/provider2agent.js";
7
- import { apiKeyMissingError, agentGenerationError, openAIAgentGenerationError, agentIncorrectAPIKeyError, agentAPIRateLimitError, agentInvalidResponseError, imageAction, imageFileTarget, } from "../utils/error_cause.js";
6
+ import { provider2ImageAgent, gptImages, deprecatedOpenAIImageModelHints } from "../types/provider2agent.js";
7
+ import { apiKeyMissingError, agentGenerationError, openAIAgentGenerationError, agentIncorrectAPIKeyError, agentAPIRateLimitError, agentInvalidResponseError, imageAction, imageFileTarget, unsupportedModelTarget, } from "../utils/error_cause.js";
8
+ const isDeprecatedOpenAIImageModel = (model) => model in deprecatedOpenAIImageModelHints;
9
+ export const buildDeprecatedModelMessage = (model) => {
10
+ if (!isDeprecatedOpenAIImageModel(model))
11
+ return null;
12
+ return `OpenAI image model "${model}" is no longer available. ${deprecatedOpenAIImageModelHints[model]}`;
13
+ };
8
14
  // https://platform.openai.com/docs/guides/image-generation
9
15
  export const imageOpenaiAgent = async ({ namedInputs, params, config, }) => {
10
16
  const { prompt, referenceImages } = namedInputs;
@@ -16,6 +22,12 @@ export const imageOpenaiAgent = async ({ namedInputs, params, config, }) => {
16
22
  });
17
23
  }
18
24
  const model = params.model ?? provider2ImageAgent["openai"].defaultModel;
25
+ const deprecatedMessage = buildDeprecatedModelMessage(model);
26
+ if (deprecatedMessage) {
27
+ throw new Error(deprecatedMessage, {
28
+ cause: agentGenerationError("imageOpenaiAgent", imageAction, unsupportedModelTarget),
29
+ });
30
+ }
19
31
  const openai = createOpenAIClient({ apiKey, baseURL, apiVersion });
20
32
  const size = (() => {
21
33
  if (gptImages.includes(model)) {
@@ -114,7 +126,7 @@ export const imageOpenaiAgent = async ({ namedInputs, params, config, }) => {
114
126
  }
115
127
  return { buffer: Buffer.from(image_base64, "base64") };
116
128
  }
117
- // For dall-e-3
129
+ // URL response handling (legacy OpenAI image API response format)
118
130
  const res = await fetch(url);
119
131
  if (!res.ok) {
120
132
  throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`, {
@@ -84,7 +84,7 @@ export const MulmoPresentationStyleMethods = {
84
84
  const imageParams = { ...presentationStyle.imageParams, ...beat?.imageParams };
85
85
  const provider = MulmoPresentationStyleMethods.getText2ImageProvider(imageParams?.provider) ?? defaultProviders.text2image;
86
86
  const agentInfo = provider2ImageAgent[provider];
87
- // The default text2image model is gpt-image-1 from OpenAI, and to use it you must have an OpenAI account and have verified your identity. If this is not possible, please specify dall-e-3 as the model.
87
+ // The default text2image model is gpt-image-1 from OpenAI.
88
88
  const defaultImageParams = {
89
89
  provider,
90
90
  model: agentInfo.defaultModel,
@@ -133,8 +133,7 @@ export const MulmoPresentationStyleMethods = {
133
133
  const imageAgentInfo = MulmoPresentationStyleMethods.getImageAgentInfo(presentationStyle);
134
134
  if (imageAgentInfo.imageParams.provider === "openai") {
135
135
  // NOTE: Here are the rate limits of OpenAI's text2image API (1token = 32x32 patch).
136
- // dall-e-3: 7,500 RPM、15 images per minute (4 images for max resolution)
137
- // gpt-image-1:3,000,000 TPM、150 images per minute
136
+ // gpt-image-1: 3,000,000 TPM, 150 images per minute
138
137
  if (imageAgentInfo.imageParams.model === provider2ImageAgent.openai.defaultModel) {
139
138
  return 16;
140
139
  }
@@ -42,6 +42,11 @@ export declare const provider2TTSAgent: {
42
42
  };
43
43
  };
44
44
  export declare const gptImages: string[];
45
+ export declare const deprecatedOpenAIImageModelHints: {
46
+ readonly "dall-e-2": "Use 'gpt-image-1' or another supported model.";
47
+ readonly "dall-e-3": "Use 'gpt-image-1' or another supported model.";
48
+ };
49
+ export type DeprecatedOpenAIImageModel = keyof typeof deprecatedOpenAIImageModelHints;
45
50
  export declare const provider2ImageAgent: {
46
51
  openai: {
47
52
  agentName: string;
@@ -45,11 +45,16 @@ export const provider2TTSAgent = {
45
45
  },
46
46
  };
47
47
  export const gptImages = ["gpt-image-2", "gpt-image-1.5", "gpt-image-1", "gpt-image-1-mini"];
48
+ const supportedOpenAIImageReplacementHint = "Use 'gpt-image-1' or another supported model.";
49
+ export const deprecatedOpenAIImageModelHints = {
50
+ "dall-e-2": supportedOpenAIImageReplacementHint,
51
+ "dall-e-3": supportedOpenAIImageReplacementHint,
52
+ };
48
53
  export const provider2ImageAgent = {
49
54
  openai: {
50
55
  agentName: "imageOpenaiAgent",
51
56
  defaultModel: "gpt-image-1",
52
- models: ["dall-e-3", ...gptImages],
57
+ models: [...gptImages],
53
58
  keyName: "OPENAI_API_KEY",
54
59
  baseURLKeyName: "OPENAI_BASE_URL",
55
60
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mulmocast",
3
- "version": "2.6.10",
3
+ "version": "2.6.11",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "lib/index.node.js",
@@ -88,7 +88,7 @@
88
88
  },
89
89
  "homepage": "https://github.com/receptron/mulmocast-cli#readme",
90
90
  "dependencies": {
91
- "@google-cloud/text-to-speech": "^6.4.0",
91
+ "@google-cloud/text-to-speech": "^6.4.1",
92
92
  "@google/genai": "^1.50.1",
93
93
  "@graphai/anthropic_agent": "^2.0.12",
94
94
  "@graphai/browserless_agent": "^2.0.2",
@@ -109,15 +109,15 @@
109
109
  "dotenv": "^17.4.2",
110
110
  "fluent-ffmpeg": "^2.1.3",
111
111
  "graphai": "^2.0.16",
112
- "jsdom": "^29.1.0",
113
- "marked": "^18.0.2",
112
+ "jsdom": "^29.1.1",
113
+ "marked": "^18.0.3",
114
114
  "mulmocast-vision": "^1.0.9",
115
115
  "ora": "^9.4.0",
116
- "puppeteer": "^24.42.0",
116
+ "puppeteer": "^24.43.0",
117
117
  "replicate": "^1.4.0",
118
- "yaml": "^2.8.3",
118
+ "yaml": "^2.8.4",
119
119
  "yargs": "^18.0.0",
120
- "zod": "^4.3.6"
120
+ "zod": "^4.4.3"
121
121
  },
122
122
  "devDependencies": {
123
123
  "@eslint/js": "^10.0.1",
@@ -127,16 +127,16 @@
127
127
  "@types/jsdom": "^28.0.1",
128
128
  "@types/yargs": "^17.0.35",
129
129
  "cross-env": "^10.1.0",
130
- "eslint": "^10.2.1",
130
+ "eslint": "^10.3.0",
131
131
  "eslint-config-prettier": "^10.1.8",
132
132
  "eslint-plugin-import": "^2.32.0",
133
133
  "eslint-plugin-prettier": "^5.5.5",
134
134
  "eslint-plugin-sonarjs": "^4.0.3",
135
- "globals": "^17.5.0",
135
+ "globals": "^17.6.0",
136
136
  "prettier": "^3.8.3",
137
137
  "tsx": "^4.21.0",
138
138
  "typescript": "6.0.3",
139
- "typescript-eslint": "^8.59.1"
139
+ "typescript-eslint": "^8.59.2"
140
140
  },
141
141
  "engines": {
142
142
  "node": ">=22.0.0"
@@ -21,10 +21,10 @@
21
21
  }
22
22
  },
23
23
  {
24
- "text": "Image with Dall-E 3",
24
+ "text": "Image with OpenAI gpt-image-1-mini",
25
25
  "imagePrompt": "Blue sky, a flock of birds",
26
26
  "imageParams": {
27
- "model": "dall-e-3",
27
+ "model": "gpt-image-1-mini",
28
28
  "style": "anime-style",
29
29
  "provider": "openai"
30
30
  }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$mulmocast": {
3
+ "version": "1.1"
4
+ },
5
+ "lang": "en",
6
+ "title": "Test Deprecated OpenAI Image Models",
7
+ "imageParams": {
8
+ "provider": "openai",
9
+ "style": "Photorealistic-style"
10
+ },
11
+ "beats": [
12
+ {
13
+ "text": "dall-e-2 is deprecated; mulmocast rejects this with a migration hint before calling OpenAI",
14
+ "imagePrompt": "Blue sky, a flock of birds",
15
+ "imageParams": {
16
+ "model": "dall-e-2"
17
+ }
18
+ },
19
+ {
20
+ "text": "dall-e-3 is deprecated; mulmocast rejects this with a migration hint before calling OpenAI",
21
+ "imagePrompt": "Blue sky, a flock of birds",
22
+ "imageParams": {
23
+ "model": "dall-e-3"
24
+ }
25
+ }
26
+ ]
27
+ }
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "imageParams": {
14
14
  "provider": "openai",
15
- "model": "dall-e-3",
15
+ "model": "gpt-image-1-mini",
16
16
  "style": "Photo realistic, cinematic style.",
17
17
  "images": {
18
18
  "optimus": {
@@ -0,0 +1,26 @@
1
+ {
2
+ "$mulmocast": {
3
+ "version": "1.1"
4
+ },
5
+ "lang": "en",
6
+ "movieParams": {
7
+ "provider": "google"
8
+ },
9
+ "canvasSize": {
10
+ "width": 720,
11
+ "height": 1280
12
+ },
13
+ "imageParams": {
14
+ "provider": "openai",
15
+ "model": "dall-e-3",
16
+ "style": "Photo realistic, cinematic style."
17
+ },
18
+ "beats": [
19
+ {
20
+ "text": "dall-e-3 on movie flow is deprecated; mulmocast rejects upfront with a migration hint",
21
+ "imagePrompt": "A rocket on the launch pad at dusk.",
22
+ "moviePrompt": "Rocket lifts off.",
23
+ "duration": 5
24
+ }
25
+ ]
26
+ }