@mux/ai 0.31.0 → 0.33.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.
@@ -1,3 +1,3 @@
1
- export { D as DEFAULT_STORYBOARD_WIDTH, H as HeatmapOptions, a as HeatmapResponse, L as LOW_CONFIDENCE_THRESHOLD, M as MAX_CUE_TEXT_CHARS, T as ThumbnailOptions, b as TranscriptFetchOptions, c as TranscriptResult, V as VTTCue, d as VTTCueBudgetChunkingOptions, e as VTTDurationChunk, f as VTTDurationChunkingOptions, g as buildTranscriptUrl, h as buildVttFromCueBlocks, j as buildVttFromTranslatedCueBlocks, k as chunkByTokens, l as chunkText, m as chunkVTTCues, n as chunkVTTCuesByBudget, o as chunkVTTCuesByDuration, p as concatenateVttSegments, q as estimateTokenCount, r as extractTextFromVTT, s as extractTimestampedTranscript, t as fetchTranscriptForAsset, u as filterVttByScope, v as findCaptionTrack, w as getHeatmapForAsset, x as getHeatmapForPlaybackId, y as getHeatmapForVideo, z as getReadyTextTracks, A as getReliableLanguageCode, B as getStoryboardUrl, C as getThumbnailUrls, E as parseVTTCues, F as replaceCueText, G as sanitizeUntrustedText, I as secondsToTimestamp, J as splitVttPreambleAndCueBlocks, K as stripVttMetadataBlocks, N as vttTimestampToSeconds } from '../index-CJtQiGj7.js';
2
- export { q as CompletedShotsResult, r as ErroredShotsResult, H as Hotspot, s as HotspotOptions, t as HotspotResponse, u as PendingShotsResult, v as Shot, w as ShotRequestOptions, x as ShotsResult, y as WaitForShotsOptions, z as getHotspotsForAsset, B as getHotspotsForPlaybackId, D as getHotspotsForVideo, F as getShotsForAsset, G as requestShotsForAsset, J as waitForShotsForAsset } from '../shots-Bh0GrvLx.js';
1
+ export { D as DEFAULT_STORYBOARD_WIDTH, H as HeatmapOptions, a as HeatmapResponse, L as LOW_CONFIDENCE_THRESHOLD, M as MAX_CUE_TEXT_CHARS, T as ThumbnailOptions, b as TranscriptFetchOptions, c as TranscriptResult, V as VTTCue, d as VTTCueBudgetChunkingOptions, e as VTTDurationChunk, f as VTTDurationChunkingOptions, g as buildTranscriptUrl, h as buildVttFromCueBlocks, j as buildVttFromTranslatedCueBlocks, k as chunkByTokens, l as chunkText, m as chunkVTTCues, n as chunkVTTCuesByBudget, o as chunkVTTCuesByDuration, p as concatenateVttSegments, q as estimateTokenCount, r as extractTextFromVTT, s as extractTimestampedTranscript, t as fetchTranscriptForAsset, u as filterVttByScope, v as findCaptionTrack, w as getHeatmapForAsset, x as getHeatmapForPlaybackId, y as getHeatmapForVideo, z as getReadyTextTracks, A as getReliableLanguageCode, B as getStoryboardUrl, C as getThumbnailUrls, E as parseVTTCues, F as replaceCueText, G as sanitizeUntrustedText, I as secondsToTimestamp, J as splitVttPreambleAndCueBlocks, K as stripVttMetadataBlocks, N as vttTimestampToSeconds } from '../index-SjpXUdXl.js';
2
+ export { q as CompletedShotsResult, r as ErroredShotsResult, H as Hotspot, s as HotspotOptions, t as HotspotResponse, u as PendingShotsResult, v as Shot, w as ShotRequestOptions, x as ShotsResult, y as WaitForShotsOptions, z as getHotspotsForAsset, B as getHotspotsForPlaybackId, D as getHotspotsForVideo, F as getShotsForAsset, G as requestShotsForAsset, J as waitForShotsForAsset } from '../shots-BMbViFbZ.js';
3
3
  import '@mux/mux-node';
@@ -2,6 +2,7 @@
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 { createOpenAICompatible } from "@ai-sdk/openai-compatible";
5
6
 
6
7
  // src/env.ts
7
8
  import { z } from "zod";
@@ -72,6 +73,43 @@ var EnvSchema = z.object({
72
73
  MUX_AI_EVAL_MODELS: optionalString("Comma-separated eval model pairs.", "Comma-separated provider:model pairs (e.g. 'openai:gpt-5.6-luna,anthropic:claude-sonnet-4-5,google:gemini-3-flash-preview')"),
73
74
  // AI Providers
74
75
  OPENAI_API_KEY: optionalString("OpenAI API key for OpenAI-backed workflows.", "OpenAI API key"),
76
+ BASETEN_API_KEY: optionalString("Baseten API key for Baseten-backed workflows.", "Baseten API key"),
77
+ BASETEN_URL: optionalString(
78
+ "Optional Baseten language endpoint URL: a dedicated deployment's /sync/v1 URL (such as https://model-{MODEL_ID}.api.baseten.co/environments/production/sync/v1) or a shared OpenAI-compatible base URL. Omit to use Baseten Model APIs.",
79
+ "Baseten URL"
80
+ ),
81
+ BASETEN_EMBEDDING_URL: optionalString(
82
+ "Baseten dedicated embedding deployment URL, such as https://model-{MODEL_ID}.api.baseten.co/environments/production/sync. Required for Baseten embeddings.",
83
+ "Baseten embedding URL"
84
+ ),
85
+ BASETEN_MODEL: optionalString(
86
+ "Default Baseten language model identifier used when provider='baseten' and no explicit model is passed.",
87
+ "Baseten model"
88
+ ),
89
+ BASETEN_EMBEDDING_MODEL: optionalString(
90
+ "Default Baseten embedding model identifier used when provider='baseten' and no explicit model is passed.",
91
+ "Baseten embedding model"
92
+ ),
93
+ OPENAI_COMPATIBLE_API_KEY: optionalString(
94
+ "Optional API key for OpenAI-compatible endpoints. Some local or self-hosted endpoints do not require one.",
95
+ "OpenAI-compatible API key"
96
+ ),
97
+ OPENAI_COMPATIBLE_BASE_URL: optionalString(
98
+ "Base URL of an OpenAI-compatible API, such as https://my-endpoint.example.com/v1.",
99
+ "OpenAI-compatible base URL"
100
+ ),
101
+ OPENAI_COMPATIBLE_EMBEDDING_BASE_URL: optionalString(
102
+ "Optional embedding-specific OpenAI-compatible base URL. Falls back to OPENAI_COMPATIBLE_BASE_URL.",
103
+ "OpenAI-compatible embedding base URL"
104
+ ),
105
+ OPENAI_COMPATIBLE_MODEL: optionalString(
106
+ "Default language model identifier used when provider='openai-compatible' and no explicit model is passed.",
107
+ "OpenAI-compatible model"
108
+ ),
109
+ OPENAI_COMPATIBLE_EMBEDDING_MODEL: optionalString(
110
+ "Default embedding model identifier used when provider='openai-compatible' and no explicit model is passed.",
111
+ "OpenAI-compatible embedding model"
112
+ ),
75
113
  ANTHROPIC_API_KEY: optionalString("Anthropic API key for Claude-backed workflows.", "Anthropic API key"),
76
114
  GOOGLE_GENERATIVE_AI_API_KEY: optionalString("Google Generative AI API key for Gemini-backed workflows.", "Google Generative AI API key"),
77
115
  ELEVENLABS_API_KEY: optionalString("ElevenLabs API key for audio translation.", "ElevenLabs API key"),
@@ -477,7 +515,7 @@ function getDefaultEvalModelConfigs() {
477
515
  function getAllEvalModelConfigs() {
478
516
  return Object.entries(LANGUAGE_MODELS).flatMap(([provider, models]) => models.map((modelId) => ({ provider, modelId })));
479
517
  }
480
- function isSupportedProvider(value) {
518
+ function isSupportedEvalProvider(value) {
481
519
  return value === "openai" || value === "anthropic" || value === "google";
482
520
  }
483
521
  function parseEvalModelPair(value) {
@@ -490,7 +528,10 @@ function parseEvalModelPair(value) {
490
528
  `Invalid eval model pair "${value}". Use "provider:model" (example: "openai:gpt-5.6-luna").`
491
529
  );
492
530
  }
493
- if (!isSupportedProvider(provider)) {
531
+ if (provider === "baseten" || provider === "openai-compatible") {
532
+ return void 0;
533
+ }
534
+ if (!isSupportedEvalProvider(provider)) {
494
535
  throw new Error(
495
536
  `Unsupported eval provider "${provider}" in "${value}". Supported providers: ${Object.keys(LANGUAGE_MODELS).join(", ")}.`
496
537
  );
@@ -511,7 +552,7 @@ function resolveEvalModelConfigs(options = {}) {
511
552
  const explicitPairs = options.modelPairs?.map((value) => value.trim()).filter(Boolean) ?? [];
512
553
  if (explicitPairs.length > 0) {
513
554
  const dedupedPairs = Array.from(new Set(explicitPairs));
514
- return dedupedPairs.map(parseEvalModelPair);
555
+ return dedupedPairs.map(parseEvalModelPair).filter((config) => Boolean(config));
515
556
  }
516
557
  const selection = options.selection ?? "default";
517
558
  if (selection === "all") {
@@ -1448,6 +1489,7 @@ async function getThumbnailUrls(playbackId, duration, options = {}) {
1448
1489
  timestamps.push(time);
1449
1490
  }
1450
1491
  }
1492
+ timestamps = [...new Set(timestamps)];
1451
1493
  if (maxSamples !== void 0 && timestamps.length > maxSamples) {
1452
1494
  const newTimestamps = [];
1453
1495
  newTimestamps.push(resolvedScope.startTime);