@broberg/ai-sdk 0.6.0 → 0.8.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 +369 -4
- package/dist/index.js +256 -8
- 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" | "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 = {
|
|
@@ -180,6 +180,55 @@ interface TranscribeResult {
|
|
|
180
180
|
text: string;
|
|
181
181
|
usage: Usage;
|
|
182
182
|
}
|
|
183
|
+
interface OcrRequest {
|
|
184
|
+
/** A URL, data-URL, or raw bytes of the document/image. */
|
|
185
|
+
document: string | Uint8Array;
|
|
186
|
+
mimeType?: string;
|
|
187
|
+
spec: TierSpec;
|
|
188
|
+
}
|
|
189
|
+
interface OcrPage {
|
|
190
|
+
index: number;
|
|
191
|
+
markdown: string;
|
|
192
|
+
}
|
|
193
|
+
interface OcrResult {
|
|
194
|
+
pages: OcrPage[];
|
|
195
|
+
usage: Usage;
|
|
196
|
+
}
|
|
197
|
+
interface ModerationRequest {
|
|
198
|
+
input: string[];
|
|
199
|
+
spec: TierSpec;
|
|
200
|
+
}
|
|
201
|
+
interface ModerationItem {
|
|
202
|
+
/** True if any category tripped. */
|
|
203
|
+
flagged: boolean;
|
|
204
|
+
categories: Record<string, boolean>;
|
|
205
|
+
categoryScores: Record<string, number>;
|
|
206
|
+
}
|
|
207
|
+
interface ModerationResult {
|
|
208
|
+
results: ModerationItem[];
|
|
209
|
+
usage: Usage;
|
|
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
|
+
}
|
|
183
232
|
/** The thin contract every provider implements (F4). A provider need only
|
|
184
233
|
* support the capabilities it offers — `chat` is the baseline; vision/image/
|
|
185
234
|
* embedding are optional and absence is a typed capability gap. */
|
|
@@ -196,6 +245,12 @@ interface ProviderAdapter {
|
|
|
196
245
|
image?(req: ImageRequest): Promise<ImageResult>;
|
|
197
246
|
embedding?(req: EmbeddingRequest): Promise<EmbeddingResult>;
|
|
198
247
|
transcribe?(req: TranscribeRequest): Promise<TranscribeResult>;
|
|
248
|
+
ocr?(req: OcrRequest): Promise<OcrResult>;
|
|
249
|
+
moderate?(req: ModerationRequest): Promise<ModerationResult>;
|
|
250
|
+
/** Multi-voice dialogue → one audio episode (F020). ElevenLabs. */
|
|
251
|
+
dialogue?(req: DialogueRequest): Promise<PodcastResult>;
|
|
252
|
+
/** Single-voice TTS (F020.4) → audio. ElevenLabs. */
|
|
253
|
+
tts?(req: TtsRequest): Promise<PodcastResult>;
|
|
199
254
|
}
|
|
200
255
|
interface TranslateResult {
|
|
201
256
|
text: string;
|
|
@@ -971,6 +1026,283 @@ declare const transcribeInputSchema: z.ZodObject<{
|
|
|
971
1026
|
labels?: Record<string, string> | undefined;
|
|
972
1027
|
durationSec?: number | undefined;
|
|
973
1028
|
}>;
|
|
1029
|
+
declare const ocrInputSchema: z.ZodObject<{
|
|
1030
|
+
tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
|
|
1031
|
+
override: z.ZodOptional<z.ZodObject<{
|
|
1032
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
1033
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1034
|
+
transport: z.ZodOptional<z.ZodEnum<["http", "subprocess"]>>;
|
|
1035
|
+
}, "strip", z.ZodTypeAny, {
|
|
1036
|
+
provider?: string | undefined;
|
|
1037
|
+
model?: string | undefined;
|
|
1038
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1039
|
+
}, {
|
|
1040
|
+
provider?: string | undefined;
|
|
1041
|
+
model?: string | undefined;
|
|
1042
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1043
|
+
}>>;
|
|
1044
|
+
fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
|
|
1045
|
+
provider: z.ZodString;
|
|
1046
|
+
model: z.ZodString;
|
|
1047
|
+
transport: z.ZodEnum<["http", "subprocess"]>;
|
|
1048
|
+
}, "strip", z.ZodTypeAny, {
|
|
1049
|
+
provider: string;
|
|
1050
|
+
model: string;
|
|
1051
|
+
transport: "http" | "subprocess";
|
|
1052
|
+
}, {
|
|
1053
|
+
provider: string;
|
|
1054
|
+
model: string;
|
|
1055
|
+
transport: "http" | "subprocess";
|
|
1056
|
+
}>]>, "many">>;
|
|
1057
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
1058
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1059
|
+
/** A URL, data-URL, or raw bytes of the document/image. */
|
|
1060
|
+
document: z.ZodUnion<[z.ZodString, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>;
|
|
1061
|
+
/** image/* → routed as an image; anything else → a document (PDF etc.). */
|
|
1062
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
1063
|
+
}, "strip", z.ZodTypeAny, {
|
|
1064
|
+
document: string | Uint8Array<ArrayBuffer>;
|
|
1065
|
+
mimeType?: string | undefined;
|
|
1066
|
+
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1067
|
+
override?: {
|
|
1068
|
+
provider?: string | undefined;
|
|
1069
|
+
model?: string | undefined;
|
|
1070
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1071
|
+
} | undefined;
|
|
1072
|
+
fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
|
|
1073
|
+
provider: string;
|
|
1074
|
+
model: string;
|
|
1075
|
+
transport: "http" | "subprocess";
|
|
1076
|
+
})[] | undefined;
|
|
1077
|
+
purpose?: string | undefined;
|
|
1078
|
+
labels?: Record<string, string> | undefined;
|
|
1079
|
+
}, {
|
|
1080
|
+
document: string | Uint8Array<ArrayBuffer>;
|
|
1081
|
+
mimeType?: string | undefined;
|
|
1082
|
+
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1083
|
+
override?: {
|
|
1084
|
+
provider?: string | undefined;
|
|
1085
|
+
model?: string | undefined;
|
|
1086
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1087
|
+
} | undefined;
|
|
1088
|
+
fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
|
|
1089
|
+
provider: string;
|
|
1090
|
+
model: string;
|
|
1091
|
+
transport: "http" | "subprocess";
|
|
1092
|
+
})[] | undefined;
|
|
1093
|
+
purpose?: string | undefined;
|
|
1094
|
+
labels?: Record<string, string> | undefined;
|
|
1095
|
+
}>;
|
|
1096
|
+
declare const moderationInputSchema: z.ZodObject<{
|
|
1097
|
+
tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
|
|
1098
|
+
override: z.ZodOptional<z.ZodObject<{
|
|
1099
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
1100
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1101
|
+
transport: z.ZodOptional<z.ZodEnum<["http", "subprocess"]>>;
|
|
1102
|
+
}, "strip", z.ZodTypeAny, {
|
|
1103
|
+
provider?: string | undefined;
|
|
1104
|
+
model?: string | undefined;
|
|
1105
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1106
|
+
}, {
|
|
1107
|
+
provider?: string | undefined;
|
|
1108
|
+
model?: string | undefined;
|
|
1109
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1110
|
+
}>>;
|
|
1111
|
+
fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
|
|
1112
|
+
provider: z.ZodString;
|
|
1113
|
+
model: z.ZodString;
|
|
1114
|
+
transport: z.ZodEnum<["http", "subprocess"]>;
|
|
1115
|
+
}, "strip", z.ZodTypeAny, {
|
|
1116
|
+
provider: string;
|
|
1117
|
+
model: string;
|
|
1118
|
+
transport: "http" | "subprocess";
|
|
1119
|
+
}, {
|
|
1120
|
+
provider: string;
|
|
1121
|
+
model: string;
|
|
1122
|
+
transport: "http" | "subprocess";
|
|
1123
|
+
}>]>, "many">>;
|
|
1124
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
1125
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1126
|
+
input: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
|
|
1127
|
+
}, "strip", z.ZodTypeAny, {
|
|
1128
|
+
input: string | string[];
|
|
1129
|
+
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1130
|
+
override?: {
|
|
1131
|
+
provider?: string | undefined;
|
|
1132
|
+
model?: string | undefined;
|
|
1133
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1134
|
+
} | undefined;
|
|
1135
|
+
fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
|
|
1136
|
+
provider: string;
|
|
1137
|
+
model: string;
|
|
1138
|
+
transport: "http" | "subprocess";
|
|
1139
|
+
})[] | undefined;
|
|
1140
|
+
purpose?: string | undefined;
|
|
1141
|
+
labels?: Record<string, string> | undefined;
|
|
1142
|
+
}, {
|
|
1143
|
+
input: string | string[];
|
|
1144
|
+
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1145
|
+
override?: {
|
|
1146
|
+
provider?: string | undefined;
|
|
1147
|
+
model?: string | undefined;
|
|
1148
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1149
|
+
} | undefined;
|
|
1150
|
+
fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
|
|
1151
|
+
provider: string;
|
|
1152
|
+
model: string;
|
|
1153
|
+
transport: "http" | "subprocess";
|
|
1154
|
+
})[] | undefined;
|
|
1155
|
+
purpose?: string | undefined;
|
|
1156
|
+
labels?: Record<string, string> | undefined;
|
|
1157
|
+
}>;
|
|
1158
|
+
declare const podcastInputSchema: z.ZodObject<{
|
|
1159
|
+
tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
|
|
1160
|
+
override: z.ZodOptional<z.ZodObject<{
|
|
1161
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
1162
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1163
|
+
transport: z.ZodOptional<z.ZodEnum<["http", "subprocess"]>>;
|
|
1164
|
+
}, "strip", z.ZodTypeAny, {
|
|
1165
|
+
provider?: string | undefined;
|
|
1166
|
+
model?: string | undefined;
|
|
1167
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1168
|
+
}, {
|
|
1169
|
+
provider?: string | undefined;
|
|
1170
|
+
model?: string | undefined;
|
|
1171
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1172
|
+
}>>;
|
|
1173
|
+
fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
|
|
1174
|
+
provider: z.ZodString;
|
|
1175
|
+
model: z.ZodString;
|
|
1176
|
+
transport: z.ZodEnum<["http", "subprocess"]>;
|
|
1177
|
+
}, "strip", z.ZodTypeAny, {
|
|
1178
|
+
provider: string;
|
|
1179
|
+
model: string;
|
|
1180
|
+
transport: "http" | "subprocess";
|
|
1181
|
+
}, {
|
|
1182
|
+
provider: string;
|
|
1183
|
+
model: string;
|
|
1184
|
+
transport: "http" | "subprocess";
|
|
1185
|
+
}>]>, "many">>;
|
|
1186
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
1187
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1188
|
+
script: z.ZodArray<z.ZodObject<{
|
|
1189
|
+
speaker: z.ZodString;
|
|
1190
|
+
text: z.ZodString;
|
|
1191
|
+
}, "strip", z.ZodTypeAny, {
|
|
1192
|
+
text: string;
|
|
1193
|
+
speaker: string;
|
|
1194
|
+
}, {
|
|
1195
|
+
text: string;
|
|
1196
|
+
speaker: string;
|
|
1197
|
+
}>, "many">;
|
|
1198
|
+
voices: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
1199
|
+
format: z.ZodOptional<z.ZodString>;
|
|
1200
|
+
}, "strip", z.ZodTypeAny, {
|
|
1201
|
+
script: {
|
|
1202
|
+
text: string;
|
|
1203
|
+
speaker: string;
|
|
1204
|
+
}[];
|
|
1205
|
+
voices: Record<string, string>;
|
|
1206
|
+
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1207
|
+
override?: {
|
|
1208
|
+
provider?: string | undefined;
|
|
1209
|
+
model?: string | undefined;
|
|
1210
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1211
|
+
} | undefined;
|
|
1212
|
+
fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
|
|
1213
|
+
provider: string;
|
|
1214
|
+
model: string;
|
|
1215
|
+
transport: "http" | "subprocess";
|
|
1216
|
+
})[] | undefined;
|
|
1217
|
+
purpose?: string | undefined;
|
|
1218
|
+
labels?: Record<string, string> | undefined;
|
|
1219
|
+
format?: string | undefined;
|
|
1220
|
+
}, {
|
|
1221
|
+
script: {
|
|
1222
|
+
text: string;
|
|
1223
|
+
speaker: string;
|
|
1224
|
+
}[];
|
|
1225
|
+
voices: Record<string, string>;
|
|
1226
|
+
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1227
|
+
override?: {
|
|
1228
|
+
provider?: string | undefined;
|
|
1229
|
+
model?: string | undefined;
|
|
1230
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1231
|
+
} | undefined;
|
|
1232
|
+
fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
|
|
1233
|
+
provider: string;
|
|
1234
|
+
model: string;
|
|
1235
|
+
transport: "http" | "subprocess";
|
|
1236
|
+
})[] | undefined;
|
|
1237
|
+
purpose?: string | undefined;
|
|
1238
|
+
labels?: Record<string, string> | undefined;
|
|
1239
|
+
format?: string | undefined;
|
|
1240
|
+
}>;
|
|
1241
|
+
declare const ttsInputSchema: z.ZodObject<{
|
|
1242
|
+
tier: z.ZodOptional<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>>;
|
|
1243
|
+
override: z.ZodOptional<z.ZodObject<{
|
|
1244
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
1245
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1246
|
+
transport: z.ZodOptional<z.ZodEnum<["http", "subprocess"]>>;
|
|
1247
|
+
}, "strip", z.ZodTypeAny, {
|
|
1248
|
+
provider?: string | undefined;
|
|
1249
|
+
model?: string | undefined;
|
|
1250
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1251
|
+
}, {
|
|
1252
|
+
provider?: string | undefined;
|
|
1253
|
+
model?: string | undefined;
|
|
1254
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1255
|
+
}>>;
|
|
1256
|
+
fallback: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
|
|
1257
|
+
provider: z.ZodString;
|
|
1258
|
+
model: z.ZodString;
|
|
1259
|
+
transport: z.ZodEnum<["http", "subprocess"]>;
|
|
1260
|
+
}, "strip", z.ZodTypeAny, {
|
|
1261
|
+
provider: string;
|
|
1262
|
+
model: string;
|
|
1263
|
+
transport: "http" | "subprocess";
|
|
1264
|
+
}, {
|
|
1265
|
+
provider: string;
|
|
1266
|
+
model: string;
|
|
1267
|
+
transport: "http" | "subprocess";
|
|
1268
|
+
}>]>, "many">>;
|
|
1269
|
+
purpose: z.ZodOptional<z.ZodString>;
|
|
1270
|
+
labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
1271
|
+
text: z.ZodString;
|
|
1272
|
+
voice: z.ZodString;
|
|
1273
|
+
}, "strip", z.ZodTypeAny, {
|
|
1274
|
+
text: string;
|
|
1275
|
+
voice: string;
|
|
1276
|
+
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1277
|
+
override?: {
|
|
1278
|
+
provider?: string | undefined;
|
|
1279
|
+
model?: string | undefined;
|
|
1280
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1281
|
+
} | undefined;
|
|
1282
|
+
fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
|
|
1283
|
+
provider: string;
|
|
1284
|
+
model: string;
|
|
1285
|
+
transport: "http" | "subprocess";
|
|
1286
|
+
})[] | undefined;
|
|
1287
|
+
purpose?: string | undefined;
|
|
1288
|
+
labels?: Record<string, string> | undefined;
|
|
1289
|
+
}, {
|
|
1290
|
+
text: string;
|
|
1291
|
+
voice: string;
|
|
1292
|
+
tier?: "fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | undefined;
|
|
1293
|
+
override?: {
|
|
1294
|
+
provider?: string | undefined;
|
|
1295
|
+
model?: string | undefined;
|
|
1296
|
+
transport?: "http" | "subprocess" | undefined;
|
|
1297
|
+
} | undefined;
|
|
1298
|
+
fallback?: ("fast" | "smart" | "powerful" | "cheap" | "vision" | "video" | "embedding" | {
|
|
1299
|
+
provider: string;
|
|
1300
|
+
model: string;
|
|
1301
|
+
transport: "http" | "subprocess";
|
|
1302
|
+
})[] | undefined;
|
|
1303
|
+
purpose?: string | undefined;
|
|
1304
|
+
labels?: Record<string, string> | undefined;
|
|
1305
|
+
}>;
|
|
974
1306
|
declare const aiConfigSchema: z.ZodObject<{
|
|
975
1307
|
defaults: z.ZodOptional<z.ZodRecord<z.ZodEnum<["fast", "smart", "powerful", "cheap", "vision", "video", "embedding"]>, z.ZodObject<{
|
|
976
1308
|
provider: z.ZodString;
|
|
@@ -1029,6 +1361,10 @@ type TranslateInput = z.infer<typeof translateInputSchema>;
|
|
|
1029
1361
|
type ImageInput = z.infer<typeof imageInputSchema>;
|
|
1030
1362
|
type EmbeddingInput = z.infer<typeof embeddingInputSchema>;
|
|
1031
1363
|
type TranscribeInput = z.infer<typeof transcribeInputSchema>;
|
|
1364
|
+
type OcrInput = z.infer<typeof ocrInputSchema>;
|
|
1365
|
+
type ModerationInput = z.infer<typeof moderationInputSchema>;
|
|
1366
|
+
type PodcastInput = z.infer<typeof podcastInputSchema>;
|
|
1367
|
+
type TtsInput = z.infer<typeof ttsInputSchema>;
|
|
1032
1368
|
type AiConfig = z.infer<typeof aiConfigSchema>;
|
|
1033
1369
|
/** The public facade. Defined here because it depends on the derived inputs. */
|
|
1034
1370
|
interface AiClient {
|
|
@@ -1043,6 +1379,14 @@ interface AiClient {
|
|
|
1043
1379
|
image(input: ImageInput): Promise<ImageResult>;
|
|
1044
1380
|
embedding(input: EmbeddingInput): Promise<EmbeddingResult>;
|
|
1045
1381
|
transcribe(input: TranscribeInput): Promise<TranscribeResult>;
|
|
1382
|
+
/** OCR (F016.2) — document/image → structured markdown, billed per page. Mistral. */
|
|
1383
|
+
ocr(input: OcrInput): Promise<OcrResult>;
|
|
1384
|
+
/** Moderation (F016.4) — classify text against safety categories. Mistral. */
|
|
1385
|
+
moderate(input: ModerationInput): Promise<ModerationResult>;
|
|
1386
|
+
/** Podcast (F020) — a finished manuscript → one multi-voice audio episode. ElevenLabs. */
|
|
1387
|
+
podcast(input: PodcastInput): Promise<PodcastResult>;
|
|
1388
|
+
/** Single-voice TTS (F020.4) — text → audio. `voice` = curated name or voiceId. ElevenLabs. */
|
|
1389
|
+
tts(input: TtsInput): Promise<PodcastResult>;
|
|
1046
1390
|
/** Prompt-contract capabilities (F5.5) layered on chat/vision. */
|
|
1047
1391
|
contracts: Contracts;
|
|
1048
1392
|
}
|
|
@@ -1094,8 +1438,29 @@ declare function openrouterAdapter(config?: {
|
|
|
1094
1438
|
declare function mistralAdapter(config?: {
|
|
1095
1439
|
apiKey?: string;
|
|
1096
1440
|
baseUrl?: string;
|
|
1441
|
+
fetch?: typeof fetch;
|
|
1442
|
+
pricePerPage?: number;
|
|
1097
1443
|
}): ProviderAdapter;
|
|
1098
1444
|
|
|
1445
|
+
/** Curated Danish voices (F020.3) — friendly name → ElevenLabs voiceId. Apps can
|
|
1446
|
+
* pass these names to `ai.podcast`/`ai.tts` instead of raw IDs. */
|
|
1447
|
+
declare const ELEVENLABS_DANISH_VOICES: Record<string, string>;
|
|
1448
|
+
/** Resolve a curated voice name to its voiceId; pass a raw voiceId through unchanged. */
|
|
1449
|
+
declare function resolveVoice(nameOrId: string): string;
|
|
1450
|
+
interface ElevenLabsVoice {
|
|
1451
|
+
voiceId: string;
|
|
1452
|
+
name: string;
|
|
1453
|
+
language?: string;
|
|
1454
|
+
}
|
|
1455
|
+
declare function elevenlabsAdapter(config?: {
|
|
1456
|
+
apiKey?: string;
|
|
1457
|
+
baseUrl?: string;
|
|
1458
|
+
fetch?: typeof fetch;
|
|
1459
|
+
pricePer1kChars?: number;
|
|
1460
|
+
}): ProviderAdapter & {
|
|
1461
|
+
listVoices(): Promise<ElevenLabsVoice[]>;
|
|
1462
|
+
};
|
|
1463
|
+
|
|
1099
1464
|
interface FalAdapterConfig {
|
|
1100
1465
|
apiKey?: string;
|
|
1101
1466
|
/** "sync" (default — fal.run, fast models) or "queue" (queue.fal.run, polled). */
|
|
@@ -1143,8 +1508,8 @@ declare const falStubAdapter: ProviderAdapter;
|
|
|
1143
1508
|
* wires the live adapters. */
|
|
1144
1509
|
declare const stubProviders: Record<string, ProviderAdapter>;
|
|
1145
1510
|
|
|
1146
|
-
declare const VERSION: "0.
|
|
1147
|
-
declare const SDK_TAG: "@broberg/ai-sdk@0.
|
|
1511
|
+
declare const VERSION: "0.8.0";
|
|
1512
|
+
declare const SDK_TAG: "@broberg/ai-sdk@0.8.0";
|
|
1148
1513
|
|
|
1149
1514
|
/** Built-in defaults. Every entry is overridable via AiConfig.defaults or a
|
|
1150
1515
|
* per-call override. Model IDs are current at scaffold time; callers pin their
|
|
@@ -1337,4 +1702,4 @@ interface StreamTransportRequest extends TransportRequest {
|
|
|
1337
1702
|
*/
|
|
1338
1703
|
declare function streamTransport(req: StreamTransportRequest): AsyncIterable<string>;
|
|
1339
1704
|
|
|
1340
|
-
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 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 };
|
|
1705
|
+
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 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 };
|