@mux/ai 0.67.0-canary.109 → 0.67.0
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/dist/index.d.ts +1 -1
- package/dist/index.js +20 -30
- package/dist/index.js.map +1 -1
- package/dist/workflows/index.js +19 -29
- package/dist/workflows/index.js.map +1 -1
- package/package.json +1 -1
package/dist/workflows/index.js
CHANGED
|
@@ -4939,7 +4939,7 @@ function buildUserPrompt2(promptOverrides) {
|
|
|
4939
4939
|
var DEFAULT_PROVIDER = "openai";
|
|
4940
4940
|
async function fetchImageAsBase642(imageUrl, imageDownloadOptions) {
|
|
4941
4941
|
"use step";
|
|
4942
|
-
const downloadResult = await downloadImageAsBase64(imageUrl, imageDownloadOptions);
|
|
4942
|
+
const downloadResult = await downloadImageAsBase64(imageUrl, imageDownloadOptions, { classifiedErrors: true, call: "fetch_storyboard" });
|
|
4943
4943
|
return downloadResult.base64Data;
|
|
4944
4944
|
}
|
|
4945
4945
|
async function analyzeStoryboard({
|
|
@@ -4952,6 +4952,7 @@ async function analyzeStoryboard({
|
|
|
4952
4952
|
}) {
|
|
4953
4953
|
"use step";
|
|
4954
4954
|
const model = await createLanguageModelFromConfig(provider, modelId, credentials);
|
|
4955
|
+
const context = { call: "detect_burned_in_captions", provider, model: modelId };
|
|
4955
4956
|
const response = await withContentPolicyAwareRetry(() => generateText3({
|
|
4956
4957
|
model,
|
|
4957
4958
|
maxRetries: 0,
|
|
@@ -4967,8 +4968,10 @@ async function analyzeStoryboard({
|
|
|
4967
4968
|
]
|
|
4968
4969
|
}
|
|
4969
4970
|
]
|
|
4970
|
-
}))
|
|
4971
|
-
|
|
4971
|
+
}), void 0, context).catch((error) => {
|
|
4972
|
+
throw modelStepError(error, "Burned-in captions model call failed", { ...context });
|
|
4973
|
+
});
|
|
4974
|
+
const output = getGeneratedOutputWithContentPolicyHandling(response, context);
|
|
4972
4975
|
const unexpectedKeys = detectUnexpectedKeysFromRawText(
|
|
4973
4976
|
response.text,
|
|
4974
4977
|
burnedInCaptionsSchema.keyof().options
|
|
@@ -5015,12 +5018,13 @@ async function hasBurnedInCaptionsInternal(assetId, options, collectedUsage) {
|
|
|
5015
5018
|
model,
|
|
5016
5019
|
provider
|
|
5017
5020
|
});
|
|
5018
|
-
const { asset: assetData, playbackId, policy } = await getPlaybackIdForAsset(assetId, credentials, options.assetSnapshot);
|
|
5021
|
+
const { asset: assetData, playbackId, policy } = await getPlaybackIdForAsset(assetId, credentials, options.assetSnapshot, { classifiedErrors: true });
|
|
5019
5022
|
const assetDurationSeconds = getAssetDurationSecondsFromAsset(assetData);
|
|
5020
5023
|
const storyboardScope = resolveRenderableVideoScope(
|
|
5021
5024
|
scope,
|
|
5022
5025
|
assetDurationSeconds,
|
|
5023
|
-
getVideoTrackDurationSecondsFromAsset(assetData)
|
|
5026
|
+
getVideoTrackDurationSecondsFromAsset(assetData),
|
|
5027
|
+
{ classifiedErrors: true, assetId }
|
|
5024
5028
|
);
|
|
5025
5029
|
const imageUrl = await getStoryboardUrl(
|
|
5026
5030
|
playbackId,
|
|
@@ -5029,31 +5033,17 @@ async function hasBurnedInCaptionsInternal(assetId, options, collectedUsage) {
|
|
|
5029
5033
|
credentials,
|
|
5030
5034
|
storyboardScope
|
|
5031
5035
|
);
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
});
|
|
5043
|
-
} else {
|
|
5044
|
-
analysisResponse = await analyzeStoryboard({
|
|
5045
|
-
imageDataUrl: imageUrl,
|
|
5046
|
-
provider: modelConfig.provider,
|
|
5047
|
-
modelId: modelConfig.modelId,
|
|
5048
|
-
userPrompt,
|
|
5049
|
-
systemPrompt: SYSTEM_PROMPT2,
|
|
5050
|
-
credentials
|
|
5051
|
-
});
|
|
5052
|
-
}
|
|
5036
|
+
const imageDataUrl = imageSubmissionMode === "base64" ? await fetchImageAsBase642(imageUrl, imageDownloadOptions) : imageUrl;
|
|
5037
|
+
const modelFacts = { call: "detect_burned_in_captions", provider: modelConfig.provider, model: modelConfig.modelId, assetId };
|
|
5038
|
+
const analysisResponse = await analyzeStoryboard({
|
|
5039
|
+
imageDataUrl,
|
|
5040
|
+
provider: modelConfig.provider,
|
|
5041
|
+
modelId: modelConfig.modelId,
|
|
5042
|
+
userPrompt,
|
|
5043
|
+
systemPrompt: SYSTEM_PROMPT2,
|
|
5044
|
+
credentials
|
|
5045
|
+
}).catch((error) => wrapError(error, `Failed to analyze storyboard with ${modelConfig.provider}`, modelFacts));
|
|
5053
5046
|
collectedUsage.push(analysisResponse.usage);
|
|
5054
|
-
if (!analysisResponse.result) {
|
|
5055
|
-
throw new Error("No analysis result received from AI provider");
|
|
5056
|
-
}
|
|
5057
5047
|
const safety = createSafetyReporter();
|
|
5058
5048
|
if (analysisResponse.unexpectedKeys.length > 0) {
|
|
5059
5049
|
console.warn(
|