mulmocast 1.2.48 → 1.2.49
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,9 +1,9 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { GraphAILogger } from "graphai";
|
|
4
|
-
import OpenAI, { toFile } from "openai";
|
|
4
|
+
import OpenAI, { toFile, AuthenticationError, RateLimitError } from "openai";
|
|
5
5
|
import { provider2ImageAgent } from "../utils/provider2agent.js";
|
|
6
|
-
import { apiKeyMissingError, agentGenerationError, agentInvalidResponseError, imageAction, imageFileTarget } from "../utils/error_cause.js";
|
|
6
|
+
import { apiKeyMissingError, agentGenerationError, agentIncorrectAPIKeyError, agentAPIRateLimitError, agentInvalidResponseError, imageAction, imageFileTarget, } from "../utils/error_cause.js";
|
|
7
7
|
// https://platform.openai.com/docs/guides/image-generation
|
|
8
8
|
export const imageOpenaiAgent = async ({ namedInputs, params, config, }) => {
|
|
9
9
|
const { prompt, referenceImages } = namedInputs;
|
|
@@ -70,6 +70,16 @@ export const imageOpenaiAgent = async ({ namedInputs, params, config, }) => {
|
|
|
70
70
|
}
|
|
71
71
|
catch (error) {
|
|
72
72
|
GraphAILogger.info("Failed to generate image:", error.message);
|
|
73
|
+
if (error instanceof AuthenticationError) {
|
|
74
|
+
throw new Error("Failed to generate image: 401 Incorrect API key provided with OpenAI", {
|
|
75
|
+
cause: agentIncorrectAPIKeyError("imageOpenaiAgent", imageAction, imageFileTarget),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (error instanceof RateLimitError) {
|
|
79
|
+
throw new Error("You exceeded your current quota", {
|
|
80
|
+
cause: agentAPIRateLimitError("imageOpenaiAgent", imageAction, imageFileTarget),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
73
83
|
throw new Error("Failed to generate image with OpenAI", {
|
|
74
84
|
cause: agentGenerationError("imageOpenaiAgent", imageAction, imageFileTarget),
|
|
75
85
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GraphAILogger } from "graphai";
|
|
2
|
-
import OpenAI from "openai";
|
|
2
|
+
import OpenAI, { AuthenticationError, RateLimitError } from "openai";
|
|
3
3
|
import { provider2TTSAgent } from "../utils/provider2agent.js";
|
|
4
|
-
import { apiKeyMissingError, agentGenerationError, audioAction, audioFileTarget } from "../utils/error_cause.js";
|
|
4
|
+
import { apiKeyMissingError, agentIncorrectAPIKeyError, agentAPIRateLimitError, agentGenerationError, audioAction, audioFileTarget, } from "../utils/error_cause.js";
|
|
5
5
|
export const ttsOpenaiAgent = async ({ namedInputs, params, config, }) => {
|
|
6
6
|
const { text } = namedInputs;
|
|
7
7
|
const { model, voice, suppressError, instructions } = params;
|
|
@@ -26,24 +26,34 @@ export const ttsOpenaiAgent = async ({ namedInputs, params, config, }) => {
|
|
|
26
26
|
const buffer = Buffer.from(await response.arrayBuffer());
|
|
27
27
|
return { buffer };
|
|
28
28
|
}
|
|
29
|
-
catch (
|
|
29
|
+
catch (error) {
|
|
30
30
|
if (suppressError) {
|
|
31
31
|
return {
|
|
32
|
-
error
|
|
32
|
+
error,
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
GraphAILogger.error(
|
|
36
|
-
if (
|
|
35
|
+
GraphAILogger.error(error);
|
|
36
|
+
if (error instanceof AuthenticationError) {
|
|
37
|
+
throw new Error("Failed to generate image: 401 Incorrect API key provided with OpenAI", {
|
|
38
|
+
cause: agentIncorrectAPIKeyError("imageOpenaiAgent", audioAction, audioFileTarget),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (error instanceof RateLimitError) {
|
|
42
|
+
throw new Error("You exceeded your current quota", {
|
|
43
|
+
cause: agentAPIRateLimitError("imageOpenaiAgent", audioAction, audioFileTarget),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (error && typeof error === "object" && "error" in error) {
|
|
37
47
|
GraphAILogger.info("tts_openai_agent: ");
|
|
38
|
-
GraphAILogger.info(
|
|
39
|
-
throw new Error("TTS OpenAI Error: " + JSON.stringify(
|
|
48
|
+
GraphAILogger.info(error.error);
|
|
49
|
+
throw new Error("TTS OpenAI Error: " + JSON.stringify(error.error, null, 2), {
|
|
40
50
|
cause: agentGenerationError("ttsOpenaiAgent", audioAction, audioFileTarget),
|
|
41
51
|
});
|
|
42
52
|
}
|
|
43
|
-
else if (
|
|
53
|
+
else if (error instanceof Error) {
|
|
44
54
|
GraphAILogger.info("tts_openai_agent: ");
|
|
45
|
-
GraphAILogger.info(
|
|
46
|
-
throw new Error("TTS OpenAI Error: " +
|
|
55
|
+
GraphAILogger.info(error.message);
|
|
56
|
+
throw new Error("TTS OpenAI Error: " + error.message, {
|
|
47
57
|
cause: agentGenerationError("ttsOpenaiAgent", audioAction, audioFileTarget),
|
|
48
58
|
});
|
|
49
59
|
}
|
|
@@ -50,6 +50,8 @@ export declare const fileNotExistType = "fileNotExist";
|
|
|
50
50
|
export declare const unknownMediaType = "unknownMedia";
|
|
51
51
|
export declare const sourceUndefinedType = "undefinedSourceType";
|
|
52
52
|
export declare const apiErrorType = "apiError";
|
|
53
|
+
export declare const apiKeyInvalidType = "apiKeyInvalid";
|
|
54
|
+
export declare const apiRateLimitErrorType = "apiRateLimit";
|
|
53
55
|
export declare const apiKeyMissingType = "apiKeyMissing";
|
|
54
56
|
export declare const invalidResponseType = "invalidResponse";
|
|
55
57
|
export declare const movieAction = "movie";
|
|
@@ -154,6 +156,20 @@ export declare const agentGenerationError: (agentName: string, action: string, t
|
|
|
154
156
|
target: string;
|
|
155
157
|
agentName: string;
|
|
156
158
|
};
|
|
159
|
+
export declare const agentIncorrectAPIKeyError: (agentName: string, action: string, target: string, beatIndex?: number) => {
|
|
160
|
+
beatIndex?: number | undefined;
|
|
161
|
+
type: string;
|
|
162
|
+
action: string;
|
|
163
|
+
target: string;
|
|
164
|
+
agentName: string;
|
|
165
|
+
};
|
|
166
|
+
export declare const agentAPIRateLimitError: (agentName: string, action: string, target: string, beatIndex?: number) => {
|
|
167
|
+
beatIndex?: number | undefined;
|
|
168
|
+
type: string;
|
|
169
|
+
action: string;
|
|
170
|
+
target: string;
|
|
171
|
+
agentName: string;
|
|
172
|
+
};
|
|
157
173
|
export declare const agentInvalidResponseError: (agentName: string, action: string, target: string, beatIndex?: number) => {
|
|
158
174
|
beatIndex?: number | undefined;
|
|
159
175
|
type: string;
|
package/lib/utils/error_cause.js
CHANGED
|
@@ -51,6 +51,8 @@ export const fileNotExistType = "fileNotExist";
|
|
|
51
51
|
export const unknownMediaType = "unknownMedia";
|
|
52
52
|
export const sourceUndefinedType = "undefinedSourceType";
|
|
53
53
|
export const apiErrorType = "apiError";
|
|
54
|
+
export const apiKeyInvalidType = "apiKeyInvalid";
|
|
55
|
+
export const apiRateLimitErrorType = "apiRateLimit";
|
|
54
56
|
export const apiKeyMissingType = "apiKeyMissing";
|
|
55
57
|
export const invalidResponseType = "invalidResponse";
|
|
56
58
|
// Actions
|
|
@@ -168,6 +170,26 @@ export const agentGenerationError = (agentName, action, target, beatIndex) => {
|
|
|
168
170
|
...(beatIndex !== undefined && { beatIndex }),
|
|
169
171
|
};
|
|
170
172
|
};
|
|
173
|
+
// Agent API/Incorrect Key Errors
|
|
174
|
+
export const agentIncorrectAPIKeyError = (agentName, action, target, beatIndex) => {
|
|
175
|
+
return {
|
|
176
|
+
type: apiKeyInvalidType,
|
|
177
|
+
action,
|
|
178
|
+
target,
|
|
179
|
+
agentName,
|
|
180
|
+
...(beatIndex !== undefined && { beatIndex }),
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
// Agent API/Rate Limit Errors
|
|
184
|
+
export const agentAPIRateLimitError = (agentName, action, target, beatIndex) => {
|
|
185
|
+
return {
|
|
186
|
+
type: apiRateLimitErrorType,
|
|
187
|
+
action,
|
|
188
|
+
target,
|
|
189
|
+
agentName,
|
|
190
|
+
...(beatIndex !== undefined && { beatIndex }),
|
|
191
|
+
};
|
|
192
|
+
};
|
|
171
193
|
// Agent Invalid Response Errors
|
|
172
194
|
export const agentInvalidResponseError = (agentName, action, target, beatIndex) => {
|
|
173
195
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mulmocast",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.49",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.node.js",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"homepage": "https://github.com/receptron/mulmocast-cli#readme",
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@google-cloud/text-to-speech": "^6.3.0",
|
|
73
|
-
"@google/genai": "^1.
|
|
73
|
+
"@google/genai": "^1.22.0",
|
|
74
74
|
"@graphai/anthropic_agent": "^2.0.11",
|
|
75
75
|
"@graphai/browserless_agent": "^2.0.1",
|
|
76
76
|
"@graphai/gemini_agent": "^2.0.1",
|
|
@@ -85,16 +85,16 @@
|
|
|
85
85
|
"@modelcontextprotocol/sdk": "^1.19.1",
|
|
86
86
|
"@mozilla/readability": "^0.6.0",
|
|
87
87
|
"@tavily/core": "^0.5.11",
|
|
88
|
-
"clipboardy": "^
|
|
88
|
+
"clipboardy": "^5.0.0",
|
|
89
89
|
"dotenv": "^17.2.3",
|
|
90
90
|
"fluent-ffmpeg": "^2.1.3",
|
|
91
91
|
"graphai": "^2.0.16",
|
|
92
92
|
"jsdom": "^27.0.0",
|
|
93
93
|
"marked": "^16.3.0",
|
|
94
94
|
"mulmocast-vision": "^1.0.4",
|
|
95
|
-
"ora": "^
|
|
95
|
+
"ora": "^9.0.0",
|
|
96
96
|
"puppeteer": "^24.23.0",
|
|
97
|
-
"replicate": "^1.
|
|
97
|
+
"replicate": "^1.2.0",
|
|
98
98
|
"yaml": "^2.8.1",
|
|
99
99
|
"yargs": "^18.0.0",
|
|
100
100
|
"zod": "^3.25.76",
|