@mux/ai 0.1.6 → 0.3.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 +346 -86
- package/dist/{index-DyTSka2R.d.ts → index-BcNDGOI6.d.ts} +12 -24
- package/dist/{index-Bnv7tv90.d.ts → index-D3fZHu0h.d.ts} +124 -13
- package/dist/index.d.ts +3 -3
- package/dist/index.js +989 -669
- package/dist/index.js.map +1 -1
- package/dist/primitives/index.d.ts +2 -2
- package/dist/primitives/index.js +37 -79
- package/dist/primitives/index.js.map +1 -1
- package/dist/{types-ktXDZ93V.d.mts → types-DzOQNn9R.d.ts} +3 -25
- package/dist/workflows/index.d.ts +2 -2
- package/dist/workflows/index.js +987 -683
- package/dist/workflows/index.js.map +1 -1
- package/package.json +34 -36
- package/dist/index-BNnz9P_5.d.mts +0 -144
- package/dist/index-vJ5r2FNm.d.mts +0 -477
- package/dist/index.d.mts +0 -13
- package/dist/index.mjs +0 -2205
- package/dist/index.mjs.map +0 -1
- package/dist/primitives/index.d.mts +0 -3
- package/dist/primitives/index.mjs +0 -358
- package/dist/primitives/index.mjs.map +0 -1
- package/dist/types-ktXDZ93V.d.ts +0 -137
- package/dist/workflows/index.d.mts +0 -8
- package/dist/workflows/index.mjs +0 -2168
- package/dist/workflows/index.mjs.map +0 -1
|
@@ -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 {
|
|
5
|
+
import { g as TokenUsage, M as MuxAIOptions, I as ImageSubmissionMode, C as ChunkingStrategy, f as VideoEmbeddingsResult, T as ToneType } from './types-DzOQNn9R.js';
|
|
6
6
|
import { Buffer } from 'node:buffer';
|
|
7
7
|
|
|
8
8
|
interface ImageDownloadOptions {
|
|
@@ -308,6 +308,10 @@ interface SummaryAndTagsResult {
|
|
|
308
308
|
tags: string[];
|
|
309
309
|
/** Storyboard image URL that was analyzed. */
|
|
310
310
|
storyboardUrl: string;
|
|
311
|
+
/** Token usage from the AI provider (for efficiency/cost analysis). */
|
|
312
|
+
usage?: TokenUsage;
|
|
313
|
+
/** Raw transcript text used for analysis (when includeTranscript is true). */
|
|
314
|
+
transcriptText?: string;
|
|
311
315
|
}
|
|
312
316
|
/**
|
|
313
317
|
* Sections of the summarization user prompt that can be overridden.
|
|
@@ -335,7 +339,7 @@ interface SummarizationOptions extends MuxAIOptions {
|
|
|
335
339
|
provider?: SupportedProvider;
|
|
336
340
|
/** Provider-specific chat model identifier. */
|
|
337
341
|
model?: ModelIdByProvider[SupportedProvider];
|
|
338
|
-
/** Prompt tone shim applied to the system instruction (defaults to '
|
|
342
|
+
/** Prompt tone shim applied to the system instruction (defaults to 'neutral'). */
|
|
339
343
|
tone?: ToneType;
|
|
340
344
|
/** Fetch the transcript and send it alongside the storyboard (defaults to true). */
|
|
341
345
|
includeTranscript?: boolean;
|
|
@@ -353,10 +357,111 @@ interface SummarizationOptions extends MuxAIOptions {
|
|
|
353
357
|
}
|
|
354
358
|
declare function getSummaryAndTags(assetId: string, options?: SummarizationOptions): Promise<SummaryAndTagsResult>;
|
|
355
359
|
|
|
360
|
+
/**
|
|
361
|
+
* Language Code Conversion Utilities
|
|
362
|
+
*
|
|
363
|
+
* Provides bidirectional mapping between:
|
|
364
|
+
* - ISO 639-1 (2-letter codes) - Used by browsers, BCP-47, most video players
|
|
365
|
+
* - ISO 639-3 (3-letter codes) - Used by various APIs and language processing systems
|
|
366
|
+
*
|
|
367
|
+
* This is essential for interoperability between different systems:
|
|
368
|
+
* - Mux uses ISO 639-1 for track language codes
|
|
369
|
+
* - Browser players expect BCP-47 compliant codes (based on ISO 639-1)
|
|
370
|
+
* - Some APIs require ISO 639-3 (3-letter) codes
|
|
371
|
+
*/
|
|
372
|
+
/**
|
|
373
|
+
* Mapping from ISO 639-1 (2-letter) to ISO 639-3 (3-letter) codes.
|
|
374
|
+
* Covers the most common languages used in video translation.
|
|
375
|
+
*
|
|
376
|
+
* Reference: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
|
377
|
+
*/
|
|
378
|
+
declare const ISO639_1_TO_3: {
|
|
379
|
+
readonly en: "eng";
|
|
380
|
+
readonly es: "spa";
|
|
381
|
+
readonly fr: "fra";
|
|
382
|
+
readonly de: "deu";
|
|
383
|
+
readonly it: "ita";
|
|
384
|
+
readonly pt: "por";
|
|
385
|
+
readonly ru: "rus";
|
|
386
|
+
readonly zh: "zho";
|
|
387
|
+
readonly ja: "jpn";
|
|
388
|
+
readonly ko: "kor";
|
|
389
|
+
readonly ar: "ara";
|
|
390
|
+
readonly hi: "hin";
|
|
391
|
+
readonly nl: "nld";
|
|
392
|
+
readonly pl: "pol";
|
|
393
|
+
readonly sv: "swe";
|
|
394
|
+
readonly da: "dan";
|
|
395
|
+
readonly no: "nor";
|
|
396
|
+
readonly fi: "fin";
|
|
397
|
+
readonly el: "ell";
|
|
398
|
+
readonly cs: "ces";
|
|
399
|
+
readonly hu: "hun";
|
|
400
|
+
readonly ro: "ron";
|
|
401
|
+
readonly bg: "bul";
|
|
402
|
+
readonly hr: "hrv";
|
|
403
|
+
readonly sk: "slk";
|
|
404
|
+
readonly sl: "slv";
|
|
405
|
+
readonly uk: "ukr";
|
|
406
|
+
readonly tr: "tur";
|
|
407
|
+
readonly th: "tha";
|
|
408
|
+
readonly vi: "vie";
|
|
409
|
+
readonly id: "ind";
|
|
410
|
+
readonly ms: "msa";
|
|
411
|
+
readonly tl: "tgl";
|
|
412
|
+
readonly he: "heb";
|
|
413
|
+
readonly fa: "fas";
|
|
414
|
+
readonly bn: "ben";
|
|
415
|
+
readonly ta: "tam";
|
|
416
|
+
readonly te: "tel";
|
|
417
|
+
readonly mr: "mar";
|
|
418
|
+
readonly gu: "guj";
|
|
419
|
+
readonly kn: "kan";
|
|
420
|
+
readonly ml: "mal";
|
|
421
|
+
readonly pa: "pan";
|
|
422
|
+
readonly ur: "urd";
|
|
423
|
+
readonly sw: "swa";
|
|
424
|
+
readonly af: "afr";
|
|
425
|
+
readonly ca: "cat";
|
|
426
|
+
readonly eu: "eus";
|
|
427
|
+
readonly gl: "glg";
|
|
428
|
+
readonly is: "isl";
|
|
429
|
+
readonly et: "est";
|
|
430
|
+
readonly lv: "lav";
|
|
431
|
+
readonly lt: "lit";
|
|
432
|
+
};
|
|
433
|
+
/**
|
|
434
|
+
* Supported ISO 639-1 two-letter language codes.
|
|
435
|
+
* These are the language codes supported for translation workflows.
|
|
436
|
+
*/
|
|
437
|
+
type SupportedISO639_1 = keyof typeof ISO639_1_TO_3;
|
|
438
|
+
/**
|
|
439
|
+
* Supported ISO 639-3 three-letter language codes.
|
|
440
|
+
* These are the language codes supported for translation workflows.
|
|
441
|
+
*/
|
|
442
|
+
type SupportedISO639_3 = (typeof ISO639_1_TO_3)[SupportedISO639_1];
|
|
443
|
+
/** ISO 639-1 two-letter language code (e.g., "en", "fr", "es") */
|
|
444
|
+
type ISO639_1 = SupportedISO639_1 | (string & {});
|
|
445
|
+
/** ISO 639-3 three-letter language code (e.g., "eng", "fra", "spa") */
|
|
446
|
+
type ISO639_3 = SupportedISO639_3 | (string & {});
|
|
447
|
+
/** Structured language code result containing both formats */
|
|
448
|
+
interface LanguageCodePair {
|
|
449
|
+
/** ISO 639-1 two-letter code (BCP-47 compatible) */
|
|
450
|
+
iso639_1: ISO639_1;
|
|
451
|
+
/** ISO 639-3 three-letter code */
|
|
452
|
+
iso639_3: ISO639_3;
|
|
453
|
+
}
|
|
454
|
+
|
|
356
455
|
/** Output returned from `translateAudio`. */
|
|
357
456
|
interface AudioTranslationResult {
|
|
358
457
|
assetId: string;
|
|
359
|
-
|
|
458
|
+
/** Target language code (ISO 639-1 two-letter format). */
|
|
459
|
+
targetLanguageCode: SupportedISO639_1;
|
|
460
|
+
/**
|
|
461
|
+
* Target language codes in both ISO 639-1 (2-letter) and ISO 639-3 (3-letter) formats.
|
|
462
|
+
* Use `iso639_1` for browser players (BCP-47 compliant) and `iso639_3` for ElevenLabs API.
|
|
463
|
+
*/
|
|
464
|
+
targetLanguage: LanguageCodePair;
|
|
360
465
|
dubbingId: string;
|
|
361
466
|
uploadedTrackId?: string;
|
|
362
467
|
presignedUrl?: string;
|
|
@@ -373,10 +478,6 @@ interface AudioTranslationOptions extends MuxAIOptions {
|
|
|
373
478
|
s3Region?: string;
|
|
374
479
|
/** Bucket that will store dubbed audio files. */
|
|
375
480
|
s3Bucket?: string;
|
|
376
|
-
/** Access key ID used for uploads. */
|
|
377
|
-
s3AccessKeyId?: string;
|
|
378
|
-
/** Secret access key used for uploads. */
|
|
379
|
-
s3SecretAccessKey?: string;
|
|
380
481
|
/**
|
|
381
482
|
* When true (default) the dubbed audio file is uploaded to the configured
|
|
382
483
|
* bucket and attached to the Mux asset.
|
|
@@ -390,12 +491,26 @@ declare function translateAudio(assetId: string, toLanguageCode: string, options
|
|
|
390
491
|
/** Output returned from `translateCaptions`. */
|
|
391
492
|
interface TranslationResult {
|
|
392
493
|
assetId: string;
|
|
393
|
-
|
|
394
|
-
|
|
494
|
+
/** Source language code (ISO 639-1 two-letter format). */
|
|
495
|
+
sourceLanguageCode: SupportedISO639_1;
|
|
496
|
+
/** Target language code (ISO 639-1 two-letter format). */
|
|
497
|
+
targetLanguageCode: SupportedISO639_1;
|
|
498
|
+
/**
|
|
499
|
+
* Source language codes in both ISO 639-1 (2-letter) and ISO 639-3 (3-letter) formats.
|
|
500
|
+
* Use `iso639_1` for browser players (BCP-47 compliant) and `iso639_3` for APIs that require it.
|
|
501
|
+
*/
|
|
502
|
+
sourceLanguage: LanguageCodePair;
|
|
503
|
+
/**
|
|
504
|
+
* Target language codes in both ISO 639-1 (2-letter) and ISO 639-3 (3-letter) formats.
|
|
505
|
+
* Use `iso639_1` for browser players (BCP-47 compliant) and `iso639_3` for APIs that require it.
|
|
506
|
+
*/
|
|
507
|
+
targetLanguage: LanguageCodePair;
|
|
395
508
|
originalVtt: string;
|
|
396
509
|
translatedVtt: string;
|
|
397
510
|
uploadedTrackId?: string;
|
|
398
511
|
presignedUrl?: string;
|
|
512
|
+
/** Token usage from the AI provider (for efficiency/cost analysis). */
|
|
513
|
+
usage?: TokenUsage;
|
|
399
514
|
}
|
|
400
515
|
/** Configuration accepted by `translateCaptions`. */
|
|
401
516
|
interface TranslationOptions<P extends SupportedProvider = SupportedProvider> extends MuxAIOptions {
|
|
@@ -409,10 +524,6 @@ interface TranslationOptions<P extends SupportedProvider = SupportedProvider> ex
|
|
|
409
524
|
s3Region?: string;
|
|
410
525
|
/** Bucket that will store translated VTT files. */
|
|
411
526
|
s3Bucket?: string;
|
|
412
|
-
/** Access key ID used for uploads. */
|
|
413
|
-
s3AccessKeyId?: string;
|
|
414
|
-
/** Secret access key used for uploads. */
|
|
415
|
-
s3SecretAccessKey?: string;
|
|
416
527
|
/**
|
|
417
528
|
* When true (default) the translated VTT is uploaded to the configured
|
|
418
529
|
* bucket and attached to the Mux asset.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { i as primitives } from './index-
|
|
2
|
-
export { A as AssetTextTrack,
|
|
3
|
-
export { i as workflows } from './index-
|
|
1
|
+
export { i as primitives } from './index-BcNDGOI6.js';
|
|
2
|
+
export { A as AssetTextTrack, e as ChunkEmbedding, C as ChunkingStrategy, I as ImageSubmissionMode, M as MuxAIOptions, a as MuxAsset, b as PlaybackAsset, P as PlaybackPolicy, d as TextChunk, c as TokenChunkingConfig, g as TokenUsage, T as ToneType, V as VTTChunkingConfig, f as VideoEmbeddingsResult } from './types-DzOQNn9R.js';
|
|
3
|
+
export { i as workflows } from './index-D3fZHu0h.js';
|
|
4
4
|
import '@mux/mux-node';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import '@ai-sdk/anthropic';
|