@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
package/dist/speech.d.ts
ADDED
|
@@ -0,0 +1,1150 @@
|
|
|
1
|
+
import { Effect, Schema, Stream } from "effect";
|
|
2
|
+
import { Media } from "./media.js";
|
|
3
|
+
import { MediaModel } from "./media-model.js";
|
|
4
|
+
import { MediaRoute } from "./route/media.js";
|
|
5
|
+
import type { MediaProtocol } from "./route/media-protocol.js";
|
|
6
|
+
import { AIError, HttpOptions } from "./schema/index.js";
|
|
7
|
+
import { Service } from "./speech-client.js";
|
|
8
|
+
export type SpeechOptions = Record<string, unknown>;
|
|
9
|
+
export type SpeechRoute<Options extends SpeechOptions = SpeechOptions> = MediaRoute.StreamRoute<SpeechRequestFor<Options>, SpeechEvent, SpeechResponse>;
|
|
10
|
+
export declare class SpeechModel<Options extends SpeechOptions = SpeechOptions> extends MediaModel<SpeechRoute<Options>, Options> {
|
|
11
|
+
protected readonly _SpeechModel: void;
|
|
12
|
+
static make<Options extends SpeechOptions = SpeechOptions>(input: MediaModel.Input<SpeechRoute<Options>>): SpeechModel<Options>;
|
|
13
|
+
/** Compose a streaming speech protocol with its canonical path into a model for one deployment. */
|
|
14
|
+
static fromRoute<Options extends SpeechOptions = SpeechOptions, Frame = unknown, State = unknown>(route: SpeechModel.RouteInput<Options, Frame, State>, input: MediaRoute.ModelInput): SpeechModel<Options>;
|
|
15
|
+
}
|
|
16
|
+
export declare namespace SpeechModel {
|
|
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>>;
|
|
20
|
+
/** Provider-native: a name on OpenAI and Gemini, a voice id on ElevenLabs and Cartesia; `{ id }` is an OpenAI custom voice. */
|
|
21
|
+
export declare const SpeechVoice: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
22
|
+
readonly id: Schema.String;
|
|
23
|
+
}>]>;
|
|
24
|
+
export type SpeechVoice = Schema.Schema.Type<typeof SpeechVoice>;
|
|
25
|
+
export type SpeechFormat = "mp3" | "wav" | "pcm" | "opus" | "aac" | "flac" | (string & {});
|
|
26
|
+
/** Granularity is provider-native: characters on ElevenLabs, words on Cartesia. */
|
|
27
|
+
export declare const SpeechTimestamp: Schema.Struct<{
|
|
28
|
+
readonly text: Schema.String;
|
|
29
|
+
readonly startSeconds: Schema.Number;
|
|
30
|
+
readonly endSeconds: Schema.Number;
|
|
31
|
+
}>;
|
|
32
|
+
export type SpeechTimestamp = Schema.Schema.Type<typeof SpeechTimestamp>;
|
|
33
|
+
declare const SpeechRequest_base: Schema.Class<SpeechRequest, Schema.Struct<{
|
|
34
|
+
readonly model: Schema.declare<SpeechModel<SpeechOptions>, SpeechModel<SpeechOptions>>;
|
|
35
|
+
readonly text: Schema.String;
|
|
36
|
+
readonly voice: Schema.optional<Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
37
|
+
readonly id: Schema.String;
|
|
38
|
+
}>]>>;
|
|
39
|
+
readonly format: Schema.optional<Schema.String>;
|
|
40
|
+
readonly speed: Schema.optional<Schema.Number>;
|
|
41
|
+
readonly language: Schema.optional<Schema.String>;
|
|
42
|
+
readonly instructions: Schema.optional<Schema.String>;
|
|
43
|
+
readonly timestamps: Schema.optional<Schema.Boolean>;
|
|
44
|
+
readonly providerOptions: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
45
|
+
readonly http: Schema.optional<typeof HttpOptions>;
|
|
46
|
+
}>, {}>;
|
|
47
|
+
export declare class SpeechRequest extends SpeechRequest_base {
|
|
48
|
+
protected readonly _SpeechRequest: void;
|
|
49
|
+
}
|
|
50
|
+
export type SpeechRequestFor<Options extends SpeechOptions = SpeechOptions> = Omit<SpeechRequest, "model" | "providerOptions"> & {
|
|
51
|
+
readonly model: SpeechModel<Options>;
|
|
52
|
+
readonly providerOptions?: Options;
|
|
53
|
+
};
|
|
54
|
+
export type SpeechModelOptions<Model> = Model extends SpeechModel<infer Options> ? Options : never;
|
|
55
|
+
export type SpeechRequestInput<Model extends SpeechModel = SpeechModel> = Omit<ConstructorParameters<typeof SpeechRequest>[0], "model" | "providerOptions" | "http" | "format"> & {
|
|
56
|
+
readonly model: Model;
|
|
57
|
+
readonly format?: SpeechFormat;
|
|
58
|
+
readonly providerOptions?: NoInfer<SpeechModelOptions<Model>>;
|
|
59
|
+
readonly http?: HttpOptions.Input;
|
|
60
|
+
};
|
|
61
|
+
declare const SpeechResponse_base: Schema.Class<SpeechResponse, Schema.Struct<{
|
|
62
|
+
/** The complete audio. Headerless PCM carries `info.encoding`, `info.sampleRate`, and `info.channels`. */
|
|
63
|
+
readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
64
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
65
|
+
readonly type: Schema.Literal<"bytes">;
|
|
66
|
+
readonly data: Schema.Uint8Array;
|
|
67
|
+
readonly mediaType: Schema.String;
|
|
68
|
+
}>, Schema.Struct<{
|
|
69
|
+
readonly type: Schema.Literal<"base64">;
|
|
70
|
+
readonly data: Schema.String;
|
|
71
|
+
readonly mediaType: Schema.String;
|
|
72
|
+
}>, Schema.Struct<{
|
|
73
|
+
readonly type: Schema.Literal<"url">;
|
|
74
|
+
readonly url: Schema.String;
|
|
75
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
76
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
77
|
+
}>, Schema.Struct<{
|
|
78
|
+
readonly type: Schema.Literal<"ref">;
|
|
79
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
80
|
+
readonly id: Schema.String;
|
|
81
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
82
|
+
}>]>;
|
|
83
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
84
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
85
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
86
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
87
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
88
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
89
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
90
|
+
readonly format: Schema.optional<Schema.String>;
|
|
91
|
+
}>>;
|
|
92
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
93
|
+
}>, never, never>;
|
|
94
|
+
readonly timestamps: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
95
|
+
readonly text: Schema.String;
|
|
96
|
+
readonly startSeconds: Schema.Number;
|
|
97
|
+
readonly endSeconds: Schema.Number;
|
|
98
|
+
}>>>;
|
|
99
|
+
readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
100
|
+
readonly type: Schema.Literal<"tokens">;
|
|
101
|
+
readonly input: Schema.optional<Schema.Number>;
|
|
102
|
+
readonly output: Schema.optional<Schema.Number>;
|
|
103
|
+
readonly total: Schema.optional<Schema.Number>;
|
|
104
|
+
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
105
|
+
}>, Schema.Struct<{
|
|
106
|
+
readonly type: Schema.Literal<"seconds">;
|
|
107
|
+
readonly seconds: Schema.Number;
|
|
108
|
+
}>, Schema.Struct<{
|
|
109
|
+
readonly type: Schema.Literal<"characters">;
|
|
110
|
+
readonly characters: Schema.Number;
|
|
111
|
+
}>, Schema.Struct<{
|
|
112
|
+
readonly type: Schema.Literal<"credits">;
|
|
113
|
+
readonly credits: Schema.Number;
|
|
114
|
+
}>, Schema.Struct<{
|
|
115
|
+
readonly type: Schema.Literal<"compute">;
|
|
116
|
+
readonly seconds: Schema.Number;
|
|
117
|
+
}>]>>;
|
|
118
|
+
readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
119
|
+
readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
|
|
120
|
+
readonly message: Schema.String;
|
|
121
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
122
|
+
}>>>;
|
|
123
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
124
|
+
}>, {}>;
|
|
125
|
+
export declare class SpeechResponse extends SpeechResponse_base {
|
|
126
|
+
}
|
|
127
|
+
export declare const SpeechAudioDeltaEvent: Schema.Struct<{
|
|
128
|
+
readonly type: Schema.tag<"audio-delta">;
|
|
129
|
+
readonly chunk: Schema.Uint8Array;
|
|
130
|
+
}>;
|
|
131
|
+
export declare const SpeechTimestampsEvent: Schema.Struct<{
|
|
132
|
+
readonly type: Schema.tag<"timestamps">;
|
|
133
|
+
readonly items: Schema.$Array<Schema.Struct<{
|
|
134
|
+
readonly text: Schema.String;
|
|
135
|
+
readonly startSeconds: Schema.Number;
|
|
136
|
+
readonly endSeconds: Schema.Number;
|
|
137
|
+
}>>;
|
|
138
|
+
}>;
|
|
139
|
+
/** `audio` is every `audio-delta` chunk concatenated, so the route holds the whole clip in memory until `finish`. */
|
|
140
|
+
export declare const SpeechFinishEvent: Schema.Struct<{
|
|
141
|
+
readonly type: Schema.tag<"finish">;
|
|
142
|
+
readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
143
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
144
|
+
readonly type: Schema.Literal<"bytes">;
|
|
145
|
+
readonly data: Schema.Uint8Array;
|
|
146
|
+
readonly mediaType: Schema.String;
|
|
147
|
+
}>, Schema.Struct<{
|
|
148
|
+
readonly type: Schema.Literal<"base64">;
|
|
149
|
+
readonly data: Schema.String;
|
|
150
|
+
readonly mediaType: Schema.String;
|
|
151
|
+
}>, Schema.Struct<{
|
|
152
|
+
readonly type: Schema.Literal<"url">;
|
|
153
|
+
readonly url: Schema.String;
|
|
154
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
155
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
156
|
+
}>, Schema.Struct<{
|
|
157
|
+
readonly type: Schema.Literal<"ref">;
|
|
158
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
159
|
+
readonly id: Schema.String;
|
|
160
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
161
|
+
}>]>;
|
|
162
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
163
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
164
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
165
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
166
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
167
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
168
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
169
|
+
readonly format: Schema.optional<Schema.String>;
|
|
170
|
+
}>>;
|
|
171
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
172
|
+
}>, never, never>;
|
|
173
|
+
readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
174
|
+
readonly type: Schema.Literal<"tokens">;
|
|
175
|
+
readonly input: Schema.optional<Schema.Number>;
|
|
176
|
+
readonly output: Schema.optional<Schema.Number>;
|
|
177
|
+
readonly total: Schema.optional<Schema.Number>;
|
|
178
|
+
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
179
|
+
}>, Schema.Struct<{
|
|
180
|
+
readonly type: Schema.Literal<"seconds">;
|
|
181
|
+
readonly seconds: Schema.Number;
|
|
182
|
+
}>, Schema.Struct<{
|
|
183
|
+
readonly type: Schema.Literal<"characters">;
|
|
184
|
+
readonly characters: Schema.Number;
|
|
185
|
+
}>, Schema.Struct<{
|
|
186
|
+
readonly type: Schema.Literal<"credits">;
|
|
187
|
+
readonly credits: Schema.Number;
|
|
188
|
+
}>, Schema.Struct<{
|
|
189
|
+
readonly type: Schema.Literal<"compute">;
|
|
190
|
+
readonly seconds: Schema.Number;
|
|
191
|
+
}>]>>;
|
|
192
|
+
readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
193
|
+
readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
|
|
194
|
+
readonly message: Schema.String;
|
|
195
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
196
|
+
}>>>;
|
|
197
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
198
|
+
}>;
|
|
199
|
+
declare const speechEventTagged: Schema.toTaggedUnion<"type", readonly [Schema.Struct<{
|
|
200
|
+
readonly type: Schema.tag<"audio-delta">;
|
|
201
|
+
readonly chunk: Schema.Uint8Array;
|
|
202
|
+
}>, Schema.Struct<{
|
|
203
|
+
readonly type: Schema.tag<"timestamps">;
|
|
204
|
+
readonly items: Schema.$Array<Schema.Struct<{
|
|
205
|
+
readonly text: Schema.String;
|
|
206
|
+
readonly startSeconds: Schema.Number;
|
|
207
|
+
readonly endSeconds: Schema.Number;
|
|
208
|
+
}>>;
|
|
209
|
+
}>, Schema.Struct<{
|
|
210
|
+
readonly type: Schema.tag<"finish">;
|
|
211
|
+
readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
212
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
213
|
+
readonly type: Schema.Literal<"bytes">;
|
|
214
|
+
readonly data: Schema.Uint8Array;
|
|
215
|
+
readonly mediaType: Schema.String;
|
|
216
|
+
}>, Schema.Struct<{
|
|
217
|
+
readonly type: Schema.Literal<"base64">;
|
|
218
|
+
readonly data: Schema.String;
|
|
219
|
+
readonly mediaType: Schema.String;
|
|
220
|
+
}>, Schema.Struct<{
|
|
221
|
+
readonly type: Schema.Literal<"url">;
|
|
222
|
+
readonly url: Schema.String;
|
|
223
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
224
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
225
|
+
}>, Schema.Struct<{
|
|
226
|
+
readonly type: Schema.Literal<"ref">;
|
|
227
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
228
|
+
readonly id: Schema.String;
|
|
229
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
230
|
+
}>]>;
|
|
231
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
232
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
233
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
234
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
235
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
236
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
237
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
238
|
+
readonly format: Schema.optional<Schema.String>;
|
|
239
|
+
}>>;
|
|
240
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
241
|
+
}>, never, never>;
|
|
242
|
+
readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
243
|
+
readonly type: Schema.Literal<"tokens">;
|
|
244
|
+
readonly input: Schema.optional<Schema.Number>;
|
|
245
|
+
readonly output: Schema.optional<Schema.Number>;
|
|
246
|
+
readonly total: Schema.optional<Schema.Number>;
|
|
247
|
+
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
248
|
+
}>, Schema.Struct<{
|
|
249
|
+
readonly type: Schema.Literal<"seconds">;
|
|
250
|
+
readonly seconds: Schema.Number;
|
|
251
|
+
}>, Schema.Struct<{
|
|
252
|
+
readonly type: Schema.Literal<"characters">;
|
|
253
|
+
readonly characters: Schema.Number;
|
|
254
|
+
}>, Schema.Struct<{
|
|
255
|
+
readonly type: Schema.Literal<"credits">;
|
|
256
|
+
readonly credits: Schema.Number;
|
|
257
|
+
}>, Schema.Struct<{
|
|
258
|
+
readonly type: Schema.Literal<"compute">;
|
|
259
|
+
readonly seconds: Schema.Number;
|
|
260
|
+
}>]>>;
|
|
261
|
+
readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
262
|
+
readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
|
|
263
|
+
readonly message: Schema.String;
|
|
264
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
265
|
+
}>>>;
|
|
266
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
267
|
+
}>]>;
|
|
268
|
+
export declare const SpeechEvent: Schema.Union<readonly [Schema.Struct<{
|
|
269
|
+
readonly type: Schema.tag<"audio-delta">;
|
|
270
|
+
readonly chunk: Schema.Uint8Array;
|
|
271
|
+
}>, Schema.Struct<{
|
|
272
|
+
readonly type: Schema.tag<"timestamps">;
|
|
273
|
+
readonly items: Schema.$Array<Schema.Struct<{
|
|
274
|
+
readonly text: Schema.String;
|
|
275
|
+
readonly startSeconds: Schema.Number;
|
|
276
|
+
readonly endSeconds: Schema.Number;
|
|
277
|
+
}>>;
|
|
278
|
+
}>, Schema.Struct<{
|
|
279
|
+
readonly type: Schema.tag<"finish">;
|
|
280
|
+
readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
281
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
282
|
+
readonly type: Schema.Literal<"bytes">;
|
|
283
|
+
readonly data: Schema.Uint8Array;
|
|
284
|
+
readonly mediaType: Schema.String;
|
|
285
|
+
}>, Schema.Struct<{
|
|
286
|
+
readonly type: Schema.Literal<"base64">;
|
|
287
|
+
readonly data: Schema.String;
|
|
288
|
+
readonly mediaType: Schema.String;
|
|
289
|
+
}>, Schema.Struct<{
|
|
290
|
+
readonly type: Schema.Literal<"url">;
|
|
291
|
+
readonly url: Schema.String;
|
|
292
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
293
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
294
|
+
}>, Schema.Struct<{
|
|
295
|
+
readonly type: Schema.Literal<"ref">;
|
|
296
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
297
|
+
readonly id: Schema.String;
|
|
298
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
299
|
+
}>]>;
|
|
300
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
301
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
302
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
303
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
304
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
305
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
306
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
307
|
+
readonly format: Schema.optional<Schema.String>;
|
|
308
|
+
}>>;
|
|
309
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
310
|
+
}>, never, never>;
|
|
311
|
+
readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
312
|
+
readonly type: Schema.Literal<"tokens">;
|
|
313
|
+
readonly input: Schema.optional<Schema.Number>;
|
|
314
|
+
readonly output: Schema.optional<Schema.Number>;
|
|
315
|
+
readonly total: Schema.optional<Schema.Number>;
|
|
316
|
+
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
317
|
+
}>, Schema.Struct<{
|
|
318
|
+
readonly type: Schema.Literal<"seconds">;
|
|
319
|
+
readonly seconds: Schema.Number;
|
|
320
|
+
}>, Schema.Struct<{
|
|
321
|
+
readonly type: Schema.Literal<"characters">;
|
|
322
|
+
readonly characters: Schema.Number;
|
|
323
|
+
}>, Schema.Struct<{
|
|
324
|
+
readonly type: Schema.Literal<"credits">;
|
|
325
|
+
readonly credits: Schema.Number;
|
|
326
|
+
}>, Schema.Struct<{
|
|
327
|
+
readonly type: Schema.Literal<"compute">;
|
|
328
|
+
readonly seconds: Schema.Number;
|
|
329
|
+
}>]>>;
|
|
330
|
+
readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
331
|
+
readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
|
|
332
|
+
readonly message: Schema.String;
|
|
333
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
334
|
+
}>>>;
|
|
335
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
336
|
+
}>]> & {
|
|
337
|
+
readonly discriminants: readonly ["audio-delta", "timestamps", "finish"];
|
|
338
|
+
readonly cases: {
|
|
339
|
+
"audio-delta": Schema.Struct<{
|
|
340
|
+
readonly type: Schema.tag<"audio-delta">;
|
|
341
|
+
readonly chunk: Schema.Uint8Array;
|
|
342
|
+
}>;
|
|
343
|
+
timestamps: Schema.Struct<{
|
|
344
|
+
readonly type: Schema.tag<"timestamps">;
|
|
345
|
+
readonly items: Schema.$Array<Schema.Struct<{
|
|
346
|
+
readonly text: Schema.String;
|
|
347
|
+
readonly startSeconds: Schema.Number;
|
|
348
|
+
readonly endSeconds: Schema.Number;
|
|
349
|
+
}>>;
|
|
350
|
+
}>;
|
|
351
|
+
finish: Schema.Struct<{
|
|
352
|
+
readonly type: Schema.tag<"finish">;
|
|
353
|
+
readonly audio: Schema.decodeTo<Schema.declare<Media.Asset, Media.Asset>, Schema.Struct<{
|
|
354
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
355
|
+
readonly type: Schema.Literal<"bytes">;
|
|
356
|
+
readonly data: Schema.Uint8Array;
|
|
357
|
+
readonly mediaType: Schema.String;
|
|
358
|
+
}>, Schema.Struct<{
|
|
359
|
+
readonly type: Schema.Literal<"base64">;
|
|
360
|
+
readonly data: Schema.String;
|
|
361
|
+
readonly mediaType: Schema.String;
|
|
362
|
+
}>, Schema.Struct<{
|
|
363
|
+
readonly type: Schema.Literal<"url">;
|
|
364
|
+
readonly url: Schema.String;
|
|
365
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
366
|
+
readonly expiresAt: Schema.optional<Schema.Number>;
|
|
367
|
+
}>, Schema.Struct<{
|
|
368
|
+
readonly type: Schema.Literal<"ref">;
|
|
369
|
+
readonly provider: Schema.brand<Schema.String, "AI.ProviderID">;
|
|
370
|
+
readonly id: Schema.String;
|
|
371
|
+
readonly mediaType: Schema.optional<Schema.String>;
|
|
372
|
+
}>]>;
|
|
373
|
+
readonly info: Schema.optional<Schema.Struct<{
|
|
374
|
+
readonly width: Schema.optional<Schema.Number>;
|
|
375
|
+
readonly height: Schema.optional<Schema.Number>;
|
|
376
|
+
readonly durationSeconds: Schema.optional<Schema.Number>;
|
|
377
|
+
readonly sampleRate: Schema.optional<Schema.Number>;
|
|
378
|
+
readonly channels: Schema.optional<Schema.Number>;
|
|
379
|
+
readonly encoding: Schema.optional<Schema.String>;
|
|
380
|
+
readonly format: Schema.optional<Schema.String>;
|
|
381
|
+
}>>;
|
|
382
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
383
|
+
}>, never, never>;
|
|
384
|
+
readonly usage: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
385
|
+
readonly type: Schema.Literal<"tokens">;
|
|
386
|
+
readonly input: Schema.optional<Schema.Number>;
|
|
387
|
+
readonly output: Schema.optional<Schema.Number>;
|
|
388
|
+
readonly total: Schema.optional<Schema.Number>;
|
|
389
|
+
readonly details: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
390
|
+
}>, Schema.Struct<{
|
|
391
|
+
readonly type: Schema.Literal<"seconds">;
|
|
392
|
+
readonly seconds: Schema.Number;
|
|
393
|
+
}>, Schema.Struct<{
|
|
394
|
+
readonly type: Schema.Literal<"characters">;
|
|
395
|
+
readonly characters: Schema.Number;
|
|
396
|
+
}>, Schema.Struct<{
|
|
397
|
+
readonly type: Schema.Literal<"credits">;
|
|
398
|
+
readonly credits: Schema.Number;
|
|
399
|
+
}>, Schema.Struct<{
|
|
400
|
+
readonly type: Schema.Literal<"compute">;
|
|
401
|
+
readonly seconds: Schema.Number;
|
|
402
|
+
}>]>>;
|
|
403
|
+
readonly notices: Schema.optional<Schema.$Array<Schema.Struct<{
|
|
404
|
+
readonly type: Schema.Literals<readonly ["moderated", "filtered", "other"]>;
|
|
405
|
+
readonly message: Schema.String;
|
|
406
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
407
|
+
}>>>;
|
|
408
|
+
readonly providerMetadata: Schema.optional<Schema.$Record<Schema.String, Schema.$Record<Schema.String, Schema.Unknown>>>;
|
|
409
|
+
}>;
|
|
410
|
+
};
|
|
411
|
+
readonly isAnyOf: <const Keys>(keys: readonly Keys[]) => (value: {
|
|
412
|
+
readonly type: "audio-delta";
|
|
413
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
414
|
+
} | {
|
|
415
|
+
readonly type: "timestamps";
|
|
416
|
+
readonly items: readonly {
|
|
417
|
+
readonly text: string;
|
|
418
|
+
readonly startSeconds: number;
|
|
419
|
+
readonly endSeconds: number;
|
|
420
|
+
}[];
|
|
421
|
+
} | {
|
|
422
|
+
readonly type: "finish";
|
|
423
|
+
readonly audio: Media.Asset;
|
|
424
|
+
readonly providerMetadata?: {
|
|
425
|
+
readonly [x: string]: {
|
|
426
|
+
readonly [x: string]: unknown;
|
|
427
|
+
};
|
|
428
|
+
} | undefined;
|
|
429
|
+
readonly usage?: {
|
|
430
|
+
readonly type: "tokens";
|
|
431
|
+
readonly input?: number | undefined;
|
|
432
|
+
readonly output?: number | undefined;
|
|
433
|
+
readonly total?: number | undefined;
|
|
434
|
+
readonly details?: {
|
|
435
|
+
readonly [x: string]: unknown;
|
|
436
|
+
} | undefined;
|
|
437
|
+
} | {
|
|
438
|
+
readonly type: "seconds";
|
|
439
|
+
readonly seconds: number;
|
|
440
|
+
} | {
|
|
441
|
+
readonly type: "characters";
|
|
442
|
+
readonly characters: number;
|
|
443
|
+
} | {
|
|
444
|
+
readonly type: "credits";
|
|
445
|
+
readonly credits: number;
|
|
446
|
+
} | {
|
|
447
|
+
readonly type: "compute";
|
|
448
|
+
readonly seconds: number;
|
|
449
|
+
} | undefined;
|
|
450
|
+
readonly notices?: readonly {
|
|
451
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
452
|
+
readonly message: string;
|
|
453
|
+
readonly providerMetadata?: {
|
|
454
|
+
readonly [x: string]: {
|
|
455
|
+
readonly [x: string]: unknown;
|
|
456
|
+
};
|
|
457
|
+
} | undefined;
|
|
458
|
+
}[] | undefined;
|
|
459
|
+
}) => value is Extract<{
|
|
460
|
+
readonly type: "audio-delta";
|
|
461
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
462
|
+
}, {
|
|
463
|
+
readonly type: Keys;
|
|
464
|
+
}> | Extract<{
|
|
465
|
+
readonly type: "timestamps";
|
|
466
|
+
readonly items: readonly {
|
|
467
|
+
readonly text: string;
|
|
468
|
+
readonly startSeconds: number;
|
|
469
|
+
readonly endSeconds: number;
|
|
470
|
+
}[];
|
|
471
|
+
}, {
|
|
472
|
+
readonly type: Keys;
|
|
473
|
+
}> | Extract<{
|
|
474
|
+
readonly type: "finish";
|
|
475
|
+
readonly audio: Media.Asset;
|
|
476
|
+
readonly providerMetadata?: {
|
|
477
|
+
readonly [x: string]: {
|
|
478
|
+
readonly [x: string]: unknown;
|
|
479
|
+
};
|
|
480
|
+
} | undefined;
|
|
481
|
+
readonly usage?: {
|
|
482
|
+
readonly type: "tokens";
|
|
483
|
+
readonly input?: number | undefined;
|
|
484
|
+
readonly output?: number | undefined;
|
|
485
|
+
readonly total?: number | undefined;
|
|
486
|
+
readonly details?: {
|
|
487
|
+
readonly [x: string]: unknown;
|
|
488
|
+
} | undefined;
|
|
489
|
+
} | {
|
|
490
|
+
readonly type: "seconds";
|
|
491
|
+
readonly seconds: number;
|
|
492
|
+
} | {
|
|
493
|
+
readonly type: "characters";
|
|
494
|
+
readonly characters: number;
|
|
495
|
+
} | {
|
|
496
|
+
readonly type: "credits";
|
|
497
|
+
readonly credits: number;
|
|
498
|
+
} | {
|
|
499
|
+
readonly type: "compute";
|
|
500
|
+
readonly seconds: number;
|
|
501
|
+
} | undefined;
|
|
502
|
+
readonly notices?: readonly {
|
|
503
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
504
|
+
readonly message: string;
|
|
505
|
+
readonly providerMetadata?: {
|
|
506
|
+
readonly [x: string]: {
|
|
507
|
+
readonly [x: string]: unknown;
|
|
508
|
+
};
|
|
509
|
+
} | undefined;
|
|
510
|
+
}[] | undefined;
|
|
511
|
+
}, {
|
|
512
|
+
readonly type: Keys;
|
|
513
|
+
}>;
|
|
514
|
+
readonly guards: {
|
|
515
|
+
"audio-delta": (u: unknown) => u is {
|
|
516
|
+
readonly type: "audio-delta";
|
|
517
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
518
|
+
};
|
|
519
|
+
timestamps: (u: unknown) => u is {
|
|
520
|
+
readonly type: "timestamps";
|
|
521
|
+
readonly items: readonly {
|
|
522
|
+
readonly text: string;
|
|
523
|
+
readonly startSeconds: number;
|
|
524
|
+
readonly endSeconds: number;
|
|
525
|
+
}[];
|
|
526
|
+
};
|
|
527
|
+
finish: (u: unknown) => u is {
|
|
528
|
+
readonly type: "finish";
|
|
529
|
+
readonly audio: Media.Asset;
|
|
530
|
+
readonly providerMetadata?: {
|
|
531
|
+
readonly [x: string]: {
|
|
532
|
+
readonly [x: string]: unknown;
|
|
533
|
+
};
|
|
534
|
+
} | undefined;
|
|
535
|
+
readonly usage?: {
|
|
536
|
+
readonly type: "tokens";
|
|
537
|
+
readonly input?: number | undefined;
|
|
538
|
+
readonly output?: number | undefined;
|
|
539
|
+
readonly total?: number | undefined;
|
|
540
|
+
readonly details?: {
|
|
541
|
+
readonly [x: string]: unknown;
|
|
542
|
+
} | undefined;
|
|
543
|
+
} | {
|
|
544
|
+
readonly type: "seconds";
|
|
545
|
+
readonly seconds: number;
|
|
546
|
+
} | {
|
|
547
|
+
readonly type: "characters";
|
|
548
|
+
readonly characters: number;
|
|
549
|
+
} | {
|
|
550
|
+
readonly type: "credits";
|
|
551
|
+
readonly credits: number;
|
|
552
|
+
} | {
|
|
553
|
+
readonly type: "compute";
|
|
554
|
+
readonly seconds: number;
|
|
555
|
+
} | undefined;
|
|
556
|
+
readonly notices?: readonly {
|
|
557
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
558
|
+
readonly message: string;
|
|
559
|
+
readonly providerMetadata?: {
|
|
560
|
+
readonly [x: string]: {
|
|
561
|
+
readonly [x: string]: unknown;
|
|
562
|
+
};
|
|
563
|
+
} | undefined;
|
|
564
|
+
}[] | undefined;
|
|
565
|
+
};
|
|
566
|
+
};
|
|
567
|
+
readonly match: {
|
|
568
|
+
<Cases extends {
|
|
569
|
+
"audio-delta": (value: {
|
|
570
|
+
readonly type: "audio-delta";
|
|
571
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
572
|
+
}) => any;
|
|
573
|
+
timestamps: (value: {
|
|
574
|
+
readonly type: "timestamps";
|
|
575
|
+
readonly items: readonly {
|
|
576
|
+
readonly text: string;
|
|
577
|
+
readonly startSeconds: number;
|
|
578
|
+
readonly endSeconds: number;
|
|
579
|
+
}[];
|
|
580
|
+
}) => any;
|
|
581
|
+
finish: (value: {
|
|
582
|
+
readonly type: "finish";
|
|
583
|
+
readonly audio: Media.Asset;
|
|
584
|
+
readonly providerMetadata?: {
|
|
585
|
+
readonly [x: string]: {
|
|
586
|
+
readonly [x: string]: unknown;
|
|
587
|
+
};
|
|
588
|
+
} | undefined;
|
|
589
|
+
readonly usage?: {
|
|
590
|
+
readonly type: "tokens";
|
|
591
|
+
readonly input?: number | undefined;
|
|
592
|
+
readonly output?: number | undefined;
|
|
593
|
+
readonly total?: number | undefined;
|
|
594
|
+
readonly details?: {
|
|
595
|
+
readonly [x: string]: unknown;
|
|
596
|
+
} | undefined;
|
|
597
|
+
} | {
|
|
598
|
+
readonly type: "seconds";
|
|
599
|
+
readonly seconds: number;
|
|
600
|
+
} | {
|
|
601
|
+
readonly type: "characters";
|
|
602
|
+
readonly characters: number;
|
|
603
|
+
} | {
|
|
604
|
+
readonly type: "credits";
|
|
605
|
+
readonly credits: number;
|
|
606
|
+
} | {
|
|
607
|
+
readonly type: "compute";
|
|
608
|
+
readonly seconds: number;
|
|
609
|
+
} | undefined;
|
|
610
|
+
readonly notices?: readonly {
|
|
611
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
612
|
+
readonly message: string;
|
|
613
|
+
readonly providerMetadata?: {
|
|
614
|
+
readonly [x: string]: {
|
|
615
|
+
readonly [x: string]: unknown;
|
|
616
|
+
};
|
|
617
|
+
} | undefined;
|
|
618
|
+
}[] | undefined;
|
|
619
|
+
}) => any;
|
|
620
|
+
}>(value: {
|
|
621
|
+
readonly type: "audio-delta";
|
|
622
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
623
|
+
} | {
|
|
624
|
+
readonly type: "timestamps";
|
|
625
|
+
readonly items: readonly {
|
|
626
|
+
readonly text: string;
|
|
627
|
+
readonly startSeconds: number;
|
|
628
|
+
readonly endSeconds: number;
|
|
629
|
+
}[];
|
|
630
|
+
} | {
|
|
631
|
+
readonly type: "finish";
|
|
632
|
+
readonly audio: Media.Asset;
|
|
633
|
+
readonly providerMetadata?: {
|
|
634
|
+
readonly [x: string]: {
|
|
635
|
+
readonly [x: string]: unknown;
|
|
636
|
+
};
|
|
637
|
+
} | undefined;
|
|
638
|
+
readonly usage?: {
|
|
639
|
+
readonly type: "tokens";
|
|
640
|
+
readonly input?: number | undefined;
|
|
641
|
+
readonly output?: number | undefined;
|
|
642
|
+
readonly total?: number | undefined;
|
|
643
|
+
readonly details?: {
|
|
644
|
+
readonly [x: string]: unknown;
|
|
645
|
+
} | undefined;
|
|
646
|
+
} | {
|
|
647
|
+
readonly type: "seconds";
|
|
648
|
+
readonly seconds: number;
|
|
649
|
+
} | {
|
|
650
|
+
readonly type: "characters";
|
|
651
|
+
readonly characters: number;
|
|
652
|
+
} | {
|
|
653
|
+
readonly type: "credits";
|
|
654
|
+
readonly credits: number;
|
|
655
|
+
} | {
|
|
656
|
+
readonly type: "compute";
|
|
657
|
+
readonly seconds: number;
|
|
658
|
+
} | undefined;
|
|
659
|
+
readonly notices?: readonly {
|
|
660
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
661
|
+
readonly message: string;
|
|
662
|
+
readonly providerMetadata?: {
|
|
663
|
+
readonly [x: string]: {
|
|
664
|
+
readonly [x: string]: unknown;
|
|
665
|
+
};
|
|
666
|
+
} | undefined;
|
|
667
|
+
}[] | undefined;
|
|
668
|
+
}, cases: Cases): Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
669
|
+
<Cases extends {
|
|
670
|
+
"audio-delta": (value: {
|
|
671
|
+
readonly type: "audio-delta";
|
|
672
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
673
|
+
}) => any;
|
|
674
|
+
timestamps: (value: {
|
|
675
|
+
readonly type: "timestamps";
|
|
676
|
+
readonly items: readonly {
|
|
677
|
+
readonly text: string;
|
|
678
|
+
readonly startSeconds: number;
|
|
679
|
+
readonly endSeconds: number;
|
|
680
|
+
}[];
|
|
681
|
+
}) => any;
|
|
682
|
+
finish: (value: {
|
|
683
|
+
readonly type: "finish";
|
|
684
|
+
readonly audio: Media.Asset;
|
|
685
|
+
readonly providerMetadata?: {
|
|
686
|
+
readonly [x: string]: {
|
|
687
|
+
readonly [x: string]: unknown;
|
|
688
|
+
};
|
|
689
|
+
} | undefined;
|
|
690
|
+
readonly usage?: {
|
|
691
|
+
readonly type: "tokens";
|
|
692
|
+
readonly input?: number | undefined;
|
|
693
|
+
readonly output?: number | undefined;
|
|
694
|
+
readonly total?: number | undefined;
|
|
695
|
+
readonly details?: {
|
|
696
|
+
readonly [x: string]: unknown;
|
|
697
|
+
} | undefined;
|
|
698
|
+
} | {
|
|
699
|
+
readonly type: "seconds";
|
|
700
|
+
readonly seconds: number;
|
|
701
|
+
} | {
|
|
702
|
+
readonly type: "characters";
|
|
703
|
+
readonly characters: number;
|
|
704
|
+
} | {
|
|
705
|
+
readonly type: "credits";
|
|
706
|
+
readonly credits: number;
|
|
707
|
+
} | {
|
|
708
|
+
readonly type: "compute";
|
|
709
|
+
readonly seconds: number;
|
|
710
|
+
} | undefined;
|
|
711
|
+
readonly notices?: readonly {
|
|
712
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
713
|
+
readonly message: string;
|
|
714
|
+
readonly providerMetadata?: {
|
|
715
|
+
readonly [x: string]: {
|
|
716
|
+
readonly [x: string]: unknown;
|
|
717
|
+
};
|
|
718
|
+
} | undefined;
|
|
719
|
+
}[] | undefined;
|
|
720
|
+
}) => any;
|
|
721
|
+
}>(cases: Cases): (value: {
|
|
722
|
+
readonly type: "audio-delta";
|
|
723
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
724
|
+
} | {
|
|
725
|
+
readonly type: "timestamps";
|
|
726
|
+
readonly items: readonly {
|
|
727
|
+
readonly text: string;
|
|
728
|
+
readonly startSeconds: number;
|
|
729
|
+
readonly endSeconds: number;
|
|
730
|
+
}[];
|
|
731
|
+
} | {
|
|
732
|
+
readonly type: "finish";
|
|
733
|
+
readonly audio: Media.Asset;
|
|
734
|
+
readonly providerMetadata?: {
|
|
735
|
+
readonly [x: string]: {
|
|
736
|
+
readonly [x: string]: unknown;
|
|
737
|
+
};
|
|
738
|
+
} | undefined;
|
|
739
|
+
readonly usage?: {
|
|
740
|
+
readonly type: "tokens";
|
|
741
|
+
readonly input?: number | undefined;
|
|
742
|
+
readonly output?: number | undefined;
|
|
743
|
+
readonly total?: number | undefined;
|
|
744
|
+
readonly details?: {
|
|
745
|
+
readonly [x: string]: unknown;
|
|
746
|
+
} | undefined;
|
|
747
|
+
} | {
|
|
748
|
+
readonly type: "seconds";
|
|
749
|
+
readonly seconds: number;
|
|
750
|
+
} | {
|
|
751
|
+
readonly type: "characters";
|
|
752
|
+
readonly characters: number;
|
|
753
|
+
} | {
|
|
754
|
+
readonly type: "credits";
|
|
755
|
+
readonly credits: number;
|
|
756
|
+
} | {
|
|
757
|
+
readonly type: "compute";
|
|
758
|
+
readonly seconds: number;
|
|
759
|
+
} | undefined;
|
|
760
|
+
readonly notices?: readonly {
|
|
761
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
762
|
+
readonly message: string;
|
|
763
|
+
readonly providerMetadata?: {
|
|
764
|
+
readonly [x: string]: {
|
|
765
|
+
readonly [x: string]: unknown;
|
|
766
|
+
};
|
|
767
|
+
} | undefined;
|
|
768
|
+
}[] | undefined;
|
|
769
|
+
}) => Cases[keyof Cases] extends (value: any) => infer R ? import("effect/Unify").Unify<R> : never;
|
|
770
|
+
};
|
|
771
|
+
readonly matchOrElse: {
|
|
772
|
+
<Cases extends {
|
|
773
|
+
"audio-delta"?: ((value: {
|
|
774
|
+
readonly type: "audio-delta";
|
|
775
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
776
|
+
}) => any) | undefined;
|
|
777
|
+
timestamps?: ((value: {
|
|
778
|
+
readonly type: "timestamps";
|
|
779
|
+
readonly items: readonly {
|
|
780
|
+
readonly text: string;
|
|
781
|
+
readonly startSeconds: number;
|
|
782
|
+
readonly endSeconds: number;
|
|
783
|
+
}[];
|
|
784
|
+
}) => any) | undefined;
|
|
785
|
+
finish?: ((value: {
|
|
786
|
+
readonly type: "finish";
|
|
787
|
+
readonly audio: Media.Asset;
|
|
788
|
+
readonly providerMetadata?: {
|
|
789
|
+
readonly [x: string]: {
|
|
790
|
+
readonly [x: string]: unknown;
|
|
791
|
+
};
|
|
792
|
+
} | undefined;
|
|
793
|
+
readonly usage?: {
|
|
794
|
+
readonly type: "tokens";
|
|
795
|
+
readonly input?: number | undefined;
|
|
796
|
+
readonly output?: number | undefined;
|
|
797
|
+
readonly total?: number | undefined;
|
|
798
|
+
readonly details?: {
|
|
799
|
+
readonly [x: string]: unknown;
|
|
800
|
+
} | undefined;
|
|
801
|
+
} | {
|
|
802
|
+
readonly type: "seconds";
|
|
803
|
+
readonly seconds: number;
|
|
804
|
+
} | {
|
|
805
|
+
readonly type: "characters";
|
|
806
|
+
readonly characters: number;
|
|
807
|
+
} | {
|
|
808
|
+
readonly type: "credits";
|
|
809
|
+
readonly credits: number;
|
|
810
|
+
} | {
|
|
811
|
+
readonly type: "compute";
|
|
812
|
+
readonly seconds: number;
|
|
813
|
+
} | undefined;
|
|
814
|
+
readonly notices?: readonly {
|
|
815
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
816
|
+
readonly message: string;
|
|
817
|
+
readonly providerMetadata?: {
|
|
818
|
+
readonly [x: string]: {
|
|
819
|
+
readonly [x: string]: unknown;
|
|
820
|
+
};
|
|
821
|
+
} | undefined;
|
|
822
|
+
}[] | undefined;
|
|
823
|
+
}) => any) | undefined;
|
|
824
|
+
} & { [K in Exclude<keyof Cases, "finish" | "timestamps" | "audio-delta">]: never; }, OrElse extends (value: Exclude<{
|
|
825
|
+
readonly type: "audio-delta";
|
|
826
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
827
|
+
}, {
|
|
828
|
+
readonly type: keyof Cases;
|
|
829
|
+
}> | Exclude<{
|
|
830
|
+
readonly type: "timestamps";
|
|
831
|
+
readonly items: readonly {
|
|
832
|
+
readonly text: string;
|
|
833
|
+
readonly startSeconds: number;
|
|
834
|
+
readonly endSeconds: number;
|
|
835
|
+
}[];
|
|
836
|
+
}, {
|
|
837
|
+
readonly type: keyof Cases;
|
|
838
|
+
}> | Exclude<{
|
|
839
|
+
readonly type: "finish";
|
|
840
|
+
readonly audio: Media.Asset;
|
|
841
|
+
readonly providerMetadata?: {
|
|
842
|
+
readonly [x: string]: {
|
|
843
|
+
readonly [x: string]: unknown;
|
|
844
|
+
};
|
|
845
|
+
} | undefined;
|
|
846
|
+
readonly usage?: {
|
|
847
|
+
readonly type: "tokens";
|
|
848
|
+
readonly input?: number | undefined;
|
|
849
|
+
readonly output?: number | undefined;
|
|
850
|
+
readonly total?: number | undefined;
|
|
851
|
+
readonly details?: {
|
|
852
|
+
readonly [x: string]: unknown;
|
|
853
|
+
} | undefined;
|
|
854
|
+
} | {
|
|
855
|
+
readonly type: "seconds";
|
|
856
|
+
readonly seconds: number;
|
|
857
|
+
} | {
|
|
858
|
+
readonly type: "characters";
|
|
859
|
+
readonly characters: number;
|
|
860
|
+
} | {
|
|
861
|
+
readonly type: "credits";
|
|
862
|
+
readonly credits: number;
|
|
863
|
+
} | {
|
|
864
|
+
readonly type: "compute";
|
|
865
|
+
readonly seconds: number;
|
|
866
|
+
} | undefined;
|
|
867
|
+
readonly notices?: readonly {
|
|
868
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
869
|
+
readonly message: string;
|
|
870
|
+
readonly providerMetadata?: {
|
|
871
|
+
readonly [x: string]: {
|
|
872
|
+
readonly [x: string]: unknown;
|
|
873
|
+
};
|
|
874
|
+
} | undefined;
|
|
875
|
+
}[] | undefined;
|
|
876
|
+
}, {
|
|
877
|
+
readonly type: keyof Cases;
|
|
878
|
+
}>) => any>(value: {
|
|
879
|
+
readonly type: "audio-delta";
|
|
880
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
881
|
+
} | {
|
|
882
|
+
readonly type: "timestamps";
|
|
883
|
+
readonly items: readonly {
|
|
884
|
+
readonly text: string;
|
|
885
|
+
readonly startSeconds: number;
|
|
886
|
+
readonly endSeconds: number;
|
|
887
|
+
}[];
|
|
888
|
+
} | {
|
|
889
|
+
readonly type: "finish";
|
|
890
|
+
readonly audio: Media.Asset;
|
|
891
|
+
readonly providerMetadata?: {
|
|
892
|
+
readonly [x: string]: {
|
|
893
|
+
readonly [x: string]: unknown;
|
|
894
|
+
};
|
|
895
|
+
} | undefined;
|
|
896
|
+
readonly usage?: {
|
|
897
|
+
readonly type: "tokens";
|
|
898
|
+
readonly input?: number | undefined;
|
|
899
|
+
readonly output?: number | undefined;
|
|
900
|
+
readonly total?: number | undefined;
|
|
901
|
+
readonly details?: {
|
|
902
|
+
readonly [x: string]: unknown;
|
|
903
|
+
} | undefined;
|
|
904
|
+
} | {
|
|
905
|
+
readonly type: "seconds";
|
|
906
|
+
readonly seconds: number;
|
|
907
|
+
} | {
|
|
908
|
+
readonly type: "characters";
|
|
909
|
+
readonly characters: number;
|
|
910
|
+
} | {
|
|
911
|
+
readonly type: "credits";
|
|
912
|
+
readonly credits: number;
|
|
913
|
+
} | {
|
|
914
|
+
readonly type: "compute";
|
|
915
|
+
readonly seconds: number;
|
|
916
|
+
} | undefined;
|
|
917
|
+
readonly notices?: readonly {
|
|
918
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
919
|
+
readonly message: string;
|
|
920
|
+
readonly providerMetadata?: {
|
|
921
|
+
readonly [x: string]: {
|
|
922
|
+
readonly [x: string]: unknown;
|
|
923
|
+
};
|
|
924
|
+
} | undefined;
|
|
925
|
+
}[] | undefined;
|
|
926
|
+
}, 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
|
+
<Cases extends {
|
|
928
|
+
"audio-delta"?: ((value: {
|
|
929
|
+
readonly type: "audio-delta";
|
|
930
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
931
|
+
}) => any) | undefined;
|
|
932
|
+
timestamps?: ((value: {
|
|
933
|
+
readonly type: "timestamps";
|
|
934
|
+
readonly items: readonly {
|
|
935
|
+
readonly text: string;
|
|
936
|
+
readonly startSeconds: number;
|
|
937
|
+
readonly endSeconds: number;
|
|
938
|
+
}[];
|
|
939
|
+
}) => any) | undefined;
|
|
940
|
+
finish?: ((value: {
|
|
941
|
+
readonly type: "finish";
|
|
942
|
+
readonly audio: Media.Asset;
|
|
943
|
+
readonly providerMetadata?: {
|
|
944
|
+
readonly [x: string]: {
|
|
945
|
+
readonly [x: string]: unknown;
|
|
946
|
+
};
|
|
947
|
+
} | undefined;
|
|
948
|
+
readonly usage?: {
|
|
949
|
+
readonly type: "tokens";
|
|
950
|
+
readonly input?: number | undefined;
|
|
951
|
+
readonly output?: number | undefined;
|
|
952
|
+
readonly total?: number | undefined;
|
|
953
|
+
readonly details?: {
|
|
954
|
+
readonly [x: string]: unknown;
|
|
955
|
+
} | undefined;
|
|
956
|
+
} | {
|
|
957
|
+
readonly type: "seconds";
|
|
958
|
+
readonly seconds: number;
|
|
959
|
+
} | {
|
|
960
|
+
readonly type: "characters";
|
|
961
|
+
readonly characters: number;
|
|
962
|
+
} | {
|
|
963
|
+
readonly type: "credits";
|
|
964
|
+
readonly credits: number;
|
|
965
|
+
} | {
|
|
966
|
+
readonly type: "compute";
|
|
967
|
+
readonly seconds: number;
|
|
968
|
+
} | undefined;
|
|
969
|
+
readonly notices?: readonly {
|
|
970
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
971
|
+
readonly message: string;
|
|
972
|
+
readonly providerMetadata?: {
|
|
973
|
+
readonly [x: string]: {
|
|
974
|
+
readonly [x: string]: unknown;
|
|
975
|
+
};
|
|
976
|
+
} | undefined;
|
|
977
|
+
}[] | undefined;
|
|
978
|
+
}) => any) | undefined;
|
|
979
|
+
} & { [K in Exclude<keyof Cases, "finish" | "timestamps" | "audio-delta">]: never; }, OrElse extends (value: Exclude<{
|
|
980
|
+
readonly type: "audio-delta";
|
|
981
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
982
|
+
}, {
|
|
983
|
+
readonly type: keyof Cases;
|
|
984
|
+
}> | Exclude<{
|
|
985
|
+
readonly type: "timestamps";
|
|
986
|
+
readonly items: readonly {
|
|
987
|
+
readonly text: string;
|
|
988
|
+
readonly startSeconds: number;
|
|
989
|
+
readonly endSeconds: number;
|
|
990
|
+
}[];
|
|
991
|
+
}, {
|
|
992
|
+
readonly type: keyof Cases;
|
|
993
|
+
}> | Exclude<{
|
|
994
|
+
readonly type: "finish";
|
|
995
|
+
readonly audio: Media.Asset;
|
|
996
|
+
readonly providerMetadata?: {
|
|
997
|
+
readonly [x: string]: {
|
|
998
|
+
readonly [x: string]: unknown;
|
|
999
|
+
};
|
|
1000
|
+
} | undefined;
|
|
1001
|
+
readonly usage?: {
|
|
1002
|
+
readonly type: "tokens";
|
|
1003
|
+
readonly input?: number | undefined;
|
|
1004
|
+
readonly output?: number | undefined;
|
|
1005
|
+
readonly total?: number | undefined;
|
|
1006
|
+
readonly details?: {
|
|
1007
|
+
readonly [x: string]: unknown;
|
|
1008
|
+
} | undefined;
|
|
1009
|
+
} | {
|
|
1010
|
+
readonly type: "seconds";
|
|
1011
|
+
readonly seconds: number;
|
|
1012
|
+
} | {
|
|
1013
|
+
readonly type: "characters";
|
|
1014
|
+
readonly characters: number;
|
|
1015
|
+
} | {
|
|
1016
|
+
readonly type: "credits";
|
|
1017
|
+
readonly credits: number;
|
|
1018
|
+
} | {
|
|
1019
|
+
readonly type: "compute";
|
|
1020
|
+
readonly seconds: number;
|
|
1021
|
+
} | undefined;
|
|
1022
|
+
readonly notices?: readonly {
|
|
1023
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
1024
|
+
readonly message: string;
|
|
1025
|
+
readonly providerMetadata?: {
|
|
1026
|
+
readonly [x: string]: {
|
|
1027
|
+
readonly [x: string]: unknown;
|
|
1028
|
+
};
|
|
1029
|
+
} | undefined;
|
|
1030
|
+
}[] | undefined;
|
|
1031
|
+
}, {
|
|
1032
|
+
readonly type: keyof Cases;
|
|
1033
|
+
}>) => any>(cases: Cases, orElse: OrElse): (value: {
|
|
1034
|
+
readonly type: "audio-delta";
|
|
1035
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
1036
|
+
} | {
|
|
1037
|
+
readonly type: "timestamps";
|
|
1038
|
+
readonly items: readonly {
|
|
1039
|
+
readonly text: string;
|
|
1040
|
+
readonly startSeconds: number;
|
|
1041
|
+
readonly endSeconds: number;
|
|
1042
|
+
}[];
|
|
1043
|
+
} | {
|
|
1044
|
+
readonly type: "finish";
|
|
1045
|
+
readonly audio: Media.Asset;
|
|
1046
|
+
readonly providerMetadata?: {
|
|
1047
|
+
readonly [x: string]: {
|
|
1048
|
+
readonly [x: string]: unknown;
|
|
1049
|
+
};
|
|
1050
|
+
} | undefined;
|
|
1051
|
+
readonly usage?: {
|
|
1052
|
+
readonly type: "tokens";
|
|
1053
|
+
readonly input?: number | undefined;
|
|
1054
|
+
readonly output?: number | undefined;
|
|
1055
|
+
readonly total?: number | undefined;
|
|
1056
|
+
readonly details?: {
|
|
1057
|
+
readonly [x: string]: unknown;
|
|
1058
|
+
} | undefined;
|
|
1059
|
+
} | {
|
|
1060
|
+
readonly type: "seconds";
|
|
1061
|
+
readonly seconds: number;
|
|
1062
|
+
} | {
|
|
1063
|
+
readonly type: "characters";
|
|
1064
|
+
readonly characters: number;
|
|
1065
|
+
} | {
|
|
1066
|
+
readonly type: "credits";
|
|
1067
|
+
readonly credits: number;
|
|
1068
|
+
} | {
|
|
1069
|
+
readonly type: "compute";
|
|
1070
|
+
readonly seconds: number;
|
|
1071
|
+
} | undefined;
|
|
1072
|
+
readonly notices?: readonly {
|
|
1073
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
1074
|
+
readonly message: string;
|
|
1075
|
+
readonly providerMetadata?: {
|
|
1076
|
+
readonly [x: string]: {
|
|
1077
|
+
readonly [x: string]: unknown;
|
|
1078
|
+
};
|
|
1079
|
+
} | undefined;
|
|
1080
|
+
}[] | undefined;
|
|
1081
|
+
}) => 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>>;
|
|
1082
|
+
};
|
|
1083
|
+
} & {
|
|
1084
|
+
is: {
|
|
1085
|
+
audioDelta: (u: unknown) => u is {
|
|
1086
|
+
readonly type: "audio-delta";
|
|
1087
|
+
readonly chunk: Uint8Array<ArrayBufferLike>;
|
|
1088
|
+
};
|
|
1089
|
+
timestamps: (u: unknown) => u is {
|
|
1090
|
+
readonly type: "timestamps";
|
|
1091
|
+
readonly items: readonly {
|
|
1092
|
+
readonly text: string;
|
|
1093
|
+
readonly startSeconds: number;
|
|
1094
|
+
readonly endSeconds: number;
|
|
1095
|
+
}[];
|
|
1096
|
+
};
|
|
1097
|
+
finish: (u: unknown) => u is {
|
|
1098
|
+
readonly type: "finish";
|
|
1099
|
+
readonly audio: Media.Asset;
|
|
1100
|
+
readonly providerMetadata?: {
|
|
1101
|
+
readonly [x: string]: {
|
|
1102
|
+
readonly [x: string]: unknown;
|
|
1103
|
+
};
|
|
1104
|
+
} | undefined;
|
|
1105
|
+
readonly usage?: {
|
|
1106
|
+
readonly type: "tokens";
|
|
1107
|
+
readonly input?: number | undefined;
|
|
1108
|
+
readonly output?: number | undefined;
|
|
1109
|
+
readonly total?: number | undefined;
|
|
1110
|
+
readonly details?: {
|
|
1111
|
+
readonly [x: string]: unknown;
|
|
1112
|
+
} | undefined;
|
|
1113
|
+
} | {
|
|
1114
|
+
readonly type: "seconds";
|
|
1115
|
+
readonly seconds: number;
|
|
1116
|
+
} | {
|
|
1117
|
+
readonly type: "characters";
|
|
1118
|
+
readonly characters: number;
|
|
1119
|
+
} | {
|
|
1120
|
+
readonly type: "credits";
|
|
1121
|
+
readonly credits: number;
|
|
1122
|
+
} | {
|
|
1123
|
+
readonly type: "compute";
|
|
1124
|
+
readonly seconds: number;
|
|
1125
|
+
} | undefined;
|
|
1126
|
+
readonly notices?: readonly {
|
|
1127
|
+
readonly type: "other" | "moderated" | "filtered";
|
|
1128
|
+
readonly message: string;
|
|
1129
|
+
readonly providerMetadata?: {
|
|
1130
|
+
readonly [x: string]: {
|
|
1131
|
+
readonly [x: string]: unknown;
|
|
1132
|
+
};
|
|
1133
|
+
} | undefined;
|
|
1134
|
+
}[] | undefined;
|
|
1135
|
+
};
|
|
1136
|
+
};
|
|
1137
|
+
};
|
|
1138
|
+
export type SpeechEvent = Schema.Schema.Type<typeof speechEventTagged>;
|
|
1139
|
+
export declare function request<const Model extends SpeechModel>(input: SpeechRequestInput<Model>): SpeechRequestFor<SpeechModelOptions<Model>>;
|
|
1140
|
+
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 generate(input: SpeechRequest): Effect.Effect<SpeechResponse, AIError, Service>;
|
|
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>;
|
|
1145
|
+
export declare const Speech: {
|
|
1146
|
+
readonly request: typeof request;
|
|
1147
|
+
readonly generate: typeof generate;
|
|
1148
|
+
readonly stream: typeof stream;
|
|
1149
|
+
};
|
|
1150
|
+
export {};
|