@mux/ai 0.34.0 → 0.35.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-B5l0yXZD.d.ts → index-fU3hmKZu.d.ts} +4 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +39 -6
- package/dist/index.js.map +1 -1
- package/dist/workflows/index.d.ts +1 -1
- package/dist/workflows/index.js +38 -5
- package/dist/workflows/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH, j as ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH, k as ASK_QUESTIONS_MAX_QUESTION_LENGTH, l as AskQuestionsOptions, m as AskQuestionsResult, n as AskQuestionsType, o as AudioTranslationOptions, p as AudioTranslationResult, q as AutoCensorProfanityOptions, B as BurnedInCaptionsAnalysis, r as BurnedInCaptionsOptions, s as BurnedInCaptionsPromptOverrides, u as BurnedInCaptionsPromptSections, v as BurnedInCaptionsResult, C as CaptionReplacement, w as CensorMode, x as Chapter, y as ChapterSystemPromptSections, z as ChaptersOptions, D as ChaptersPromptOverrides, E as ChaptersPromptSections, F as ChaptersResult, G as ChaptersType, H as DEFAULT_DESCRIPTION_LENGTH, J as DEFAULT_SUMMARY_KEYWORD_LIMIT, K as DEFAULT_TITLE_LENGTH, M as EditCaptionsOptions, N as EditCaptionsResult, O as EmbeddingsOptions, P as EmbeddingsResult, Q as EngagementInsightsOptions, R as EngagementInsightsResult, T as GOOGLE_VISION_LIKELIHOOD_TO_SCORE, U as HIVE_SEXUAL_CATEGORIES, V as HIVE_VIOLENCE_CATEGORIES, W as HiveModerationOutput, X as HiveModerationSource, Y as ModerationOptions, Z as ModerationProvider, _ as ModerationResult, $ as MomentInsight, a0 as OverallInsight, a1 as ProfanityDetectionPayload, a2 as Question, a3 as QuestionAnswer, a4 as QuestionAnswerType, a5 as ReplacementRecord, a6 as StaticRenditionCleanupOutcome, a7 as SummarizationOptions, a8 as SummarizationPromptOverrides, a9 as SummarizationPromptSections, aa as SummaryAndTagsResult, ab as SummaryType, ac as ThumbnailModerationScore, ad as TranslationChunkingOptions, ae as TranslationOptions, af as TranslationPayload, ag as TranslationResult, ah as aggregateTokenUsage, ai as applyOverrideLists, aj as applyReplacements, ak as askQuestions, al as buildReplacementRegex, am as burnedInCaptionsSchema, an as censorVttContent, ao as chapterSchema, ap as chaptersSchema, aq as createReplacer, ar as editCaptions, as as extractTranscriptSegmentsForHotspots, at as generateChapters, au as generateEmbeddings, av as generateEngagementInsights, aw as generateVideoEmbeddings, ax as getModerationScores, ay as getSummaryAndTags, az as hasBurnedInCaptions, aA as mapShotsToHotspots, aB as normalizeTranslatedVtt, aC as profanityDetectionSchema, aD as questionAnswerSchema, aE as shouldSplitChunkTranslationError, aF as summarySchema, aG as transformCueText, aH as translateAudio, aI as translateCaptions, aJ as translationSchema, aK as validateNeverTranslateTerms, aL as verifyNeverTranslateTerms } from '../index-
|
|
1
|
+
export { A as ASK_QUESTIONS_DEFAULT_MAX_ANSWER_OPTION_LENGTH, j as ASK_QUESTIONS_DEFAULT_MAX_FREE_FORM_ANSWER_LENGTH, k as ASK_QUESTIONS_MAX_QUESTION_LENGTH, l as AskQuestionsOptions, m as AskQuestionsResult, n as AskQuestionsType, o as AudioTranslationOptions, p as AudioTranslationResult, q as AutoCensorProfanityOptions, B as BurnedInCaptionsAnalysis, r as BurnedInCaptionsOptions, s as BurnedInCaptionsPromptOverrides, u as BurnedInCaptionsPromptSections, v as BurnedInCaptionsResult, C as CaptionReplacement, w as CensorMode, x as Chapter, y as ChapterSystemPromptSections, z as ChaptersOptions, D as ChaptersPromptOverrides, E as ChaptersPromptSections, F as ChaptersResult, G as ChaptersType, H as DEFAULT_DESCRIPTION_LENGTH, J as DEFAULT_SUMMARY_KEYWORD_LIMIT, K as DEFAULT_TITLE_LENGTH, M as EditCaptionsOptions, N as EditCaptionsResult, O as EmbeddingsOptions, P as EmbeddingsResult, Q as EngagementInsightsOptions, R as EngagementInsightsResult, T as GOOGLE_VISION_LIKELIHOOD_TO_SCORE, U as HIVE_SEXUAL_CATEGORIES, V as HIVE_VIOLENCE_CATEGORIES, W as HiveModerationOutput, X as HiveModerationSource, Y as ModerationOptions, Z as ModerationProvider, _ as ModerationResult, $ as MomentInsight, a0 as OverallInsight, a1 as ProfanityDetectionPayload, a2 as Question, a3 as QuestionAnswer, a4 as QuestionAnswerType, a5 as ReplacementRecord, a6 as StaticRenditionCleanupOutcome, a7 as SummarizationOptions, a8 as SummarizationPromptOverrides, a9 as SummarizationPromptSections, aa as SummaryAndTagsResult, ab as SummaryType, ac as ThumbnailModerationScore, ad as TranslationChunkingOptions, ae as TranslationOptions, af as TranslationPayload, ag as TranslationResult, ah as aggregateTokenUsage, ai as applyOverrideLists, aj as applyReplacements, ak as askQuestions, al as buildReplacementRegex, am as burnedInCaptionsSchema, an as censorVttContent, ao as chapterSchema, ap as chaptersSchema, aq as createReplacer, ar as editCaptions, as as extractTranscriptSegmentsForHotspots, at as generateChapters, au as generateEmbeddings, av as generateEngagementInsights, aw as generateVideoEmbeddings, ax as getModerationScores, ay as getSummaryAndTags, az as hasBurnedInCaptions, aA as mapShotsToHotspots, aB as normalizeTranslatedVtt, aC as profanityDetectionSchema, aD as questionAnswerSchema, aE as shouldSplitChunkTranslationError, aF as summarySchema, aG as transformCueText, aH as translateAudio, aI as translateCaptions, aJ as translationSchema, aK as validateNeverTranslateTerms, aL as verifyNeverTranslateTerms } from '../index-fU3hmKZu.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '@ai-sdk/anthropic';
|
|
4
4
|
import '@ai-sdk/google';
|
package/dist/workflows/index.js
CHANGED
|
@@ -643,6 +643,22 @@ var CONTENT_POLICY_REASONS = /* @__PURE__ */ new Set([
|
|
|
643
643
|
"SAFETY",
|
|
644
644
|
"SPII"
|
|
645
645
|
]);
|
|
646
|
+
var IncompleteGenerationError = class extends MuxAiError {
|
|
647
|
+
constructor(finishReason, rawFinishReason, usage) {
|
|
648
|
+
const reason = rawFinishReason ?? finishReason;
|
|
649
|
+
const message = finishReason === "length" ? `The model reached its output limit before producing a complete response (finish reason: ${reason}).` : `The model stopped before producing a complete response (finish reason: ${reason}).`;
|
|
650
|
+
super(message, {
|
|
651
|
+
type: "processing_error",
|
|
652
|
+
retryable: finishReason !== "length"
|
|
653
|
+
});
|
|
654
|
+
this.finishReason = finishReason;
|
|
655
|
+
this.rawFinishReason = rawFinishReason;
|
|
656
|
+
this.usage = usage;
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
function isIncompleteGenerationError(error) {
|
|
660
|
+
return MuxAiError.is(error) && typeof error.finishReason === "string";
|
|
661
|
+
}
|
|
646
662
|
async function withContentPolicyErrorHandling(operation) {
|
|
647
663
|
try {
|
|
648
664
|
return await operation();
|
|
@@ -669,6 +685,14 @@ function getGeneratedOutputWithContentPolicyHandling(response) {
|
|
|
669
685
|
const reason = rawReason.success && isContentPolicyReason(rawReason.data) ? rawReason.data : "CONTENT_FILTER";
|
|
670
686
|
throwContentPolicyError({ reason }, getErrorTokenUsage(response));
|
|
671
687
|
}
|
|
688
|
+
if (response.finishReason !== "stop") {
|
|
689
|
+
const rawReason = PolicyTokenSchema.safeParse(response.rawFinishReason);
|
|
690
|
+
throw new IncompleteGenerationError(
|
|
691
|
+
response.finishReason,
|
|
692
|
+
rawReason.success ? rawReason.data : void 0,
|
|
693
|
+
getErrorTokenUsage(response)
|
|
694
|
+
);
|
|
695
|
+
}
|
|
672
696
|
return response.output;
|
|
673
697
|
}
|
|
674
698
|
function throwContentPolicyError(block, usage) {
|
|
@@ -7381,6 +7405,7 @@ import {
|
|
|
7381
7405
|
APICallError as APICallError3,
|
|
7382
7406
|
generateText as generateText7,
|
|
7383
7407
|
NoObjectGeneratedError as NoObjectGeneratedError2,
|
|
7408
|
+
NoOutputGeneratedError as NoOutputGeneratedError2,
|
|
7384
7409
|
Output as Output7,
|
|
7385
7410
|
RetryError as RetryError2,
|
|
7386
7411
|
TypeValidationError
|
|
@@ -7544,7 +7569,7 @@ function shouldSplitChunkTranslationError(error) {
|
|
|
7544
7569
|
if (isProviderServiceError(error)) {
|
|
7545
7570
|
return false;
|
|
7546
7571
|
}
|
|
7547
|
-
return NoObjectGeneratedError2.isInstance(error) || TypeValidationError.isInstance(error) || isTranslationChunkValidationError(error);
|
|
7572
|
+
return NoObjectGeneratedError2.isInstance(error) || NoOutputGeneratedError2.isInstance(error) || TypeValidationError.isInstance(error) || isIncompleteGenerationError(error) || isTranslationChunkValidationError(error);
|
|
7548
7573
|
}
|
|
7549
7574
|
function resolveTranslationChunkingOptions(options) {
|
|
7550
7575
|
const targetChunkDurationSeconds = Math.max(
|
|
@@ -7641,9 +7666,13 @@ function buildTranslationChunkRequests(vttContent, assetDurationSeconds, chunkin
|
|
|
7641
7666
|
if (typeof assetDurationSeconds !== "number" || assetDurationSeconds < resolvedChunking.minimumAssetDurationSeconds) {
|
|
7642
7667
|
return {
|
|
7643
7668
|
preamble,
|
|
7644
|
-
chunks:
|
|
7645
|
-
|
|
7646
|
-
|
|
7669
|
+
chunks: splitTranslationChunkRequestByBudget(
|
|
7670
|
+
"chunk-0",
|
|
7671
|
+
cues,
|
|
7672
|
+
cueBlocks,
|
|
7673
|
+
resolvedChunking.maxCuesPerChunk,
|
|
7674
|
+
resolvedChunking.maxCueTextTokensPerChunk
|
|
7675
|
+
)
|
|
7647
7676
|
};
|
|
7648
7677
|
}
|
|
7649
7678
|
const targetChunkDurationSeconds = resolvedChunking.targetChunkDurationSeconds;
|
|
@@ -7904,7 +7933,11 @@ async function translateChunkWithFallback({
|
|
|
7904
7933
|
);
|
|
7905
7934
|
return {
|
|
7906
7935
|
translatedVtt: concatenateVttSegments([leftResult.translatedVtt, rightResult.translatedVtt]),
|
|
7907
|
-
usage: aggregateTokenUsage([
|
|
7936
|
+
usage: aggregateTokenUsage([
|
|
7937
|
+
...failedAttemptUsage ? [failedAttemptUsage] : [],
|
|
7938
|
+
leftResult.usage,
|
|
7939
|
+
rightResult.usage
|
|
7940
|
+
]),
|
|
7908
7941
|
scrubbedCueCounts: mergeScrubbedCueCounts(
|
|
7909
7942
|
leftResult.scrubbedCueCounts,
|
|
7910
7943
|
rightResult.scrubbedCueCounts
|