voice-router-dev 0.1.5 → 0.1.7

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
@@ -144,39 +144,7 @@ var VoiceRouter = class {
144
144
  const adapter = this.getAdapter(provider);
145
145
  return adapter.getTranscript(transcriptId);
146
146
  }
147
- /**
148
- * Stream audio for real-time transcription
149
- * Only works with providers that support streaming
150
- *
151
- * @param options - Streaming options including provider selection
152
- * @param callbacks - Event callbacks for transcription results
153
- * @returns Promise that resolves with a StreamingSession
154
- *
155
- * @example
156
- * ```typescript
157
- * import { VoiceRouter } from '@meeting-baas/sdk';
158
- *
159
- * const router = new VoiceRouter();
160
- * router.initialize({
161
- * gladia: { apiKey: process.env.GLADIA_KEY },
162
- * deepgram: { apiKey: process.env.DEEPGRAM_KEY }
163
- * });
164
- *
165
- * const session = await router.transcribeStream({
166
- * provider: 'deepgram',
167
- * encoding: 'linear16',
168
- * sampleRate: 16000,
169
- * language: 'en'
170
- * }, {
171
- * onTranscript: (event) => console.log(event.text),
172
- * onError: (error) => console.error(error)
173
- * });
174
- *
175
- * // Send audio chunks
176
- * await session.sendAudio({ data: audioBuffer });
177
- * await session.close();
178
- * ```
179
- */
147
+ // Implementation
180
148
  async transcribeStream(options, callbacks) {
181
149
  const provider = this.selectProvider(options?.provider);
182
150
  const adapter = this.getAdapter(provider);
@@ -1815,11 +1783,20 @@ var GladiaAdapter = class extends BaseAdapter {
1815
1783
  */
1816
1784
  async transcribeStream(options, callbacks) {
1817
1785
  this.validateConfig();
1786
+ let validatedSampleRate;
1787
+ if (options?.sampleRate) {
1788
+ const validRates = Object.values(StreamingSupportedSampleRateEnum);
1789
+ const isValidRate = validRates.some((rate) => rate === options.sampleRate);
1790
+ if (!isValidRate) {
1791
+ throw new Error(
1792
+ `Gladia does not support sample rate ${options.sampleRate} Hz. Supported rates (from OpenAPI spec): ${validRates.join(", ")} Hz`
1793
+ );
1794
+ }
1795
+ validatedSampleRate = options.sampleRate;
1796
+ }
1818
1797
  const streamingRequest = {
1819
- // Map unified encoding format to Gladia's provider-specific format
1820
- // e.g., 'linear16' → 'wav/pcm'
1821
1798
  encoding: options?.encoding ? mapEncodingToProvider(options.encoding, "gladia") : void 0,
1822
- sample_rate: options?.sampleRate,
1799
+ sample_rate: validatedSampleRate,
1823
1800
  channels: options?.channels,
1824
1801
  endpointing: options?.endpointing
1825
1802
  };
@@ -2984,7 +2961,7 @@ var DeepgramAdapter = class extends BaseAdapter {
2984
2961
  params.detect_entities = true;
2985
2962
  }
2986
2963
  if (options.piiRedaction) {
2987
- params.redact = true;
2964
+ params.redact = ["pci", "pii"];
2988
2965
  }
2989
2966
  if (options.webhookUrl) {
2990
2967
  params.callback = options.webhookUrl;