@mux/ai 0.10.0 → 0.11.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/README.md +23 -1
- package/dist/{index-CA7bG50u.d.ts → index-BapL6paa.d.ts} +148 -12
- package/dist/{index-C8-E3VR9.d.ts → index-DLhfJsOd.d.ts} +73 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +680 -132
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.d.ts +1 -1
- package/dist/primitives/index.js +140 -1
- package/dist/primitives/index.js.map +1 -1
- package/dist/workflows/index.d.ts +1 -1
- package/dist/workflows/index.js +1953 -1544
- package/dist/workflows/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Easy to use, purpose-driven, cost effective, configurable **_workflow functions_** in a TypeScript SDK for building AI-powered video and audio workflows on the server, powered by [Mux](https://www.mux.com), with support for popular AI/LLM providers (OpenAI, Anthropic, Google).
|
|
7
7
|
|
|
8
|
-
- **Examples:** [`getSummaryAndTags`](#video-summarization), [`getModerationScores`](#content-moderation), [`hasBurnedInCaptions`](#burned-in-caption-detection), [`generateChapters`](#chapter-generation), [`generateEmbeddings`](#search-with-embeddings), [`translateCaptions`](#caption-translation), [`translateAudio`](#audio-dubbing)
|
|
8
|
+
- **Examples:** [`getSummaryAndTags`](#video-summarization), [`getModerationScores`](#content-moderation), [`hasBurnedInCaptions`](#burned-in-caption-detection), [`generateChapters`](#chapter-generation), [`generateEmbeddings`](#search-with-embeddings), [`translateCaptions`](#caption-translation), [`editCaptions`](#caption-editing), [`translateAudio`](#audio-dubbing)
|
|
9
9
|
- Workflows automatically ship with `"use workflow"` [compatability with Workflow DevKit](#compatability-with-workflow-devkit)
|
|
10
10
|
|
|
11
11
|
Turn your Mux video and audio assets into structured, actionable data — summaries, chapters, moderation scores, translations, embeddings, and more — with a single function call. `@mux/ai` handles fetching media data from Mux, formatting it for AI providers, and returning typed results so you can focus on building your product instead of wrangling prompts and media pipelines.
|
|
@@ -75,6 +75,7 @@ Workflows are high-level functions that handle complete media AI tasks end-to-en
|
|
|
75
75
|
| [`generateChapters`](./docs/WORKFLOWS.md#chapter-generation) | Create chapter markers from transcripts | OpenAI, Anthropic, Google | Yes |
|
|
76
76
|
| [`generateEmbeddings`](./docs/WORKFLOWS.md#embeddings) | Generate vector embeddings for semantic search | OpenAI, Google | Yes |
|
|
77
77
|
| [`translateCaptions`](./docs/WORKFLOWS.md#caption-translation) | Translate captions into other languages | OpenAI, Anthropic, Google | Yes |
|
|
78
|
+
| [`editCaptions`](./docs/WORKFLOWS.md#caption-editing) | Edit captions: censor profanity and/or apply static replacements | OpenAI, Anthropic, Google | Yes |
|
|
78
79
|
| [`translateAudio`](./docs/WORKFLOWS.md#audio-dubbing) | Create AI-dubbed audio tracks | ElevenLabs | Yes |
|
|
79
80
|
|
|
80
81
|
See the [Workflows guide](./docs/WORKFLOWS.md) for detailed documentation, options, and examples for each workflow. See the [API Reference](./docs/API.md) for complete parameter and return type details.
|
|
@@ -108,6 +109,27 @@ const result = await generateChapters("your-asset-id", "en", {
|
|
|
108
109
|
// [{ startTime: 0, title: "Introduction" }, { startTime: 45, title: "Main Content" }, ...]
|
|
109
110
|
```
|
|
110
111
|
|
|
112
|
+
**Caption editing:**
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
import { editCaptions } from "@mux/ai/workflows";
|
|
116
|
+
|
|
117
|
+
const result = await editCaptions("your-asset-id", "track-id", {
|
|
118
|
+
provider: "anthropic",
|
|
119
|
+
autoCensorProfanity: {
|
|
120
|
+
mode: "blank", // "blank" ([____]), "remove", or "mask" (????)
|
|
121
|
+
alwaysCensor: ["brandname"],
|
|
122
|
+
neverCensor: ["damn"],
|
|
123
|
+
},
|
|
124
|
+
replacements: [
|
|
125
|
+
{ find: "Mucks", replace: "Mux" },
|
|
126
|
+
],
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
console.log(result.totalReplacementCount); // 8
|
|
130
|
+
console.log(result.autoCensorProfanity?.replacements); // [{cueStartTime: 5, before: "shit", after: "[____]"}, ...]
|
|
131
|
+
```
|
|
132
|
+
|
|
111
133
|
**Semantic search embeddings:**
|
|
112
134
|
|
|
113
135
|
```ts
|
|
@@ -256,11 +256,11 @@ declare const chapterSchema: z.ZodObject<{
|
|
|
256
256
|
startTime: z.ZodNumber;
|
|
257
257
|
title: z.ZodString;
|
|
258
258
|
}, "strip", z.ZodTypeAny, {
|
|
259
|
-
title: string;
|
|
260
259
|
startTime: number;
|
|
261
|
-
}, {
|
|
262
260
|
title: string;
|
|
261
|
+
}, {
|
|
263
262
|
startTime: number;
|
|
263
|
+
title: string;
|
|
264
264
|
}>;
|
|
265
265
|
type Chapter = z.infer<typeof chapterSchema>;
|
|
266
266
|
declare const chaptersSchema: z.ZodObject<{
|
|
@@ -268,21 +268,21 @@ declare const chaptersSchema: z.ZodObject<{
|
|
|
268
268
|
startTime: z.ZodNumber;
|
|
269
269
|
title: z.ZodString;
|
|
270
270
|
}, "strip", z.ZodTypeAny, {
|
|
271
|
-
title: string;
|
|
272
271
|
startTime: number;
|
|
273
|
-
}, {
|
|
274
272
|
title: string;
|
|
273
|
+
}, {
|
|
275
274
|
startTime: number;
|
|
275
|
+
title: string;
|
|
276
276
|
}>, "many">;
|
|
277
277
|
}, "strip", z.ZodTypeAny, {
|
|
278
278
|
chapters: {
|
|
279
|
-
title: string;
|
|
280
279
|
startTime: number;
|
|
280
|
+
title: string;
|
|
281
281
|
}[];
|
|
282
282
|
}, {
|
|
283
283
|
chapters: {
|
|
284
|
-
title: string;
|
|
285
284
|
startTime: number;
|
|
285
|
+
title: string;
|
|
286
286
|
}[];
|
|
287
287
|
}>;
|
|
288
288
|
type ChaptersType = z.infer<typeof chaptersSchema>;
|
|
@@ -348,6 +348,119 @@ interface ChaptersOptions extends MuxAIOptions {
|
|
|
348
348
|
type ChapterSystemPromptSections = "role" | "context" | "constraints" | "qualityGuidelines";
|
|
349
349
|
declare function generateChapters(assetId: string, languageCode: string, options?: ChaptersOptions): Promise<ChaptersResult>;
|
|
350
350
|
|
|
351
|
+
/** Replacement strategy for censored words. */
|
|
352
|
+
type CensorMode = "blank" | "remove" | "mask";
|
|
353
|
+
interface AutoCensorProfanityOptions {
|
|
354
|
+
mode?: CensorMode;
|
|
355
|
+
alwaysCensor?: string[];
|
|
356
|
+
neverCensor?: string[];
|
|
357
|
+
}
|
|
358
|
+
interface CaptionReplacement {
|
|
359
|
+
find: string;
|
|
360
|
+
replace: string;
|
|
361
|
+
}
|
|
362
|
+
interface ReplacementRecord {
|
|
363
|
+
cueStartTime: number;
|
|
364
|
+
before: string;
|
|
365
|
+
after: string;
|
|
366
|
+
}
|
|
367
|
+
/** Configuration accepted by `editCaptions`. */
|
|
368
|
+
interface EditCaptionsOptions<P extends SupportedProvider = SupportedProvider> extends MuxAIOptions {
|
|
369
|
+
/** Provider responsible for profanity detection. Required when autoCensorProfanity is set. */
|
|
370
|
+
provider?: P;
|
|
371
|
+
/** Provider-specific chat model identifier. */
|
|
372
|
+
model?: ModelIdByProvider[P];
|
|
373
|
+
/** LLM-powered profanity censorship. */
|
|
374
|
+
autoCensorProfanity?: AutoCensorProfanityOptions;
|
|
375
|
+
/** Static find/replace pairs (no LLM needed). */
|
|
376
|
+
replacements?: CaptionReplacement[];
|
|
377
|
+
/** Delete the original track after creating the edited one. Defaults to true. */
|
|
378
|
+
deleteOriginalTrack?: boolean;
|
|
379
|
+
/**
|
|
380
|
+
* When true (default) the edited VTT is uploaded to the configured
|
|
381
|
+
* bucket and attached to the Mux asset.
|
|
382
|
+
*/
|
|
383
|
+
uploadToMux?: boolean;
|
|
384
|
+
/** Optional override for the S3-compatible endpoint used for uploads. */
|
|
385
|
+
s3Endpoint?: string;
|
|
386
|
+
/** S3 region (defaults to env.S3_REGION or 'auto'). */
|
|
387
|
+
s3Region?: string;
|
|
388
|
+
/** Bucket that will store edited VTT files. */
|
|
389
|
+
s3Bucket?: string;
|
|
390
|
+
/** Suffix appended to the original track name, e.g. "edited" produces "Subtitles (edited)". Defaults to "edited". */
|
|
391
|
+
trackNameSuffix?: string;
|
|
392
|
+
/** Expiry duration in seconds for S3 presigned GET URLs. Defaults to 86400 (24 hours). */
|
|
393
|
+
s3SignedUrlExpirySeconds?: number;
|
|
394
|
+
}
|
|
395
|
+
/** Output returned from `editCaptions`. */
|
|
396
|
+
interface EditCaptionsResult {
|
|
397
|
+
assetId: string;
|
|
398
|
+
trackId: string;
|
|
399
|
+
originalVtt: string;
|
|
400
|
+
editedVtt: string;
|
|
401
|
+
totalReplacementCount: number;
|
|
402
|
+
autoCensorProfanity?: {
|
|
403
|
+
replacements: ReplacementRecord[];
|
|
404
|
+
};
|
|
405
|
+
replacements?: {
|
|
406
|
+
replacements: ReplacementRecord[];
|
|
407
|
+
};
|
|
408
|
+
uploadedTrackId?: string;
|
|
409
|
+
presignedUrl?: string;
|
|
410
|
+
usage?: TokenUsage;
|
|
411
|
+
}
|
|
412
|
+
/** Schema used when requesting profanity detection from a language model. */
|
|
413
|
+
declare const profanityDetectionSchema: z.ZodObject<{
|
|
414
|
+
profanity: z.ZodArray<z.ZodString, "many">;
|
|
415
|
+
}, "strip", z.ZodTypeAny, {
|
|
416
|
+
profanity: string[];
|
|
417
|
+
}, {
|
|
418
|
+
profanity: string[];
|
|
419
|
+
}>;
|
|
420
|
+
/** Inferred shape returned by `profanityDetectionSchema`. */
|
|
421
|
+
type ProfanityDetectionPayload = z.infer<typeof profanityDetectionSchema>;
|
|
422
|
+
/**
|
|
423
|
+
* Applies a transform function only to VTT cue text lines, leaving headers,
|
|
424
|
+
* timestamps, and cue identifiers untouched. A cue text line is any line that
|
|
425
|
+
* follows a timestamp line (contains "-->") up until the next blank line.
|
|
426
|
+
* The transform receives the line text and the cue's start time in seconds.
|
|
427
|
+
*/
|
|
428
|
+
declare function transformCueText(rawVtt: string, transform: (line: string, cueStartTime: number) => string): string;
|
|
429
|
+
/**
|
|
430
|
+
* Builds a case-insensitive word-boundary regex from an array of profane words.
|
|
431
|
+
* Words are sorted longest-first so multi-word phrases match before individual words.
|
|
432
|
+
*/
|
|
433
|
+
declare function buildReplacementRegex(words: string[]): RegExp | null;
|
|
434
|
+
/**
|
|
435
|
+
* Returns a replacer function for the given censor mode.
|
|
436
|
+
*/
|
|
437
|
+
declare function createReplacer(mode: CensorMode): (match: string) => string;
|
|
438
|
+
/**
|
|
439
|
+
* Applies profanity censorship to cue text lines in raw VTT content via
|
|
440
|
+
* regex replacement. Headers, timestamps, and cue identifiers are untouched.
|
|
441
|
+
*/
|
|
442
|
+
declare function censorVttContent(rawVtt: string, profanity: string[], mode: CensorMode): {
|
|
443
|
+
censoredVtt: string;
|
|
444
|
+
replacements: ReplacementRecord[];
|
|
445
|
+
};
|
|
446
|
+
/**
|
|
447
|
+
* Merges `alwaysCensor` into and filters `neverCensor` from an LLM-detected
|
|
448
|
+
* profanity list. Comparison is case-insensitive. `neverCensor` takes
|
|
449
|
+
* precedence over `alwaysCensor` when the same word appears in both.
|
|
450
|
+
*/
|
|
451
|
+
declare function applyOverrideLists(detected: string[], alwaysCensor: string[], neverCensor: string[]): string[];
|
|
452
|
+
/**
|
|
453
|
+
* Applies static find/replace pairs to cue text lines in raw VTT content
|
|
454
|
+
* using word-boundary regex. Case-sensitive matching since static replacements
|
|
455
|
+
* target specific known strings. Headers, timestamps, and cue identifiers are
|
|
456
|
+
* untouched. Returns the edited VTT and the total number of replacements.
|
|
457
|
+
*/
|
|
458
|
+
declare function applyReplacements(rawVtt: string, replacements: CaptionReplacement[]): {
|
|
459
|
+
editedVtt: string;
|
|
460
|
+
replacements: ReplacementRecord[];
|
|
461
|
+
};
|
|
462
|
+
declare function editCaptions<P extends SupportedProvider = SupportedProvider>(assetId: string, trackId: string, options: EditCaptionsOptions<P>): Promise<EditCaptionsResult>;
|
|
463
|
+
|
|
351
464
|
/** Configuration accepted by `generateEmbeddings`. */
|
|
352
465
|
interface EmbeddingsOptions extends MuxAIOptions {
|
|
353
466
|
/** AI provider used to generate embeddings (defaults to 'openai'). */
|
|
@@ -458,7 +571,9 @@ declare const HIVE_VIOLENCE_CATEGORIES: string[];
|
|
|
458
571
|
*/
|
|
459
572
|
declare function getModerationScores(assetId: string, options?: ModerationOptions): Promise<ModerationResult>;
|
|
460
573
|
|
|
461
|
-
declare const
|
|
574
|
+
declare const DEFAULT_SUMMARY_KEYWORD_LIMIT = 10;
|
|
575
|
+
declare const DEFAULT_TITLE_LENGTH = 10;
|
|
576
|
+
declare const DEFAULT_DESCRIPTION_LENGTH = 50;
|
|
462
577
|
declare const summarySchema: z.ZodObject<{
|
|
463
578
|
keywords: z.ZodArray<z.ZodString, "many">;
|
|
464
579
|
title: z.ZodString;
|
|
@@ -531,9 +646,9 @@ interface SummarizationOptions extends MuxAIOptions {
|
|
|
531
646
|
* Useful for customizing the AI's output for specific use cases (SEO, social media, etc.)
|
|
532
647
|
*/
|
|
533
648
|
promptOverrides?: SummarizationPromptOverrides;
|
|
534
|
-
/** Desired title length in
|
|
649
|
+
/** Desired title length in words. */
|
|
535
650
|
titleLength?: number;
|
|
536
|
-
/** Desired description length in
|
|
651
|
+
/** Desired description length in words. */
|
|
537
652
|
descriptionLength?: number;
|
|
538
653
|
/** Desired number of tags. */
|
|
539
654
|
tagCount?: number;
|
|
@@ -682,6 +797,8 @@ interface AudioTranslationOptions extends MuxAIOptions {
|
|
|
682
797
|
uploadToMux?: boolean;
|
|
683
798
|
/** Optional storage adapter override for upload + presign operations. */
|
|
684
799
|
storageAdapter?: StorageAdapter;
|
|
800
|
+
/** Expiry duration in seconds for S3 presigned GET URLs. Defaults to 86400 (24 hours). */
|
|
801
|
+
s3SignedUrlExpirySeconds?: number;
|
|
685
802
|
}
|
|
686
803
|
declare function translateAudio(assetId: string, toLanguageCode: string, options?: AudioTranslationOptions): Promise<AudioTranslationResult>;
|
|
687
804
|
|
|
@@ -728,6 +845,8 @@ interface TranslationOptions<P extends SupportedProvider = SupportedProvider> ex
|
|
|
728
845
|
uploadToMux?: boolean;
|
|
729
846
|
/** Optional storage adapter override for upload + presign operations. */
|
|
730
847
|
storageAdapter?: StorageAdapter;
|
|
848
|
+
/** Expiry duration in seconds for S3 presigned GET URLs. Defaults to 86400 (24 hours). */
|
|
849
|
+
s3SignedUrlExpirySeconds?: number;
|
|
731
850
|
/**
|
|
732
851
|
* Optional VTT-aware chunking for caption translation.
|
|
733
852
|
* When enabled, the workflow splits cue-aligned translation requests by
|
|
@@ -768,11 +887,14 @@ type index_AskQuestionsResult = AskQuestionsResult;
|
|
|
768
887
|
type index_AskQuestionsType = AskQuestionsType;
|
|
769
888
|
type index_AudioTranslationOptions = AudioTranslationOptions;
|
|
770
889
|
type index_AudioTranslationResult = AudioTranslationResult;
|
|
890
|
+
type index_AutoCensorProfanityOptions = AutoCensorProfanityOptions;
|
|
771
891
|
type index_BurnedInCaptionsAnalysis = BurnedInCaptionsAnalysis;
|
|
772
892
|
type index_BurnedInCaptionsOptions = BurnedInCaptionsOptions;
|
|
773
893
|
type index_BurnedInCaptionsPromptOverrides = BurnedInCaptionsPromptOverrides;
|
|
774
894
|
type index_BurnedInCaptionsPromptSections = BurnedInCaptionsPromptSections;
|
|
775
895
|
type index_BurnedInCaptionsResult = BurnedInCaptionsResult;
|
|
896
|
+
type index_CaptionReplacement = CaptionReplacement;
|
|
897
|
+
type index_CensorMode = CensorMode;
|
|
776
898
|
type index_Chapter = Chapter;
|
|
777
899
|
type index_ChapterSystemPromptSections = ChapterSystemPromptSections;
|
|
778
900
|
type index_ChaptersOptions = ChaptersOptions;
|
|
@@ -780,6 +902,11 @@ type index_ChaptersPromptOverrides = ChaptersPromptOverrides;
|
|
|
780
902
|
type index_ChaptersPromptSections = ChaptersPromptSections;
|
|
781
903
|
type index_ChaptersResult = ChaptersResult;
|
|
782
904
|
type index_ChaptersType = ChaptersType;
|
|
905
|
+
declare const index_DEFAULT_DESCRIPTION_LENGTH: typeof DEFAULT_DESCRIPTION_LENGTH;
|
|
906
|
+
declare const index_DEFAULT_SUMMARY_KEYWORD_LIMIT: typeof DEFAULT_SUMMARY_KEYWORD_LIMIT;
|
|
907
|
+
declare const index_DEFAULT_TITLE_LENGTH: typeof DEFAULT_TITLE_LENGTH;
|
|
908
|
+
type index_EditCaptionsOptions<P extends SupportedProvider = SupportedProvider> = EditCaptionsOptions<P>;
|
|
909
|
+
type index_EditCaptionsResult = EditCaptionsResult;
|
|
783
910
|
type index_EmbeddingsOptions = EmbeddingsOptions;
|
|
784
911
|
type index_EmbeddingsResult = EmbeddingsResult;
|
|
785
912
|
declare const index_HIVE_SEXUAL_CATEGORIES: typeof HIVE_SEXUAL_CATEGORIES;
|
|
@@ -789,10 +916,11 @@ type index_HiveModerationSource = HiveModerationSource;
|
|
|
789
916
|
type index_ModerationOptions = ModerationOptions;
|
|
790
917
|
type index_ModerationProvider = ModerationProvider;
|
|
791
918
|
type index_ModerationResult = ModerationResult;
|
|
919
|
+
type index_ProfanityDetectionPayload = ProfanityDetectionPayload;
|
|
792
920
|
type index_Question = Question;
|
|
793
921
|
type index_QuestionAnswer = QuestionAnswer;
|
|
794
922
|
type index_QuestionAnswerType = QuestionAnswerType;
|
|
795
|
-
|
|
923
|
+
type index_ReplacementRecord = ReplacementRecord;
|
|
796
924
|
type index_SummarizationOptions = SummarizationOptions;
|
|
797
925
|
type index_SummarizationPromptOverrides = SummarizationPromptOverrides;
|
|
798
926
|
type index_SummarizationPromptSections = SummarizationPromptSections;
|
|
@@ -804,24 +932,32 @@ type index_TranslationOptions<P extends SupportedProvider = SupportedProvider> =
|
|
|
804
932
|
type index_TranslationPayload = TranslationPayload;
|
|
805
933
|
type index_TranslationResult = TranslationResult;
|
|
806
934
|
declare const index_aggregateTokenUsage: typeof aggregateTokenUsage;
|
|
935
|
+
declare const index_applyOverrideLists: typeof applyOverrideLists;
|
|
936
|
+
declare const index_applyReplacements: typeof applyReplacements;
|
|
807
937
|
declare const index_askQuestions: typeof askQuestions;
|
|
938
|
+
declare const index_buildReplacementRegex: typeof buildReplacementRegex;
|
|
808
939
|
declare const index_burnedInCaptionsSchema: typeof burnedInCaptionsSchema;
|
|
940
|
+
declare const index_censorVttContent: typeof censorVttContent;
|
|
809
941
|
declare const index_chapterSchema: typeof chapterSchema;
|
|
810
942
|
declare const index_chaptersSchema: typeof chaptersSchema;
|
|
943
|
+
declare const index_createReplacer: typeof createReplacer;
|
|
944
|
+
declare const index_editCaptions: typeof editCaptions;
|
|
811
945
|
declare const index_generateChapters: typeof generateChapters;
|
|
812
946
|
declare const index_generateEmbeddings: typeof generateEmbeddings;
|
|
813
947
|
declare const index_generateVideoEmbeddings: typeof generateVideoEmbeddings;
|
|
814
948
|
declare const index_getModerationScores: typeof getModerationScores;
|
|
815
949
|
declare const index_getSummaryAndTags: typeof getSummaryAndTags;
|
|
816
950
|
declare const index_hasBurnedInCaptions: typeof hasBurnedInCaptions;
|
|
951
|
+
declare const index_profanityDetectionSchema: typeof profanityDetectionSchema;
|
|
817
952
|
declare const index_questionAnswerSchema: typeof questionAnswerSchema;
|
|
818
953
|
declare const index_shouldSplitChunkTranslationError: typeof shouldSplitChunkTranslationError;
|
|
819
954
|
declare const index_summarySchema: typeof summarySchema;
|
|
955
|
+
declare const index_transformCueText: typeof transformCueText;
|
|
820
956
|
declare const index_translateAudio: typeof translateAudio;
|
|
821
957
|
declare const index_translateCaptions: typeof translateCaptions;
|
|
822
958
|
declare const index_translationSchema: typeof translationSchema;
|
|
823
959
|
declare namespace index {
|
|
824
|
-
export { type index_AskQuestionsOptions as AskQuestionsOptions, type index_AskQuestionsResult as AskQuestionsResult, type index_AskQuestionsType as AskQuestionsType, type index_AudioTranslationOptions as AudioTranslationOptions, type index_AudioTranslationResult as AudioTranslationResult, type index_BurnedInCaptionsAnalysis as BurnedInCaptionsAnalysis, type index_BurnedInCaptionsOptions as BurnedInCaptionsOptions, type index_BurnedInCaptionsPromptOverrides as BurnedInCaptionsPromptOverrides, type index_BurnedInCaptionsPromptSections as BurnedInCaptionsPromptSections, type index_BurnedInCaptionsResult as BurnedInCaptionsResult, type index_Chapter as Chapter, type index_ChapterSystemPromptSections as ChapterSystemPromptSections, type index_ChaptersOptions as ChaptersOptions, type index_ChaptersPromptOverrides as ChaptersPromptOverrides, type index_ChaptersPromptSections as ChaptersPromptSections, type index_ChaptersResult as ChaptersResult, type index_ChaptersType as ChaptersType, type index_EmbeddingsOptions as EmbeddingsOptions, type index_EmbeddingsResult as EmbeddingsResult, index_HIVE_SEXUAL_CATEGORIES as HIVE_SEXUAL_CATEGORIES, index_HIVE_VIOLENCE_CATEGORIES as HIVE_VIOLENCE_CATEGORIES, type index_HiveModerationOutput as HiveModerationOutput, type index_HiveModerationSource as HiveModerationSource, type index_ModerationOptions as ModerationOptions, type index_ModerationProvider as ModerationProvider, type index_ModerationResult as ModerationResult, type index_Question as Question, type index_QuestionAnswer as QuestionAnswer, type index_QuestionAnswerType as QuestionAnswerType,
|
|
960
|
+
export { type index_AskQuestionsOptions as AskQuestionsOptions, type index_AskQuestionsResult as AskQuestionsResult, type index_AskQuestionsType as AskQuestionsType, type index_AudioTranslationOptions as AudioTranslationOptions, type index_AudioTranslationResult as AudioTranslationResult, type index_AutoCensorProfanityOptions as AutoCensorProfanityOptions, type index_BurnedInCaptionsAnalysis as BurnedInCaptionsAnalysis, type index_BurnedInCaptionsOptions as BurnedInCaptionsOptions, type index_BurnedInCaptionsPromptOverrides as BurnedInCaptionsPromptOverrides, type index_BurnedInCaptionsPromptSections as BurnedInCaptionsPromptSections, type index_BurnedInCaptionsResult as BurnedInCaptionsResult, type index_CaptionReplacement as CaptionReplacement, type index_CensorMode as CensorMode, type index_Chapter as Chapter, type index_ChapterSystemPromptSections as ChapterSystemPromptSections, type index_ChaptersOptions as ChaptersOptions, type index_ChaptersPromptOverrides as ChaptersPromptOverrides, type index_ChaptersPromptSections as ChaptersPromptSections, type index_ChaptersResult as ChaptersResult, type index_ChaptersType as ChaptersType, index_DEFAULT_DESCRIPTION_LENGTH as DEFAULT_DESCRIPTION_LENGTH, index_DEFAULT_SUMMARY_KEYWORD_LIMIT as DEFAULT_SUMMARY_KEYWORD_LIMIT, index_DEFAULT_TITLE_LENGTH as DEFAULT_TITLE_LENGTH, type index_EditCaptionsOptions as EditCaptionsOptions, type index_EditCaptionsResult as EditCaptionsResult, type index_EmbeddingsOptions as EmbeddingsOptions, type index_EmbeddingsResult as EmbeddingsResult, index_HIVE_SEXUAL_CATEGORIES as HIVE_SEXUAL_CATEGORIES, index_HIVE_VIOLENCE_CATEGORIES as HIVE_VIOLENCE_CATEGORIES, type index_HiveModerationOutput as HiveModerationOutput, type index_HiveModerationSource as HiveModerationSource, type index_ModerationOptions as ModerationOptions, type index_ModerationProvider as ModerationProvider, type index_ModerationResult as ModerationResult, type index_ProfanityDetectionPayload as ProfanityDetectionPayload, type index_Question as Question, type index_QuestionAnswer as QuestionAnswer, type index_QuestionAnswerType as QuestionAnswerType, type index_ReplacementRecord as ReplacementRecord, type index_SummarizationOptions as SummarizationOptions, type index_SummarizationPromptOverrides as SummarizationPromptOverrides, type index_SummarizationPromptSections as SummarizationPromptSections, type index_SummaryAndTagsResult as SummaryAndTagsResult, type index_SummaryType as SummaryType, type index_ThumbnailModerationScore as ThumbnailModerationScore, type index_TranslationChunkingOptions as TranslationChunkingOptions, type index_TranslationOptions as TranslationOptions, type index_TranslationPayload as TranslationPayload, type index_TranslationResult as TranslationResult, index_aggregateTokenUsage as aggregateTokenUsage, index_applyOverrideLists as applyOverrideLists, index_applyReplacements as applyReplacements, index_askQuestions as askQuestions, index_buildReplacementRegex as buildReplacementRegex, index_burnedInCaptionsSchema as burnedInCaptionsSchema, index_censorVttContent as censorVttContent, index_chapterSchema as chapterSchema, index_chaptersSchema as chaptersSchema, index_createReplacer as createReplacer, index_editCaptions as editCaptions, index_generateChapters as generateChapters, index_generateEmbeddings as generateEmbeddings, index_generateVideoEmbeddings as generateVideoEmbeddings, index_getModerationScores as getModerationScores, index_getSummaryAndTags as getSummaryAndTags, index_hasBurnedInCaptions as hasBurnedInCaptions, index_profanityDetectionSchema as profanityDetectionSchema, index_questionAnswerSchema as questionAnswerSchema, index_shouldSplitChunkTranslationError as shouldSplitChunkTranslationError, index_summarySchema as summarySchema, index_transformCueText as transformCueText, index_translateAudio as translateAudio, index_translateCaptions as translateCaptions, index_translationSchema as translationSchema };
|
|
825
961
|
}
|
|
826
962
|
|
|
827
|
-
export {
|
|
963
|
+
export { askQuestions as $, type AskQuestionsOptions as A, type BurnedInCaptionsAnalysis as B, type CaptionReplacement as C, DEFAULT_DESCRIPTION_LENGTH as D, type EditCaptionsOptions as E, type ModerationProvider as F, type ModerationResult as G, HIVE_SEXUAL_CATEGORIES as H, type QuestionAnswer as I, type QuestionAnswerType as J, type SummarizationPromptOverrides as K, type SummarizationPromptSections as L, type ModerationOptions as M, type SummaryAndTagsResult as N, type SummaryType as O, type ProfanityDetectionPayload as P, type Question as Q, type ReplacementRecord as R, type SummarizationOptions as S, type ThumbnailModerationScore as T, type TranslationChunkingOptions as U, type TranslationOptions as V, type TranslationPayload as W, type TranslationResult as X, aggregateTokenUsage as Y, applyOverrideLists as Z, applyReplacements as _, type AskQuestionsResult as a, buildReplacementRegex as a0, burnedInCaptionsSchema as a1, censorVttContent as a2, chapterSchema as a3, chaptersSchema as a4, createReplacer as a5, editCaptions as a6, generateChapters as a7, generateEmbeddings as a8, generateVideoEmbeddings as a9, getModerationScores as aa, getSummaryAndTags as ab, hasBurnedInCaptions as ac, profanityDetectionSchema as ad, questionAnswerSchema as ae, shouldSplitChunkTranslationError as af, summarySchema as ag, transformCueText as ah, translateAudio as ai, translateCaptions as aj, translationSchema as ak, type AskQuestionsType as b, type AudioTranslationOptions as c, type AudioTranslationResult as d, type AutoCensorProfanityOptions as e, type BurnedInCaptionsOptions as f, type BurnedInCaptionsPromptOverrides as g, type BurnedInCaptionsPromptSections as h, index as i, type BurnedInCaptionsResult as j, type CensorMode as k, type Chapter as l, type ChapterSystemPromptSections as m, type ChaptersOptions as n, type ChaptersPromptOverrides as o, type ChaptersPromptSections as p, type ChaptersResult as q, type ChaptersType as r, DEFAULT_SUMMARY_KEYWORD_LIMIT as s, DEFAULT_TITLE_LENGTH as t, type EditCaptionsResult as u, type EmbeddingsOptions as v, type EmbeddingsResult as w, HIVE_VIOLENCE_CATEGORIES as x, type HiveModerationOutput as y, type HiveModerationSource as z };
|
|
@@ -99,6 +99,67 @@ declare function getHotspotsForVideo(videoId: string, options?: HotspotOptions):
|
|
|
99
99
|
*/
|
|
100
100
|
declare function getHotspotsForPlaybackId(playbackId: string, options?: HotspotOptions): Promise<Hotspot[]>;
|
|
101
101
|
|
|
102
|
+
interface Shot {
|
|
103
|
+
/** Start time of the shot in seconds from the beginning of the asset. */
|
|
104
|
+
startTime: number;
|
|
105
|
+
/** Signed URL for a representative image of the shot. */
|
|
106
|
+
imageUrl: string;
|
|
107
|
+
}
|
|
108
|
+
interface PendingShotsResult {
|
|
109
|
+
status: "pending";
|
|
110
|
+
createdAt: string;
|
|
111
|
+
}
|
|
112
|
+
interface ErroredShotsResult {
|
|
113
|
+
status: "errored";
|
|
114
|
+
createdAt: string;
|
|
115
|
+
error: {
|
|
116
|
+
type: string;
|
|
117
|
+
messages: string[];
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
interface CompletedShotsResult {
|
|
121
|
+
status: "completed";
|
|
122
|
+
createdAt: string;
|
|
123
|
+
shots: Shot[];
|
|
124
|
+
}
|
|
125
|
+
type ShotsResult = PendingShotsResult | ErroredShotsResult | CompletedShotsResult;
|
|
126
|
+
interface ShotRequestOptions {
|
|
127
|
+
/** Optional workflow credentials */
|
|
128
|
+
credentials?: WorkflowCredentialsInput;
|
|
129
|
+
}
|
|
130
|
+
interface WaitForShotsOptions extends ShotRequestOptions {
|
|
131
|
+
/** Polling interval in milliseconds (default: 2000, minimum enforced: 1000) */
|
|
132
|
+
pollIntervalMs?: number;
|
|
133
|
+
/** Maximum number of polling attempts (default: 60) */
|
|
134
|
+
maxAttempts?: number;
|
|
135
|
+
/** When true, request shot generation before polling (default: true) */
|
|
136
|
+
createIfMissing?: boolean;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Starts generating shots for an asset.
|
|
140
|
+
*
|
|
141
|
+
* @param assetId - The Mux asset ID
|
|
142
|
+
* @param options - Request options
|
|
143
|
+
* @returns Pending shot generation state
|
|
144
|
+
*/
|
|
145
|
+
declare function requestShotsForAsset(assetId: string, options?: ShotRequestOptions): Promise<PendingShotsResult>;
|
|
146
|
+
/**
|
|
147
|
+
* Gets the current shot generation status for an asset.
|
|
148
|
+
*
|
|
149
|
+
* @param assetId - The Mux asset ID
|
|
150
|
+
* @param options - Request options
|
|
151
|
+
* @returns Pending, errored, or completed shot result
|
|
152
|
+
*/
|
|
153
|
+
declare function getShotsForAsset(assetId: string, options?: ShotRequestOptions): Promise<ShotsResult>;
|
|
154
|
+
/**
|
|
155
|
+
* Requests shot generation if needed and polls until shots are completed.
|
|
156
|
+
*
|
|
157
|
+
* @param assetId - The Mux asset ID
|
|
158
|
+
* @param options - Polling options
|
|
159
|
+
* @returns Completed shot result
|
|
160
|
+
*/
|
|
161
|
+
declare function waitForShotsForAsset(assetId: string, options?: WaitForShotsOptions): Promise<CompletedShotsResult>;
|
|
162
|
+
|
|
102
163
|
declare const DEFAULT_STORYBOARD_WIDTH = 640;
|
|
103
164
|
/**
|
|
104
165
|
* Generates a storyboard URL for the given playback ID.
|
|
@@ -270,12 +331,18 @@ declare function getThumbnailUrls(playbackId: string, duration: number, options?
|
|
|
270
331
|
time: number;
|
|
271
332
|
}>>;
|
|
272
333
|
|
|
334
|
+
type index_CompletedShotsResult = CompletedShotsResult;
|
|
273
335
|
declare const index_DEFAULT_STORYBOARD_WIDTH: typeof DEFAULT_STORYBOARD_WIDTH;
|
|
336
|
+
type index_ErroredShotsResult = ErroredShotsResult;
|
|
274
337
|
type index_HeatmapOptions = HeatmapOptions;
|
|
275
338
|
type index_HeatmapResponse = HeatmapResponse;
|
|
276
339
|
type index_Hotspot = Hotspot;
|
|
277
340
|
type index_HotspotOptions = HotspotOptions;
|
|
278
341
|
type index_HotspotResponse = HotspotResponse;
|
|
342
|
+
type index_PendingShotsResult = PendingShotsResult;
|
|
343
|
+
type index_Shot = Shot;
|
|
344
|
+
type index_ShotRequestOptions = ShotRequestOptions;
|
|
345
|
+
type index_ShotsResult = ShotsResult;
|
|
279
346
|
type index_ThumbnailOptions = ThumbnailOptions;
|
|
280
347
|
type index_TranscriptFetchOptions = TranscriptFetchOptions;
|
|
281
348
|
type index_TranscriptResult = TranscriptResult;
|
|
@@ -283,6 +350,7 @@ type index_VTTCue = VTTCue;
|
|
|
283
350
|
type index_VTTCueBudgetChunkingOptions = VTTCueBudgetChunkingOptions;
|
|
284
351
|
type index_VTTDurationChunk = VTTDurationChunk;
|
|
285
352
|
type index_VTTDurationChunkingOptions = VTTDurationChunkingOptions;
|
|
353
|
+
type index_WaitForShotsOptions = WaitForShotsOptions;
|
|
286
354
|
declare const index_buildTranscriptUrl: typeof buildTranscriptUrl;
|
|
287
355
|
declare const index_buildVttFromCueBlocks: typeof buildVttFromCueBlocks;
|
|
288
356
|
declare const index_buildVttFromTranslatedCueBlocks: typeof buildVttFromTranslatedCueBlocks;
|
|
@@ -304,15 +372,18 @@ declare const index_getHotspotsForAsset: typeof getHotspotsForAsset;
|
|
|
304
372
|
declare const index_getHotspotsForPlaybackId: typeof getHotspotsForPlaybackId;
|
|
305
373
|
declare const index_getHotspotsForVideo: typeof getHotspotsForVideo;
|
|
306
374
|
declare const index_getReadyTextTracks: typeof getReadyTextTracks;
|
|
375
|
+
declare const index_getShotsForAsset: typeof getShotsForAsset;
|
|
307
376
|
declare const index_getStoryboardUrl: typeof getStoryboardUrl;
|
|
308
377
|
declare const index_getThumbnailUrls: typeof getThumbnailUrls;
|
|
309
378
|
declare const index_parseVTTCues: typeof parseVTTCues;
|
|
310
379
|
declare const index_replaceCueText: typeof replaceCueText;
|
|
380
|
+
declare const index_requestShotsForAsset: typeof requestShotsForAsset;
|
|
311
381
|
declare const index_secondsToTimestamp: typeof secondsToTimestamp;
|
|
312
382
|
declare const index_splitVttPreambleAndCueBlocks: typeof splitVttPreambleAndCueBlocks;
|
|
313
383
|
declare const index_vttTimestampToSeconds: typeof vttTimestampToSeconds;
|
|
384
|
+
declare const index_waitForShotsForAsset: typeof waitForShotsForAsset;
|
|
314
385
|
declare namespace index {
|
|
315
|
-
export { index_DEFAULT_STORYBOARD_WIDTH as DEFAULT_STORYBOARD_WIDTH, type index_HeatmapOptions as HeatmapOptions, type index_HeatmapResponse as HeatmapResponse, type index_Hotspot as Hotspot, type index_HotspotOptions as HotspotOptions, type index_HotspotResponse as HotspotResponse, type index_ThumbnailOptions as ThumbnailOptions, type index_TranscriptFetchOptions as TranscriptFetchOptions, type index_TranscriptResult as TranscriptResult, type index_VTTCue as VTTCue, type index_VTTCueBudgetChunkingOptions as VTTCueBudgetChunkingOptions, type index_VTTDurationChunk as VTTDurationChunk, type index_VTTDurationChunkingOptions as VTTDurationChunkingOptions, index_buildTranscriptUrl as buildTranscriptUrl, index_buildVttFromCueBlocks as buildVttFromCueBlocks, index_buildVttFromTranslatedCueBlocks as buildVttFromTranslatedCueBlocks, index_chunkByTokens as chunkByTokens, index_chunkText as chunkText, index_chunkVTTCues as chunkVTTCues, index_chunkVTTCuesByBudget as chunkVTTCuesByBudget, index_chunkVTTCuesByDuration as chunkVTTCuesByDuration, index_concatenateVttSegments as concatenateVttSegments, index_estimateTokenCount as estimateTokenCount, index_extractTextFromVTT as extractTextFromVTT, index_extractTimestampedTranscript as extractTimestampedTranscript, index_fetchTranscriptForAsset as fetchTranscriptForAsset, index_findCaptionTrack as findCaptionTrack, index_getHeatmapForAsset as getHeatmapForAsset, index_getHeatmapForPlaybackId as getHeatmapForPlaybackId, index_getHeatmapForVideo as getHeatmapForVideo, index_getHotspotsForAsset as getHotspotsForAsset, index_getHotspotsForPlaybackId as getHotspotsForPlaybackId, index_getHotspotsForVideo as getHotspotsForVideo, index_getReadyTextTracks as getReadyTextTracks, index_getStoryboardUrl as getStoryboardUrl, index_getThumbnailUrls as getThumbnailUrls, index_parseVTTCues as parseVTTCues, index_replaceCueText as replaceCueText, index_secondsToTimestamp as secondsToTimestamp, index_splitVttPreambleAndCueBlocks as splitVttPreambleAndCueBlocks, index_vttTimestampToSeconds as vttTimestampToSeconds };
|
|
386
|
+
export { type index_CompletedShotsResult as CompletedShotsResult, index_DEFAULT_STORYBOARD_WIDTH as DEFAULT_STORYBOARD_WIDTH, type index_ErroredShotsResult as ErroredShotsResult, type index_HeatmapOptions as HeatmapOptions, type index_HeatmapResponse as HeatmapResponse, type index_Hotspot as Hotspot, type index_HotspotOptions as HotspotOptions, type index_HotspotResponse as HotspotResponse, type index_PendingShotsResult as PendingShotsResult, type index_Shot as Shot, type index_ShotRequestOptions as ShotRequestOptions, type index_ShotsResult as ShotsResult, type index_ThumbnailOptions as ThumbnailOptions, type index_TranscriptFetchOptions as TranscriptFetchOptions, type index_TranscriptResult as TranscriptResult, type index_VTTCue as VTTCue, type index_VTTCueBudgetChunkingOptions as VTTCueBudgetChunkingOptions, type index_VTTDurationChunk as VTTDurationChunk, type index_VTTDurationChunkingOptions as VTTDurationChunkingOptions, type index_WaitForShotsOptions as WaitForShotsOptions, index_buildTranscriptUrl as buildTranscriptUrl, index_buildVttFromCueBlocks as buildVttFromCueBlocks, index_buildVttFromTranslatedCueBlocks as buildVttFromTranslatedCueBlocks, index_chunkByTokens as chunkByTokens, index_chunkText as chunkText, index_chunkVTTCues as chunkVTTCues, index_chunkVTTCuesByBudget as chunkVTTCuesByBudget, index_chunkVTTCuesByDuration as chunkVTTCuesByDuration, index_concatenateVttSegments as concatenateVttSegments, index_estimateTokenCount as estimateTokenCount, index_extractTextFromVTT as extractTextFromVTT, index_extractTimestampedTranscript as extractTimestampedTranscript, index_fetchTranscriptForAsset as fetchTranscriptForAsset, index_findCaptionTrack as findCaptionTrack, index_getHeatmapForAsset as getHeatmapForAsset, index_getHeatmapForPlaybackId as getHeatmapForPlaybackId, index_getHeatmapForVideo as getHeatmapForVideo, index_getHotspotsForAsset as getHotspotsForAsset, index_getHotspotsForPlaybackId as getHotspotsForPlaybackId, index_getHotspotsForVideo as getHotspotsForVideo, index_getReadyTextTracks as getReadyTextTracks, index_getShotsForAsset as getShotsForAsset, index_getStoryboardUrl as getStoryboardUrl, index_getThumbnailUrls as getThumbnailUrls, index_parseVTTCues as parseVTTCues, index_replaceCueText as replaceCueText, index_requestShotsForAsset as requestShotsForAsset, index_secondsToTimestamp as secondsToTimestamp, index_splitVttPreambleAndCueBlocks as splitVttPreambleAndCueBlocks, index_vttTimestampToSeconds as vttTimestampToSeconds, index_waitForShotsForAsset as waitForShotsForAsset };
|
|
316
387
|
}
|
|
317
388
|
|
|
318
|
-
export {
|
|
389
|
+
export { getHeatmapForAsset as A, getHeatmapForPlaybackId as B, type CompletedShotsResult as C, DEFAULT_STORYBOARD_WIDTH as D, type ErroredShotsResult as E, getHeatmapForVideo as F, getHotspotsForAsset as G, type HeatmapOptions as H, getHotspotsForPlaybackId as I, getHotspotsForVideo as J, getReadyTextTracks as K, getShotsForAsset as L, getStoryboardUrl as M, getThumbnailUrls as N, parseVTTCues as O, type PendingShotsResult as P, replaceCueText as Q, requestShotsForAsset as R, type Shot as S, type ThumbnailOptions as T, secondsToTimestamp as U, type VTTCue as V, type WaitForShotsOptions as W, splitVttPreambleAndCueBlocks as X, vttTimestampToSeconds as Y, waitForShotsForAsset as Z, type HeatmapResponse as a, type Hotspot as b, type HotspotOptions as c, type HotspotResponse as d, type ShotRequestOptions as e, type ShotsResult as f, type TranscriptFetchOptions as g, type TranscriptResult as h, index as i, type VTTCueBudgetChunkingOptions as j, type VTTDurationChunk as k, type VTTDurationChunkingOptions as l, buildTranscriptUrl as m, buildVttFromCueBlocks as n, buildVttFromTranslatedCueBlocks as o, chunkByTokens as p, chunkText as q, chunkVTTCues as r, chunkVTTCuesByBudget as s, chunkVTTCuesByDuration as t, concatenateVttSegments as u, estimateTokenCount as v, extractTextFromVTT as w, extractTimestampedTranscript as x, fetchTranscriptForAsset as y, findCaptionTrack as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { W as WorkflowCredentials, S as StoragePutObjectInput, a as StoragePresignGetObjectInput } from './types-BRbaGW3t.js';
|
|
2
2
|
export { A as AssetTextTrack, C as ChunkEmbedding, b as ChunkingStrategy, E as Encrypted, c as EncryptedPayload, I as ImageSubmissionMode, M as MuxAIOptions, d as MuxAsset, P as PlaybackAsset, e as PlaybackPolicy, f as StorageAdapter, T as TextChunk, g as TokenChunkingConfig, h as TokenUsage, i as ToneType, U as UsageMetadata, V as VTTChunkingConfig, j as VideoEmbeddingsResult, k as WorkflowCredentialsInput, l as WorkflowMuxClient, m as decryptFromWorkflow, n as encryptForWorkflow } from './types-BRbaGW3t.js';
|
|
3
3
|
import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
|
|
4
|
-
export { i as primitives } from './index-
|
|
5
|
-
export { i as workflows } from './index-
|
|
4
|
+
export { i as primitives } from './index-DLhfJsOd.js';
|
|
5
|
+
export { i as workflows } from './index-BapL6paa.js';
|
|
6
6
|
import '@mux/mux-node';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import '@ai-sdk/anthropic';
|
|
9
9
|
import '@ai-sdk/google';
|
|
10
10
|
import '@ai-sdk/openai';
|
|
11
11
|
|
|
12
|
-
var version = "0.
|
|
12
|
+
var version = "0.11.0";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* A function that returns workflow credentials, either synchronously or asynchronously.
|