@opencode/ai 2.0.16 → 2.0.17
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 +187 -129
- package/dist/ai-client.d.ts +8 -0
- package/dist/ai-client.js +12 -0
- package/dist/experimental/evaluation-client.d.ts +3 -3
- package/dist/experimental/evaluation-client.js +1 -1
- package/dist/experimental/evaluation.js +1 -1
- package/dist/generation.d.ts +6 -10
- package/dist/generation.js +17 -20
- package/dist/image-client.d.ts +59 -24
- package/dist/image-client.js +16 -40
- package/dist/image.d.ts +15 -27
- package/dist/image.js +4 -15
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/llm.d.ts +7 -5
- package/dist/llm.js +10 -4
- package/dist/media-client.d.ts +30 -0
- package/dist/media-client.js +51 -0
- package/dist/media-model.d.ts +9 -10
- package/dist/media-model.js +10 -12
- package/dist/media.js +2 -2
- package/dist/promise.d.ts +68 -30
- package/dist/promise.js +52 -31
- package/dist/protocols/alibaba-chat.js +4 -1
- package/dist/protocols/alibaba-messages.d.ts +1 -1
- package/dist/protocols/alibaba-messages.js +6 -4
- package/dist/protocols/anthropic-messages.d.ts +34 -34
- package/dist/protocols/anthropic-messages.js +14 -8
- package/dist/protocols/assemblyai-transcription.d.ts +2 -1
- package/dist/protocols/assemblyai-transcription.js +14 -16
- package/dist/protocols/bedrock-converse.d.ts +7 -0
- package/dist/protocols/bedrock-converse.js +37 -11
- package/dist/protocols/bfl-images.d.ts +7 -1
- package/dist/protocols/bfl-images.js +36 -36
- package/dist/protocols/cartesia-speech.d.ts +18 -2
- package/dist/protocols/cartesia-speech.js +10 -16
- package/dist/protocols/deepgram-speech.d.ts +19 -3
- package/dist/protocols/deepgram-speech.js +11 -12
- package/dist/protocols/deepgram-transcription.d.ts +2 -1
- package/dist/protocols/deepgram-transcription.js +9 -13
- package/dist/protocols/elevenlabs-speech.d.ts +19 -3
- package/dist/protocols/elevenlabs-speech.js +9 -13
- package/dist/protocols/fal-images.d.ts +2 -1
- package/dist/protocols/fal-images.js +30 -40
- package/dist/protocols/fal-video.d.ts +2 -2
- package/dist/protocols/fal-video.js +9 -24
- package/dist/protocols/gemini.d.ts +13 -13
- package/dist/protocols/gemini.js +16 -7
- package/dist/protocols/google-images.d.ts +3 -3
- package/dist/protocols/google-images.js +11 -21
- package/dist/protocols/google-speech.d.ts +16 -0
- package/dist/protocols/google-speech.js +20 -16
- package/dist/protocols/google-transcription.d.ts +2 -1
- package/dist/protocols/google-transcription.js +8 -20
- package/dist/protocols/google-video.d.ts +2 -2
- package/dist/protocols/google-video.js +14 -30
- package/dist/protocols/meta-images.d.ts +3 -4
- package/dist/protocols/meta-images.js +12 -21
- package/dist/protocols/meta-messages.d.ts +5 -5
- package/dist/protocols/meta-responses.js +6 -4
- package/dist/protocols/open-responses.d.ts +4 -3
- package/dist/protocols/open-responses.js +4 -8
- package/dist/protocols/openai-chat.js +3 -4
- package/dist/protocols/openai-images.d.ts +7 -5
- package/dist/protocols/openai-images.js +65 -66
- package/dist/protocols/openai-responses.d.ts +10 -10
- package/dist/protocols/openai-responses.js +31 -30
- package/dist/protocols/openai-speech.d.ts +21 -1
- package/dist/protocols/openai-speech.js +11 -12
- package/dist/protocols/openai-transcription.d.ts +4 -0
- package/dist/protocols/openai-transcription.js +44 -32
- package/dist/protocols/replicate-images.js +11 -17
- package/dist/protocols/runway-video.d.ts +3 -3
- package/dist/protocols/runway-video.js +11 -17
- package/dist/protocols/shared.d.ts +11 -17
- package/dist/protocols/shared.js +11 -40
- package/dist/protocols/stability-images.d.ts +2 -1
- package/dist/protocols/stability-images.js +24 -36
- package/dist/protocols/utils/fal-queue.d.ts +1 -3
- package/dist/protocols/utils/fal-queue.js +4 -6
- package/dist/protocols/utils/media-input.d.ts +15 -1
- package/dist/protocols/utils/media-input.js +22 -0
- package/dist/protocols/utils/responses-checkpoint.js +3 -7
- package/dist/protocols/utils/responses-compaction.d.ts +3 -1
- package/dist/protocols/utils/responses-compaction.js +16 -3
- package/dist/protocols/utils/speech-stream.d.ts +3 -3
- package/dist/protocols/utils/speech-stream.js +1 -4
- package/dist/protocols/utils/tool-schema.d.ts +2 -2
- package/dist/protocols/utils/tool-schema.js +29 -9
- package/dist/protocols/xai-images.d.ts +4 -4
- package/dist/protocols/xai-images.js +14 -29
- package/dist/protocols/xai-responses.js +1 -1
- package/dist/protocols/xai-video.js +12 -18
- package/dist/protocols/zai-images.d.ts +2 -2
- package/dist/protocols/zai-images.js +11 -14
- package/dist/protocols/zai-messages.d.ts +1 -1
- package/dist/provider-error.js +7 -1
- package/dist/providers/alibaba.d.ts +1 -1
- package/dist/providers/amazon-bedrock.d.ts +2 -0
- package/dist/providers/amazon-bedrock.js +1 -0
- package/dist/providers/anthropic-compatible.d.ts +5 -5
- package/dist/providers/anthropic.d.ts +5 -5
- package/dist/providers/assemblyai.d.ts +1 -1
- package/dist/providers/assemblyai.js +5 -10
- package/dist/providers/azure.d.ts +4 -4
- package/dist/providers/azure.js +2 -2
- package/dist/providers/black-forest-labs.d.ts +1 -1
- package/dist/providers/black-forest-labs.js +5 -10
- package/dist/providers/cartesia.d.ts +1 -1
- package/dist/providers/cartesia.js +5 -10
- package/dist/providers/cloudflare-ai-gateway.d.ts +14 -14
- package/dist/providers/deepgram.d.ts +1 -1
- package/dist/providers/deepgram.js +6 -12
- package/dist/providers/elevenlabs.d.ts +1 -1
- package/dist/providers/elevenlabs.js +5 -10
- package/dist/providers/fal.d.ts +1 -1
- package/dist/providers/fal.js +5 -12
- package/dist/providers/google-vertex-messages.d.ts +5 -5
- package/dist/providers/google-vertex.d.ts +3 -3
- package/dist/providers/google.d.ts +3 -3
- package/dist/providers/google.js +7 -12
- package/dist/providers/meta.d.ts +8 -8
- package/dist/providers/meta.js +4 -8
- package/dist/providers/minimax.d.ts +5 -5
- package/dist/providers/moonshot.d.ts +5 -5
- package/dist/providers/openai-options.d.ts +3 -9
- package/dist/providers/openai-options.js +4 -7
- package/dist/providers/openai.d.ts +9 -10
- package/dist/providers/openai.js +11 -12
- package/dist/providers/opencode-zen.js +1 -1
- package/dist/providers/openrouter.d.ts +6 -7
- package/dist/providers/openrouter.js +10 -5
- package/dist/providers/replicate.d.ts +1 -1
- package/dist/providers/replicate.js +5 -10
- package/dist/providers/runway.d.ts +1 -1
- package/dist/providers/runway.js +5 -10
- package/dist/providers/stability.d.ts +1 -1
- package/dist/providers/stability.js +6 -11
- package/dist/providers/typesafe-ai.js +1 -1
- package/dist/providers/vercel-ai-gateway.js +1 -1
- package/dist/providers/xai.js +5 -10
- package/dist/providers/zai-coding-plan.d.ts +1 -1
- package/dist/providers/zai.js +4 -8
- package/dist/route/auth.d.ts +1 -1
- package/dist/route/auth.js +14 -13
- package/dist/route/client.d.ts +9 -7
- package/dist/route/client.js +6 -8
- package/dist/route/endpoint.d.ts +1 -0
- package/dist/route/endpoint.js +2 -2
- package/dist/route/executor-service.d.ts +4 -2
- package/dist/route/executor-service.js +2 -1
- package/dist/route/executor.d.ts +3 -1
- package/dist/route/executor.js +7 -0
- package/dist/route/framing.d.ts +10 -1
- package/dist/route/framing.js +45 -5
- package/dist/route/index.d.ts +1 -1
- package/dist/route/media-protocol.d.ts +49 -35
- package/dist/route/media-protocol.js +77 -65
- package/dist/route/media.d.ts +10 -16
- package/dist/route/media.js +46 -62
- package/dist/route/protocol.d.ts +3 -1
- package/dist/schema/options.d.ts +6 -3
- package/dist/schema/options.js +7 -3
- package/dist/speech-client.d.ts +62 -17
- package/dist/speech-client.js +17 -21
- package/dist/speech.d.ts +178 -21
- package/dist/speech.js +13 -8
- package/dist/testing.d.ts +2 -2
- package/dist/transcription-client.d.ts +78 -24
- package/dist/transcription-client.js +9 -40
- package/dist/transcription.d.ts +15 -27
- package/dist/transcription.js +4 -10
- package/dist/utils/json.d.ts +4 -0
- package/dist/utils/json.js +4 -0
- package/dist/utils/media-type.d.ts +2 -1
- package/dist/utils/media-type.js +3 -1
- package/dist/video-client.d.ts +55 -24
- package/dist/video-client.js +16 -36
- package/dist/video.d.ts +18 -26
- package/dist/video.js +15 -16
- package/package.json +3 -3
- package/dist/protocols/utils/meta-image.d.ts +0 -2
- package/dist/protocols/utils/meta-image.js +0 -13
- package/dist/protocols/utils/openai-image.d.ts +0 -5
- package/dist/protocols/utils/openai-image.js +0 -18
package/dist/speech-client.d.ts
CHANGED
|
@@ -1,21 +1,66 @@
|
|
|
1
|
-
import { Context
|
|
2
|
-
import {
|
|
3
|
-
import type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
readonly stream: <Options extends SpeechOptions>(request: SpeechRequestFor<Options>) => Stream.Stream<SpeechEvent, AIError>;
|
|
1
|
+
import { Context } from "effect";
|
|
2
|
+
import { MediaClient } from "./media-client.js";
|
|
3
|
+
import { type SpeechEvent, type SpeechRequestFor, type SpeechResponse } from "./speech.js";
|
|
4
|
+
export type Interface = MediaClient.Interface<SpeechRequestFor, SpeechEvent, SpeechResponse>;
|
|
5
|
+
declare const SpeechClientService_base: Context.ServiceClass<SpeechClientService, "@opencode/SpeechClient", Interface>;
|
|
6
|
+
export declare class SpeechClientService extends SpeechClientService_base {
|
|
8
7
|
}
|
|
9
|
-
declare const
|
|
10
|
-
export
|
|
11
|
-
}
|
|
12
|
-
export declare const generate: <Options extends SpeechOptions>(request: SpeechRequestFor<Options>) => Effect.Effect<SpeechResponse, AIError, Service>;
|
|
13
|
-
export declare const stream: <Options extends SpeechOptions>(request: SpeechRequestFor<Options>) => Stream.Stream<SpeechEvent, AIError, Service>;
|
|
14
|
-
export declare const layer: Layer.Layer<Service, never, RequestExecutor.Service>;
|
|
8
|
+
export declare const Service: typeof SpeechClientService;
|
|
9
|
+
export type Service = SpeechClientService;
|
|
15
10
|
export declare const SpeechClient: {
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
|
|
11
|
+
readonly layer: import("effect/Layer").Layer<SpeechClientService, never, import("./route/executor-service.js").RequestExecutorService>;
|
|
12
|
+
readonly generate: (request: SpeechRequestFor, options?: import("./generation.js").AwaitOptions) => import("effect/Effect").Effect<SpeechResponse, import("./index.js").AIError, SpeechClientService>;
|
|
13
|
+
readonly stream: (request: SpeechRequestFor, options?: import("./generation.js").AwaitOptions) => import("effect/Stream").Stream<import("./generation.js").Observation | {
|
|
14
|
+
readonly type: "audio-delta";
|
|
15
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
16
|
+
} | {
|
|
17
|
+
readonly type: "timestamps";
|
|
18
|
+
readonly items: readonly {
|
|
19
|
+
readonly text: string;
|
|
20
|
+
readonly startSeconds: number;
|
|
21
|
+
readonly endSeconds: number;
|
|
22
|
+
}[];
|
|
23
|
+
} | {
|
|
24
|
+
readonly type: "finish";
|
|
25
|
+
readonly audio: import("./media.js").Asset;
|
|
26
|
+
readonly providerMetadata?: {
|
|
27
|
+
readonly [x: string]: {
|
|
28
|
+
readonly [x: string]: unknown;
|
|
29
|
+
};
|
|
30
|
+
} | undefined;
|
|
31
|
+
readonly usage?: {
|
|
32
|
+
readonly type: "tokens";
|
|
33
|
+
readonly input?: number | undefined;
|
|
34
|
+
readonly output?: number | undefined;
|
|
35
|
+
readonly total?: number | undefined;
|
|
36
|
+
readonly details?: {
|
|
37
|
+
readonly [x: string]: unknown;
|
|
38
|
+
} | undefined;
|
|
39
|
+
} | {
|
|
40
|
+
readonly type: "seconds";
|
|
41
|
+
readonly seconds: number;
|
|
42
|
+
} | {
|
|
43
|
+
readonly type: "characters";
|
|
44
|
+
readonly characters: number;
|
|
45
|
+
} | {
|
|
46
|
+
readonly type: "credits";
|
|
47
|
+
readonly credits: number;
|
|
48
|
+
} | {
|
|
49
|
+
readonly type: "compute";
|
|
50
|
+
readonly seconds: number;
|
|
51
|
+
} | undefined;
|
|
52
|
+
readonly notices?: readonly {
|
|
53
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
54
|
+
readonly message: string;
|
|
55
|
+
readonly providerMetadata?: {
|
|
56
|
+
readonly [x: string]: {
|
|
57
|
+
readonly [x: string]: unknown;
|
|
58
|
+
};
|
|
59
|
+
} | undefined;
|
|
60
|
+
}[] | undefined;
|
|
61
|
+
}, import("./index.js").AIError, SpeechClientService>;
|
|
62
|
+
readonly start: (request: SpeechRequestFor) => import("effect/Effect").Effect<import("./generation.js").Generation<SpeechResponse>, import("./index.js").AIError, SpeechClientService>;
|
|
63
|
+
readonly resume: (model: import("./speech.js").SpeechModel<import("./media-model.js").MediaModel.Options>, token: unknown) => import("effect/Effect").Effect<import("./generation.js").Generation<SpeechResponse>, import("./index.js").AIError, SpeechClientService>;
|
|
64
|
+
readonly Service: typeof SpeechClientService;
|
|
20
65
|
};
|
|
21
66
|
export {};
|
package/dist/speech-client.js
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
import { Context
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Context } from "effect";
|
|
2
|
+
import { MediaClient } from "./media-client.js";
|
|
3
|
+
import { SpeechTimestampsEvent, SpeechFinishEvent, } from "./speech.js";
|
|
4
|
+
export class SpeechClientService extends Context.Service()("@opencode/SpeechClient") {
|
|
4
5
|
}
|
|
5
|
-
export const
|
|
6
|
-
const client = yield* Service;
|
|
7
|
-
return yield* client.generate(request);
|
|
8
|
-
});
|
|
9
|
-
export const stream = (request) => Stream.unwrap(Effect.gen(function* () {
|
|
10
|
-
const client = yield* Service;
|
|
11
|
-
return client.stream(request);
|
|
12
|
-
}));
|
|
13
|
-
export const layer = Layer.effect(Service, Effect.gen(function* () {
|
|
14
|
-
const executor = yield* RequestExecutor.Service;
|
|
15
|
-
return Service.of({
|
|
16
|
-
generate: (request) => request.model.route.generate(request, executor.execute),
|
|
17
|
-
stream: (request) => request.model.route.stream(request, executor.execute),
|
|
18
|
-
});
|
|
19
|
-
}));
|
|
6
|
+
export const Service = SpeechClientService;
|
|
20
7
|
export const SpeechClient = {
|
|
21
8
|
Service,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
9
|
+
...MediaClient.make(Service, {
|
|
10
|
+
modality: "speech",
|
|
11
|
+
responseEvents: (response) => [
|
|
12
|
+
...(response.timestamps === undefined ? [] : [SpeechTimestampsEvent.make({ items: response.timestamps })]),
|
|
13
|
+
SpeechFinishEvent.make({
|
|
14
|
+
audio: response.audio,
|
|
15
|
+
usage: response.usage,
|
|
16
|
+
notices: response.notices,
|
|
17
|
+
providerMetadata: response.providerMetadata,
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
}),
|
|
25
21
|
};
|
package/dist/speech.d.ts
CHANGED
|
@@ -2,27 +2,24 @@ import { Effect, Schema, Stream } from "effect";
|
|
|
2
2
|
import { Media } from "./media.js";
|
|
3
3
|
import { MediaModel } from "./media-model.js";
|
|
4
4
|
import { MediaRoute } from "./route/media.js";
|
|
5
|
-
import type
|
|
6
|
-
import { AIError, HttpOptions } from "./schema/index.js";
|
|
5
|
+
import { AIError, HttpOptions, type OpenString } from "./schema/index.js";
|
|
7
6
|
import { Service } from "./speech-client.js";
|
|
8
|
-
export type SpeechOptions =
|
|
9
|
-
export type SpeechRoute
|
|
10
|
-
export declare class SpeechModel<Options extends SpeechOptions = SpeechOptions> extends MediaModel<SpeechRoute
|
|
7
|
+
export type SpeechOptions = MediaModel.Options;
|
|
8
|
+
export type SpeechRoute = MediaRoute.AnyRoute<SpeechRequestFor, SpeechEvent, SpeechResponse>;
|
|
9
|
+
export declare class SpeechModel<Options extends SpeechOptions = SpeechOptions> extends MediaModel<SpeechRoute, Options> {
|
|
11
10
|
protected readonly _SpeechModel: void;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
static fromRoute<Options extends SpeechOptions
|
|
11
|
+
/** The number of type arguments selects the kind: `<Options>`, `<Options, Frame, State>`, or `<Options, Token>`. */
|
|
12
|
+
static fromRoute<Options extends SpeechOptions>(route: MediaModel.InlineRouteInput<SpeechRequestFor<Options>, SpeechResponse>, input: MediaRoute.ModelInput): SpeechModel<Options>;
|
|
13
|
+
static fromRoute<Options extends SpeechOptions, Frame, State>(route: MediaModel.StreamRouteInput<SpeechRequestFor<Options>, SpeechEvent, Frame, State>, input: MediaRoute.ModelInput): SpeechModel<Options>;
|
|
14
|
+
static fromRoute<Options extends SpeechOptions, Token>(route: MediaModel.QueuedRouteInput<SpeechRequestFor<Options>, SpeechResponse, Token>, input: MediaRoute.ModelInput): SpeechModel<Options>;
|
|
15
15
|
}
|
|
16
|
-
export declare
|
|
17
|
-
type RouteInput<Options extends SpeechOptions = SpeechOptions, Frame = unknown, State = unknown> = MediaModel.RouteInput<MediaProtocol.Addressed<SpeechRequestFor<Options>>, MediaProtocol.Streamed<SpeechRequestFor<Options>, SpeechEvent, Frame, State>>;
|
|
18
|
-
}
|
|
19
|
-
export declare const SpeechModelSchema: Schema.declare<SpeechModel<SpeechOptions>, SpeechModel<SpeechOptions>>;
|
|
16
|
+
export declare const SpeechModelSchema: Schema.declare<SpeechModel<MediaModel.Options>, SpeechModel<MediaModel.Options>>;
|
|
20
17
|
/** Provider-native: a name on OpenAI and Gemini, a voice id on ElevenLabs and Cartesia; `{ id }` is an OpenAI custom voice. */
|
|
21
18
|
export declare const SpeechVoice: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
22
19
|
readonly id: Schema.String;
|
|
23
20
|
}>]>;
|
|
24
21
|
export type SpeechVoice = Schema.Schema.Type<typeof SpeechVoice>;
|
|
25
|
-
export type SpeechFormat = "mp3" | "wav" | "pcm" | "opus" | "aac" | "flac"
|
|
22
|
+
export type SpeechFormat = OpenString<"mp3" | "wav" | "pcm" | "opus" | "aac" | "flac">;
|
|
26
23
|
/** Granularity is provider-native: characters on ElevenLabs, words on Cartesia. */
|
|
27
24
|
export declare const SpeechTimestamp: Schema.Struct<{
|
|
28
25
|
readonly text: Schema.String;
|
|
@@ -31,7 +28,7 @@ export declare const SpeechTimestamp: Schema.Struct<{
|
|
|
31
28
|
}>;
|
|
32
29
|
export type SpeechTimestamp = Schema.Schema.Type<typeof SpeechTimestamp>;
|
|
33
30
|
declare const SpeechRequest_base: Schema.Class<SpeechRequest, Schema.Struct<{
|
|
34
|
-
readonly model: Schema.declare<SpeechModel<
|
|
31
|
+
readonly model: Schema.declare<SpeechModel<MediaModel.Options>, SpeechModel<MediaModel.Options>>;
|
|
35
32
|
readonly text: Schema.String;
|
|
36
33
|
readonly voice: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
37
34
|
readonly id: Schema.String;
|
|
@@ -197,6 +194,14 @@ export declare const SpeechFinishEvent: Schema.Struct<{
|
|
|
197
194
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
198
195
|
}>;
|
|
199
196
|
declare const speechEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
197
|
+
readonly type: Schema.tag<"generation-queued">;
|
|
198
|
+
readonly id: Schema.String;
|
|
199
|
+
readonly position: Schema.optional<Schema.Number>;
|
|
200
|
+
}>, Schema.Struct<{
|
|
201
|
+
readonly type: Schema.tag<"generation-progress">;
|
|
202
|
+
readonly id: Schema.String;
|
|
203
|
+
readonly progress: Schema.optional<Schema.Number>;
|
|
204
|
+
}>, Schema.Struct<{
|
|
200
205
|
readonly type: Schema.tag<"audio-delta">;
|
|
201
206
|
readonly chunk: Schema.Uint8Array;
|
|
202
207
|
}>, Schema.Struct<{
|
|
@@ -266,6 +271,14 @@ declare const speechEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.S
|
|
|
266
271
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
267
272
|
}>]>;
|
|
268
273
|
export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
274
|
+
readonly type: Schema.tag<"generation-queued">;
|
|
275
|
+
readonly id: Schema.String;
|
|
276
|
+
readonly position: Schema.optional<Schema.Number>;
|
|
277
|
+
}>, Schema.Struct<{
|
|
278
|
+
readonly type: Schema.tag<"generation-progress">;
|
|
279
|
+
readonly id: Schema.String;
|
|
280
|
+
readonly progress: Schema.optional<Schema.Number>;
|
|
281
|
+
}>, Schema.Struct<{
|
|
269
282
|
readonly type: Schema.tag<"audio-delta">;
|
|
270
283
|
readonly chunk: Schema.Uint8Array;
|
|
271
284
|
}>, Schema.Struct<{
|
|
@@ -334,8 +347,18 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
334
347
|
}>>>;
|
|
335
348
|
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
336
349
|
}>]> & {
|
|
337
|
-
readonly discriminants: readonly ["audio-delta", "timestamps", "finish"];
|
|
350
|
+
readonly discriminants: readonly ["generation-queued", "generation-progress", "audio-delta", "timestamps", "finish"];
|
|
338
351
|
readonly cases: {
|
|
352
|
+
"generation-queued": Schema.Struct<{
|
|
353
|
+
readonly type: Schema.tag<"generation-queued">;
|
|
354
|
+
readonly id: Schema.String;
|
|
355
|
+
readonly position: Schema.optional<Schema.Number>;
|
|
356
|
+
}>;
|
|
357
|
+
"generation-progress": Schema.Struct<{
|
|
358
|
+
readonly type: Schema.tag<"generation-progress">;
|
|
359
|
+
readonly id: Schema.String;
|
|
360
|
+
readonly progress: Schema.optional<Schema.Number>;
|
|
361
|
+
}>;
|
|
339
362
|
"audio-delta": Schema.Struct<{
|
|
340
363
|
readonly type: Schema.tag<"audio-delta">;
|
|
341
364
|
readonly chunk: Schema.Uint8Array;
|
|
@@ -409,6 +432,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
409
432
|
}>;
|
|
410
433
|
};
|
|
411
434
|
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
435
|
+
readonly id: string;
|
|
436
|
+
readonly type: "generation-queued";
|
|
437
|
+
readonly position?: number | undefined;
|
|
438
|
+
} | {
|
|
439
|
+
readonly id: string;
|
|
440
|
+
readonly type: "generation-progress";
|
|
441
|
+
readonly progress?: number | undefined;
|
|
442
|
+
} | {
|
|
412
443
|
readonly type: "audio-delta";
|
|
413
444
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
414
445
|
} | {
|
|
@@ -457,6 +488,18 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
457
488
|
} | undefined;
|
|
458
489
|
}[] | undefined;
|
|
459
490
|
}) => value is Extract<{
|
|
491
|
+
readonly id: string;
|
|
492
|
+
readonly type: "generation-queued";
|
|
493
|
+
readonly position?: number | undefined;
|
|
494
|
+
}, {
|
|
495
|
+
readonly type: Keys;
|
|
496
|
+
}> | Extract<{
|
|
497
|
+
readonly id: string;
|
|
498
|
+
readonly type: "generation-progress";
|
|
499
|
+
readonly progress?: number | undefined;
|
|
500
|
+
}, {
|
|
501
|
+
readonly type: Keys;
|
|
502
|
+
}> | Extract<{
|
|
460
503
|
readonly type: "audio-delta";
|
|
461
504
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
462
505
|
}, {
|
|
@@ -512,6 +555,16 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
512
555
|
readonly type: Keys;
|
|
513
556
|
}>;
|
|
514
557
|
readonly guards: {
|
|
558
|
+
"generation-queued": (u: unknown) => u is {
|
|
559
|
+
readonly id: string;
|
|
560
|
+
readonly type: "generation-queued";
|
|
561
|
+
readonly position?: number | undefined;
|
|
562
|
+
};
|
|
563
|
+
"generation-progress": (u: unknown) => u is {
|
|
564
|
+
readonly id: string;
|
|
565
|
+
readonly type: "generation-progress";
|
|
566
|
+
readonly progress?: number | undefined;
|
|
567
|
+
};
|
|
515
568
|
"audio-delta": (u: unknown) => u is {
|
|
516
569
|
readonly type: "audio-delta";
|
|
517
570
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
@@ -566,6 +619,16 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
566
619
|
};
|
|
567
620
|
readonly match: {
|
|
568
621
|
<Cases extends {
|
|
622
|
+
"generation-queued": (value: {
|
|
623
|
+
readonly id: string;
|
|
624
|
+
readonly type: "generation-queued";
|
|
625
|
+
readonly position?: number | undefined;
|
|
626
|
+
}) => any;
|
|
627
|
+
"generation-progress": (value: {
|
|
628
|
+
readonly id: string;
|
|
629
|
+
readonly type: "generation-progress";
|
|
630
|
+
readonly progress?: number | undefined;
|
|
631
|
+
}) => any;
|
|
569
632
|
"audio-delta": (value: {
|
|
570
633
|
readonly type: "audio-delta";
|
|
571
634
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
@@ -618,6 +681,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
618
681
|
}[] | undefined;
|
|
619
682
|
}) => any;
|
|
620
683
|
}>(value: {
|
|
684
|
+
readonly id: string;
|
|
685
|
+
readonly type: "generation-queued";
|
|
686
|
+
readonly position?: number | undefined;
|
|
687
|
+
} | {
|
|
688
|
+
readonly id: string;
|
|
689
|
+
readonly type: "generation-progress";
|
|
690
|
+
readonly progress?: number | undefined;
|
|
691
|
+
} | {
|
|
621
692
|
readonly type: "audio-delta";
|
|
622
693
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
623
694
|
} | {
|
|
@@ -667,6 +738,16 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
667
738
|
}[] | undefined;
|
|
668
739
|
}, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
669
740
|
<Cases extends {
|
|
741
|
+
"generation-queued": (value: {
|
|
742
|
+
readonly id: string;
|
|
743
|
+
readonly type: "generation-queued";
|
|
744
|
+
readonly position?: number | undefined;
|
|
745
|
+
}) => any;
|
|
746
|
+
"generation-progress": (value: {
|
|
747
|
+
readonly id: string;
|
|
748
|
+
readonly type: "generation-progress";
|
|
749
|
+
readonly progress?: number | undefined;
|
|
750
|
+
}) => any;
|
|
670
751
|
"audio-delta": (value: {
|
|
671
752
|
readonly type: "audio-delta";
|
|
672
753
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
@@ -719,6 +800,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
719
800
|
}[] | undefined;
|
|
720
801
|
}) => any;
|
|
721
802
|
}>(cases: Cases): (value: {
|
|
803
|
+
readonly id: string;
|
|
804
|
+
readonly type: "generation-queued";
|
|
805
|
+
readonly position?: number | undefined;
|
|
806
|
+
} | {
|
|
807
|
+
readonly id: string;
|
|
808
|
+
readonly type: "generation-progress";
|
|
809
|
+
readonly progress?: number | undefined;
|
|
810
|
+
} | {
|
|
722
811
|
readonly type: "audio-delta";
|
|
723
812
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
724
813
|
} | {
|
|
@@ -770,6 +859,16 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
770
859
|
};
|
|
771
860
|
readonly matchOrElse: {
|
|
772
861
|
<Cases extends {
|
|
862
|
+
"generation-queued"?: ((value: {
|
|
863
|
+
readonly id: string;
|
|
864
|
+
readonly type: "generation-queued";
|
|
865
|
+
readonly position?: number | undefined;
|
|
866
|
+
}) => any) | undefined;
|
|
867
|
+
"generation-progress"?: ((value: {
|
|
868
|
+
readonly id: string;
|
|
869
|
+
readonly type: "generation-progress";
|
|
870
|
+
readonly progress?: number | undefined;
|
|
871
|
+
}) => any) | undefined;
|
|
773
872
|
"audio-delta"?: ((value: {
|
|
774
873
|
readonly type: "audio-delta";
|
|
775
874
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
@@ -821,7 +920,19 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
821
920
|
} | undefined;
|
|
822
921
|
}[] | undefined;
|
|
823
922
|
}) => any) | undefined;
|
|
824
|
-
} & { [K in Exclude<keyof Cases, "finish" | "timestamps" | "audio-delta">]: never; }, OrElse extends (value: Exclude<{
|
|
923
|
+
} & { [K in Exclude<keyof Cases, "finish" | "generation-queued" | "generation-progress" | "timestamps" | "audio-delta">]: never; }, OrElse extends (value: Exclude<{
|
|
924
|
+
readonly id: string;
|
|
925
|
+
readonly type: "generation-queued";
|
|
926
|
+
readonly position?: number | undefined;
|
|
927
|
+
}, {
|
|
928
|
+
readonly type: keyof Cases;
|
|
929
|
+
}> | Exclude<{
|
|
930
|
+
readonly id: string;
|
|
931
|
+
readonly type: "generation-progress";
|
|
932
|
+
readonly progress?: number | undefined;
|
|
933
|
+
}, {
|
|
934
|
+
readonly type: keyof Cases;
|
|
935
|
+
}> | Exclude<{
|
|
825
936
|
readonly type: "audio-delta";
|
|
826
937
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
827
938
|
}, {
|
|
@@ -876,6 +987,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
876
987
|
}, {
|
|
877
988
|
readonly type: keyof Cases;
|
|
878
989
|
}>) => any>(value: {
|
|
990
|
+
readonly id: string;
|
|
991
|
+
readonly type: "generation-queued";
|
|
992
|
+
readonly position?: number | undefined;
|
|
993
|
+
} | {
|
|
994
|
+
readonly id: string;
|
|
995
|
+
readonly type: "generation-progress";
|
|
996
|
+
readonly progress?: number | undefined;
|
|
997
|
+
} | {
|
|
879
998
|
readonly type: "audio-delta";
|
|
880
999
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
881
1000
|
} | {
|
|
@@ -925,6 +1044,16 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
925
1044
|
}[] | undefined;
|
|
926
1045
|
}, cases: Cases, orElse: OrElse): import("effect/Unify").Unify<{ [K_1 in keyof Cases]-?: NonNullable<Cases[K_1]> extends (...args: Array<any>) => infer R ? R : never; }[keyof Cases] | ReturnType<OrElse>>;
|
|
927
1046
|
<Cases extends {
|
|
1047
|
+
"generation-queued"?: ((value: {
|
|
1048
|
+
readonly id: string;
|
|
1049
|
+
readonly type: "generation-queued";
|
|
1050
|
+
readonly position?: number | undefined;
|
|
1051
|
+
}) => any) | undefined;
|
|
1052
|
+
"generation-progress"?: ((value: {
|
|
1053
|
+
readonly id: string;
|
|
1054
|
+
readonly type: "generation-progress";
|
|
1055
|
+
readonly progress?: number | undefined;
|
|
1056
|
+
}) => any) | undefined;
|
|
928
1057
|
"audio-delta"?: ((value: {
|
|
929
1058
|
readonly type: "audio-delta";
|
|
930
1059
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
@@ -976,7 +1105,19 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
976
1105
|
} | undefined;
|
|
977
1106
|
}[] | undefined;
|
|
978
1107
|
}) => any) | undefined;
|
|
979
|
-
} & { [K in Exclude<keyof Cases, "finish" | "timestamps" | "audio-delta">]: never; }, OrElse extends (value: Exclude<{
|
|
1108
|
+
} & { [K in Exclude<keyof Cases, "finish" | "generation-queued" | "generation-progress" | "timestamps" | "audio-delta">]: never; }, OrElse extends (value: Exclude<{
|
|
1109
|
+
readonly id: string;
|
|
1110
|
+
readonly type: "generation-queued";
|
|
1111
|
+
readonly position?: number | undefined;
|
|
1112
|
+
}, {
|
|
1113
|
+
readonly type: keyof Cases;
|
|
1114
|
+
}> | Exclude<{
|
|
1115
|
+
readonly id: string;
|
|
1116
|
+
readonly type: "generation-progress";
|
|
1117
|
+
readonly progress?: number | undefined;
|
|
1118
|
+
}, {
|
|
1119
|
+
readonly type: keyof Cases;
|
|
1120
|
+
}> | Exclude<{
|
|
980
1121
|
readonly type: "audio-delta";
|
|
981
1122
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
982
1123
|
}, {
|
|
@@ -1031,6 +1172,14 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1031
1172
|
}, {
|
|
1032
1173
|
readonly type: keyof Cases;
|
|
1033
1174
|
}>) => any>(cases: Cases, orElse: OrElse): (value: {
|
|
1175
|
+
readonly id: string;
|
|
1176
|
+
readonly type: "generation-queued";
|
|
1177
|
+
readonly position?: number | undefined;
|
|
1178
|
+
} | {
|
|
1179
|
+
readonly id: string;
|
|
1180
|
+
readonly type: "generation-progress";
|
|
1181
|
+
readonly progress?: number | undefined;
|
|
1182
|
+
} | {
|
|
1034
1183
|
readonly type: "audio-delta";
|
|
1035
1184
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
1036
1185
|
} | {
|
|
@@ -1082,6 +1231,16 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1082
1231
|
};
|
|
1083
1232
|
} & {
|
|
1084
1233
|
is: {
|
|
1234
|
+
generationQueued: (u: unknown) => u is {
|
|
1235
|
+
readonly id: string;
|
|
1236
|
+
readonly type: "generation-queued";
|
|
1237
|
+
readonly position?: number | undefined;
|
|
1238
|
+
};
|
|
1239
|
+
generationProgress: (u: unknown) => u is {
|
|
1240
|
+
readonly id: string;
|
|
1241
|
+
readonly type: "generation-progress";
|
|
1242
|
+
readonly progress?: number | undefined;
|
|
1243
|
+
};
|
|
1085
1244
|
audioDelta: (u: unknown) => u is {
|
|
1086
1245
|
readonly type: "audio-delta";
|
|
1087
1246
|
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
@@ -1138,10 +1297,8 @@ export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
1138
1297
|
export type SpeechEvent = Schema.Schema.Type<typeof speechEventTagged>;
|
|
1139
1298
|
export declare function request<const Model extends SpeechModel>(input: SpeechRequestInput<Model>): SpeechRequestFor<SpeechModelOptions<Model>>;
|
|
1140
1299
|
export declare function request(input: SpeechRequest): SpeechRequest;
|
|
1141
|
-
export declare function generate<const Model extends SpeechModel>(input: SpeechRequestInput<Model>): Effect.Effect<SpeechResponse, AIError, Service>;
|
|
1142
|
-
export declare function
|
|
1143
|
-
export declare function stream<const Model extends SpeechModel>(input: SpeechRequestInput<Model>): Stream.Stream<SpeechEvent, AIError, Service>;
|
|
1144
|
-
export declare function stream(input: SpeechRequest): Stream.Stream<SpeechEvent, AIError, Service>;
|
|
1300
|
+
export declare function generate<const Model extends SpeechModel>(input: SpeechRequest | SpeechRequestInput<Model>): Effect.Effect<SpeechResponse, AIError, Service>;
|
|
1301
|
+
export declare function stream<const Model extends SpeechModel>(input: SpeechRequest | SpeechRequestInput<Model>): Stream.Stream<SpeechEvent, AIError, Service>;
|
|
1145
1302
|
export declare const Speech: {
|
|
1146
1303
|
readonly request: typeof request;
|
|
1147
1304
|
readonly generate: typeof generate;
|
package/dist/speech.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { Effect, Schema, Stream } from "effect";
|
|
2
|
+
import { ProgressEvent, QueuedEvent } from "./generation.js";
|
|
2
3
|
import { Media } from "./media.js";
|
|
3
4
|
import { MediaModel, composeRoute, tryRequest } from "./media-model.js";
|
|
4
5
|
import { MediaRoute } from "./route/media.js";
|
|
5
6
|
import { AIError, HttpOptions, MediaUsage, ProviderMetadata } from "./schema/index.js";
|
|
6
7
|
import { SpeechClient, Service } from "./speech-client.js";
|
|
7
8
|
export class SpeechModel extends MediaModel {
|
|
8
|
-
static make(input) {
|
|
9
|
-
return new SpeechModel(input);
|
|
10
|
-
}
|
|
11
|
-
/** Compose a streaming speech protocol with its canonical path into a model for one deployment. */
|
|
12
9
|
static fromRoute(route, input) {
|
|
13
10
|
return new SpeechModel({
|
|
14
11
|
id: input.id,
|
|
15
|
-
provider: route.provider,
|
|
12
|
+
provider: route.protocol.provider,
|
|
16
13
|
http: input.http,
|
|
17
|
-
route: composeRoute(
|
|
14
|
+
route: composeRoute(route, input, collectResponse),
|
|
18
15
|
});
|
|
19
16
|
}
|
|
20
17
|
}
|
|
@@ -75,9 +72,17 @@ export const SpeechFinishEvent = Schema.Struct({
|
|
|
75
72
|
notices: Schema.optional(Schema.Array(Media.Notice)),
|
|
76
73
|
providerMetadata: Schema.optional(ProviderMetadata),
|
|
77
74
|
}).annotate({ identifier: "Speech.Event.Finish" });
|
|
78
|
-
const speechEventTagged = Schema.Union([
|
|
75
|
+
const speechEventTagged = Schema.Union([
|
|
76
|
+
QueuedEvent,
|
|
77
|
+
ProgressEvent,
|
|
78
|
+
SpeechAudioDeltaEvent,
|
|
79
|
+
SpeechTimestampsEvent,
|
|
80
|
+
SpeechFinishEvent,
|
|
81
|
+
]).pipe(Schema.toTaggedUnion("type"));
|
|
79
82
|
export const SpeechEvent = Object.assign(speechEventTagged, {
|
|
80
83
|
is: {
|
|
84
|
+
generationQueued: speechEventTagged.guards["generation-queued"],
|
|
85
|
+
generationProgress: speechEventTagged.guards["generation-progress"],
|
|
81
86
|
audioDelta: speechEventTagged.guards["audio-delta"],
|
|
82
87
|
timestamps: speechEventTagged.guards.timestamps,
|
|
83
88
|
finish: speechEventTagged.guards.finish,
|
|
@@ -102,7 +107,7 @@ export function request(input) {
|
|
|
102
107
|
return input;
|
|
103
108
|
return new SpeechRequest({
|
|
104
109
|
...input,
|
|
105
|
-
http:
|
|
110
|
+
http: HttpOptions.make(input.http),
|
|
106
111
|
});
|
|
107
112
|
}
|
|
108
113
|
const requestEffect = (input) => tryRequest(() => request(input));
|
package/dist/testing.d.ts
CHANGED
|
@@ -1743,11 +1743,11 @@ export declare const hangAfter: (...events: readonly LLMEvent[]) => Stream.Strea
|
|
|
1743
1743
|
} | undefined;
|
|
1744
1744
|
}, never, never>;
|
|
1745
1745
|
/** Provides one shared implementation under the normal client and test-control tags. */
|
|
1746
|
-
export declare const testLayer: (options?: LayerOptions) => Layer.Layer<import("./route/client.js").
|
|
1746
|
+
export declare const testLayer: (options?: LayerOptions) => Layer.Layer<import("./route/client.js").LLMClientService | Test, never, never>;
|
|
1747
1747
|
/** @deprecated Use testLayer; retained for published callers of the legacy control interface. */
|
|
1748
1748
|
export declare const layer: (options?: LayerOptions) => Layer.Layer<Service, never, never>;
|
|
1749
1749
|
/** @deprecated testLayer provides LLMClient.Service directly. */
|
|
1750
|
-
export declare const clientLayer: Layer.Layer<import("./route/client.js").
|
|
1750
|
+
export declare const clientLayer: Layer.Layer<import("./route/client.js").LLMClientService, never, Service>;
|
|
1751
1751
|
export declare const push: (...responses: readonly Response[]) => Effect.Effect<void, never, Service>;
|
|
1752
1752
|
export declare const always: (response: Response) => Effect.Effect<void, never, Service>;
|
|
1753
1753
|
export declare const wait: (count: number) => Effect.Effect<void, never, Service>;
|
|
@@ -1,28 +1,82 @@
|
|
|
1
|
-
import { Context
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
readonly generate: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>, options?: AwaitOptions) => Effect.Effect<TranscriptionResponse, AIError>;
|
|
8
|
-
readonly stream: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>, options?: AwaitOptions) => Stream.Stream<TranscriptionEvent, AIError>;
|
|
9
|
-
readonly start: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>) => Effect.Effect<Generation<TranscriptionResponse>, AIError>;
|
|
10
|
-
readonly resume: <Options extends TranscriptionOptions>(model: TranscriptionModel<Options>, token: unknown) => Effect.Effect<Generation<TranscriptionResponse>, AIError>;
|
|
1
|
+
import { Context } from "effect";
|
|
2
|
+
import { MediaClient } from "./media-client.js";
|
|
3
|
+
import { type TranscriptionEvent, type TranscriptionRequestFor, type TranscriptionResponse } from "./transcription.js";
|
|
4
|
+
export type Interface = MediaClient.Interface<TranscriptionRequestFor, TranscriptionEvent, TranscriptionResponse>;
|
|
5
|
+
declare const TranscriptionClientService_base: Context.ServiceClass<TranscriptionClientService, "@opencode/TranscriptionClient", Interface>;
|
|
6
|
+
export declare class TranscriptionClientService extends TranscriptionClientService_base {
|
|
11
7
|
}
|
|
12
|
-
declare const
|
|
13
|
-
export
|
|
14
|
-
}
|
|
15
|
-
export declare const generate: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>, options?: AwaitOptions) => Effect.Effect<TranscriptionResponse, AIError, Service>;
|
|
16
|
-
export declare const stream: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>, options?: AwaitOptions) => Stream.Stream<TranscriptionEvent, AIError, Service>;
|
|
17
|
-
export declare const start: <Options extends TranscriptionOptions>(request: TranscriptionRequestFor<Options>) => Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
|
|
18
|
-
export declare const resume: <Options extends TranscriptionOptions>(model: TranscriptionModel<Options>, token: unknown) => Effect.Effect<Generation<TranscriptionResponse>, AIError, Service>;
|
|
19
|
-
export declare const layer: Layer.Layer<Service, never, RequestExecutor.Service>;
|
|
8
|
+
export declare const Service: typeof TranscriptionClientService;
|
|
9
|
+
export type Service = TranscriptionClientService;
|
|
20
10
|
export declare const TranscriptionClient: {
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
23
|
-
readonly
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
readonly layer: import("effect/Layer").Layer<TranscriptionClientService, never, import("./route/executor-service.js").RequestExecutorService>;
|
|
12
|
+
readonly generate: (request: TranscriptionRequestFor, options?: import("./generation.js").AwaitOptions) => import("effect/Effect").Effect<TranscriptionResponse, import("./index.js").AIError, TranscriptionClientService>;
|
|
13
|
+
readonly stream: (request: TranscriptionRequestFor, options?: import("./generation.js").AwaitOptions) => import("effect/Stream").Stream<import("./generation.js").Observation | {
|
|
14
|
+
readonly type: "text-delta";
|
|
15
|
+
readonly delta: string;
|
|
16
|
+
} | {
|
|
17
|
+
readonly type: "segment";
|
|
18
|
+
readonly segment: {
|
|
19
|
+
readonly text: string;
|
|
20
|
+
readonly startSeconds: number;
|
|
21
|
+
readonly endSeconds: number;
|
|
22
|
+
readonly speaker?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: "finish";
|
|
26
|
+
readonly text: string;
|
|
27
|
+
readonly durationSeconds?: number | undefined;
|
|
28
|
+
readonly providerMetadata?: {
|
|
29
|
+
readonly [x: string]: {
|
|
30
|
+
readonly [x: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
} | undefined;
|
|
33
|
+
readonly usage?: {
|
|
34
|
+
readonly type: "tokens";
|
|
35
|
+
readonly input?: number | undefined;
|
|
36
|
+
readonly output?: number | undefined;
|
|
37
|
+
readonly total?: number | undefined;
|
|
38
|
+
readonly details?: {
|
|
39
|
+
readonly [x: string]: unknown;
|
|
40
|
+
} | undefined;
|
|
41
|
+
} | {
|
|
42
|
+
readonly type: "seconds";
|
|
43
|
+
readonly seconds: number;
|
|
44
|
+
} | {
|
|
45
|
+
readonly type: "characters";
|
|
46
|
+
readonly characters: number;
|
|
47
|
+
} | {
|
|
48
|
+
readonly type: "credits";
|
|
49
|
+
readonly credits: number;
|
|
50
|
+
} | {
|
|
51
|
+
readonly type: "compute";
|
|
52
|
+
readonly seconds: number;
|
|
53
|
+
} | undefined;
|
|
54
|
+
readonly notices?: readonly {
|
|
55
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
56
|
+
readonly message: string;
|
|
57
|
+
readonly providerMetadata?: {
|
|
58
|
+
readonly [x: string]: {
|
|
59
|
+
readonly [x: string]: unknown;
|
|
60
|
+
};
|
|
61
|
+
} | undefined;
|
|
62
|
+
}[] | undefined;
|
|
63
|
+
readonly language?: string | undefined;
|
|
64
|
+
readonly segments?: readonly {
|
|
65
|
+
readonly text: string;
|
|
66
|
+
readonly startSeconds: number;
|
|
67
|
+
readonly endSeconds: number;
|
|
68
|
+
readonly speaker?: string | undefined;
|
|
69
|
+
}[] | undefined;
|
|
70
|
+
readonly words?: readonly {
|
|
71
|
+
readonly text: string;
|
|
72
|
+
readonly startSeconds: number;
|
|
73
|
+
readonly endSeconds: number;
|
|
74
|
+
readonly speaker?: string | undefined;
|
|
75
|
+
readonly confidence?: number | undefined;
|
|
76
|
+
}[] | undefined;
|
|
77
|
+
}, import("./index.js").AIError, TranscriptionClientService>;
|
|
78
|
+
readonly start: (request: TranscriptionRequestFor) => import("effect/Effect").Effect<import("./generation.js").Generation<TranscriptionResponse>, import("./index.js").AIError, TranscriptionClientService>;
|
|
79
|
+
readonly resume: (model: import("./transcription.js").TranscriptionModel<import("./media-model.js").MediaModel.Options>, token: unknown) => import("effect/Effect").Effect<import("./generation.js").Generation<TranscriptionResponse>, import("./index.js").AIError, TranscriptionClientService>;
|
|
80
|
+
readonly Service: typeof TranscriptionClientService;
|
|
27
81
|
};
|
|
28
82
|
export {};
|