@elevenlabs/client 0.9.2 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import type { SessionStartedMessage, PartialTranscriptMessage, FinalTranscriptMessage, FinalTranscriptWithTimestampsMessage, ScribeErrorMessage, ScribeAuthErrorMessage } from "@elevenlabs/types";
2
- export type { SessionStartedMessage, PartialTranscriptMessage, FinalTranscriptMessage, FinalTranscriptWithTimestampsMessage, ScribeErrorMessage, ScribeAuthErrorMessage, };
3
- export type WebSocketMessage = SessionStartedMessage | PartialTranscriptMessage | FinalTranscriptMessage | FinalTranscriptWithTimestampsMessage | ScribeErrorMessage | ScribeAuthErrorMessage;
1
+ import type { SessionStartedMessage, PartialTranscriptMessage, CommittedTranscriptMessage, CommittedTranscriptWithTimestampsMessage, ScribeErrorMessage, ScribeAuthErrorMessage, ScribeQuotaExceededErrorMessage } from "@elevenlabs/types";
2
+ export type { SessionStartedMessage, PartialTranscriptMessage, CommittedTranscriptMessage, CommittedTranscriptWithTimestampsMessage, ScribeErrorMessage, ScribeAuthErrorMessage, ScribeQuotaExceededErrorMessage, };
3
+ export type WebSocketMessage = SessionStartedMessage | PartialTranscriptMessage | CommittedTranscriptMessage | CommittedTranscriptWithTimestampsMessage | ScribeErrorMessage | ScribeAuthErrorMessage | ScribeQuotaExceededErrorMessage;
4
4
  /**
5
5
  * Events emitted by the RealtimeConnection.
6
6
  */
@@ -10,9 +10,9 @@ export declare enum RealtimeEvents {
10
10
  /** Emitted when a partial (interim) transcript is available */
11
11
  PARTIAL_TRANSCRIPT = "partial_transcript",
12
12
  /** Emitted when a final transcript is available */
13
- FINAL_TRANSCRIPT = "final_transcript",
13
+ COMMITTED_TRANSCRIPT = "committed_transcript",
14
14
  /** Emitted when a final transcript with timestamps is available */
15
- FINAL_TRANSCRIPT_WITH_TIMESTAMPS = "final_transcript_with_timestamps",
15
+ COMMITTED_TRANSCRIPT_WITH_TIMESTAMPS = "committed_transcript_with_timestamps",
16
16
  /** Emitted when an authentication error occurs */
17
17
  AUTH_ERROR = "auth_error",
18
18
  /** Emitted when an error occurs */
@@ -20,7 +20,9 @@ export declare enum RealtimeEvents {
20
20
  /** Emitted when the WebSocket connection is opened */
21
21
  OPEN = "open",
22
22
  /** Emitted when the WebSocket connection is closed */
23
- CLOSE = "close"
23
+ CLOSE = "close",
24
+ /** Emitted when a quota exceeded error occurs */
25
+ QUOTA_EXCEEDED = "quota_exceeded"
24
26
  }
25
27
  /**
26
28
  * Manages a real-time transcription WebSocket connection.
@@ -29,7 +31,7 @@ export declare enum RealtimeEvents {
29
31
  * ```typescript
30
32
  * const connection = await Scribe.connect({
31
33
  * token: "...",
32
- * modelId: "scribe_realtime_v2",
34
+ * modelId: "scribe_v2_realtime",
33
35
  * audioFormat: AudioFormat.PCM_16000,
34
36
  * sampleRate: 16000,
35
37
  * });
@@ -42,7 +44,7 @@ export declare enum RealtimeEvents {
42
44
  * console.log("Partial:", data.transcript);
43
45
  * });
44
46
  *
45
- * connection.on(RealtimeEvents.FINAL_TRANSCRIPT, (data) => {
47
+ * connection.on(RealtimeEvents.COMMITTED_TRANSCRIPT, (data) => {
46
48
  * console.log("Final:", data.transcript);
47
49
  * connection.close();
48
50
  * });
@@ -81,7 +83,7 @@ export declare class RealtimeConnection {
81
83
  * console.log("Partial:", data.transcript);
82
84
  * });
83
85
  *
84
- * connection.on(RealtimeEvents.FINAL_TRANSCRIPT, (data) => {
86
+ * connection.on(RealtimeEvents.COMMITTED_TRANSCRIPT, (data) => {
85
87
  * console.log("Final:", data.transcript);
86
88
  * });
87
89
  * ```
@@ -133,8 +135,8 @@ export declare class RealtimeConnection {
133
135
  sampleRate?: number;
134
136
  }): void;
135
137
  /**
136
- * Commits the transcription, signaling that all audio has been sent.
137
- * This finalizes the transcription and triggers a FINAL_TRANSCRIPT event.
138
+ * Commits the transcription, signaling that a segment of audio has been sent. This clears the buffer and triggers a COMMITTED_TRANSCRIPT event. Context from previous segments is kept.
139
+ * Committing a segment triggers a COMMITTED_TRANSCRIPT event.
138
140
  *
139
141
  * @throws {Error} If the WebSocket connection is not open
140
142
  *
@@ -164,8 +166,8 @@ export declare class RealtimeConnection {
164
166
  *
165
167
  * @example
166
168
  * ```typescript
167
- * connection.on(RealtimeEvents.FINAL_TRANSCRIPT, (data) => {
168
- * console.log("Final:", data.transcript);
169
+ * connection.on(RealtimeEvents.COMMITTED_TRANSCRIPT, (data) => {
170
+ * console.log("Segment committed:", data.transcript);
169
171
  * connection.close();
170
172
  * });
171
173
  * ```
@@ -3,4 +3,4 @@ export { RealtimeConnection } from "./connection";
3
3
  export { AudioFormat, CommitStrategy } from "./scribe";
4
4
  export { RealtimeEvents } from "./connection";
5
5
  export type { AudioOptions, MicrophoneOptions } from "./scribe";
6
- export type { WebSocketMessage, SessionStartedMessage, PartialTranscriptMessage, FinalTranscriptMessage, FinalTranscriptWithTimestampsMessage, ScribeErrorMessage, ScribeAuthErrorMessage, } from "./connection";
6
+ export type { WebSocketMessage, SessionStartedMessage, PartialTranscriptMessage, CommittedTranscriptMessage, CommittedTranscriptWithTimestampsMessage, ScribeErrorMessage, ScribeAuthErrorMessage, ScribeQuotaExceededErrorMessage, } from "./connection";
@@ -57,6 +57,11 @@ interface BaseOptions {
57
57
  * If not provided, the default URI will be used.
58
58
  */
59
59
  baseUri?: string;
60
+ /**
61
+ * Whether to receive a committed_transcript_with_timestamps event which includes word-level timestamps.
62
+ * @default false
63
+ */
64
+ includeTimestamps?: boolean;
60
65
  }
61
66
  export interface AudioOptions extends BaseOptions {
62
67
  audioFormat: AudioFormat;
@@ -96,7 +101,7 @@ export declare class ScribeRealtime {
96
101
  * // Manual audio streaming
97
102
  * const connection = Scribe.connect({
98
103
  * token: "...",
99
- * modelId: "scribe_realtime_v2",
104
+ * modelId: "scribe_v2_realtime",
100
105
  * audioFormat: AudioFormat.PCM_16000,
101
106
  * sampleRate: 16000,
102
107
  * });
@@ -104,7 +109,7 @@ export declare class ScribeRealtime {
104
109
  * // Automatic microphone streaming
105
110
  * const connection = Scribe.connect({
106
111
  * token: "...",
107
- * modelId: "scribe_realtime_v2",
112
+ * modelId: "scribe_v2_realtime",
108
113
  * microphone: {
109
114
  * echoCancellation: true,
110
115
  * noiseSuppression: true
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const PACKAGE_VERSION = "0.9.2";
1
+ export declare const PACKAGE_VERSION = "0.11.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevenlabs/client",
3
- "version": "0.9.2",
3
+ "version": "0.11.0",
4
4
  "description": "ElevenLabs JavaScript Client Library",
5
5
  "main": "./dist/lib.umd.js",
6
6
  "module": "./dist/lib.module.js",
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "livekit-client": "^2.11.4",
42
- "@elevenlabs/types": "0.1.1"
42
+ "@elevenlabs/types": "0.3.0"
43
43
  },
44
44
  "scripts": {
45
45
  "generate-version": "printf \"// This file is auto-generated during build\\nexport const PACKAGE_VERSION = \\\"%s\\\";\\n\" \"$npm_package_version\" > src/version.ts",