@opencode/ai 2.0.14 → 2.0.16
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 +399 -56
- package/dist/experimental/evaluation-client.d.ts +1 -1
- package/dist/experimental/evaluation-client.js +39 -3
- package/dist/experimental/evaluation.d.ts +4 -4
- package/dist/experimental/evaluation.js +2 -2
- package/dist/experimental/system-one.d.ts +3 -3
- package/dist/experimental/system-one.js +40 -51
- package/dist/generation.d.ts +83 -0
- package/dist/generation.js +113 -0
- package/dist/image-client.d.ts +16 -7
- package/dist/image-client.js +29 -13
- package/dist/image.d.ts +1410 -81
- package/dist/image.js +97 -67
- package/dist/index.d.ts +17 -2
- package/dist/index.js +12 -1
- package/dist/llm.d.ts +9 -1
- package/dist/media-model.d.ts +44 -0
- package/dist/media-model.js +49 -0
- package/dist/media.d.ts +213 -0
- package/dist/media.js +227 -0
- package/dist/promise.d.ts +974 -0
- package/dist/promise.js +81 -0
- package/dist/protocols/alibaba-chat.d.ts +12 -0
- package/dist/protocols/alibaba-responses.d.ts +2 -2
- package/dist/protocols/anthropic-messages.js +8 -19
- package/dist/protocols/assemblyai-transcription.d.ts +40 -0
- package/dist/protocols/assemblyai-transcription.js +138 -0
- package/dist/protocols/bedrock-converse.d.ts +4 -4
- package/dist/protocols/bedrock-converse.js +6 -17
- package/dist/protocols/bfl-images.d.ts +32 -0
- package/dist/protocols/bfl-images.js +153 -0
- package/dist/protocols/cartesia-speech.d.ts +127 -0
- package/dist/protocols/cartesia-speech.js +126 -0
- package/dist/protocols/deepgram-speech.d.ts +119 -0
- package/dist/protocols/deepgram-speech.js +92 -0
- package/dist/protocols/deepgram-transcription.d.ts +25 -0
- package/dist/protocols/deepgram-transcription.js +129 -0
- package/dist/protocols/elevenlabs-speech.d.ts +122 -0
- package/dist/protocols/elevenlabs-speech.js +115 -0
- package/dist/protocols/fal-images.d.ts +24 -0
- package/dist/protocols/fal-images.js +114 -0
- package/dist/protocols/fal-video.d.ts +29 -0
- package/dist/protocols/fal-video.js +88 -0
- package/dist/protocols/gemini.d.ts +30 -9
- package/dist/protocols/gemini.js +45 -35
- package/dist/protocols/google-images.d.ts +9 -21
- package/dist/protocols/google-images.js +158 -133
- package/dist/protocols/google-speech.d.ts +130 -0
- package/dist/protocols/google-speech.js +84 -0
- package/dist/protocols/google-transcription.d.ts +173 -0
- package/dist/protocols/google-transcription.js +138 -0
- package/dist/protocols/google-video.d.ts +26 -0
- package/dist/protocols/google-video.js +158 -0
- package/dist/protocols/meta-images.d.ts +7 -12
- package/dist/protocols/meta-images.js +85 -66
- package/dist/protocols/meta-responses.d.ts +4 -4
- package/dist/protocols/meta-responses.js +1 -1
- package/dist/protocols/mistral-chat.js +7 -6
- package/dist/protocols/open-responses.d.ts +17 -9
- package/dist/protocols/open-responses.js +24 -14
- package/dist/protocols/openai-chat.d.ts +118 -1
- package/dist/protocols/openai-chat.js +125 -44
- package/dist/protocols/openai-compatible-chat.d.ts +12 -0
- package/dist/protocols/openai-compatible-responses.d.ts +2 -2
- package/dist/protocols/openai-images.d.ts +128 -18
- package/dist/protocols/openai-images.js +177 -154
- package/dist/protocols/openai-responses.d.ts +15 -15
- package/dist/protocols/openai-responses.js +5 -6
- package/dist/protocols/openai-speech.d.ts +116 -0
- package/dist/protocols/openai-speech.js +98 -0
- package/dist/protocols/openai-transcription.d.ts +207 -0
- package/dist/protocols/openai-transcription.js +190 -0
- package/dist/protocols/replicate-images.d.ts +28 -0
- package/dist/protocols/replicate-images.js +133 -0
- package/dist/protocols/runway-video.d.ts +38 -0
- package/dist/protocols/runway-video.js +146 -0
- package/dist/protocols/shared.d.ts +27 -17
- package/dist/protocols/shared.js +52 -35
- package/dist/protocols/stability-images.d.ts +38 -0
- package/dist/protocols/stability-images.js +148 -0
- package/dist/protocols/utils/bedrock-media.d.ts +2 -3
- package/dist/protocols/utils/bedrock-media.js +4 -4
- package/dist/protocols/utils/fal-queue.d.ts +28 -0
- package/dist/protocols/utils/fal-queue.js +69 -0
- package/dist/protocols/utils/gemini-generate-content.d.ts +65 -0
- package/dist/protocols/utils/gemini-generate-content.js +65 -0
- package/dist/protocols/utils/gemini-json-schema.d.ts +3 -0
- package/dist/protocols/utils/gemini-json-schema.js +76 -0
- package/dist/protocols/utils/media-input.d.ts +18 -0
- package/dist/protocols/utils/media-input.js +35 -0
- package/dist/protocols/utils/responses-compaction.js +6 -5
- package/dist/protocols/utils/speech-stream.d.ts +49 -0
- package/dist/protocols/utils/speech-stream.js +67 -0
- package/dist/protocols/utils/tool-schema.d.ts +2 -2
- package/dist/protocols/utils/tool-schema.js +40 -17
- package/dist/protocols/utils/tool-stream.d.ts +27 -3
- package/dist/protocols/xai-images.d.ts +9 -15
- package/dist/protocols/xai-images.js +75 -84
- package/dist/protocols/xai-responses.d.ts +2 -2
- package/dist/protocols/xai-video.d.ts +34 -0
- package/dist/protocols/xai-video.js +147 -0
- package/dist/protocols/zai-chat.d.ts +13 -1
- package/dist/protocols/zai-images.d.ts +9 -13
- package/dist/protocols/zai-images.js +59 -57
- package/dist/provider-error.js +3 -0
- package/dist/providers/alibaba.d.ts +14 -2
- package/dist/providers/amazon-bedrock-mantle.d.ts +14 -2
- package/dist/providers/amazon-bedrock.d.ts +2 -2
- package/dist/providers/assemblyai.d.ts +25 -0
- package/dist/providers/assemblyai.js +29 -0
- package/dist/providers/azure.d.ts +18 -6
- package/dist/providers/baseten.d.ts +24 -0
- package/dist/providers/black-forest-labs.d.ts +25 -0
- package/dist/providers/black-forest-labs.js +28 -0
- package/dist/providers/cartesia.d.ts +24 -0
- package/dist/providers/cartesia.js +22 -0
- package/dist/providers/cerebras.d.ts +24 -0
- package/dist/providers/cerebras.js +6 -1
- package/dist/providers/cloudflare-ai-gateway.d.ts +30 -6
- package/dist/providers/cloudflare-workers-ai.d.ts +24 -0
- package/dist/providers/deepgram.d.ts +29 -0
- package/dist/providers/deepgram.js +31 -0
- package/dist/providers/deepinfra.d.ts +24 -0
- package/dist/providers/deepinfra.js +6 -1
- package/dist/providers/deepseek.d.ts +24 -0
- package/dist/providers/elevenlabs.d.ts +24 -0
- package/dist/providers/elevenlabs.js +28 -0
- package/dist/providers/fal.d.ts +29 -0
- package/dist/providers/fal.js +33 -0
- package/dist/providers/fireworks.d.ts +24 -0
- package/dist/providers/google-vertex-chat.d.ts +12 -0
- package/dist/providers/google-vertex-responses.d.ts +2 -2
- package/dist/providers/google-vertex.d.ts +10 -3
- package/dist/providers/google.d.ts +25 -3
- package/dist/providers/google.js +11 -2
- package/dist/providers/groq.d.ts +24 -0
- package/dist/providers/index.d.ts +10 -0
- package/dist/providers/index.js +10 -0
- package/dist/providers/meta.d.ts +14 -2
- package/dist/providers/minimax.d.ts +14 -2
- package/dist/providers/moonshot.d.ts +14 -2
- package/dist/providers/moonshot.js +3 -3
- package/dist/providers/openai-compatible-responses.d.ts +2 -2
- package/dist/providers/openai-compatible.d.ts +12 -0
- package/dist/providers/openai.d.ts +25 -3
- package/dist/providers/openai.js +10 -1
- package/dist/providers/openrouter.d.ts +67 -0
- package/dist/providers/openrouter.js +13 -1
- package/dist/providers/replicate.d.ts +25 -0
- package/dist/providers/replicate.js +22 -0
- package/dist/providers/runway.d.ts +24 -0
- package/dist/providers/runway.js +22 -0
- package/dist/providers/stability.d.ts +28 -0
- package/dist/providers/stability.js +23 -0
- package/dist/providers/togetherai.d.ts +24 -0
- package/dist/providers/vercel-ai-gateway.d.ts +41 -0
- package/dist/providers/vercel-ai-gateway.js +85 -0
- package/dist/providers/xai.d.ts +17 -0
- package/dist/providers/xai.js +5 -2
- package/dist/providers/zai-coding-plan.d.ts +15 -3
- package/dist/providers/zai.d.ts +13 -1
- package/dist/route/auth.d.ts +4 -1
- package/dist/route/auth.js +6 -0
- package/dist/route/client.d.ts +9 -1
- package/dist/route/endpoint.d.ts +10 -10
- package/dist/route/executor-service.d.ts +12 -0
- package/dist/route/executor-service.js +3 -0
- package/dist/route/executor.d.ts +4 -9
- package/dist/route/executor.js +3 -3
- package/dist/route/framing.d.ts +5 -1
- package/dist/route/framing.js +9 -0
- package/dist/route/index.d.ts +2 -0
- package/dist/route/index.js +2 -0
- package/dist/route/media-protocol.d.ts +158 -0
- package/dist/route/media-protocol.js +96 -0
- package/dist/route/media.d.ts +97 -0
- package/dist/route/media.js +236 -0
- package/dist/schema/errors.d.ts +13 -3
- package/dist/schema/errors.js +7 -0
- package/dist/schema/events.d.ts +557 -40
- package/dist/schema/events.js +35 -2
- package/dist/schema/messages.d.ts +95 -8
- package/dist/schema/messages.js +8 -6
- package/dist/schema/options.d.ts +6 -3
- package/dist/schema/options.js +6 -2
- package/dist/speech-client.d.ts +21 -0
- package/dist/speech-client.js +25 -0
- package/dist/speech.d.ts +1150 -0
- package/dist/speech.js +119 -0
- package/dist/testing.d.ts +72 -8
- package/dist/transcription-client.d.ts +28 -0
- package/dist/transcription-client.js +44 -0
- package/dist/transcription.d.ts +1504 -0
- package/dist/transcription.js +133 -0
- package/dist/utils/bytes.d.ts +1 -0
- package/dist/utils/bytes.js +10 -0
- package/dist/utils/media-type.d.ts +7 -0
- package/dist/utils/media-type.js +70 -0
- package/dist/utils/sanitize.js +3 -1
- package/dist/video-client.d.ts +28 -0
- package/dist/video-client.js +40 -0
- package/dist/video.d.ts +1359 -0
- package/dist/video.js +119 -0
- package/package.json +7 -3
- package/dist/protocols/utils/gemini-tool-schema.d.ts +0 -2
- package/dist/protocols/utils/gemini-tool-schema.js +0 -103
- package/dist/protocols/utils/image-input.d.ts +0 -21
- package/dist/protocols/utils/image-input.js +0 -20
|
@@ -42,6 +42,12 @@ export declare const routes: (Route<{
|
|
|
42
42
|
readonly image_url: {
|
|
43
43
|
readonly url: string;
|
|
44
44
|
};
|
|
45
|
+
} | {
|
|
46
|
+
readonly type: "file";
|
|
47
|
+
readonly file: {
|
|
48
|
+
readonly filename: string;
|
|
49
|
+
readonly file_data: string;
|
|
50
|
+
};
|
|
45
51
|
})[];
|
|
46
52
|
} | {
|
|
47
53
|
readonly role: "user";
|
|
@@ -57,6 +63,12 @@ export declare const routes: (Route<{
|
|
|
57
63
|
readonly image_url: {
|
|
58
64
|
readonly url: string;
|
|
59
65
|
};
|
|
66
|
+
} | {
|
|
67
|
+
readonly type: "file";
|
|
68
|
+
readonly file: {
|
|
69
|
+
readonly filename: string;
|
|
70
|
+
readonly file_data: string;
|
|
71
|
+
};
|
|
60
72
|
})[];
|
|
61
73
|
} | {
|
|
62
74
|
readonly [x: string]: unknown;
|
|
@@ -191,8 +203,8 @@ export declare const routes: (Route<{
|
|
|
191
203
|
} | {
|
|
192
204
|
readonly type: "input_file";
|
|
193
205
|
readonly filename: string;
|
|
194
|
-
readonly detail?: string | undefined;
|
|
195
206
|
readonly file_data?: string | undefined;
|
|
207
|
+
readonly detail?: string | undefined;
|
|
196
208
|
readonly file_url?: string | undefined;
|
|
197
209
|
} | {
|
|
198
210
|
readonly type: "input_text";
|
|
@@ -228,8 +240,8 @@ export declare const routes: (Route<{
|
|
|
228
240
|
} | {
|
|
229
241
|
readonly type: "input_file";
|
|
230
242
|
readonly filename: string;
|
|
231
|
-
readonly detail?: string | undefined;
|
|
232
243
|
readonly file_data?: string | undefined;
|
|
244
|
+
readonly detail?: string | undefined;
|
|
233
245
|
readonly file_url?: string | undefined;
|
|
234
246
|
} | {
|
|
235
247
|
readonly type: "input_text";
|
|
@@ -44,7 +44,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
44
44
|
};
|
|
45
45
|
} | {
|
|
46
46
|
readonly document: {
|
|
47
|
-
readonly format: "pdf" | "
|
|
47
|
+
readonly format: "pdf" | "txt" | "md" | "csv" | "doc" | "docx" | "xls" | "xlsx" | "html";
|
|
48
48
|
readonly name: string;
|
|
49
49
|
readonly source: {
|
|
50
50
|
readonly bytes: string;
|
|
@@ -63,7 +63,7 @@ export declare const routes: import("../route/client.js").Route<{
|
|
|
63
63
|
};
|
|
64
64
|
} | {
|
|
65
65
|
readonly document: {
|
|
66
|
-
readonly format: "pdf" | "
|
|
66
|
+
readonly format: "pdf" | "txt" | "md" | "csv" | "doc" | "docx" | "xls" | "xlsx" | "html";
|
|
67
67
|
readonly name: string;
|
|
68
68
|
readonly source: {
|
|
69
69
|
readonly bytes: string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
+
import { HttpOptions, type ModelID } from "../schema/index.js";
|
|
3
|
+
export type { AssemblyAITranscriptionOptions } from "../protocols/assemblyai-transcription.js";
|
|
4
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
|
+
export type Config = ProviderAuthOption<"optional"> & {
|
|
6
|
+
/** `https://api.eu.assemblyai.com` for the EU region. */
|
|
7
|
+
readonly baseURL?: string;
|
|
8
|
+
readonly headers?: Record<string, string>;
|
|
9
|
+
readonly http?: HttpOptions.Input;
|
|
10
|
+
};
|
|
11
|
+
export declare const configure: (input?: Config) => {
|
|
12
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
13
|
+
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/assemblyai-transcription.js").AssemblyAITranscriptionOptions>;
|
|
14
|
+
configure: (input?: Config) => /*elided*/ any;
|
|
15
|
+
};
|
|
16
|
+
export declare const provider: {
|
|
17
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
18
|
+
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/assemblyai-transcription.js").AssemblyAITranscriptionOptions>;
|
|
19
|
+
configure: (input?: Config) => {
|
|
20
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
21
|
+
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/assemblyai-transcription.js").AssemblyAITranscriptionOptions>;
|
|
22
|
+
configure: /*elided*/ any;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare const transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/assemblyai-transcription.js").AssemblyAITranscriptionOptions>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Auth } from "../route/auth.js";
|
|
2
|
+
import { HttpOptions, ProviderID } from "../schema/index.js";
|
|
3
|
+
import { AssemblyAITranscription, DEFAULT_BASE_URL } from "../protocols/assemblyai-transcription.js";
|
|
4
|
+
export const id = ProviderID.make("assemblyai");
|
|
5
|
+
const baseURL = DEFAULT_BASE_URL;
|
|
6
|
+
// The key is the whole `authorization` value, without a scheme.
|
|
7
|
+
const auth = (options) => {
|
|
8
|
+
if ("auth" in options && options.auth)
|
|
9
|
+
return options.auth;
|
|
10
|
+
return Auth.optional("apiKey" in options ? options.apiKey : undefined, "apiKey")
|
|
11
|
+
.orElse(Auth.config("ASSEMBLYAI_API_KEY"))
|
|
12
|
+
.pipe(Auth.header("authorization"));
|
|
13
|
+
};
|
|
14
|
+
export const configure = (input = {}) => {
|
|
15
|
+
const transcription = (modelID) => AssemblyAITranscription.model({
|
|
16
|
+
id: modelID,
|
|
17
|
+
auth: auth(input),
|
|
18
|
+
baseURL: input.baseURL ?? baseURL,
|
|
19
|
+
headers: input.headers,
|
|
20
|
+
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
id,
|
|
24
|
+
transcription,
|
|
25
|
+
configure,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export const provider = configure();
|
|
29
|
+
export const transcription = provider.transcription;
|
|
@@ -93,8 +93,8 @@ declare const responsesRoute: Route<{
|
|
|
93
93
|
} | {
|
|
94
94
|
readonly type: "input_file";
|
|
95
95
|
readonly filename: string;
|
|
96
|
-
readonly detail?: string | undefined;
|
|
97
96
|
readonly file_data?: string | undefined;
|
|
97
|
+
readonly detail?: string | undefined;
|
|
98
98
|
readonly file_url?: string | undefined;
|
|
99
99
|
} | {
|
|
100
100
|
readonly type: "input_text";
|
|
@@ -130,8 +130,8 @@ declare const responsesRoute: Route<{
|
|
|
130
130
|
} | {
|
|
131
131
|
readonly type: "input_file";
|
|
132
132
|
readonly filename: string;
|
|
133
|
-
readonly detail?: string | undefined;
|
|
134
133
|
readonly file_data?: string | undefined;
|
|
134
|
+
readonly detail?: string | undefined;
|
|
135
135
|
readonly file_url?: string | undefined;
|
|
136
136
|
} | {
|
|
137
137
|
readonly type: "input_text";
|
|
@@ -192,11 +192,11 @@ declare const responsesRoute: Route<{
|
|
|
192
192
|
readonly size?: string | undefined;
|
|
193
193
|
readonly action?: "generate" | "auto" | "edit" | undefined;
|
|
194
194
|
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
195
|
+
readonly partial_images?: number | undefined;
|
|
195
196
|
readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
|
|
196
197
|
readonly background?: "auto" | "opaque" | "transparent" | undefined;
|
|
197
198
|
readonly output_compression?: number | undefined;
|
|
198
199
|
readonly input_fidelity?: "low" | "high" | undefined;
|
|
199
|
-
readonly partial_images?: number | undefined;
|
|
200
200
|
} | {
|
|
201
201
|
readonly type: "namespace";
|
|
202
202
|
readonly name: string;
|
|
@@ -267,6 +267,12 @@ export declare const routes: (Route<{
|
|
|
267
267
|
readonly image_url: {
|
|
268
268
|
readonly url: string;
|
|
269
269
|
};
|
|
270
|
+
} | {
|
|
271
|
+
readonly type: "file";
|
|
272
|
+
readonly file: {
|
|
273
|
+
readonly filename: string;
|
|
274
|
+
readonly file_data: string;
|
|
275
|
+
};
|
|
270
276
|
})[];
|
|
271
277
|
} | {
|
|
272
278
|
readonly role: "user";
|
|
@@ -282,6 +288,12 @@ export declare const routes: (Route<{
|
|
|
282
288
|
readonly image_url: {
|
|
283
289
|
readonly url: string;
|
|
284
290
|
};
|
|
291
|
+
} | {
|
|
292
|
+
readonly type: "file";
|
|
293
|
+
readonly file: {
|
|
294
|
+
readonly filename: string;
|
|
295
|
+
readonly file_data: string;
|
|
296
|
+
};
|
|
285
297
|
})[];
|
|
286
298
|
} | {
|
|
287
299
|
readonly [x: string]: unknown;
|
|
@@ -421,8 +433,8 @@ export declare const routes: (Route<{
|
|
|
421
433
|
} | {
|
|
422
434
|
readonly type: "input_file";
|
|
423
435
|
readonly filename: string;
|
|
424
|
-
readonly detail?: string | undefined;
|
|
425
436
|
readonly file_data?: string | undefined;
|
|
437
|
+
readonly detail?: string | undefined;
|
|
426
438
|
readonly file_url?: string | undefined;
|
|
427
439
|
} | {
|
|
428
440
|
readonly type: "input_text";
|
|
@@ -458,8 +470,8 @@ export declare const routes: (Route<{
|
|
|
458
470
|
} | {
|
|
459
471
|
readonly type: "input_file";
|
|
460
472
|
readonly filename: string;
|
|
461
|
-
readonly detail?: string | undefined;
|
|
462
473
|
readonly file_data?: string | undefined;
|
|
474
|
+
readonly detail?: string | undefined;
|
|
463
475
|
readonly file_url?: string | undefined;
|
|
464
476
|
} | {
|
|
465
477
|
readonly type: "input_text";
|
|
@@ -520,11 +532,11 @@ export declare const routes: (Route<{
|
|
|
520
532
|
readonly size?: string | undefined;
|
|
521
533
|
readonly action?: "generate" | "auto" | "edit" | undefined;
|
|
522
534
|
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
535
|
+
readonly partial_images?: number | undefined;
|
|
523
536
|
readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
|
|
524
537
|
readonly background?: "auto" | "opaque" | "transparent" | undefined;
|
|
525
538
|
readonly output_compression?: number | undefined;
|
|
526
539
|
readonly input_fidelity?: "low" | "high" | undefined;
|
|
527
|
-
readonly partial_images?: number | undefined;
|
|
528
540
|
} | {
|
|
529
541
|
readonly type: "namespace";
|
|
530
542
|
readonly name: string;
|
|
@@ -28,6 +28,12 @@ export declare const route: Route<{
|
|
|
28
28
|
readonly image_url: {
|
|
29
29
|
readonly url: string;
|
|
30
30
|
};
|
|
31
|
+
} | {
|
|
32
|
+
readonly type: "file";
|
|
33
|
+
readonly file: {
|
|
34
|
+
readonly filename: string;
|
|
35
|
+
readonly file_data: string;
|
|
36
|
+
};
|
|
31
37
|
})[];
|
|
32
38
|
} | {
|
|
33
39
|
readonly role: "user";
|
|
@@ -43,6 +49,12 @@ export declare const route: Route<{
|
|
|
43
49
|
readonly image_url: {
|
|
44
50
|
readonly url: string;
|
|
45
51
|
};
|
|
52
|
+
} | {
|
|
53
|
+
readonly type: "file";
|
|
54
|
+
readonly file: {
|
|
55
|
+
readonly filename: string;
|
|
56
|
+
readonly file_data: string;
|
|
57
|
+
};
|
|
46
58
|
})[];
|
|
47
59
|
} | {
|
|
48
60
|
readonly [x: string]: unknown;
|
|
@@ -127,6 +139,12 @@ export declare const routes: Route<{
|
|
|
127
139
|
readonly image_url: {
|
|
128
140
|
readonly url: string;
|
|
129
141
|
};
|
|
142
|
+
} | {
|
|
143
|
+
readonly type: "file";
|
|
144
|
+
readonly file: {
|
|
145
|
+
readonly filename: string;
|
|
146
|
+
readonly file_data: string;
|
|
147
|
+
};
|
|
130
148
|
})[];
|
|
131
149
|
} | {
|
|
132
150
|
readonly role: "user";
|
|
@@ -142,6 +160,12 @@ export declare const routes: Route<{
|
|
|
142
160
|
readonly image_url: {
|
|
143
161
|
readonly url: string;
|
|
144
162
|
};
|
|
163
|
+
} | {
|
|
164
|
+
readonly type: "file";
|
|
165
|
+
readonly file: {
|
|
166
|
+
readonly filename: string;
|
|
167
|
+
readonly file_data: string;
|
|
168
|
+
};
|
|
145
169
|
})[];
|
|
146
170
|
} | {
|
|
147
171
|
readonly [x: string]: unknown;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
+
import { HttpOptions, type ModelID } from "../schema/index.js";
|
|
3
|
+
export type { BlackForestLabsImageOptions } from "../protocols/bfl-images.js";
|
|
4
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
|
+
export type Config = ProviderAuthOption<"optional"> & {
|
|
6
|
+
/** `https://api.eu.bfl.ai` or `https://api.us.bfl.ai` pin inference to one region. */
|
|
7
|
+
readonly baseURL?: string;
|
|
8
|
+
readonly headers?: Record<string, string>;
|
|
9
|
+
readonly http?: HttpOptions.Input;
|
|
10
|
+
};
|
|
11
|
+
export declare const configure: (input?: Config) => {
|
|
12
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
13
|
+
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/bfl-images.js").BlackForestLabsImageOptions>;
|
|
14
|
+
configure: (input?: Config) => /*elided*/ any;
|
|
15
|
+
};
|
|
16
|
+
export declare const provider: {
|
|
17
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
18
|
+
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/bfl-images.js").BlackForestLabsImageOptions>;
|
|
19
|
+
configure: (input?: Config) => {
|
|
20
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
21
|
+
image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/bfl-images.js").BlackForestLabsImageOptions>;
|
|
22
|
+
configure: /*elided*/ any;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare const image: (modelID: string | ModelID) => import("../image.js").ImageModel<import("../protocols/bfl-images.js").BlackForestLabsImageOptions>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Auth } from "../route/auth.js";
|
|
2
|
+
import { HttpOptions, ProviderID } from "../schema/index.js";
|
|
3
|
+
import { BlackForestLabsImages, DEFAULT_BASE_URL } from "../protocols/bfl-images.js";
|
|
4
|
+
export const id = ProviderID.make("black-forest-labs");
|
|
5
|
+
const baseURL = DEFAULT_BASE_URL;
|
|
6
|
+
const auth = (options) => {
|
|
7
|
+
if ("auth" in options && options.auth)
|
|
8
|
+
return options.auth;
|
|
9
|
+
return Auth.optional("apiKey" in options ? options.apiKey : undefined, "apiKey")
|
|
10
|
+
.orElse(Auth.config("BFL_API_KEY"))
|
|
11
|
+
.pipe(Auth.header("x-key"));
|
|
12
|
+
};
|
|
13
|
+
export const configure = (input = {}) => {
|
|
14
|
+
const image = (modelID) => BlackForestLabsImages.model({
|
|
15
|
+
id: modelID,
|
|
16
|
+
auth: auth(input),
|
|
17
|
+
baseURL: input.baseURL ?? baseURL,
|
|
18
|
+
headers: input.headers,
|
|
19
|
+
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
id,
|
|
23
|
+
image,
|
|
24
|
+
configure,
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export const provider = configure();
|
|
28
|
+
export const image = provider.image;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
+
import { HttpOptions, type ModelID } from "../schema/index.js";
|
|
3
|
+
export type { CartesiaEncoding, CartesiaSpeechOptions } from "../protocols/cartesia-speech.js";
|
|
4
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
5
|
+
export type Config = ProviderAuthOption<"optional"> & {
|
|
6
|
+
readonly baseURL?: string;
|
|
7
|
+
readonly headers?: Record<string, string>;
|
|
8
|
+
readonly http?: HttpOptions.Input;
|
|
9
|
+
};
|
|
10
|
+
export declare const configure: (input?: Config) => {
|
|
11
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
12
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/cartesia-speech.js").CartesiaSpeechOptions>;
|
|
13
|
+
configure: (input?: Config) => /*elided*/ any;
|
|
14
|
+
};
|
|
15
|
+
export declare const provider: {
|
|
16
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
17
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/cartesia-speech.js").CartesiaSpeechOptions>;
|
|
18
|
+
configure: (input?: Config) => {
|
|
19
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
20
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/cartesia-speech.js").CartesiaSpeechOptions>;
|
|
21
|
+
configure: /*elided*/ any;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/cartesia-speech.js").CartesiaSpeechOptions>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
2
|
+
import { HttpOptions, ProviderID } from "../schema/index.js";
|
|
3
|
+
import { CartesiaSpeech, DEFAULT_BASE_URL } from "../protocols/cartesia-speech.js";
|
|
4
|
+
export const id = ProviderID.make("cartesia");
|
|
5
|
+
const baseURL = DEFAULT_BASE_URL;
|
|
6
|
+
const auth = (options) => AuthOptions.bearer(options, "CARTESIA_API_KEY");
|
|
7
|
+
export const configure = (input = {}) => {
|
|
8
|
+
const speech = (modelID) => CartesiaSpeech.model({
|
|
9
|
+
id: modelID,
|
|
10
|
+
auth: auth(input),
|
|
11
|
+
baseURL: input.baseURL ?? baseURL,
|
|
12
|
+
headers: input.headers,
|
|
13
|
+
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
id,
|
|
17
|
+
speech,
|
|
18
|
+
configure,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export const provider = configure();
|
|
22
|
+
export const speech = provider.speech;
|
|
@@ -28,6 +28,12 @@ export declare const route: Route<{
|
|
|
28
28
|
readonly image_url: {
|
|
29
29
|
readonly url: string;
|
|
30
30
|
};
|
|
31
|
+
} | {
|
|
32
|
+
readonly type: "file";
|
|
33
|
+
readonly file: {
|
|
34
|
+
readonly filename: string;
|
|
35
|
+
readonly file_data: string;
|
|
36
|
+
};
|
|
31
37
|
})[];
|
|
32
38
|
} | {
|
|
33
39
|
readonly role: "user";
|
|
@@ -43,6 +49,12 @@ export declare const route: Route<{
|
|
|
43
49
|
readonly image_url: {
|
|
44
50
|
readonly url: string;
|
|
45
51
|
};
|
|
52
|
+
} | {
|
|
53
|
+
readonly type: "file";
|
|
54
|
+
readonly file: {
|
|
55
|
+
readonly filename: string;
|
|
56
|
+
readonly file_data: string;
|
|
57
|
+
};
|
|
46
58
|
})[];
|
|
47
59
|
} | {
|
|
48
60
|
readonly [x: string]: unknown;
|
|
@@ -127,6 +139,12 @@ export declare const routes: Route<{
|
|
|
127
139
|
readonly image_url: {
|
|
128
140
|
readonly url: string;
|
|
129
141
|
};
|
|
142
|
+
} | {
|
|
143
|
+
readonly type: "file";
|
|
144
|
+
readonly file: {
|
|
145
|
+
readonly filename: string;
|
|
146
|
+
readonly file_data: string;
|
|
147
|
+
};
|
|
130
148
|
})[];
|
|
131
149
|
} | {
|
|
132
150
|
readonly role: "user";
|
|
@@ -142,6 +160,12 @@ export declare const routes: Route<{
|
|
|
142
160
|
readonly image_url: {
|
|
143
161
|
readonly url: string;
|
|
144
162
|
};
|
|
163
|
+
} | {
|
|
164
|
+
readonly type: "file";
|
|
165
|
+
readonly file: {
|
|
166
|
+
readonly filename: string;
|
|
167
|
+
readonly file_data: string;
|
|
168
|
+
};
|
|
145
169
|
})[];
|
|
146
170
|
} | {
|
|
147
171
|
readonly [x: string]: unknown;
|
|
@@ -25,7 +25,12 @@ export const configure = (input = {}) => {
|
|
|
25
25
|
id,
|
|
26
26
|
model: (modelID) => configured.model({
|
|
27
27
|
id: modelID,
|
|
28
|
-
compatibility: {
|
|
28
|
+
compatibility: {
|
|
29
|
+
maxTokensField: "max_tokens",
|
|
30
|
+
reasoningField: "reasoning",
|
|
31
|
+
supportsStore: false,
|
|
32
|
+
supportsPromptCacheKey: true,
|
|
33
|
+
},
|
|
29
34
|
}),
|
|
30
35
|
configure,
|
|
31
36
|
};
|
|
@@ -99,8 +99,8 @@ export declare const responsesRoute: import("../route/client.js").Route<{
|
|
|
99
99
|
} | {
|
|
100
100
|
readonly type: "input_file";
|
|
101
101
|
readonly filename: string;
|
|
102
|
-
readonly detail?: string | undefined;
|
|
103
102
|
readonly file_data?: string | undefined;
|
|
103
|
+
readonly detail?: string | undefined;
|
|
104
104
|
readonly file_url?: string | undefined;
|
|
105
105
|
} | {
|
|
106
106
|
readonly type: "input_text";
|
|
@@ -136,8 +136,8 @@ export declare const responsesRoute: import("../route/client.js").Route<{
|
|
|
136
136
|
} | {
|
|
137
137
|
readonly type: "input_file";
|
|
138
138
|
readonly filename: string;
|
|
139
|
-
readonly detail?: string | undefined;
|
|
140
139
|
readonly file_data?: string | undefined;
|
|
140
|
+
readonly detail?: string | undefined;
|
|
141
141
|
readonly file_url?: string | undefined;
|
|
142
142
|
} | {
|
|
143
143
|
readonly type: "input_text";
|
|
@@ -198,11 +198,11 @@ export declare const responsesRoute: import("../route/client.js").Route<{
|
|
|
198
198
|
readonly size?: string | undefined;
|
|
199
199
|
readonly action?: "generate" | "auto" | "edit" | undefined;
|
|
200
200
|
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
201
|
+
readonly partial_images?: number | undefined;
|
|
201
202
|
readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
|
|
202
203
|
readonly background?: "auto" | "opaque" | "transparent" | undefined;
|
|
203
204
|
readonly output_compression?: number | undefined;
|
|
204
205
|
readonly input_fidelity?: "low" | "high" | undefined;
|
|
205
|
-
readonly partial_images?: number | undefined;
|
|
206
206
|
} | {
|
|
207
207
|
readonly type: "namespace";
|
|
208
208
|
readonly name: string;
|
|
@@ -547,6 +547,12 @@ export declare const route: import("../route/client.js").Route<{
|
|
|
547
547
|
readonly image_url: {
|
|
548
548
|
readonly url: string;
|
|
549
549
|
};
|
|
550
|
+
} | {
|
|
551
|
+
readonly type: "file";
|
|
552
|
+
readonly file: {
|
|
553
|
+
readonly filename: string;
|
|
554
|
+
readonly file_data: string;
|
|
555
|
+
};
|
|
550
556
|
})[];
|
|
551
557
|
} | {
|
|
552
558
|
readonly role: "user";
|
|
@@ -562,6 +568,12 @@ export declare const route: import("../route/client.js").Route<{
|
|
|
562
568
|
readonly image_url: {
|
|
563
569
|
readonly url: string;
|
|
564
570
|
};
|
|
571
|
+
} | {
|
|
572
|
+
readonly type: "file";
|
|
573
|
+
readonly file: {
|
|
574
|
+
readonly filename: string;
|
|
575
|
+
readonly file_data: string;
|
|
576
|
+
};
|
|
565
577
|
})[];
|
|
566
578
|
} | {
|
|
567
579
|
readonly [x: string]: unknown;
|
|
@@ -918,6 +930,12 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
918
930
|
readonly image_url: {
|
|
919
931
|
readonly url: string;
|
|
920
932
|
};
|
|
933
|
+
} | {
|
|
934
|
+
readonly type: "file";
|
|
935
|
+
readonly file: {
|
|
936
|
+
readonly filename: string;
|
|
937
|
+
readonly file_data: string;
|
|
938
|
+
};
|
|
921
939
|
})[];
|
|
922
940
|
} | {
|
|
923
941
|
readonly role: "user";
|
|
@@ -933,6 +951,12 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
933
951
|
readonly image_url: {
|
|
934
952
|
readonly url: string;
|
|
935
953
|
};
|
|
954
|
+
} | {
|
|
955
|
+
readonly type: "file";
|
|
956
|
+
readonly file: {
|
|
957
|
+
readonly filename: string;
|
|
958
|
+
readonly file_data: string;
|
|
959
|
+
};
|
|
936
960
|
})[];
|
|
937
961
|
} | {
|
|
938
962
|
readonly [x: string]: unknown;
|
|
@@ -1072,8 +1096,8 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
1072
1096
|
} | {
|
|
1073
1097
|
readonly type: "input_file";
|
|
1074
1098
|
readonly filename: string;
|
|
1075
|
-
readonly detail?: string | undefined;
|
|
1076
1099
|
readonly file_data?: string | undefined;
|
|
1100
|
+
readonly detail?: string | undefined;
|
|
1077
1101
|
readonly file_url?: string | undefined;
|
|
1078
1102
|
} | {
|
|
1079
1103
|
readonly type: "input_text";
|
|
@@ -1109,8 +1133,8 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
1109
1133
|
} | {
|
|
1110
1134
|
readonly type: "input_file";
|
|
1111
1135
|
readonly filename: string;
|
|
1112
|
-
readonly detail?: string | undefined;
|
|
1113
1136
|
readonly file_data?: string | undefined;
|
|
1137
|
+
readonly detail?: string | undefined;
|
|
1114
1138
|
readonly file_url?: string | undefined;
|
|
1115
1139
|
} | {
|
|
1116
1140
|
readonly type: "input_text";
|
|
@@ -1171,11 +1195,11 @@ export declare const routes: (import("../route/client.js").Route<{
|
|
|
1171
1195
|
readonly size?: string | undefined;
|
|
1172
1196
|
readonly action?: "generate" | "auto" | "edit" | undefined;
|
|
1173
1197
|
readonly output_format?: "png" | "jpeg" | "webp" | undefined;
|
|
1198
|
+
readonly partial_images?: number | undefined;
|
|
1174
1199
|
readonly quality?: "auto" | "low" | "medium" | "high" | undefined;
|
|
1175
1200
|
readonly background?: "auto" | "opaque" | "transparent" | undefined;
|
|
1176
1201
|
readonly output_compression?: number | undefined;
|
|
1177
1202
|
readonly input_fidelity?: "low" | "high" | undefined;
|
|
1178
|
-
readonly partial_images?: number | undefined;
|
|
1179
1203
|
} | {
|
|
1180
1204
|
readonly type: "namespace";
|
|
1181
1205
|
readonly name: string;
|
|
@@ -32,6 +32,12 @@ export declare const route: Route<{
|
|
|
32
32
|
readonly image_url: {
|
|
33
33
|
readonly url: string;
|
|
34
34
|
};
|
|
35
|
+
} | {
|
|
36
|
+
readonly type: "file";
|
|
37
|
+
readonly file: {
|
|
38
|
+
readonly filename: string;
|
|
39
|
+
readonly file_data: string;
|
|
40
|
+
};
|
|
35
41
|
})[];
|
|
36
42
|
} | {
|
|
37
43
|
readonly role: "user";
|
|
@@ -47,6 +53,12 @@ export declare const route: Route<{
|
|
|
47
53
|
readonly image_url: {
|
|
48
54
|
readonly url: string;
|
|
49
55
|
};
|
|
56
|
+
} | {
|
|
57
|
+
readonly type: "file";
|
|
58
|
+
readonly file: {
|
|
59
|
+
readonly filename: string;
|
|
60
|
+
readonly file_data: string;
|
|
61
|
+
};
|
|
50
62
|
})[];
|
|
51
63
|
} | {
|
|
52
64
|
readonly [x: string]: unknown;
|
|
@@ -131,6 +143,12 @@ export declare const routes: Route<{
|
|
|
131
143
|
readonly image_url: {
|
|
132
144
|
readonly url: string;
|
|
133
145
|
};
|
|
146
|
+
} | {
|
|
147
|
+
readonly type: "file";
|
|
148
|
+
readonly file: {
|
|
149
|
+
readonly filename: string;
|
|
150
|
+
readonly file_data: string;
|
|
151
|
+
};
|
|
134
152
|
})[];
|
|
135
153
|
} | {
|
|
136
154
|
readonly role: "user";
|
|
@@ -146,6 +164,12 @@ export declare const routes: Route<{
|
|
|
146
164
|
readonly image_url: {
|
|
147
165
|
readonly url: string;
|
|
148
166
|
};
|
|
167
|
+
} | {
|
|
168
|
+
readonly type: "file";
|
|
169
|
+
readonly file: {
|
|
170
|
+
readonly filename: string;
|
|
171
|
+
readonly file_data: string;
|
|
172
|
+
};
|
|
149
173
|
})[];
|
|
150
174
|
} | {
|
|
151
175
|
readonly [x: string]: unknown;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ProviderAuthOption } from "../route/auth-options.js";
|
|
2
|
+
import { HttpOptions, type ModelID } from "../schema/index.js";
|
|
3
|
+
export type { DeepgramEncoding, DeepgramSpeechOptions } from "../protocols/deepgram-speech.js";
|
|
4
|
+
export type { DeepgramTranscriptionOptions } from "../protocols/deepgram-transcription.js";
|
|
5
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
6
|
+
export type Config = ProviderAuthOption<"optional"> & {
|
|
7
|
+
readonly baseURL?: string;
|
|
8
|
+
readonly headers?: Record<string, string>;
|
|
9
|
+
readonly http?: HttpOptions.Input;
|
|
10
|
+
};
|
|
11
|
+
export declare const configure: (input?: Config) => {
|
|
12
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
13
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/deepgram-speech.js").DeepgramSpeechOptions>;
|
|
14
|
+
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/deepgram-transcription.js").DeepgramTranscriptionOptions>;
|
|
15
|
+
configure: (input?: Config) => /*elided*/ any;
|
|
16
|
+
};
|
|
17
|
+
export declare const provider: {
|
|
18
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
19
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/deepgram-speech.js").DeepgramSpeechOptions>;
|
|
20
|
+
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/deepgram-transcription.js").DeepgramTranscriptionOptions>;
|
|
21
|
+
configure: (input?: Config) => {
|
|
22
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
23
|
+
speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/deepgram-speech.js").DeepgramSpeechOptions>;
|
|
24
|
+
transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/deepgram-transcription.js").DeepgramTranscriptionOptions>;
|
|
25
|
+
configure: /*elided*/ any;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare const speech: (modelID: string | ModelID) => import("../speech.js").SpeechModel<import("../protocols/deepgram-speech.js").DeepgramSpeechOptions>;
|
|
29
|
+
export declare const transcription: (modelID: string | ModelID) => import("../transcription.js").TranscriptionModel<import("../protocols/deepgram-transcription.js").DeepgramTranscriptionOptions>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Auth } from "../route/auth.js";
|
|
2
|
+
import { HttpOptions, ProviderID } from "../schema/index.js";
|
|
3
|
+
import { DEFAULT_BASE_URL, DeepgramSpeech } from "../protocols/deepgram-speech.js";
|
|
4
|
+
import { DeepgramTranscription } from "../protocols/deepgram-transcription.js";
|
|
5
|
+
export const id = ProviderID.make("deepgram");
|
|
6
|
+
const baseURL = DEFAULT_BASE_URL;
|
|
7
|
+
const auth = (options) => {
|
|
8
|
+
if ("auth" in options && options.auth)
|
|
9
|
+
return options.auth;
|
|
10
|
+
return Auth.optional("apiKey" in options ? options.apiKey : undefined, "apiKey")
|
|
11
|
+
.orElse(Auth.config("DEEPGRAM_API_KEY"))
|
|
12
|
+
.pipe(Auth.scheme("Token"));
|
|
13
|
+
};
|
|
14
|
+
export const configure = (input = {}) => {
|
|
15
|
+
const media = (modelID) => ({
|
|
16
|
+
id: modelID,
|
|
17
|
+
auth: auth(input),
|
|
18
|
+
baseURL: input.baseURL ?? baseURL,
|
|
19
|
+
headers: input.headers,
|
|
20
|
+
http: input.http === undefined ? undefined : HttpOptions.make(input.http),
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
id,
|
|
24
|
+
speech: (modelID) => DeepgramSpeech.model(media(modelID)),
|
|
25
|
+
transcription: (modelID) => DeepgramTranscription.model(media(modelID)),
|
|
26
|
+
configure,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export const provider = configure();
|
|
30
|
+
export const speech = provider.speech;
|
|
31
|
+
export const transcription = provider.transcription;
|