@omg-dev/media 0.4.29 → 0.4.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -115,16 +115,16 @@ async function generateSpeech(opts) {
115
115
  /**
116
116
  * Speech → text. Submits, polls to completion, and returns the transcript.
117
117
  *
118
- * const { text } = await transcribe({ audioUrl, durationSeconds: 42 })
118
+ * const { text } = await transcribe({ audioUrl })
119
119
  */
120
120
  async function transcribe(opts) {
121
121
  const { audioUrl, durationSeconds, model, input, ...rest } = opts;
122
122
  const job = await generate({
123
- model: model ?? "elevenlabs/scribe_v1",
123
+ model: model ?? "elevenlabs/scribe_v2",
124
124
  input: {
125
+ ...input,
125
126
  audio_url: audioUrl,
126
- duration_seconds: durationSeconds,
127
- ...input
127
+ duration_seconds: durationSeconds
128
128
  },
129
129
  ...rest
130
130
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omg-dev/media",
3
- "version": "0.4.29",
3
+ "version": "0.4.31",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
package/src/index.ts CHANGED
@@ -205,13 +205,9 @@ export async function generateSpeech(
205
205
  export interface TranscribeOptions extends Omit<GenerateOptions, "model" | "input"> {
206
206
  /** Public URL of the audio to transcribe (e.g. an uploaded file's URL). */
207
207
  audioUrl: string
208
- /**
209
- * Length of the audio in seconds — REQUIRED, it is what you're billed on
210
- * ($0.22/audio-hour pass-through, 60s minimum). Understating it undercharges;
211
- * read it off the file/recorder before submitting.
212
- */
213
- durationSeconds: number
214
- /** Curated model id (default "elevenlabs/scribe_v1"). */
208
+ /** Optional UI hint; the host measures the real duration before billing. */
209
+ durationSeconds?: number
210
+ /** Curated model id (default "elevenlabs/scribe_v2"). */
215
211
  model?: string
216
212
  /** Extra model params merged into the input (language_code…). */
217
213
  input?: Record<string, unknown>
@@ -220,15 +216,15 @@ export interface TranscribeOptions extends Omit<GenerateOptions, "model" | "inpu
220
216
  /**
221
217
  * Speech → text. Submits, polls to completion, and returns the transcript.
222
218
  *
223
- * const { text } = await transcribe({ audioUrl, durationSeconds: 42 })
219
+ * const { text } = await transcribe({ audioUrl })
224
220
  */
225
221
  export async function transcribe(
226
222
  opts: TranscribeOptions,
227
223
  ): Promise<{ text: string; job: Job }> {
228
224
  const { audioUrl, durationSeconds, model, input, ...rest } = opts
229
225
  const job = await generate({
230
- model: model ?? "elevenlabs/scribe_v1",
231
- input: { audio_url: audioUrl, duration_seconds: durationSeconds, ...input },
226
+ model: model ?? "elevenlabs/scribe_v2",
227
+ input: { ...input, audio_url: audioUrl, duration_seconds: durationSeconds },
232
228
  ...rest,
233
229
  })
234
230
  const text = job.results?.[0]?.text