@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,4 +1,4 @@
|
|
|
1
|
-
import { b as WorkflowCredentialsInput, A as AssetTextTrack, c as MuxAsset, h as TextChunk, C as ChunkingStrategy } from './types-
|
|
1
|
+
import { b as WorkflowCredentialsInput, A as AssetTextTrack, c as MuxAsset, h as TextChunk, C as ChunkingStrategy } from './types-BhVuLeSp.js';
|
|
2
2
|
|
|
3
3
|
declare const DEFAULT_STORYBOARD_WIDTH = 640;
|
|
4
4
|
/**
|
|
@@ -2,7 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
import { createAnthropic } from '@ai-sdk/anthropic';
|
|
3
3
|
import { createGoogleGenerativeAI } from '@ai-sdk/google';
|
|
4
4
|
import { createOpenAI } from '@ai-sdk/openai';
|
|
5
|
-
import { k as TokenUsage, M as MuxAIOptions, I as ImageSubmissionMode, C as ChunkingStrategy, j as VideoEmbeddingsResult, T as ToneType } from './types-
|
|
5
|
+
import { k as TokenUsage, M as MuxAIOptions, I as ImageSubmissionMode, C as ChunkingStrategy, j as VideoEmbeddingsResult, T as ToneType } from './types-BhVuLeSp.js';
|
|
6
6
|
|
|
7
7
|
interface ImageDownloadOptions {
|
|
8
8
|
/** Request timeout in milliseconds (default: 10000) */
|
|
@@ -124,11 +124,11 @@ declare const chapterSchema: z.ZodObject<{
|
|
|
124
124
|
startTime: z.ZodNumber;
|
|
125
125
|
title: z.ZodString;
|
|
126
126
|
}, "strip", z.ZodTypeAny, {
|
|
127
|
-
startTime: number;
|
|
128
127
|
title: string;
|
|
129
|
-
}, {
|
|
130
128
|
startTime: number;
|
|
129
|
+
}, {
|
|
131
130
|
title: string;
|
|
131
|
+
startTime: number;
|
|
132
132
|
}>;
|
|
133
133
|
type Chapter = z.infer<typeof chapterSchema>;
|
|
134
134
|
declare const chaptersSchema: z.ZodObject<{
|
|
@@ -136,21 +136,21 @@ declare const chaptersSchema: z.ZodObject<{
|
|
|
136
136
|
startTime: z.ZodNumber;
|
|
137
137
|
title: z.ZodString;
|
|
138
138
|
}, "strip", z.ZodTypeAny, {
|
|
139
|
-
startTime: number;
|
|
140
139
|
title: string;
|
|
141
|
-
}, {
|
|
142
140
|
startTime: number;
|
|
141
|
+
}, {
|
|
143
142
|
title: string;
|
|
143
|
+
startTime: number;
|
|
144
144
|
}>, "many">;
|
|
145
145
|
}, "strip", z.ZodTypeAny, {
|
|
146
146
|
chapters: {
|
|
147
|
-
startTime: number;
|
|
148
147
|
title: string;
|
|
148
|
+
startTime: number;
|
|
149
149
|
}[];
|
|
150
150
|
}, {
|
|
151
151
|
chapters: {
|
|
152
|
-
startTime: number;
|
|
153
152
|
title: string;
|
|
153
|
+
startTime: number;
|
|
154
154
|
}[];
|
|
155
155
|
}>;
|
|
156
156
|
type ChaptersType = z.infer<typeof chaptersSchema>;
|
|
@@ -320,12 +320,12 @@ declare const summarySchema: z.ZodObject<{
|
|
|
320
320
|
description: z.ZodString;
|
|
321
321
|
}, "strip", z.ZodTypeAny, {
|
|
322
322
|
title: string;
|
|
323
|
-
keywords: string[];
|
|
324
323
|
description: string;
|
|
324
|
+
keywords: string[];
|
|
325
325
|
}, {
|
|
326
326
|
title: string;
|
|
327
|
-
keywords: string[];
|
|
328
327
|
description: string;
|
|
328
|
+
keywords: string[];
|
|
329
329
|
}>;
|
|
330
330
|
type SummaryType = z.infer<typeof summarySchema>;
|
|
331
331
|
/** Structured return payload for `getSummaryAndTags`. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { W as WorkflowCredentials } from './types-
|
|
2
|
-
export { A as AssetTextTrack, i as ChunkEmbedding, C as ChunkingStrategy, E as Encrypted, a as EncryptedPayload, I as ImageSubmissionMode, M as MuxAIOptions, c as MuxAsset, f as PlaybackAsset, P as PlaybackPolicy, h as TextChunk, g as TokenChunkingConfig, k as TokenUsage, T as ToneType, V as VTTChunkingConfig, j as VideoEmbeddingsResult, b as WorkflowCredentialsInput, d as decryptFromWorkflow, e as encryptForWorkflow } from './types-
|
|
3
|
-
export { i as primitives } from './index-
|
|
4
|
-
export { i as workflows } from './index-
|
|
1
|
+
import { W as WorkflowCredentials } from './types-BhVuLeSp.js';
|
|
2
|
+
export { A as AssetTextTrack, i as ChunkEmbedding, C as ChunkingStrategy, E as Encrypted, a as EncryptedPayload, I as ImageSubmissionMode, M as MuxAIOptions, c as MuxAsset, f as PlaybackAsset, P as PlaybackPolicy, h as TextChunk, g as TokenChunkingConfig, k as TokenUsage, T as ToneType, V as VTTChunkingConfig, j as VideoEmbeddingsResult, b as WorkflowCredentialsInput, d as decryptFromWorkflow, e as encryptForWorkflow } from './types-BhVuLeSp.js';
|
|
3
|
+
export { i as primitives } from './index-2oUwgWsE.js';
|
|
4
|
+
export { i as workflows } from './index-DgCfxP4T.js';
|
|
5
5
|
import '@mux/mux-node';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import '@ai-sdk/anthropic';
|
|
8
8
|
import '@ai-sdk/google';
|
|
9
9
|
import '@ai-sdk/openai';
|
|
10
10
|
|
|
11
|
-
var version = "0.5.
|
|
11
|
+
var version = "0.5.2";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* A function that returns workflow credentials, either synchronously or asynchronously.
|
package/dist/index.js
CHANGED
|
@@ -28018,7 +28018,7 @@ var init_dist10 = __esm({
|
|
|
28018
28018
|
});
|
|
28019
28019
|
|
|
28020
28020
|
// package.json
|
|
28021
|
-
var version = "0.5.
|
|
28021
|
+
var version = "0.5.2";
|
|
28022
28022
|
|
|
28023
28023
|
// src/env.ts
|
|
28024
28024
|
import { z } from "zod";
|
|
@@ -28765,7 +28765,7 @@ __export(workflows_exports, {
|
|
|
28765
28765
|
});
|
|
28766
28766
|
|
|
28767
28767
|
// src/workflows/burned-in-captions.ts
|
|
28768
|
-
import {
|
|
28768
|
+
import { generateText, Output } from "ai";
|
|
28769
28769
|
import dedent from "dedent";
|
|
28770
28770
|
import { z as z21 } from "zod";
|
|
28771
28771
|
|
|
@@ -29061,7 +29061,7 @@ function createToneSection(instruction) {
|
|
|
29061
29061
|
// src/workflows/burned-in-captions.ts
|
|
29062
29062
|
var burnedInCaptionsSchema = z21.object({
|
|
29063
29063
|
hasBurnedInCaptions: z21.boolean(),
|
|
29064
|
-
confidence: z21.number()
|
|
29064
|
+
confidence: z21.number(),
|
|
29065
29065
|
detectedLanguage: z21.string().nullable()
|
|
29066
29066
|
});
|
|
29067
29067
|
var SYSTEM_PROMPT = dedent`
|
|
@@ -29162,9 +29162,9 @@ async function analyzeStoryboard({
|
|
|
29162
29162
|
}) {
|
|
29163
29163
|
"use step";
|
|
29164
29164
|
const model = await createLanguageModelFromConfig(provider, modelId, credentials);
|
|
29165
|
-
const response = await
|
|
29165
|
+
const response = await generateText({
|
|
29166
29166
|
model,
|
|
29167
|
-
schema: burnedInCaptionsSchema,
|
|
29167
|
+
output: Output.object({ schema: burnedInCaptionsSchema }),
|
|
29168
29168
|
experimental_telemetry: { isEnabled: true },
|
|
29169
29169
|
messages: [
|
|
29170
29170
|
{
|
|
@@ -29181,7 +29181,10 @@ async function analyzeStoryboard({
|
|
|
29181
29181
|
]
|
|
29182
29182
|
});
|
|
29183
29183
|
return {
|
|
29184
|
-
result:
|
|
29184
|
+
result: {
|
|
29185
|
+
...response.output,
|
|
29186
|
+
confidence: Math.min(1, Math.max(0, response.output.confidence))
|
|
29187
|
+
},
|
|
29185
29188
|
usage: {
|
|
29186
29189
|
inputTokens: response.usage.inputTokens,
|
|
29187
29190
|
outputTokens: response.usage.outputTokens,
|
|
@@ -29245,7 +29248,7 @@ async function hasBurnedInCaptions(assetId, options = {}) {
|
|
|
29245
29248
|
}
|
|
29246
29249
|
|
|
29247
29250
|
// src/workflows/chapters.ts
|
|
29248
|
-
import {
|
|
29251
|
+
import { generateText as generateText2, Output as Output2 } from "ai";
|
|
29249
29252
|
import dedent2 from "dedent";
|
|
29250
29253
|
import { z as z22 } from "zod";
|
|
29251
29254
|
|
|
@@ -29307,9 +29310,9 @@ async function generateChaptersWithAI({
|
|
|
29307
29310
|
"use step";
|
|
29308
29311
|
const model = await createLanguageModelFromConfig(provider, modelId, credentials);
|
|
29309
29312
|
const response = await withRetry(
|
|
29310
|
-
() =>
|
|
29313
|
+
() => generateText2({
|
|
29311
29314
|
model,
|
|
29312
|
-
schema: chaptersSchema,
|
|
29315
|
+
output: Output2.object({ schema: chaptersSchema }),
|
|
29313
29316
|
messages: [
|
|
29314
29317
|
{
|
|
29315
29318
|
role: "system",
|
|
@@ -29323,7 +29326,7 @@ async function generateChaptersWithAI({
|
|
|
29323
29326
|
})
|
|
29324
29327
|
);
|
|
29325
29328
|
return {
|
|
29326
|
-
chapters: response.
|
|
29329
|
+
chapters: response.output,
|
|
29327
29330
|
usage: {
|
|
29328
29331
|
inputTokens: response.usage.inputTokens,
|
|
29329
29332
|
outputTokens: response.usage.outputTokens,
|
|
@@ -30016,7 +30019,7 @@ async function getModerationScores(assetId, options = {}) {
|
|
|
30016
30019
|
}
|
|
30017
30020
|
|
|
30018
30021
|
// src/workflows/summarization.ts
|
|
30019
|
-
import {
|
|
30022
|
+
import { generateText as generateText3, Output as Output3 } from "ai";
|
|
30020
30023
|
import dedent3 from "dedent";
|
|
30021
30024
|
import { z as z23 } from "zod";
|
|
30022
30025
|
var SUMMARY_KEYWORD_LIMIT = 10;
|
|
@@ -30246,9 +30249,9 @@ function buildUserPrompt3({
|
|
|
30246
30249
|
async function analyzeStoryboard2(imageDataUrl, provider, modelId, userPrompt, systemPrompt, credentials) {
|
|
30247
30250
|
"use step";
|
|
30248
30251
|
const model = await createLanguageModelFromConfig(provider, modelId, credentials);
|
|
30249
|
-
const response = await
|
|
30252
|
+
const response = await generateText3({
|
|
30250
30253
|
model,
|
|
30251
|
-
schema: summarySchema,
|
|
30254
|
+
output: Output3.object({ schema: summarySchema }),
|
|
30252
30255
|
messages: [
|
|
30253
30256
|
{
|
|
30254
30257
|
role: "system",
|
|
@@ -30264,7 +30267,7 @@ async function analyzeStoryboard2(imageDataUrl, provider, modelId, userPrompt, s
|
|
|
30264
30267
|
]
|
|
30265
30268
|
});
|
|
30266
30269
|
return {
|
|
30267
|
-
result: response.
|
|
30270
|
+
result: response.output,
|
|
30268
30271
|
usage: {
|
|
30269
30272
|
inputTokens: response.usage.inputTokens,
|
|
30270
30273
|
outputTokens: response.usage.outputTokens,
|
|
@@ -30277,9 +30280,9 @@ async function analyzeStoryboard2(imageDataUrl, provider, modelId, userPrompt, s
|
|
|
30277
30280
|
async function analyzeAudioOnly(provider, modelId, userPrompt, systemPrompt, credentials) {
|
|
30278
30281
|
"use step";
|
|
30279
30282
|
const model = await createLanguageModelFromConfig(provider, modelId, credentials);
|
|
30280
|
-
const response = await
|
|
30283
|
+
const response = await generateText3({
|
|
30281
30284
|
model,
|
|
30282
|
-
schema: summarySchema,
|
|
30285
|
+
output: Output3.object({ schema: summarySchema }),
|
|
30283
30286
|
messages: [
|
|
30284
30287
|
{
|
|
30285
30288
|
role: "system",
|
|
@@ -30292,7 +30295,7 @@ async function analyzeAudioOnly(provider, modelId, userPrompt, systemPrompt, cre
|
|
|
30292
30295
|
]
|
|
30293
30296
|
});
|
|
30294
30297
|
return {
|
|
30295
|
-
result: response.
|
|
30298
|
+
result: response.output,
|
|
30296
30299
|
usage: {
|
|
30297
30300
|
inputTokens: response.usage.inputTokens,
|
|
30298
30301
|
outputTokens: response.usage.outputTokens,
|
|
@@ -30335,7 +30338,6 @@ async function getSummaryAndTags(assetId, options) {
|
|
|
30335
30338
|
cleanTranscript = true,
|
|
30336
30339
|
imageSubmissionMode = "url",
|
|
30337
30340
|
imageDownloadOptions,
|
|
30338
|
-
abortSignal: _abortSignal,
|
|
30339
30341
|
promptOverrides,
|
|
30340
30342
|
credentials
|
|
30341
30343
|
} = options ?? {};
|
|
@@ -30996,7 +30998,7 @@ async function translateAudio(assetId, toLanguageCode, options = {}) {
|
|
|
30996
30998
|
|
|
30997
30999
|
// src/workflows/translate-captions.ts
|
|
30998
31000
|
import Mux4 from "@mux/mux-node";
|
|
30999
|
-
import {
|
|
31001
|
+
import { generateText as generateText4, Output as Output4 } from "ai";
|
|
31000
31002
|
import { z as z24 } from "zod";
|
|
31001
31003
|
var translationSchema = z24.object({
|
|
31002
31004
|
translation: z24.string()
|
|
@@ -31015,15 +31017,13 @@ async function translateVttWithAI({
|
|
|
31015
31017
|
toLanguageCode,
|
|
31016
31018
|
provider,
|
|
31017
31019
|
modelId,
|
|
31018
|
-
abortSignal,
|
|
31019
31020
|
credentials
|
|
31020
31021
|
}) {
|
|
31021
31022
|
"use step";
|
|
31022
|
-
const
|
|
31023
|
-
const response = await
|
|
31024
|
-
model
|
|
31025
|
-
schema: translationSchema,
|
|
31026
|
-
abortSignal,
|
|
31023
|
+
const model = await createLanguageModelFromConfig(provider, modelId, credentials);
|
|
31024
|
+
const response = await generateText4({
|
|
31025
|
+
model,
|
|
31026
|
+
output: Output4.object({ schema: translationSchema }),
|
|
31027
31027
|
messages: [
|
|
31028
31028
|
{
|
|
31029
31029
|
role: "user",
|
|
@@ -31034,7 +31034,7 @@ ${vttContent}`
|
|
|
31034
31034
|
]
|
|
31035
31035
|
});
|
|
31036
31036
|
return {
|
|
31037
|
-
translatedVtt: response.
|
|
31037
|
+
translatedVtt: response.output.translation,
|
|
31038
31038
|
usage: {
|
|
31039
31039
|
inputTokens: response.usage.inputTokens,
|
|
31040
31040
|
outputTokens: response.usage.outputTokens,
|
|
@@ -31181,7 +31181,6 @@ async function translateCaptions(assetId, fromLanguageCode, toLanguageCode, opti
|
|
|
31181
31181
|
toLanguageCode,
|
|
31182
31182
|
provider: modelConfig.provider,
|
|
31183
31183
|
modelId: modelConfig.modelId,
|
|
31184
|
-
abortSignal: options.abortSignal,
|
|
31185
31184
|
credentials
|
|
31186
31185
|
});
|
|
31187
31186
|
translatedVtt = result.translatedVtt;
|