@broberg/ai-sdk 0.64.0 → 0.64.1
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.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CostSink, T as Tier, U as Usage, a as ChatResult, b as ChatStreamEvent, c as TranslateResult, I as ImageResult, A as AnimateResult, d as TrainStyleResult, E as EmbeddingResult, e as TranscribeResult, O as OcrResult, M as ModerationResult, J as JudgeResult, P as PodcastResult, B as BatchRequestItem, f as TierSpec, g as BatchJob, h as BatchResultItem, i as ProviderAdapter, j as ToolCall, k as Tool, l as Transport, m as Capability, R as Region, n as BudgetConfig, o as BudgetStore } from './registry-
|
|
2
|
-
export { p as AlignedWordTimings, q as AvailabilitySource, r as AvailabilityStatus, s as AzureWordBoundary, t as CallOptions, u as ChatRequest, v as ContentPart, D as DialogueRequest, w as DialogueTurn, x as EmbeddingRequest, y as ImageRequest, z as JudgeAnswer, F as JudgeChoiceAnswer, G as JudgeNoulAnswer, H as JudgeQuestion, K as JudgeScoreAnswer, L as LoraWeight, N as Message, Q as ModelStatus, S as ModelUnavailableError, V as ModerationItem, W as ModerationRequest, X as OcrPage, Y as OcrRequest, Z as ResolveOptions, _ as ResolveResult, $ as Role, a0 as TierDescription, a1 as TrainStyleRequest, a2 as TranscribeRequest, a3 as TtsRequest, a4 as WordTiming, a5 as alignWordTimings, a6 as classifyRegionName, a7 as describeTier, a8 as listModels, a9 as regionOfHost, aa as regionOfProvider, ab as resolveModel } from './registry-
|
|
1
|
+
import { C as CostSink, T as Tier, U as Usage, a as ChatResult, b as ChatStreamEvent, c as TranslateResult, I as ImageResult, A as AnimateResult, d as TrainStyleResult, E as EmbeddingResult, e as TranscribeResult, O as OcrResult, M as ModerationResult, J as JudgeResult, P as PodcastResult, B as BatchRequestItem, f as TierSpec, g as BatchJob, h as BatchResultItem, i as ProviderAdapter, j as ToolCall, k as Tool, l as Transport, m as Capability, R as Region, n as BudgetConfig, o as BudgetStore } from './registry-NdNUaIv4.js';
|
|
2
|
+
export { p as AlignedWordTimings, q as AvailabilitySource, r as AvailabilityStatus, s as AzureWordBoundary, t as CallOptions, u as ChatRequest, v as ContentPart, D as DialogueRequest, w as DialogueTurn, x as EmbeddingRequest, y as ImageRequest, z as JudgeAnswer, F as JudgeChoiceAnswer, G as JudgeNoulAnswer, H as JudgeQuestion, K as JudgeScoreAnswer, L as LoraWeight, N as Message, Q as ModelStatus, S as ModelUnavailableError, V as ModerationItem, W as ModerationRequest, X as OcrPage, Y as OcrRequest, Z as ResolveOptions, _ as ResolveResult, $ as Role, a0 as TierDescription, a1 as TrainStyleRequest, a2 as TranscribeRequest, a3 as TtsRequest, a4 as WordTiming, a5 as alignWordTimings, a6 as classifyRegionName, a7 as describeTier, a8 as listModels, a9 as regionOfHost, aa as regionOfProvider, ab as resolveModel } from './registry-NdNUaIv4.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
export { DEFAULT_CLIP_SEC, MEDIA_PRICING_CHECKED_AT, MediaPrice, MediaUnit, PRICING_STALE_AFTER_DAYS, PricingFreshness, UnitFreshness, getMediaPrice, listMediaPrices, pricingFreshness, pricingGeneratedAt } from './pricing.js';
|
|
5
5
|
|
|
@@ -1001,12 +1001,15 @@ declare const animateInputSchema: z.ZodObject<{
|
|
|
1001
1001
|
durationSec: z.ZodOptional<z.ZodNumber>;
|
|
1002
1002
|
/** e.g. "720p" / "1080p" (provider-dependent). */
|
|
1003
1003
|
resolution: z.ZodOptional<z.ZodString>;
|
|
1004
|
+
/** F079.6 — false = no audio track at all (bfl/flux-3-video only; other routes refuse). */
|
|
1005
|
+
audio: z.ZodOptional<z.ZodBoolean>;
|
|
1004
1006
|
}, "strip", z.ZodTypeAny, {
|
|
1005
1007
|
image?: string | Uint8Array<ArrayBuffer> | undefined;
|
|
1006
1008
|
purpose?: string | undefined;
|
|
1007
1009
|
labels?: Record<string, string> | undefined;
|
|
1008
1010
|
tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
|
|
1009
1011
|
prompt?: string | undefined;
|
|
1012
|
+
audio?: boolean | undefined;
|
|
1010
1013
|
resolution?: string | undefined;
|
|
1011
1014
|
override?: {
|
|
1012
1015
|
provider?: string | undefined;
|
|
@@ -1026,6 +1029,7 @@ declare const animateInputSchema: z.ZodObject<{
|
|
|
1026
1029
|
labels?: Record<string, string> | undefined;
|
|
1027
1030
|
tier?: "vision" | "video" | "embedding" | "fast" | "smart" | "powerful" | "cheap" | undefined;
|
|
1028
1031
|
prompt?: string | undefined;
|
|
1032
|
+
audio?: boolean | undefined;
|
|
1029
1033
|
resolution?: string | undefined;
|
|
1030
1034
|
override?: {
|
|
1031
1035
|
provider?: string | undefined;
|
|
@@ -2342,8 +2346,8 @@ declare const falStubAdapter: ProviderAdapter;
|
|
|
2342
2346
|
* wires the live adapters. */
|
|
2343
2347
|
declare const stubProviders: Record<string, ProviderAdapter>;
|
|
2344
2348
|
|
|
2345
|
-
declare const VERSION: "0.64.
|
|
2346
|
-
declare const SDK_TAG: "@broberg/ai-sdk@0.64.
|
|
2349
|
+
declare const VERSION: "0.64.1";
|
|
2350
|
+
declare const SDK_TAG: "@broberg/ai-sdk@0.64.1";
|
|
2347
2351
|
|
|
2348
2352
|
/** Built-in defaults. Every entry is overridable via AiConfig.defaults or a
|
|
2349
2353
|
* per-call override.
|
package/dist/index.js
CHANGED
|
@@ -3242,6 +3242,7 @@ function bflAdapter(config = {}) {
|
|
|
3242
3242
|
}
|
|
3243
3243
|
body.resolution = r;
|
|
3244
3244
|
}
|
|
3245
|
+
if (req.audio === false) body.generate_audio = false;
|
|
3245
3246
|
const submitRes = await doFetch(`${base}/v1/${req.spec.model}`, {
|
|
3246
3247
|
method: "POST",
|
|
3247
3248
|
headers: { "content-type": "application/json", "x-key": apiKey },
|
|
@@ -3857,6 +3858,8 @@ var animateInputSchema = z.object({
|
|
|
3857
3858
|
durationSec: z.number().positive().optional(),
|
|
3858
3859
|
/** e.g. "720p" / "1080p" (provider-dependent). */
|
|
3859
3860
|
resolution: z.string().optional(),
|
|
3861
|
+
/** F079.6 — false = no audio track at all (bfl/flux-3-video only; other routes refuse). */
|
|
3862
|
+
audio: z.boolean().optional(),
|
|
3860
3863
|
...callOptions
|
|
3861
3864
|
});
|
|
3862
3865
|
var trainStyleInputSchema = z.object({
|
|
@@ -4011,8 +4014,8 @@ var aiConfigSchema = z.object({
|
|
|
4011
4014
|
import { randomUUID } from "crypto";
|
|
4012
4015
|
|
|
4013
4016
|
// src/version.ts
|
|
4014
|
-
var VERSION = "0.64.
|
|
4015
|
-
var SDK_TAG = "@broberg/ai-sdk@0.64.
|
|
4017
|
+
var VERSION = "0.64.1";
|
|
4018
|
+
var SDK_TAG = "@broberg/ai-sdk@0.64.1";
|
|
4016
4019
|
|
|
4017
4020
|
// src/cost/sinks/upmetrics.ts
|
|
4018
4021
|
function isRetryableStatus(status) {
|
|
@@ -4321,6 +4324,9 @@ function routeHasAudio(spec) {
|
|
|
4321
4324
|
if (m.includes("kling") || m.includes("seedance") || m.includes("wan-")) return false;
|
|
4322
4325
|
return true;
|
|
4323
4326
|
}
|
|
4327
|
+
function canSilenceAudio(spec) {
|
|
4328
|
+
return spec.provider === "bfl" && spec.model === "flux-3-video";
|
|
4329
|
+
}
|
|
4324
4330
|
var DEFAULT_BFL_FINETUNE_SPEC = {
|
|
4325
4331
|
provider: "bfl",
|
|
4326
4332
|
model: "flux-pro-1.1-ultra-finetuned",
|
|
@@ -4736,12 +4742,19 @@ function createAI(config = {}) {
|
|
|
4736
4742
|
invoke: async (spec) => {
|
|
4737
4743
|
const adapter = pickProvider(spec.provider);
|
|
4738
4744
|
if (!adapter.animate) throw new Error(`createAI: provider "${spec.provider}" does not support animate`);
|
|
4739
|
-
const
|
|
4745
|
+
const silent = input.audio === false;
|
|
4746
|
+
if (silent && routeHasAudio(spec) && !canSilenceAudio(spec)) {
|
|
4747
|
+
throw new Error(
|
|
4748
|
+
`createAI: animate route "${spec.provider}:${spec.model}" cannot switch audio off. For a silent clip use override:{ provider:"bfl", model:"flux-3-video" }.`
|
|
4749
|
+
);
|
|
4750
|
+
}
|
|
4751
|
+
const prompt = routeHasAudio(spec) && !silent ? `${basePrompt} ${ANIMATE_AUDIO_DIRECTIVE}`.trim() : basePrompt;
|
|
4740
4752
|
return adapter.animate({
|
|
4741
4753
|
image: input.image,
|
|
4742
4754
|
prompt: prompt || void 0,
|
|
4743
4755
|
durationSec: input.durationSec,
|
|
4744
4756
|
resolution: input.resolution,
|
|
4757
|
+
...silent ? { audio: false } : {},
|
|
4745
4758
|
spec
|
|
4746
4759
|
});
|
|
4747
4760
|
}
|