@broberg/ai-sdk 0.7.0 → 0.9.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/dist/index.d.ts +255 -21
- package/dist/index.js +260 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ interface TierSpec {
|
|
|
13
13
|
transport: Transport;
|
|
14
14
|
}
|
|
15
15
|
/** High-level capability a call exercises. Mirrors the capability layer (F5). */
|
|
16
|
-
type Capability = "chat" | "vision" | "video" | "translate" | "image" | "embedding" | "transcribe" | "ocr" | "moderation" | "mockup" | "design" | "extract" | "classify" | "rerank";
|
|
16
|
+
type Capability = "chat" | "vision" | "video" | "translate" | "image" | "embedding" | "transcribe" | "ocr" | "moderation" | "podcast" | "tts" | "mockup" | "design" | "extract" | "classify" | "rerank";
|
|
17
17
|
type Role = "system" | "user" | "assistant" | "tool";
|
|
18
18
|
/** A piece of message content. Text everywhere; image parts feed vision. */
|
|
19
19
|
type ContentPart = {
|
|
@@ -208,6 +208,41 @@ interface ModerationResult {
|
|
|
208
208
|
results: ModerationItem[];
|
|
209
209
|
usage: Usage;
|
|
210
210
|
}
|
|
211
|
+
interface DialogueTurn {
|
|
212
|
+
text: string;
|
|
213
|
+
voiceId: string;
|
|
214
|
+
}
|
|
215
|
+
interface DialogueRequest {
|
|
216
|
+
inputs: DialogueTurn[];
|
|
217
|
+
/** Output container, e.g. "mp3" (default). */
|
|
218
|
+
format?: string;
|
|
219
|
+
spec: TierSpec;
|
|
220
|
+
}
|
|
221
|
+
interface PodcastResult {
|
|
222
|
+
/** Episode audio bytes. */
|
|
223
|
+
audio: Uint8Array;
|
|
224
|
+
mimeType: string;
|
|
225
|
+
usage: Usage;
|
|
226
|
+
}
|
|
227
|
+
interface TtsRequest {
|
|
228
|
+
text: string;
|
|
229
|
+
voiceId: string;
|
|
230
|
+
spec: TierSpec;
|
|
231
|
+
}
|
|
232
|
+
interface BatchRequestItem {
|
|
233
|
+
customId: string;
|
|
234
|
+
prompt: string;
|
|
235
|
+
}
|
|
236
|
+
interface BatchJob {
|
|
237
|
+
jobId: string;
|
|
238
|
+
status: string;
|
|
239
|
+
total?: number;
|
|
240
|
+
completed?: number;
|
|
241
|
+
}
|
|
242
|
+
interface BatchResultItem {
|
|
243
|
+
customId: string;
|
|
244
|
+
text: string;
|
|
245
|
+
}
|
|
211
246
|
/** The thin contract every provider implements (F4). A provider need only
|
|
212
247
|
* support the capabilities it offers — `chat` is the baseline; vision/image/
|
|
213
248
|
* embedding are optional and absence is a typed capability gap. */
|
|
@@ -226,6 +261,23 @@ interface ProviderAdapter {
|
|
|
226
261
|
transcribe?(req: TranscribeRequest): Promise<TranscribeResult>;
|
|
227
262
|
ocr?(req: OcrRequest): Promise<OcrResult>;
|
|
228
263
|
moderate?(req: ModerationRequest): Promise<ModerationResult>;
|
|
264
|
+
/** Multi-voice dialogue → one audio episode (F020). ElevenLabs. */
|
|
265
|
+
dialogue?(req: DialogueRequest): Promise<PodcastResult>;
|
|
266
|
+
/** Single-voice TTS (F020.4) → audio. ElevenLabs. */
|
|
267
|
+
tts?(req: TtsRequest): Promise<PodcastResult>;
|
|
268
|
+
/** Batch (F016.1) — async chat-request processing at 50% cost. Mistral. */
|
|
269
|
+
batchSubmit?(req: {
|
|
270
|
+
items: BatchRequestItem[];
|
|
271
|
+
spec: TierSpec;
|
|
272
|
+
}): Promise<BatchJob>;
|
|
273
|
+
batchStatus?(req: {
|
|
274
|
+
jobId: string;
|
|
275
|
+
spec: TierSpec;
|
|
276
|
+
}): Promise<BatchJob>;
|
|
277
|
+
batchResults?(req: {
|
|
278
|
+
jobId: string;
|
|
279
|
+
spec: TierSpec;
|
|
280
|
+
}): Promise<BatchResultItem[]>;
|
|
229
281
|
}
|
|
230
282
|
interface TranslateResult {
|
|
231
283
|
text: string;
|
|
@@ -540,6 +592,7 @@ declare const chatInputSchema: z.ZodObject<{
|
|
|
540
592
|
parameters: Record<string, unknown>;
|
|
541
593
|
}[] | undefined;
|
|
542
594
|
temperature?: number | undefined;
|
|
595
|
+
purpose?: string | undefined;
|
|
543
596
|
maxTokens?: number | undefined;
|
|
544
597
|
responseFormat?: "text" | "json" | undefined;
|
|
545
598
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
@@ -553,7 +606,6 @@ declare const chatInputSchema: z.ZodObject<{
|
|
|
553
606
|
model: string;
|
|
554
607
|
transport: "http" | "subprocess";
|
|
555
608
|
})[] | undefined;
|
|
556
|
-
purpose?: string | undefined;
|
|
557
609
|
labels?: Record<string, string> | undefined;
|
|
558
610
|
}, {
|
|
559
611
|
system?: string | undefined;
|
|
@@ -581,6 +633,7 @@ declare const chatInputSchema: z.ZodObject<{
|
|
|
581
633
|
parameters: Record<string, unknown>;
|
|
582
634
|
}[] | undefined;
|
|
583
635
|
temperature?: number | undefined;
|
|
636
|
+
purpose?: string | undefined;
|
|
584
637
|
maxTokens?: number | undefined;
|
|
585
638
|
responseFormat?: "text" | "json" | undefined;
|
|
586
639
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
@@ -594,7 +647,6 @@ declare const chatInputSchema: z.ZodObject<{
|
|
|
594
647
|
model: string;
|
|
595
648
|
transport: "http" | "subprocess";
|
|
596
649
|
})[] | undefined;
|
|
597
|
-
purpose?: string | undefined;
|
|
598
650
|
labels?: Record<string, string> | undefined;
|
|
599
651
|
}>;
|
|
600
652
|
declare const visionInputSchema: z.ZodObject<{
|
|
@@ -634,6 +686,7 @@ declare const visionInputSchema: z.ZodObject<{
|
|
|
634
686
|
image: string | Uint8Array<ArrayBuffer>;
|
|
635
687
|
prompt: string;
|
|
636
688
|
mimeType?: string | undefined;
|
|
689
|
+
purpose?: string | undefined;
|
|
637
690
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
638
691
|
override?: {
|
|
639
692
|
provider?: string | undefined;
|
|
@@ -645,12 +698,12 @@ declare const visionInputSchema: z.ZodObject<{
|
|
|
645
698
|
model: string;
|
|
646
699
|
transport: "http" | "subprocess";
|
|
647
700
|
})[] | undefined;
|
|
648
|
-
purpose?: string | undefined;
|
|
649
701
|
labels?: Record<string, string> | undefined;
|
|
650
702
|
}, {
|
|
651
703
|
image: string | Uint8Array<ArrayBuffer>;
|
|
652
704
|
prompt: string;
|
|
653
705
|
mimeType?: string | undefined;
|
|
706
|
+
purpose?: string | undefined;
|
|
654
707
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
655
708
|
override?: {
|
|
656
709
|
provider?: string | undefined;
|
|
@@ -662,7 +715,6 @@ declare const visionInputSchema: z.ZodObject<{
|
|
|
662
715
|
model: string;
|
|
663
716
|
transport: "http" | "subprocess";
|
|
664
717
|
})[] | undefined;
|
|
665
|
-
purpose?: string | undefined;
|
|
666
718
|
labels?: Record<string, string> | undefined;
|
|
667
719
|
}>;
|
|
668
720
|
declare const videoInputSchema: z.ZodObject<{
|
|
@@ -702,6 +754,7 @@ declare const videoInputSchema: z.ZodObject<{
|
|
|
702
754
|
video: string | Uint8Array<ArrayBuffer>;
|
|
703
755
|
prompt: string;
|
|
704
756
|
mimeType?: string | undefined;
|
|
757
|
+
purpose?: string | undefined;
|
|
705
758
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
706
759
|
override?: {
|
|
707
760
|
provider?: string | undefined;
|
|
@@ -713,12 +766,12 @@ declare const videoInputSchema: z.ZodObject<{
|
|
|
713
766
|
model: string;
|
|
714
767
|
transport: "http" | "subprocess";
|
|
715
768
|
})[] | undefined;
|
|
716
|
-
purpose?: string | undefined;
|
|
717
769
|
labels?: Record<string, string> | undefined;
|
|
718
770
|
}, {
|
|
719
771
|
video: string | Uint8Array<ArrayBuffer>;
|
|
720
772
|
prompt: string;
|
|
721
773
|
mimeType?: string | undefined;
|
|
774
|
+
purpose?: string | undefined;
|
|
722
775
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
723
776
|
override?: {
|
|
724
777
|
provider?: string | undefined;
|
|
@@ -730,7 +783,6 @@ declare const videoInputSchema: z.ZodObject<{
|
|
|
730
783
|
model: string;
|
|
731
784
|
transport: "http" | "subprocess";
|
|
732
785
|
})[] | undefined;
|
|
733
|
-
purpose?: string | undefined;
|
|
734
786
|
labels?: Record<string, string> | undefined;
|
|
735
787
|
}>;
|
|
736
788
|
declare const translateInputSchema: z.ZodObject<{
|
|
@@ -769,6 +821,7 @@ declare const translateInputSchema: z.ZodObject<{
|
|
|
769
821
|
}, "strip", z.ZodTypeAny, {
|
|
770
822
|
text: string;
|
|
771
823
|
to: string;
|
|
824
|
+
purpose?: string | undefined;
|
|
772
825
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
773
826
|
override?: {
|
|
774
827
|
provider?: string | undefined;
|
|
@@ -780,12 +833,12 @@ declare const translateInputSchema: z.ZodObject<{
|
|
|
780
833
|
model: string;
|
|
781
834
|
transport: "http" | "subprocess";
|
|
782
835
|
})[] | undefined;
|
|
783
|
-
purpose?: string | undefined;
|
|
784
836
|
labels?: Record<string, string> | undefined;
|
|
785
837
|
from?: string | undefined;
|
|
786
838
|
}, {
|
|
787
839
|
text: string;
|
|
788
840
|
to: string;
|
|
841
|
+
purpose?: string | undefined;
|
|
789
842
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
790
843
|
override?: {
|
|
791
844
|
provider?: string | undefined;
|
|
@@ -797,7 +850,6 @@ declare const translateInputSchema: z.ZodObject<{
|
|
|
797
850
|
model: string;
|
|
798
851
|
transport: "http" | "subprocess";
|
|
799
852
|
})[] | undefined;
|
|
800
|
-
purpose?: string | undefined;
|
|
801
853
|
labels?: Record<string, string> | undefined;
|
|
802
854
|
from?: string | undefined;
|
|
803
855
|
}>;
|
|
@@ -836,6 +888,7 @@ declare const imageInputSchema: z.ZodObject<{
|
|
|
836
888
|
height: z.ZodOptional<z.ZodNumber>;
|
|
837
889
|
}, "strip", z.ZodTypeAny, {
|
|
838
890
|
prompt: string;
|
|
891
|
+
purpose?: string | undefined;
|
|
839
892
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
840
893
|
override?: {
|
|
841
894
|
provider?: string | undefined;
|
|
@@ -847,12 +900,12 @@ declare const imageInputSchema: z.ZodObject<{
|
|
|
847
900
|
model: string;
|
|
848
901
|
transport: "http" | "subprocess";
|
|
849
902
|
})[] | undefined;
|
|
850
|
-
purpose?: string | undefined;
|
|
851
903
|
labels?: Record<string, string> | undefined;
|
|
852
904
|
width?: number | undefined;
|
|
853
905
|
height?: number | undefined;
|
|
854
906
|
}, {
|
|
855
907
|
prompt: string;
|
|
908
|
+
purpose?: string | undefined;
|
|
856
909
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
857
910
|
override?: {
|
|
858
911
|
provider?: string | undefined;
|
|
@@ -864,7 +917,6 @@ declare const imageInputSchema: z.ZodObject<{
|
|
|
864
917
|
model: string;
|
|
865
918
|
transport: "http" | "subprocess";
|
|
866
919
|
})[] | undefined;
|
|
867
|
-
purpose?: string | undefined;
|
|
868
920
|
labels?: Record<string, string> | undefined;
|
|
869
921
|
width?: number | undefined;
|
|
870
922
|
height?: number | undefined;
|
|
@@ -902,6 +954,7 @@ declare const embeddingInputSchema: z.ZodObject<{
|
|
|
902
954
|
text: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
903
955
|
}, "strip", z.ZodTypeAny, {
|
|
904
956
|
text: string | string[];
|
|
957
|
+
purpose?: string | undefined;
|
|
905
958
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
906
959
|
override?: {
|
|
907
960
|
provider?: string | undefined;
|
|
@@ -913,10 +966,10 @@ declare const embeddingInputSchema: z.ZodObject<{
|
|
|
913
966
|
model: string;
|
|
914
967
|
transport: "http" | "subprocess";
|
|
915
968
|
})[] | undefined;
|
|
916
|
-
purpose?: string | undefined;
|
|
917
969
|
labels?: Record<string, string> | undefined;
|
|
918
970
|
}, {
|
|
919
971
|
text: string | string[];
|
|
972
|
+
purpose?: string | undefined;
|
|
920
973
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
921
974
|
override?: {
|
|
922
975
|
provider?: string | undefined;
|
|
@@ -928,7 +981,6 @@ declare const embeddingInputSchema: z.ZodObject<{
|
|
|
928
981
|
model: string;
|
|
929
982
|
transport: "http" | "subprocess";
|
|
930
983
|
})[] | undefined;
|
|
931
|
-
purpose?: string | undefined;
|
|
932
984
|
labels?: Record<string, string> | undefined;
|
|
933
985
|
}>;
|
|
934
986
|
declare const transcribeInputSchema: z.ZodObject<{
|
|
@@ -969,6 +1021,7 @@ declare const transcribeInputSchema: z.ZodObject<{
|
|
|
969
1021
|
}, "strip", z.ZodTypeAny, {
|
|
970
1022
|
audio: string | Uint8Array<ArrayBuffer>;
|
|
971
1023
|
language?: string | undefined;
|
|
1024
|
+
purpose?: string | undefined;
|
|
972
1025
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
973
1026
|
override?: {
|
|
974
1027
|
provider?: string | undefined;
|
|
@@ -980,12 +1033,12 @@ declare const transcribeInputSchema: z.ZodObject<{
|
|
|
980
1033
|
model: string;
|
|
981
1034
|
transport: "http" | "subprocess";
|
|
982
1035
|
})[] | undefined;
|
|
983
|
-
purpose?: string | undefined;
|
|
984
1036
|
labels?: Record<string, string> | undefined;
|
|
985
1037
|
durationSec?: number | undefined;
|
|
986
1038
|
}, {
|
|
987
1039
|
audio: string | Uint8Array<ArrayBuffer>;
|
|
988
1040
|
language?: string | undefined;
|
|
1041
|
+
purpose?: string | undefined;
|
|
989
1042
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
990
1043
|
override?: {
|
|
991
1044
|
provider?: string | undefined;
|
|
@@ -997,7 +1050,6 @@ declare const transcribeInputSchema: z.ZodObject<{
|
|
|
997
1050
|
model: string;
|
|
998
1051
|
transport: "http" | "subprocess";
|
|
999
1052
|
})[] | undefined;
|
|
1000
|
-
purpose?: string | undefined;
|
|
1001
1053
|
labels?: Record<string, string> | undefined;
|
|
1002
1054
|
durationSec?: number | undefined;
|
|
1003
1055
|
}>;
|
|
@@ -1038,6 +1090,7 @@ declare const ocrInputSchema: z.ZodObject<{
|
|
|
1038
1090
|
}, "strip", z.ZodTypeAny, {
|
|
1039
1091
|
document: string | Uint8Array<ArrayBuffer>;
|
|
1040
1092
|
mimeType?: string | undefined;
|
|
1093
|
+
purpose?: string | undefined;
|
|
1041
1094
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1042
1095
|
override?: {
|
|
1043
1096
|
provider?: string | undefined;
|
|
@@ -1049,11 +1102,11 @@ declare const ocrInputSchema: z.ZodObject<{
|
|
|
1049
1102
|
model: string;
|
|
1050
1103
|
transport: "http" | "subprocess";
|
|
1051
1104
|
})[] | undefined;
|
|
1052
|
-
purpose?: string | undefined;
|
|
1053
1105
|
labels?: Record<string, string> | undefined;
|
|
1054
1106
|
}, {
|
|
1055
1107
|
document: string | Uint8Array<ArrayBuffer>;
|
|
1056
1108
|
mimeType?: string | undefined;
|
|
1109
|
+
purpose?: string | undefined;
|
|
1057
1110
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1058
1111
|
override?: {
|
|
1059
1112
|
provider?: string | undefined;
|
|
@@ -1065,7 +1118,6 @@ declare const ocrInputSchema: z.ZodObject<{
|
|
|
1065
1118
|
model: string;
|
|
1066
1119
|
transport: "http" | "subprocess";
|
|
1067
1120
|
})[] | undefined;
|
|
1068
|
-
purpose?: string | undefined;
|
|
1069
1121
|
labels?: Record<string, string> | undefined;
|
|
1070
1122
|
}>;
|
|
1071
1123
|
declare const moderationInputSchema: z.ZodObject<{
|
|
@@ -1101,6 +1153,7 @@ declare const moderationInputSchema: z.ZodObject<{
|
|
|
1101
1153
|
input: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
1102
1154
|
}, "strip", z.ZodTypeAny, {
|
|
1103
1155
|
input: string | string[];
|
|
1156
|
+
purpose?: string | undefined;
|
|
1104
1157
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1105
1158
|
override?: {
|
|
1106
1159
|
provider?: string | undefined;
|
|
@@ -1112,10 +1165,72 @@ declare const moderationInputSchema: z.ZodObject<{
|
|
|
1112
1165
|
model: string;
|
|
1113
1166
|
transport: "http" | "subprocess";
|
|
1114
1167
|
})[] | undefined;
|
|
1115
|
-
purpose?: string | undefined;
|
|
1116
1168
|
labels?: Record<string, string> | undefined;
|
|
1117
1169
|
}, {
|
|
1118
1170
|
input: string | string[];
|
|
1171
|
+
purpose?: string | undefined;
|
|
1172
|
+
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1173
|
+
override?: {
|
|
1174
|
+
provider?: string | undefined;
|
|
1175
|
+
model?: string | undefined;
|
|
1176
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1177
|
+
} | undefined;
|
|
1178
|
+
fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
|
|
1179
|
+
provider: string;
|
|
1180
|
+
model: string;
|
|
1181
|
+
transport: "http" | "subprocess";
|
|
1182
|
+
})[] | undefined;
|
|
1183
|
+
labels?: Record<string, string> | undefined;
|
|
1184
|
+
}>;
|
|
1185
|
+
declare const podcastInputSchema: z.ZodObject<{
|
|
1186
|
+
tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
|
|
1187
|
+
override: z.ZodOptional<z.ZodObject<{
|
|
1188
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
1189
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1190
|
+
transport: z.ZodOptional<z.ZodEnum<["http", "subprocess"]>>;
|
|
1191
|
+
}, "strip", z.ZodTypeAny, {
|
|
1192
|
+
provider?: string | undefined;
|
|
1193
|
+
model?: string | undefined;
|
|
1194
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1195
|
+
}, {
|
|
1196
|
+
provider?: string | undefined;
|
|
1197
|
+
model?: string | undefined;
|
|
1198
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1199
|
+
}>>;
|
|
1200
|
+
fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
|
|
1201
|
+
provider: z.ZodString;
|
|
1202
|
+
model: z.ZodString;
|
|
1203
|
+
transport: z.ZodEnum<["http", "subprocess"]>;
|
|
1204
|
+
}, "strip", z.ZodTypeAny, {
|
|
1205
|
+
provider: string;
|
|
1206
|
+
model: string;
|
|
1207
|
+
transport: "http" | "subprocess";
|
|
1208
|
+
}, {
|
|
1209
|
+
provider: string;
|
|
1210
|
+
model: string;
|
|
1211
|
+
transport: "http" | "subprocess";
|
|
1212
|
+
}>]>, "many">>;
|
|
1213
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
1214
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1215
|
+
script: z.ZodArray<z.ZodObject<{
|
|
1216
|
+
speaker: z.ZodString;
|
|
1217
|
+
text: z.ZodString;
|
|
1218
|
+
}, "strip", z.ZodTypeAny, {
|
|
1219
|
+
text: string;
|
|
1220
|
+
speaker: string;
|
|
1221
|
+
}, {
|
|
1222
|
+
text: string;
|
|
1223
|
+
speaker: string;
|
|
1224
|
+
}>, "many">;
|
|
1225
|
+
voices: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1226
|
+
format: z.ZodOptional<z.ZodString>;
|
|
1227
|
+
}, "strip", z.ZodTypeAny, {
|
|
1228
|
+
script: {
|
|
1229
|
+
text: string;
|
|
1230
|
+
speaker: string;
|
|
1231
|
+
}[];
|
|
1232
|
+
voices: Record<string, string>;
|
|
1233
|
+
purpose?: string | undefined;
|
|
1119
1234
|
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1120
1235
|
override?: {
|
|
1121
1236
|
provider?: string | undefined;
|
|
@@ -1127,7 +1242,92 @@ declare const moderationInputSchema: z.ZodObject<{
|
|
|
1127
1242
|
model: string;
|
|
1128
1243
|
transport: "http" | "subprocess";
|
|
1129
1244
|
})[] | undefined;
|
|
1245
|
+
labels?: Record<string, string> | undefined;
|
|
1246
|
+
format?: string | undefined;
|
|
1247
|
+
}, {
|
|
1248
|
+
script: {
|
|
1249
|
+
text: string;
|
|
1250
|
+
speaker: string;
|
|
1251
|
+
}[];
|
|
1252
|
+
voices: Record<string, string>;
|
|
1130
1253
|
purpose?: string | undefined;
|
|
1254
|
+
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1255
|
+
override?: {
|
|
1256
|
+
provider?: string | undefined;
|
|
1257
|
+
model?: string | undefined;
|
|
1258
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1259
|
+
} | undefined;
|
|
1260
|
+
fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
|
|
1261
|
+
provider: string;
|
|
1262
|
+
model: string;
|
|
1263
|
+
transport: "http" | "subprocess";
|
|
1264
|
+
})[] | undefined;
|
|
1265
|
+
labels?: Record<string, string> | undefined;
|
|
1266
|
+
format?: string | undefined;
|
|
1267
|
+
}>;
|
|
1268
|
+
declare const ttsInputSchema: z.ZodObject<{
|
|
1269
|
+
tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
|
|
1270
|
+
override: z.ZodOptional<z.ZodObject<{
|
|
1271
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
1272
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1273
|
+
transport: z.ZodOptional<z.ZodEnum<["http", "subprocess"]>>;
|
|
1274
|
+
}, "strip", z.ZodTypeAny, {
|
|
1275
|
+
provider?: string | undefined;
|
|
1276
|
+
model?: string | undefined;
|
|
1277
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1278
|
+
}, {
|
|
1279
|
+
provider?: string | undefined;
|
|
1280
|
+
model?: string | undefined;
|
|
1281
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1282
|
+
}>>;
|
|
1283
|
+
fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
|
|
1284
|
+
provider: z.ZodString;
|
|
1285
|
+
model: z.ZodString;
|
|
1286
|
+
transport: z.ZodEnum<["http", "subprocess"]>;
|
|
1287
|
+
}, "strip", z.ZodTypeAny, {
|
|
1288
|
+
provider: string;
|
|
1289
|
+
model: string;
|
|
1290
|
+
transport: "http" | "subprocess";
|
|
1291
|
+
}, {
|
|
1292
|
+
provider: string;
|
|
1293
|
+
model: string;
|
|
1294
|
+
transport: "http" | "subprocess";
|
|
1295
|
+
}>]>, "many">>;
|
|
1296
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
1297
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1298
|
+
text: z.ZodString;
|
|
1299
|
+
voice: z.ZodString;
|
|
1300
|
+
}, "strip", z.ZodTypeAny, {
|
|
1301
|
+
text: string;
|
|
1302
|
+
voice: string;
|
|
1303
|
+
purpose?: string | undefined;
|
|
1304
|
+
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1305
|
+
override?: {
|
|
1306
|
+
provider?: string | undefined;
|
|
1307
|
+
model?: string | undefined;
|
|
1308
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1309
|
+
} | undefined;
|
|
1310
|
+
fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
|
|
1311
|
+
provider: string;
|
|
1312
|
+
model: string;
|
|
1313
|
+
transport: "http" | "subprocess";
|
|
1314
|
+
})[] | undefined;
|
|
1315
|
+
labels?: Record<string, string> | undefined;
|
|
1316
|
+
}, {
|
|
1317
|
+
text: string;
|
|
1318
|
+
voice: string;
|
|
1319
|
+
purpose?: string | undefined;
|
|
1320
|
+
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1321
|
+
override?: {
|
|
1322
|
+
provider?: string | undefined;
|
|
1323
|
+
model?: string | undefined;
|
|
1324
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1325
|
+
} | undefined;
|
|
1326
|
+
fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
|
|
1327
|
+
provider: string;
|
|
1328
|
+
model: string;
|
|
1329
|
+
transport: "http" | "subprocess";
|
|
1330
|
+
})[] | undefined;
|
|
1131
1331
|
labels?: Record<string, string> | undefined;
|
|
1132
1332
|
}>;
|
|
1133
1333
|
declare const aiConfigSchema: z.ZodObject<{
|
|
@@ -1190,6 +1390,8 @@ type EmbeddingInput = z.infer<typeof embeddingInputSchema>;
|
|
|
1190
1390
|
type TranscribeInput = z.infer<typeof transcribeInputSchema>;
|
|
1191
1391
|
type OcrInput = z.infer<typeof ocrInputSchema>;
|
|
1192
1392
|
type ModerationInput = z.infer<typeof moderationInputSchema>;
|
|
1393
|
+
type PodcastInput = z.infer<typeof podcastInputSchema>;
|
|
1394
|
+
type TtsInput = z.infer<typeof ttsInputSchema>;
|
|
1193
1395
|
type AiConfig = z.infer<typeof aiConfigSchema>;
|
|
1194
1396
|
/** The public facade. Defined here because it depends on the derived inputs. */
|
|
1195
1397
|
interface AiClient {
|
|
@@ -1208,6 +1410,19 @@ interface AiClient {
|
|
|
1208
1410
|
ocr(input: OcrInput): Promise<OcrResult>;
|
|
1209
1411
|
/** Moderation (F016.4) — classify text against safety categories. Mistral. */
|
|
1210
1412
|
moderate(input: ModerationInput): Promise<ModerationResult>;
|
|
1413
|
+
/** Podcast (F020) — a finished manuscript → one multi-voice audio episode. ElevenLabs. */
|
|
1414
|
+
podcast(input: PodcastInput): Promise<PodcastResult>;
|
|
1415
|
+
/** Single-voice TTS (F020.4) — text → audio. `voice` = curated name or voiceId. ElevenLabs. */
|
|
1416
|
+
tts(input: TtsInput): Promise<PodcastResult>;
|
|
1417
|
+
/** Batch (F016.1) — submit many chat requests for async (≤24h) processing at 50% cost. Mistral. */
|
|
1418
|
+
batch: {
|
|
1419
|
+
submit(input: {
|
|
1420
|
+
requests: BatchRequestItem[];
|
|
1421
|
+
override?: TierSpec;
|
|
1422
|
+
}): Promise<BatchJob>;
|
|
1423
|
+
status(jobId: string, override?: TierSpec): Promise<BatchJob>;
|
|
1424
|
+
results(jobId: string, override?: TierSpec): Promise<BatchResultItem[]>;
|
|
1425
|
+
};
|
|
1211
1426
|
/** Prompt-contract capabilities (F5.5) layered on chat/vision. */
|
|
1212
1427
|
contracts: Contracts;
|
|
1213
1428
|
}
|
|
@@ -1263,6 +1478,25 @@ declare function mistralAdapter(config?: {
|
|
|
1263
1478
|
pricePerPage?: number;
|
|
1264
1479
|
}): ProviderAdapter;
|
|
1265
1480
|
|
|
1481
|
+
/** Curated Danish voices (F020.3) — friendly name → ElevenLabs voiceId. Apps can
|
|
1482
|
+
* pass these names to `ai.podcast`/`ai.tts` instead of raw IDs. */
|
|
1483
|
+
declare const ELEVENLABS_DANISH_VOICES: Record<string, string>;
|
|
1484
|
+
/** Resolve a curated voice name to its voiceId; pass a raw voiceId through unchanged. */
|
|
1485
|
+
declare function resolveVoice(nameOrId: string): string;
|
|
1486
|
+
interface ElevenLabsVoice {
|
|
1487
|
+
voiceId: string;
|
|
1488
|
+
name: string;
|
|
1489
|
+
language?: string;
|
|
1490
|
+
}
|
|
1491
|
+
declare function elevenlabsAdapter(config?: {
|
|
1492
|
+
apiKey?: string;
|
|
1493
|
+
baseUrl?: string;
|
|
1494
|
+
fetch?: typeof fetch;
|
|
1495
|
+
pricePer1kChars?: number;
|
|
1496
|
+
}): ProviderAdapter & {
|
|
1497
|
+
listVoices(): Promise<ElevenLabsVoice[]>;
|
|
1498
|
+
};
|
|
1499
|
+
|
|
1266
1500
|
interface FalAdapterConfig {
|
|
1267
1501
|
apiKey?: string;
|
|
1268
1502
|
/** "sync" (default — fal.run, fast models) or "queue" (queue.fal.run, polled). */
|
|
@@ -1310,8 +1544,8 @@ declare const falStubAdapter: ProviderAdapter;
|
|
|
1310
1544
|
* wires the live adapters. */
|
|
1311
1545
|
declare const stubProviders: Record<string, ProviderAdapter>;
|
|
1312
1546
|
|
|
1313
|
-
declare const VERSION: "0.
|
|
1314
|
-
declare const SDK_TAG: "@broberg/ai-sdk@0.
|
|
1547
|
+
declare const VERSION: "0.9.0";
|
|
1548
|
+
declare const SDK_TAG: "@broberg/ai-sdk@0.9.0";
|
|
1315
1549
|
|
|
1316
1550
|
/** Built-in defaults. Every entry is overridable via AiConfig.defaults or a
|
|
1317
1551
|
* per-call override. Model IDs are current at scaffold time; callers pin their
|
|
@@ -1504,4 +1738,4 @@ interface StreamTransportRequest extends TransportRequest {
|
|
|
1504
1738
|
*/
|
|
1505
1739
|
declare function streamTransport(req: StreamTransportRequest): AsyncIterable<string>;
|
|
1506
1740
|
|
|
1507
|
-
export { type AiClient, type AiConfig, type BudgetConfig, BudgetExceededError, BudgetGuard, type BudgetStore, type CallOptions, type Capability, type ChatInput, type ChatRequest, type ChatResult, type ChatStreamEvent, type ClassifyInput, type ClassifyResult, type ContentPart, type Contracts, type CostSink, type CostSummary, DEFAULT_TIER_MAP, type DesignInput, type DesignResult, type DiscordSinkConfig, type EmbeddingInput, type EmbeddingRequest, type EmbeddingResult, type ExtractInput, type ExtractResult, type FalAdapterConfig, type HttpResponse, type ImageInput, type ImageRequest, type ImageResult, type Message, type MockupInput, type MockupResult, type ModerationInput, type ModerationItem, type ModerationRequest, type ModerationResult, type OcrInput, type OcrPage, type OcrRequest, type OcrResult, type OpenAICompatibleConfig, type PricingEntry, type ProviderAdapter, type RerankInput, type RerankResult, type Role, SDK_TAG, type SqliteBudgetStoreConfig, type SqliteSinkConfig, StreamHttpError, type SubprocessResponse, type Tier, type TierSpec, type Tool, type ToolCall, type TranscribeInput, type TranscribeRequest, type TranscribeResult, type TranslateInput, type TranslateResult, type Transport, type TransportRequest, type TransportResponse, type UpmetricsSinkConfig, type Usage, VERSION, type VideoInput, type VisionInput, aiConfigSchema, anthropicAdapter, anthropicApiAdapter, anthropicSubprocessAdapter, chatInputSchema, computeCost, createAI, deepinfraAdapter, defaultProviders, discordSink, embeddingInputSchema, falAdapter, falStubAdapter, freshUsage, fromProviderToolCall, geminiAdapter, getCostSummary, getPrice, httpTransport, imageInputSchema, makeContracts, makeOpenAICompatibleAdapter, messageSchema, mistralAdapter, multiSink, noopSink, openaiAdapter, openaiStubAdapter, openrouterAdapter, parseClaudeCliJson, parseJsonLoose, resolveTier, sqliteBudgetStore, sqliteSink, streamTransport, stubProviders, subprocessTransport, tierSpecSchema, toProviderTools, toolSchema, translateInputSchema, upmetricsSink, visionInputSchema };
|
|
1741
|
+
export { type AiClient, type AiConfig, type BatchJob, type BatchRequestItem, type BatchResultItem, type BudgetConfig, BudgetExceededError, BudgetGuard, type BudgetStore, type CallOptions, type Capability, type ChatInput, type ChatRequest, type ChatResult, type ChatStreamEvent, type ClassifyInput, type ClassifyResult, type ContentPart, type Contracts, type CostSink, type CostSummary, DEFAULT_TIER_MAP, type DesignInput, type DesignResult, type DialogueRequest, type DialogueTurn, type DiscordSinkConfig, ELEVENLABS_DANISH_VOICES, type EmbeddingInput, type EmbeddingRequest, type EmbeddingResult, type ExtractInput, type ExtractResult, type FalAdapterConfig, type HttpResponse, type ImageInput, type ImageRequest, type ImageResult, type Message, type MockupInput, type MockupResult, type ModerationInput, type ModerationItem, type ModerationRequest, type ModerationResult, type OcrInput, type OcrPage, type OcrRequest, type OcrResult, type OpenAICompatibleConfig, type PodcastInput, type PodcastResult, type PricingEntry, type ProviderAdapter, type RerankInput, type RerankResult, type Role, SDK_TAG, type SqliteBudgetStoreConfig, type SqliteSinkConfig, StreamHttpError, type SubprocessResponse, type Tier, type TierSpec, type Tool, type ToolCall, type TranscribeInput, type TranscribeRequest, type TranscribeResult, type TranslateInput, type TranslateResult, type Transport, type TransportRequest, type TransportResponse, type TtsInput, type TtsRequest, type UpmetricsSinkConfig, type Usage, VERSION, type VideoInput, type VisionInput, aiConfigSchema, anthropicAdapter, anthropicApiAdapter, anthropicSubprocessAdapter, chatInputSchema, computeCost, createAI, deepinfraAdapter, defaultProviders, discordSink, elevenlabsAdapter, embeddingInputSchema, falAdapter, falStubAdapter, freshUsage, fromProviderToolCall, geminiAdapter, getCostSummary, getPrice, httpTransport, imageInputSchema, makeContracts, makeOpenAICompatibleAdapter, messageSchema, mistralAdapter, multiSink, noopSink, openaiAdapter, openaiStubAdapter, openrouterAdapter, parseClaudeCliJson, parseJsonLoose, resolveTier, resolveVoice, sqliteBudgetStore, sqliteSink, streamTransport, stubProviders, subprocessTransport, tierSpecSchema, toProviderTools, toolSchema, translateInputSchema, upmetricsSink, visionInputSchema };
|