@mux/ai 0.5.1 → 0.5.2
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-B5bQ-IQk.d.ts → index-2oUwgWsE.d.ts} +1 -1
- package/dist/{index-D4eU6RMH.d.ts → index-DgCfxP4T.d.ts} +9 -9
- package/dist/index.d.ts +5 -5
- package/dist/index.js +26 -27
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.d.ts +2 -2
- package/dist/{types-KcVfWtUl.d.ts → types-BhVuLeSp.d.ts} +0 -6
- package/dist/workflows/index.d.ts +2 -2
- package/dist/workflows/index.js +25 -26
- package/dist/workflows/index.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { D as DEFAULT_STORYBOARD_WIDTH, T as ThumbnailOptions, f as TranscriptFetchOptions, h as TranscriptResult, V as VTTCue, n as buildTranscriptUrl, c as chunkByTokens, b as chunkText, a as chunkVTTCues, e as estimateTokenCount, l as extractTextFromVTT, m as extractTimestampedTranscript, o as fetchTranscriptForAsset, k as findCaptionTrack, j as getReadyTextTracks, g as getStoryboardUrl, d as getThumbnailUrls, p as parseVTTCues, s as secondsToTimestamp, v as vttTimestampToSeconds } from '../index-
|
|
2
|
-
import '../types-
|
|
1
|
+
export { D as DEFAULT_STORYBOARD_WIDTH, T as ThumbnailOptions, f as TranscriptFetchOptions, h as TranscriptResult, V as VTTCue, n as buildTranscriptUrl, c as chunkByTokens, b as chunkText, a as chunkVTTCues, e as estimateTokenCount, l as extractTextFromVTT, m as extractTimestampedTranscript, o as fetchTranscriptForAsset, k as findCaptionTrack, j as getReadyTextTracks, g as getStoryboardUrl, d as getThumbnailUrls, p as parseVTTCues, s as secondsToTimestamp, v as vttTimestampToSeconds } from '../index-2oUwgWsE.js';
|
|
2
|
+
import '../types-BhVuLeSp.js';
|
|
3
3
|
import '@mux/mux-node';
|
|
@@ -71,12 +71,6 @@ declare function decryptFromWorkflow<T>(payload: EncryptedPayload, key: Uint8Arr
|
|
|
71
71
|
interface MuxAIOptions {
|
|
72
72
|
/** Optional timeout (ms) for helper utilities that support request limits. */
|
|
73
73
|
timeout?: number;
|
|
74
|
-
/**
|
|
75
|
-
* Optional cancellation signal passed through to underlying AI SDK calls.
|
|
76
|
-
* When aborted, in-flight model requests will be
|
|
77
|
-
* cancelled where supported.
|
|
78
|
-
*/
|
|
79
|
-
abortSignal?: AbortSignal;
|
|
80
74
|
/**
|
|
81
75
|
* Optional credentials for workflow execution.
|
|
82
76
|
* Use encryptForWorkflow when running in Workflow Dev Kit environments.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { J as AudioTranslationOptions, I as AudioTranslationResult, e as BurnedInCaptionsAnalysis, c as BurnedInCaptionsOptions, b as BurnedInCaptionsPromptOverrides, a as BurnedInCaptionsPromptSections, B as BurnedInCaptionsResult, C as Chapter, o as ChapterSystemPromptSections, n as ChaptersOptions, m as ChaptersPromptOverrides, l as ChaptersPromptSections, k as ChaptersResult, j as ChaptersType, E as EmbeddingsOptions, q as EmbeddingsResult, u as HiveModerationOutput, H as HiveModerationSource, v as ModerationOptions, t as ModerationProvider, M as ModerationResult, S as SUMMARY_KEYWORD_LIMIT, F as SummarizationOptions, D as SummarizationPromptOverrides, A as SummarizationPromptSections, z as SummaryAndTagsResult, y as SummaryType, T as ThumbnailModerationScore, N as TranslationOptions, P as TranslationPayload, L as TranslationResult, d as burnedInCaptionsSchema, f as chapterSchema, g as chaptersSchema, p as generateChapters, r as generateEmbeddings, s as generateVideoEmbeddings, w as getModerationScores, G as getSummaryAndTags, h as hasBurnedInCaptions, x as summarySchema, K as translateAudio, Q as translateCaptions, O as translationSchema } from '../index-
|
|
1
|
+
export { J as AudioTranslationOptions, I as AudioTranslationResult, e as BurnedInCaptionsAnalysis, c as BurnedInCaptionsOptions, b as BurnedInCaptionsPromptOverrides, a as BurnedInCaptionsPromptSections, B as BurnedInCaptionsResult, C as Chapter, o as ChapterSystemPromptSections, n as ChaptersOptions, m as ChaptersPromptOverrides, l as ChaptersPromptSections, k as ChaptersResult, j as ChaptersType, E as EmbeddingsOptions, q as EmbeddingsResult, u as HiveModerationOutput, H as HiveModerationSource, v as ModerationOptions, t as ModerationProvider, M as ModerationResult, S as SUMMARY_KEYWORD_LIMIT, F as SummarizationOptions, D as SummarizationPromptOverrides, A as SummarizationPromptSections, z as SummaryAndTagsResult, y as SummaryType, T as ThumbnailModerationScore, N as TranslationOptions, P as TranslationPayload, L as TranslationResult, d as burnedInCaptionsSchema, f as chapterSchema, g as chaptersSchema, p as generateChapters, r as generateEmbeddings, s as generateVideoEmbeddings, w as getModerationScores, G as getSummaryAndTags, h as hasBurnedInCaptions, x as summarySchema, K as translateAudio, Q as translateCaptions, O as translationSchema } from '../index-DgCfxP4T.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '@ai-sdk/anthropic';
|
|
4
4
|
import '@ai-sdk/google';
|
|
5
5
|
import '@ai-sdk/openai';
|
|
6
|
-
import '../types-
|
|
6
|
+
import '../types-BhVuLeSp.js';
|
|
7
7
|
import '@mux/mux-node';
|
package/dist/workflows/index.js
CHANGED
|
@@ -28018,7 +28018,7 @@ var init_dist10 = __esm({
|
|
|
28018
28018
|
});
|
|
28019
28019
|
|
|
28020
28020
|
// src/workflows/burned-in-captions.ts
|
|
28021
|
-
import {
|
|
28021
|
+
import { generateText, Output } from "ai";
|
|
28022
28022
|
import dedent from "dedent";
|
|
28023
28023
|
import { z as z21 } from "zod";
|
|
28024
28024
|
|
|
@@ -28669,7 +28669,7 @@ async function getStoryboardUrl(playbackId, width = DEFAULT_STORYBOARD_WIDTH, sh
|
|
|
28669
28669
|
// src/workflows/burned-in-captions.ts
|
|
28670
28670
|
var burnedInCaptionsSchema = z21.object({
|
|
28671
28671
|
hasBurnedInCaptions: z21.boolean(),
|
|
28672
|
-
confidence: z21.number()
|
|
28672
|
+
confidence: z21.number(),
|
|
28673
28673
|
detectedLanguage: z21.string().nullable()
|
|
28674
28674
|
});
|
|
28675
28675
|
var SYSTEM_PROMPT = dedent`
|
|
@@ -28770,9 +28770,9 @@ async function analyzeStoryboard({
|
|
|
28770
28770
|
}) {
|
|
28771
28771
|
"use step";
|
|
28772
28772
|
const model = await createLanguageModelFromConfig(provider, modelId, credentials);
|
|
28773
|
-
const response = await
|
|
28773
|
+
const response = await generateText({
|
|
28774
28774
|
model,
|
|
28775
|
-
schema: burnedInCaptionsSchema,
|
|
28775
|
+
output: Output.object({ schema: burnedInCaptionsSchema }),
|
|
28776
28776
|
experimental_telemetry: { isEnabled: true },
|
|
28777
28777
|
messages: [
|
|
28778
28778
|
{
|
|
@@ -28789,7 +28789,10 @@ async function analyzeStoryboard({
|
|
|
28789
28789
|
]
|
|
28790
28790
|
});
|
|
28791
28791
|
return {
|
|
28792
|
-
result:
|
|
28792
|
+
result: {
|
|
28793
|
+
...response.output,
|
|
28794
|
+
confidence: Math.min(1, Math.max(0, response.output.confidence))
|
|
28795
|
+
},
|
|
28793
28796
|
usage: {
|
|
28794
28797
|
inputTokens: response.usage.inputTokens,
|
|
28795
28798
|
outputTokens: response.usage.outputTokens,
|
|
@@ -28853,7 +28856,7 @@ async function hasBurnedInCaptions(assetId, options = {}) {
|
|
|
28853
28856
|
}
|
|
28854
28857
|
|
|
28855
28858
|
// src/workflows/chapters.ts
|
|
28856
|
-
import {
|
|
28859
|
+
import { generateText as generateText2, Output as Output2 } from "ai";
|
|
28857
28860
|
import dedent2 from "dedent";
|
|
28858
28861
|
import { z as z22 } from "zod";
|
|
28859
28862
|
|
|
@@ -29082,9 +29085,9 @@ async function generateChaptersWithAI({
|
|
|
29082
29085
|
"use step";
|
|
29083
29086
|
const model = await createLanguageModelFromConfig(provider, modelId, credentials);
|
|
29084
29087
|
const response = await withRetry(
|
|
29085
|
-
() =>
|
|
29088
|
+
() => generateText2({
|
|
29086
29089
|
model,
|
|
29087
|
-
schema: chaptersSchema,
|
|
29090
|
+
output: Output2.object({ schema: chaptersSchema }),
|
|
29088
29091
|
messages: [
|
|
29089
29092
|
{
|
|
29090
29093
|
role: "system",
|
|
@@ -29098,7 +29101,7 @@ async function generateChaptersWithAI({
|
|
|
29098
29101
|
})
|
|
29099
29102
|
);
|
|
29100
29103
|
return {
|
|
29101
|
-
chapters: response.
|
|
29104
|
+
chapters: response.output,
|
|
29102
29105
|
usage: {
|
|
29103
29106
|
inputTokens: response.usage.inputTokens,
|
|
29104
29107
|
outputTokens: response.usage.outputTokens,
|
|
@@ -29915,7 +29918,7 @@ async function getModerationScores(assetId, options = {}) {
|
|
|
29915
29918
|
}
|
|
29916
29919
|
|
|
29917
29920
|
// src/workflows/summarization.ts
|
|
29918
|
-
import {
|
|
29921
|
+
import { generateText as generateText3, Output as Output3 } from "ai";
|
|
29919
29922
|
import dedent3 from "dedent";
|
|
29920
29923
|
import { z as z23 } from "zod";
|
|
29921
29924
|
var SUMMARY_KEYWORD_LIMIT = 10;
|
|
@@ -30145,9 +30148,9 @@ function buildUserPrompt3({
|
|
|
30145
30148
|
async function analyzeStoryboard2(imageDataUrl, provider, modelId, userPrompt, systemPrompt, credentials) {
|
|
30146
30149
|
"use step";
|
|
30147
30150
|
const model = await createLanguageModelFromConfig(provider, modelId, credentials);
|
|
30148
|
-
const response = await
|
|
30151
|
+
const response = await generateText3({
|
|
30149
30152
|
model,
|
|
30150
|
-
schema: summarySchema,
|
|
30153
|
+
output: Output3.object({ schema: summarySchema }),
|
|
30151
30154
|
messages: [
|
|
30152
30155
|
{
|
|
30153
30156
|
role: "system",
|
|
@@ -30163,7 +30166,7 @@ async function analyzeStoryboard2(imageDataUrl, provider, modelId, userPrompt, s
|
|
|
30163
30166
|
]
|
|
30164
30167
|
});
|
|
30165
30168
|
return {
|
|
30166
|
-
result: response.
|
|
30169
|
+
result: response.output,
|
|
30167
30170
|
usage: {
|
|
30168
30171
|
inputTokens: response.usage.inputTokens,
|
|
30169
30172
|
outputTokens: response.usage.outputTokens,
|
|
@@ -30176,9 +30179,9 @@ async function analyzeStoryboard2(imageDataUrl, provider, modelId, userPrompt, s
|
|
|
30176
30179
|
async function analyzeAudioOnly(provider, modelId, userPrompt, systemPrompt, credentials) {
|
|
30177
30180
|
"use step";
|
|
30178
30181
|
const model = await createLanguageModelFromConfig(provider, modelId, credentials);
|
|
30179
|
-
const response = await
|
|
30182
|
+
const response = await generateText3({
|
|
30180
30183
|
model,
|
|
30181
|
-
schema: summarySchema,
|
|
30184
|
+
output: Output3.object({ schema: summarySchema }),
|
|
30182
30185
|
messages: [
|
|
30183
30186
|
{
|
|
30184
30187
|
role: "system",
|
|
@@ -30191,7 +30194,7 @@ async function analyzeAudioOnly(provider, modelId, userPrompt, systemPrompt, cre
|
|
|
30191
30194
|
]
|
|
30192
30195
|
});
|
|
30193
30196
|
return {
|
|
30194
|
-
result: response.
|
|
30197
|
+
result: response.output,
|
|
30195
30198
|
usage: {
|
|
30196
30199
|
inputTokens: response.usage.inputTokens,
|
|
30197
30200
|
outputTokens: response.usage.outputTokens,
|
|
@@ -30234,7 +30237,6 @@ async function getSummaryAndTags(assetId, options) {
|
|
|
30234
30237
|
cleanTranscript = true,
|
|
30235
30238
|
imageSubmissionMode = "url",
|
|
30236
30239
|
imageDownloadOptions,
|
|
30237
|
-
abortSignal: _abortSignal,
|
|
30238
30240
|
promptOverrides,
|
|
30239
30241
|
credentials
|
|
30240
30242
|
} = options ?? {};
|
|
@@ -30895,7 +30897,7 @@ async function translateAudio(assetId, toLanguageCode, options = {}) {
|
|
|
30895
30897
|
|
|
30896
30898
|
// src/workflows/translate-captions.ts
|
|
30897
30899
|
import Mux4 from "@mux/mux-node";
|
|
30898
|
-
import {
|
|
30900
|
+
import { generateText as generateText4, Output as Output4 } from "ai";
|
|
30899
30901
|
import { z as z24 } from "zod";
|
|
30900
30902
|
var translationSchema = z24.object({
|
|
30901
30903
|
translation: z24.string()
|
|
@@ -30914,15 +30916,13 @@ async function translateVttWithAI({
|
|
|
30914
30916
|
toLanguageCode,
|
|
30915
30917
|
provider,
|
|
30916
30918
|
modelId,
|
|
30917
|
-
abortSignal,
|
|
30918
30919
|
credentials
|
|
30919
30920
|
}) {
|
|
30920
30921
|
"use step";
|
|
30921
|
-
const
|
|
30922
|
-
const response = await
|
|
30923
|
-
model
|
|
30924
|
-
schema: translationSchema,
|
|
30925
|
-
abortSignal,
|
|
30922
|
+
const model = await createLanguageModelFromConfig(provider, modelId, credentials);
|
|
30923
|
+
const response = await generateText4({
|
|
30924
|
+
model,
|
|
30925
|
+
output: Output4.object({ schema: translationSchema }),
|
|
30926
30926
|
messages: [
|
|
30927
30927
|
{
|
|
30928
30928
|
role: "user",
|
|
@@ -30933,7 +30933,7 @@ ${vttContent}`
|
|
|
30933
30933
|
]
|
|
30934
30934
|
});
|
|
30935
30935
|
return {
|
|
30936
|
-
translatedVtt: response.
|
|
30936
|
+
translatedVtt: response.output.translation,
|
|
30937
30937
|
usage: {
|
|
30938
30938
|
inputTokens: response.usage.inputTokens,
|
|
30939
30939
|
outputTokens: response.usage.outputTokens,
|
|
@@ -31080,7 +31080,6 @@ async function translateCaptions(assetId, fromLanguageCode, toLanguageCode, opti
|
|
|
31080
31080
|
toLanguageCode,
|
|
31081
31081
|
provider: modelConfig.provider,
|
|
31082
31082
|
modelId: modelConfig.modelId,
|
|
31083
|
-
abortSignal: options.abortSignal,
|
|
31084
31083
|
credentials
|
|
31085
31084
|
});
|
|
31086
31085
|
translatedVtt = result.translatedVtt;
|