voice-router-dev 0.2.2 → 0.2.4

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.d.mts CHANGED
@@ -4349,11 +4349,45 @@ interface Transcription {
4349
4349
  readonly createdDateTime?: string;
4350
4350
  }
4351
4351
 
4352
+ /**
4353
+ * Generated by orval v7.9.0 🍺
4354
+ * Do not edit manually.
4355
+ * Deepgram API Specification
4356
+ * APIs for speech-to-text transcription, text-to-speech synthesis, language understanding, and account management.
4357
+
4358
+ * OpenAPI spec version: 1.0.0
4359
+ */
4360
+ type ListenV1ModelParameter = "nova-3" | "nova-3-general" | "nova-3-medical" | "nova-2" | "nova-2-general" | "nova-2-meeting" | "nova-2-finance" | "nova-2-conversationalai" | "nova-2-voicemail" | "nova-2-video" | "nova-2-medical" | "nova-2-drivethru" | "nova-2-automotive" | "nova" | "nova-general" | "nova-phonecall" | "nova-medical" | "enhanced" | "enhanced-general" | "enhanced-meeting" | "enhanced-phonecall" | "enhanced-finance" | "base" | "meeting" | "phonecall" | "finance" | "conversationalai" | "voicemail" | "video" | string;
4361
+
4362
+ /**
4363
+ * Generated by orval v7.9.0 🍺
4364
+ * Do not edit manually.
4365
+ * Gladia Control API
4366
+ * OpenAPI spec version: 1.0
4367
+ */
4368
+ /**
4369
+ * The model used to process the audio. "solaria-1" is used by default.
4370
+ */
4371
+ type StreamingSupportedModels = (typeof StreamingSupportedModels)[keyof typeof StreamingSupportedModels];
4372
+ declare const StreamingSupportedModels: {
4373
+ readonly "solaria-1": "solaria-1";
4374
+ };
4375
+
4352
4376
  /**
4353
4377
  * Unified types for the Voice Router SDK
4354
4378
  * These types provide a provider-agnostic interface for transcription services
4355
4379
  */
4356
4380
 
4381
+ /**
4382
+ * Unified transcription model type with autocomplete for all providers
4383
+ *
4384
+ * Includes all known models from:
4385
+ * - Deepgram: nova-3, nova-2, enhanced, base, whisper, etc.
4386
+ * - Gladia: solaria-1
4387
+ *
4388
+ * Also accepts any string for future/custom models.
4389
+ */
4390
+ type TranscriptionModel = ListenV1ModelParameter | StreamingSupportedModels;
4357
4391
  /**
4358
4392
  * Supported transcription providers
4359
4393
  */
@@ -4656,6 +4690,19 @@ interface StreamingOptions extends Omit<TranscribeOptions, "webhookUrl"> {
4656
4690
  endpointing?: number;
4657
4691
  /** Maximum duration without endpointing in seconds */
4658
4692
  maxSilence?: number;
4693
+ /**
4694
+ * Model to use for transcription (provider-specific)
4695
+ *
4696
+ * Type-safe with autocomplete for all known models:
4697
+ * - Deepgram: 'nova-2', 'nova-3', 'base', 'enhanced', 'whisper-large', etc.
4698
+ * - Gladia: 'solaria-1' (default)
4699
+ * - AssemblyAI: Not applicable (uses Universal-2 automatically)
4700
+ *
4701
+ * @example
4702
+ * // Use Nova-2 for better multilingual support
4703
+ * { model: 'nova-2', language: 'fr' }
4704
+ */
4705
+ model?: TranscriptionModel;
4659
4706
  }
4660
4707
  /**
4661
4708
  * Callback functions for streaming events
@@ -5004,16 +5051,6 @@ declare const ListenV1EncodingParameter: {
5004
5051
  */
5005
5052
  type ListenV1LanguageParameter = string;
5006
5053
 
5007
- /**
5008
- * Generated by orval v7.9.0 🍺
5009
- * Do not edit manually.
5010
- * Deepgram API Specification
5011
- * APIs for speech-to-text transcription, text-to-speech synthesis, language understanding, and account management.
5012
-
5013
- * OpenAPI spec version: 1.0.0
5014
- */
5015
- type ListenV1ModelParameter = "nova-3" | "nova-3-general" | "nova-3-medical" | "nova-2" | "nova-2-general" | "nova-2-meeting" | "nova-2-finance" | "nova-2-conversationalai" | "nova-2-voicemail" | "nova-2-video" | "nova-2-medical" | "nova-2-drivethru" | "nova-2-automotive" | "nova" | "nova-general" | "nova-phonecall" | "nova-medical" | "enhanced" | "enhanced-general" | "enhanced-meeting" | "enhanced-phonecall" | "enhanced-finance" | "base" | "meeting" | "phonecall" | "finance" | "conversationalai" | "voicemail" | "video" | string;
5016
-
5017
5054
  /**
5018
5055
  * Generated by orval v7.9.0 🍺
5019
5056
  * Do not edit manually.
@@ -6740,8 +6777,7 @@ declare abstract class BaseWebhookHandler {
6740
6777
  * Gladia webhook handler
6741
6778
  *
6742
6779
  * Handles webhook callbacks from Gladia API:
6743
- * - transcription.created - Job created and queued
6744
- * - transcription.success - Job completed successfully
6780
+ * - transcription.success - Job completed successfully (includes full transcript)
6745
6781
  * - transcription.error - Job failed with error
6746
6782
  *
6747
6783
  * @example
@@ -6763,13 +6799,26 @@ declare abstract class BaseWebhookHandler {
6763
6799
  *
6764
6800
  * if (event.eventType === 'transcription.completed') {
6765
6801
  * console.log('Transcript:', event.data?.text);
6802
+ * console.log('Utterances:', event.data?.utterances);
6766
6803
  * }
6767
6804
  * ```
6768
6805
  */
6769
6806
  declare class GladiaWebhookHandler extends BaseWebhookHandler {
6770
6807
  readonly provider: TranscriptionProvider;
6808
+ /**
6809
+ * Convert Gladia WordDTO to unified Word type
6810
+ */
6811
+ private mapWord;
6812
+ /**
6813
+ * Convert Gladia UtteranceDTO to unified Utterance type
6814
+ */
6815
+ private mapUtterance;
6771
6816
  /**
6772
6817
  * Check if payload matches Gladia webhook format
6818
+ *
6819
+ * Gladia callbacks have the structure:
6820
+ * - { id, event: "transcription.success", payload: TranscriptionResultDTO, custom_metadata? }
6821
+ * - { id, event: "transcription.error", error: ErrorDTO, custom_metadata? }
6773
6822
  */
6774
6823
  matches(payload: unknown, _options?: {
6775
6824
  queryParams?: Record<string, string>;
@@ -9584,20 +9633,6 @@ interface RealtimeProcessingConfig {
9584
9633
  sentiment_analysis?: boolean;
9585
9634
  }
9586
9635
 
9587
- /**
9588
- * Generated by orval v7.9.0 🍺
9589
- * Do not edit manually.
9590
- * Gladia Control API
9591
- * OpenAPI spec version: 1.0
9592
- */
9593
- /**
9594
- * The model used to process the audio. "solaria-1" is used by default.
9595
- */
9596
- type StreamingSupportedModels = (typeof StreamingSupportedModels)[keyof typeof StreamingSupportedModels];
9597
- declare const StreamingSupportedModels: {
9598
- readonly "solaria-1": "solaria-1";
9599
- };
9600
-
9601
9636
  /**
9602
9637
  * Generated by orval v7.9.0 🍺
9603
9638
  * Do not edit manually.
@@ -12558,4 +12593,4 @@ declare namespace index {
12558
12593
  export { index_AudioIntelligenceModelStatus as AudioIntelligenceModelStatus, type index_AutoHighlightResult as AutoHighlightResult, type index_AutoHighlightsResult as AutoHighlightsResult, type index_BadRequestResponse as BadRequestResponse, type index_CannotAccessUploadedFileResponse as CannotAccessUploadedFileResponse, type index_Chapter as Chapter, type index_ContentSafetyLabel as ContentSafetyLabel, type index_ContentSafetyLabelResult as ContentSafetyLabelResult, type index_ContentSafetyLabelsResult as ContentSafetyLabelsResult, type index_ContentSafetyLabelsResultSeverityScoreSummary as ContentSafetyLabelsResultSeverityScoreSummary, type index_ContentSafetyLabelsResultSummary as ContentSafetyLabelsResultSummary, type index_CreateRealtimeTemporaryTokenParams as CreateRealtimeTemporaryTokenParams, type index_Entity as Entity, index_EntityType as EntityType, type Error$1 as Error, type index_GatewayTimeoutResponse as GatewayTimeoutResponse, type index_GetSubtitlesParams as GetSubtitlesParams, type index_InternalServerErrorResponse as InternalServerErrorResponse, type index_LemurActionItemsParams as LemurActionItemsParams, type index_LemurActionItemsParamsAllOf as LemurActionItemsParamsAllOf, type index_LemurActionItemsResponse as LemurActionItemsResponse, type index_LemurBaseParams as LemurBaseParams, type index_LemurBaseParamsContext as LemurBaseParamsContext, type index_LemurBaseParamsContextOneOf as LemurBaseParamsContextOneOf, type index_LemurBaseParamsFinalModel as LemurBaseParamsFinalModel, type index_LemurBaseResponse as LemurBaseResponse, index_LemurModel as LemurModel, type index_LemurQuestion as LemurQuestion, type index_LemurQuestionAnswer as LemurQuestionAnswer, type index_LemurQuestionAnswerParams as LemurQuestionAnswerParams, type index_LemurQuestionAnswerParamsAllOf as LemurQuestionAnswerParamsAllOf, type index_LemurQuestionAnswerResponse as LemurQuestionAnswerResponse, type index_LemurQuestionAnswerResponseAllOf as LemurQuestionAnswerResponseAllOf, type index_LemurQuestionContext as LemurQuestionContext, type index_LemurQuestionContextOneOf as LemurQuestionContextOneOf, type index_LemurResponse as LemurResponse, type index_LemurStringResponse as LemurStringResponse, type index_LemurStringResponseAllOf as LemurStringResponseAllOf, type index_LemurSummaryParams as LemurSummaryParams, type index_LemurSummaryParamsAllOf as LemurSummaryParamsAllOf, type index_LemurSummaryResponse as LemurSummaryResponse, type index_LemurTaskParams as LemurTaskParams, type index_LemurTaskParamsAllOf as LemurTaskParamsAllOf, type index_LemurTaskResponse as LemurTaskResponse, type index_LemurUsage as LemurUsage, type index_ListTranscriptParams as ListTranscriptParams, type index_ListTranscriptsParams as ListTranscriptsParams, type index_NotFoundResponse as NotFoundResponse, type index_PageDetails as PageDetails, type index_PageDetailsNextUrl as PageDetailsNextUrl, type index_PageDetailsPrevUrl as PageDetailsPrevUrl, type index_ParagraphsResponse as ParagraphsResponse, index_PiiPolicy as PiiPolicy, type index_PurgeLemurRequestDataResponse as PurgeLemurRequestDataResponse, type index_RealtimeTemporaryTokenResponse as RealtimeTemporaryTokenResponse, index_RedactPiiAudioQuality as RedactPiiAudioQuality, type index_RedactedAudioNotification as RedactedAudioNotification, type index_RedactedAudioResponse as RedactedAudioResponse, index_RedactedAudioStatus as RedactedAudioStatus, type index_SentencesResponse as SentencesResponse, index_Sentiment as Sentiment, type SentimentAnalysisResult$1 as SentimentAnalysisResult, type index_SentimentAnalysisResultChannel as SentimentAnalysisResultChannel, type index_SentimentAnalysisResultSpeaker as SentimentAnalysisResultSpeaker, type index_ServiceUnavailableResponse as ServiceUnavailableResponse, type index_SeverityScoreSummary as SeverityScoreSummary, index_SpeechModel as SpeechModel, index_SubstitutionPolicy as SubstitutionPolicy, index_SubtitleFormat as SubtitleFormat, index_SummaryModel as SummaryModel, index_SummaryType as SummaryType, type index_Timestamp as Timestamp, type index_TooManyRequestsResponse as TooManyRequestsResponse, type index_TopicDetectionModelResult as TopicDetectionModelResult, type index_TopicDetectionModelResultSummary as TopicDetectionModelResultSummary, type index_TopicDetectionResult as TopicDetectionResult, type index_TopicDetectionResultLabelsItem as TopicDetectionResultLabelsItem, type index_Transcript as Transcript, type index_TranscriptAudioDuration as TranscriptAudioDuration, type index_TranscriptAudioEndAt as TranscriptAudioEndAt, type index_TranscriptAudioStartFrom as TranscriptAudioStartFrom, type index_TranscriptAutoChapters as TranscriptAutoChapters, type index_TranscriptAutoHighlightsResult as TranscriptAutoHighlightsResult, index_TranscriptBoostParam as TranscriptBoostParam, type index_TranscriptBoostParamProperty as TranscriptBoostParamProperty, type index_TranscriptChapters as TranscriptChapters, type index_TranscriptConfidence as TranscriptConfidence, type index_TranscriptContentSafety as TranscriptContentSafety, type index_TranscriptContentSafetyLabels as TranscriptContentSafetyLabels, type index_TranscriptCustomSpelling as TranscriptCustomSpelling, type index_TranscriptCustomSpellingProperty as TranscriptCustomSpellingProperty, type index_TranscriptCustomTopics as TranscriptCustomTopics, type index_TranscriptDisfluencies as TranscriptDisfluencies, type index_TranscriptEntities as TranscriptEntities, type index_TranscriptEntityDetection as TranscriptEntityDetection, type index_TranscriptFilterProfanity as TranscriptFilterProfanity, type index_TranscriptFormatText as TranscriptFormatText, type index_TranscriptIabCategories as TranscriptIabCategories, type index_TranscriptIabCategoriesResult as TranscriptIabCategoriesResult, index_TranscriptLanguageCode as TranscriptLanguageCode, type index_TranscriptLanguageCodeProperty as TranscriptLanguageCodeProperty, type index_TranscriptLanguageConfidence as TranscriptLanguageConfidence, type index_TranscriptLanguageConfidenceThreshold as TranscriptLanguageConfidenceThreshold, type index_TranscriptLanguageDetection as TranscriptLanguageDetection, type index_TranscriptList as TranscriptList, type index_TranscriptListItem as TranscriptListItem, type index_TranscriptListItemCompleted as TranscriptListItemCompleted, type index_TranscriptListItemError as TranscriptListItemError, type index_TranscriptMultichannel as TranscriptMultichannel, type index_TranscriptOptionalParams as TranscriptOptionalParams, type index_TranscriptOptionalParamsLanguageCode as TranscriptOptionalParamsLanguageCode, type index_TranscriptOptionalParamsLanguageCodeOneOf as TranscriptOptionalParamsLanguageCodeOneOf, type index_TranscriptOptionalParamsRedactPiiSub as TranscriptOptionalParamsRedactPiiSub, type index_TranscriptOptionalParamsSpeakersExpected as TranscriptOptionalParamsSpeakersExpected, type index_TranscriptOptionalParamsSpeechModel as TranscriptOptionalParamsSpeechModel, type index_TranscriptOptionalParamsSpeechThreshold as TranscriptOptionalParamsSpeechThreshold, type index_TranscriptOptionalParamsWebhookAuthHeaderName as TranscriptOptionalParamsWebhookAuthHeaderName, type index_TranscriptOptionalParamsWebhookAuthHeaderValue as TranscriptOptionalParamsWebhookAuthHeaderValue, type index_TranscriptParagraph as TranscriptParagraph, type index_TranscriptParams as TranscriptParams, type index_TranscriptParamsAllOf as TranscriptParamsAllOf, type index_TranscriptPunctuate as TranscriptPunctuate, type index_TranscriptReadyNotification as TranscriptReadyNotification, index_TranscriptReadyStatus as TranscriptReadyStatus, type index_TranscriptRedactPiiAudio as TranscriptRedactPiiAudio, type index_TranscriptRedactPiiAudioQuality as TranscriptRedactPiiAudioQuality, type index_TranscriptRedactPiiPolicies as TranscriptRedactPiiPolicies, type index_TranscriptSentence as TranscriptSentence, type index_TranscriptSentenceChannel as TranscriptSentenceChannel, type index_TranscriptSentenceSpeaker as TranscriptSentenceSpeaker, type index_TranscriptSentimentAnalysis as TranscriptSentimentAnalysis, type index_TranscriptSentimentAnalysisResults as TranscriptSentimentAnalysisResults, type index_TranscriptSpeakerLabels as TranscriptSpeakerLabels, type index_TranscriptSpeakersExpected as TranscriptSpeakersExpected, type index_TranscriptSpeechModel as TranscriptSpeechModel, type index_TranscriptSpeechThreshold as TranscriptSpeechThreshold, type index_TranscriptSpeedBoost as TranscriptSpeedBoost, index_TranscriptStatus as TranscriptStatus, type index_TranscriptSummary as TranscriptSummary, type index_TranscriptSummaryModel as TranscriptSummaryModel, type index_TranscriptSummaryType as TranscriptSummaryType, type index_TranscriptText as TranscriptText, type index_TranscriptThrottled as TranscriptThrottled, type index_TranscriptUtterance as TranscriptUtterance, type index_TranscriptUtteranceChannel as TranscriptUtteranceChannel, type index_TranscriptUtterances as TranscriptUtterances, type index_TranscriptWebhookAuthHeaderName as TranscriptWebhookAuthHeaderName, type index_TranscriptWebhookNotification as TranscriptWebhookNotification, type index_TranscriptWebhookStatusCode as TranscriptWebhookStatusCode, type index_TranscriptWebhookUrl as TranscriptWebhookUrl, type index_TranscriptWord as TranscriptWord, type index_TranscriptWordChannel as TranscriptWordChannel, type index_TranscriptWordSpeaker as TranscriptWordSpeaker, type index_TranscriptWords as TranscriptWords, type index_UnauthorizedResponse as UnauthorizedResponse, type index_UploadedFile as UploadedFile, type index_WordSearchMatch as WordSearchMatch, type index_WordSearchParams as WordSearchParams, type index_WordSearchResponse as WordSearchResponse, type index_WordSearchTimestamp as WordSearchTimestamp };
12559
12594
  }
12560
12595
 
12561
- export { AssemblyAIAdapter, type AssemblyAIStreamingOptions, index as AssemblyAITypes, AssemblyAIWebhookHandler, type AudioChunk, type AudioInput, AudioResponseFormat, AudioTranscriptionModel, AzureSTTAdapter, AzureWebhookHandler, BaseAdapter, BaseWebhookHandler, type BatchOnlyProvider, DeepgramAdapter, type DeepgramStreamingOptions, DeepgramWebhookHandler, GladiaAdapter, type GladiaStreamingOptions, index$1 as GladiaTypes, GladiaWebhookHandler, ListenV1EncodingParameter, type ListenV1LanguageParameter, type ListenV1ModelParameter, type ListenV1VersionParameter, OpenAIWhisperAdapter, type ProviderCapabilities, type ProviderConfig, type ProviderRawResponseMap, type ProviderStreamingOptions, type SessionStatus, SpeakV1ContainerParameter, SpeakV1EncodingParameter, SpeakV1SampleRateParameter, type Speaker, SpeechmaticsAdapter, SpeechmaticsWebhookHandler, type StreamEvent, type StreamEventType, type StreamingCallbacks, type StreamingOptions, type StreamingOptionsForProvider, type StreamingProvider, type StreamingSession, StreamingSupportedBitDepthEnum, StreamingSupportedEncodingEnum, StreamingSupportedSampleRateEnum, type TranscribeOptions, type TranscribeStreamParams, type TranscriptionAdapter, type TranscriptionProvider, type TranscriptionStatus, type UnifiedTranscriptResponse, type UnifiedWebhookEvent, type Utterance, VoiceRouter, type VoiceRouterConfig, type WebhookEventType, WebhookRouter, type WebhookRouterOptions, type WebhookRouterResult, type WebhookValidation, type WebhookVerificationOptions, type Word, createAssemblyAIAdapter, createAssemblyAIWebhookHandler, createAzureSTTAdapter, createAzureWebhookHandler, createDeepgramAdapter, createDeepgramWebhookHandler, createGladiaAdapter, createGladiaWebhookHandler, createOpenAIWhisperAdapter, createSpeechmaticsAdapter, createVoiceRouter, createWebhookRouter };
12596
+ export { AssemblyAIAdapter, type AssemblyAIStreamingOptions, index as AssemblyAITypes, AssemblyAIWebhookHandler, type AudioChunk, type AudioInput, AudioResponseFormat, AudioTranscriptionModel, AzureSTTAdapter, AzureWebhookHandler, BaseAdapter, BaseWebhookHandler, type BatchOnlyProvider, DeepgramAdapter, type DeepgramStreamingOptions, DeepgramWebhookHandler, GladiaAdapter, type GladiaStreamingOptions, index$1 as GladiaTypes, GladiaWebhookHandler, ListenV1EncodingParameter, type ListenV1LanguageParameter, type ListenV1ModelParameter, type ListenV1VersionParameter, OpenAIWhisperAdapter, type ProviderCapabilities, type ProviderConfig, type ProviderRawResponseMap, type ProviderStreamingOptions, type SessionStatus, SpeakV1ContainerParameter, SpeakV1EncodingParameter, SpeakV1SampleRateParameter, type Speaker, SpeechmaticsAdapter, SpeechmaticsWebhookHandler, type StreamEvent, type StreamEventType, type StreamingCallbacks, type StreamingOptions, type StreamingOptionsForProvider, type StreamingProvider, type StreamingSession, StreamingSupportedBitDepthEnum, StreamingSupportedEncodingEnum, StreamingSupportedSampleRateEnum, type TranscribeOptions, type TranscribeStreamParams, type TranscriptionAdapter, type TranscriptionModel, type TranscriptionProvider, type TranscriptionStatus, type UnifiedTranscriptResponse, type UnifiedWebhookEvent, type Utterance, VoiceRouter, type VoiceRouterConfig, type WebhookEventType, WebhookRouter, type WebhookRouterOptions, type WebhookRouterResult, type WebhookValidation, type WebhookVerificationOptions, type Word, createAssemblyAIAdapter, createAssemblyAIWebhookHandler, createAzureSTTAdapter, createAzureWebhookHandler, createDeepgramAdapter, createDeepgramWebhookHandler, createGladiaAdapter, createGladiaWebhookHandler, createOpenAIWhisperAdapter, createSpeechmaticsAdapter, createVoiceRouter, createWebhookRouter };
package/dist/index.d.ts CHANGED
@@ -4349,11 +4349,45 @@ interface Transcription {
4349
4349
  readonly createdDateTime?: string;
4350
4350
  }
4351
4351
 
4352
+ /**
4353
+ * Generated by orval v7.9.0 🍺
4354
+ * Do not edit manually.
4355
+ * Deepgram API Specification
4356
+ * APIs for speech-to-text transcription, text-to-speech synthesis, language understanding, and account management.
4357
+
4358
+ * OpenAPI spec version: 1.0.0
4359
+ */
4360
+ type ListenV1ModelParameter = "nova-3" | "nova-3-general" | "nova-3-medical" | "nova-2" | "nova-2-general" | "nova-2-meeting" | "nova-2-finance" | "nova-2-conversationalai" | "nova-2-voicemail" | "nova-2-video" | "nova-2-medical" | "nova-2-drivethru" | "nova-2-automotive" | "nova" | "nova-general" | "nova-phonecall" | "nova-medical" | "enhanced" | "enhanced-general" | "enhanced-meeting" | "enhanced-phonecall" | "enhanced-finance" | "base" | "meeting" | "phonecall" | "finance" | "conversationalai" | "voicemail" | "video" | string;
4361
+
4362
+ /**
4363
+ * Generated by orval v7.9.0 🍺
4364
+ * Do not edit manually.
4365
+ * Gladia Control API
4366
+ * OpenAPI spec version: 1.0
4367
+ */
4368
+ /**
4369
+ * The model used to process the audio. "solaria-1" is used by default.
4370
+ */
4371
+ type StreamingSupportedModels = (typeof StreamingSupportedModels)[keyof typeof StreamingSupportedModels];
4372
+ declare const StreamingSupportedModels: {
4373
+ readonly "solaria-1": "solaria-1";
4374
+ };
4375
+
4352
4376
  /**
4353
4377
  * Unified types for the Voice Router SDK
4354
4378
  * These types provide a provider-agnostic interface for transcription services
4355
4379
  */
4356
4380
 
4381
+ /**
4382
+ * Unified transcription model type with autocomplete for all providers
4383
+ *
4384
+ * Includes all known models from:
4385
+ * - Deepgram: nova-3, nova-2, enhanced, base, whisper, etc.
4386
+ * - Gladia: solaria-1
4387
+ *
4388
+ * Also accepts any string for future/custom models.
4389
+ */
4390
+ type TranscriptionModel = ListenV1ModelParameter | StreamingSupportedModels;
4357
4391
  /**
4358
4392
  * Supported transcription providers
4359
4393
  */
@@ -4656,6 +4690,19 @@ interface StreamingOptions extends Omit<TranscribeOptions, "webhookUrl"> {
4656
4690
  endpointing?: number;
4657
4691
  /** Maximum duration without endpointing in seconds */
4658
4692
  maxSilence?: number;
4693
+ /**
4694
+ * Model to use for transcription (provider-specific)
4695
+ *
4696
+ * Type-safe with autocomplete for all known models:
4697
+ * - Deepgram: 'nova-2', 'nova-3', 'base', 'enhanced', 'whisper-large', etc.
4698
+ * - Gladia: 'solaria-1' (default)
4699
+ * - AssemblyAI: Not applicable (uses Universal-2 automatically)
4700
+ *
4701
+ * @example
4702
+ * // Use Nova-2 for better multilingual support
4703
+ * { model: 'nova-2', language: 'fr' }
4704
+ */
4705
+ model?: TranscriptionModel;
4659
4706
  }
4660
4707
  /**
4661
4708
  * Callback functions for streaming events
@@ -5004,16 +5051,6 @@ declare const ListenV1EncodingParameter: {
5004
5051
  */
5005
5052
  type ListenV1LanguageParameter = string;
5006
5053
 
5007
- /**
5008
- * Generated by orval v7.9.0 🍺
5009
- * Do not edit manually.
5010
- * Deepgram API Specification
5011
- * APIs for speech-to-text transcription, text-to-speech synthesis, language understanding, and account management.
5012
-
5013
- * OpenAPI spec version: 1.0.0
5014
- */
5015
- type ListenV1ModelParameter = "nova-3" | "nova-3-general" | "nova-3-medical" | "nova-2" | "nova-2-general" | "nova-2-meeting" | "nova-2-finance" | "nova-2-conversationalai" | "nova-2-voicemail" | "nova-2-video" | "nova-2-medical" | "nova-2-drivethru" | "nova-2-automotive" | "nova" | "nova-general" | "nova-phonecall" | "nova-medical" | "enhanced" | "enhanced-general" | "enhanced-meeting" | "enhanced-phonecall" | "enhanced-finance" | "base" | "meeting" | "phonecall" | "finance" | "conversationalai" | "voicemail" | "video" | string;
5016
-
5017
5054
  /**
5018
5055
  * Generated by orval v7.9.0 🍺
5019
5056
  * Do not edit manually.
@@ -6740,8 +6777,7 @@ declare abstract class BaseWebhookHandler {
6740
6777
  * Gladia webhook handler
6741
6778
  *
6742
6779
  * Handles webhook callbacks from Gladia API:
6743
- * - transcription.created - Job created and queued
6744
- * - transcription.success - Job completed successfully
6780
+ * - transcription.success - Job completed successfully (includes full transcript)
6745
6781
  * - transcription.error - Job failed with error
6746
6782
  *
6747
6783
  * @example
@@ -6763,13 +6799,26 @@ declare abstract class BaseWebhookHandler {
6763
6799
  *
6764
6800
  * if (event.eventType === 'transcription.completed') {
6765
6801
  * console.log('Transcript:', event.data?.text);
6802
+ * console.log('Utterances:', event.data?.utterances);
6766
6803
  * }
6767
6804
  * ```
6768
6805
  */
6769
6806
  declare class GladiaWebhookHandler extends BaseWebhookHandler {
6770
6807
  readonly provider: TranscriptionProvider;
6808
+ /**
6809
+ * Convert Gladia WordDTO to unified Word type
6810
+ */
6811
+ private mapWord;
6812
+ /**
6813
+ * Convert Gladia UtteranceDTO to unified Utterance type
6814
+ */
6815
+ private mapUtterance;
6771
6816
  /**
6772
6817
  * Check if payload matches Gladia webhook format
6818
+ *
6819
+ * Gladia callbacks have the structure:
6820
+ * - { id, event: "transcription.success", payload: TranscriptionResultDTO, custom_metadata? }
6821
+ * - { id, event: "transcription.error", error: ErrorDTO, custom_metadata? }
6773
6822
  */
6774
6823
  matches(payload: unknown, _options?: {
6775
6824
  queryParams?: Record<string, string>;
@@ -9584,20 +9633,6 @@ interface RealtimeProcessingConfig {
9584
9633
  sentiment_analysis?: boolean;
9585
9634
  }
9586
9635
 
9587
- /**
9588
- * Generated by orval v7.9.0 🍺
9589
- * Do not edit manually.
9590
- * Gladia Control API
9591
- * OpenAPI spec version: 1.0
9592
- */
9593
- /**
9594
- * The model used to process the audio. "solaria-1" is used by default.
9595
- */
9596
- type StreamingSupportedModels = (typeof StreamingSupportedModels)[keyof typeof StreamingSupportedModels];
9597
- declare const StreamingSupportedModels: {
9598
- readonly "solaria-1": "solaria-1";
9599
- };
9600
-
9601
9636
  /**
9602
9637
  * Generated by orval v7.9.0 🍺
9603
9638
  * Do not edit manually.
@@ -12558,4 +12593,4 @@ declare namespace index {
12558
12593
  export { index_AudioIntelligenceModelStatus as AudioIntelligenceModelStatus, type index_AutoHighlightResult as AutoHighlightResult, type index_AutoHighlightsResult as AutoHighlightsResult, type index_BadRequestResponse as BadRequestResponse, type index_CannotAccessUploadedFileResponse as CannotAccessUploadedFileResponse, type index_Chapter as Chapter, type index_ContentSafetyLabel as ContentSafetyLabel, type index_ContentSafetyLabelResult as ContentSafetyLabelResult, type index_ContentSafetyLabelsResult as ContentSafetyLabelsResult, type index_ContentSafetyLabelsResultSeverityScoreSummary as ContentSafetyLabelsResultSeverityScoreSummary, type index_ContentSafetyLabelsResultSummary as ContentSafetyLabelsResultSummary, type index_CreateRealtimeTemporaryTokenParams as CreateRealtimeTemporaryTokenParams, type index_Entity as Entity, index_EntityType as EntityType, type Error$1 as Error, type index_GatewayTimeoutResponse as GatewayTimeoutResponse, type index_GetSubtitlesParams as GetSubtitlesParams, type index_InternalServerErrorResponse as InternalServerErrorResponse, type index_LemurActionItemsParams as LemurActionItemsParams, type index_LemurActionItemsParamsAllOf as LemurActionItemsParamsAllOf, type index_LemurActionItemsResponse as LemurActionItemsResponse, type index_LemurBaseParams as LemurBaseParams, type index_LemurBaseParamsContext as LemurBaseParamsContext, type index_LemurBaseParamsContextOneOf as LemurBaseParamsContextOneOf, type index_LemurBaseParamsFinalModel as LemurBaseParamsFinalModel, type index_LemurBaseResponse as LemurBaseResponse, index_LemurModel as LemurModel, type index_LemurQuestion as LemurQuestion, type index_LemurQuestionAnswer as LemurQuestionAnswer, type index_LemurQuestionAnswerParams as LemurQuestionAnswerParams, type index_LemurQuestionAnswerParamsAllOf as LemurQuestionAnswerParamsAllOf, type index_LemurQuestionAnswerResponse as LemurQuestionAnswerResponse, type index_LemurQuestionAnswerResponseAllOf as LemurQuestionAnswerResponseAllOf, type index_LemurQuestionContext as LemurQuestionContext, type index_LemurQuestionContextOneOf as LemurQuestionContextOneOf, type index_LemurResponse as LemurResponse, type index_LemurStringResponse as LemurStringResponse, type index_LemurStringResponseAllOf as LemurStringResponseAllOf, type index_LemurSummaryParams as LemurSummaryParams, type index_LemurSummaryParamsAllOf as LemurSummaryParamsAllOf, type index_LemurSummaryResponse as LemurSummaryResponse, type index_LemurTaskParams as LemurTaskParams, type index_LemurTaskParamsAllOf as LemurTaskParamsAllOf, type index_LemurTaskResponse as LemurTaskResponse, type index_LemurUsage as LemurUsage, type index_ListTranscriptParams as ListTranscriptParams, type index_ListTranscriptsParams as ListTranscriptsParams, type index_NotFoundResponse as NotFoundResponse, type index_PageDetails as PageDetails, type index_PageDetailsNextUrl as PageDetailsNextUrl, type index_PageDetailsPrevUrl as PageDetailsPrevUrl, type index_ParagraphsResponse as ParagraphsResponse, index_PiiPolicy as PiiPolicy, type index_PurgeLemurRequestDataResponse as PurgeLemurRequestDataResponse, type index_RealtimeTemporaryTokenResponse as RealtimeTemporaryTokenResponse, index_RedactPiiAudioQuality as RedactPiiAudioQuality, type index_RedactedAudioNotification as RedactedAudioNotification, type index_RedactedAudioResponse as RedactedAudioResponse, index_RedactedAudioStatus as RedactedAudioStatus, type index_SentencesResponse as SentencesResponse, index_Sentiment as Sentiment, type SentimentAnalysisResult$1 as SentimentAnalysisResult, type index_SentimentAnalysisResultChannel as SentimentAnalysisResultChannel, type index_SentimentAnalysisResultSpeaker as SentimentAnalysisResultSpeaker, type index_ServiceUnavailableResponse as ServiceUnavailableResponse, type index_SeverityScoreSummary as SeverityScoreSummary, index_SpeechModel as SpeechModel, index_SubstitutionPolicy as SubstitutionPolicy, index_SubtitleFormat as SubtitleFormat, index_SummaryModel as SummaryModel, index_SummaryType as SummaryType, type index_Timestamp as Timestamp, type index_TooManyRequestsResponse as TooManyRequestsResponse, type index_TopicDetectionModelResult as TopicDetectionModelResult, type index_TopicDetectionModelResultSummary as TopicDetectionModelResultSummary, type index_TopicDetectionResult as TopicDetectionResult, type index_TopicDetectionResultLabelsItem as TopicDetectionResultLabelsItem, type index_Transcript as Transcript, type index_TranscriptAudioDuration as TranscriptAudioDuration, type index_TranscriptAudioEndAt as TranscriptAudioEndAt, type index_TranscriptAudioStartFrom as TranscriptAudioStartFrom, type index_TranscriptAutoChapters as TranscriptAutoChapters, type index_TranscriptAutoHighlightsResult as TranscriptAutoHighlightsResult, index_TranscriptBoostParam as TranscriptBoostParam, type index_TranscriptBoostParamProperty as TranscriptBoostParamProperty, type index_TranscriptChapters as TranscriptChapters, type index_TranscriptConfidence as TranscriptConfidence, type index_TranscriptContentSafety as TranscriptContentSafety, type index_TranscriptContentSafetyLabels as TranscriptContentSafetyLabels, type index_TranscriptCustomSpelling as TranscriptCustomSpelling, type index_TranscriptCustomSpellingProperty as TranscriptCustomSpellingProperty, type index_TranscriptCustomTopics as TranscriptCustomTopics, type index_TranscriptDisfluencies as TranscriptDisfluencies, type index_TranscriptEntities as TranscriptEntities, type index_TranscriptEntityDetection as TranscriptEntityDetection, type index_TranscriptFilterProfanity as TranscriptFilterProfanity, type index_TranscriptFormatText as TranscriptFormatText, type index_TranscriptIabCategories as TranscriptIabCategories, type index_TranscriptIabCategoriesResult as TranscriptIabCategoriesResult, index_TranscriptLanguageCode as TranscriptLanguageCode, type index_TranscriptLanguageCodeProperty as TranscriptLanguageCodeProperty, type index_TranscriptLanguageConfidence as TranscriptLanguageConfidence, type index_TranscriptLanguageConfidenceThreshold as TranscriptLanguageConfidenceThreshold, type index_TranscriptLanguageDetection as TranscriptLanguageDetection, type index_TranscriptList as TranscriptList, type index_TranscriptListItem as TranscriptListItem, type index_TranscriptListItemCompleted as TranscriptListItemCompleted, type index_TranscriptListItemError as TranscriptListItemError, type index_TranscriptMultichannel as TranscriptMultichannel, type index_TranscriptOptionalParams as TranscriptOptionalParams, type index_TranscriptOptionalParamsLanguageCode as TranscriptOptionalParamsLanguageCode, type index_TranscriptOptionalParamsLanguageCodeOneOf as TranscriptOptionalParamsLanguageCodeOneOf, type index_TranscriptOptionalParamsRedactPiiSub as TranscriptOptionalParamsRedactPiiSub, type index_TranscriptOptionalParamsSpeakersExpected as TranscriptOptionalParamsSpeakersExpected, type index_TranscriptOptionalParamsSpeechModel as TranscriptOptionalParamsSpeechModel, type index_TranscriptOptionalParamsSpeechThreshold as TranscriptOptionalParamsSpeechThreshold, type index_TranscriptOptionalParamsWebhookAuthHeaderName as TranscriptOptionalParamsWebhookAuthHeaderName, type index_TranscriptOptionalParamsWebhookAuthHeaderValue as TranscriptOptionalParamsWebhookAuthHeaderValue, type index_TranscriptParagraph as TranscriptParagraph, type index_TranscriptParams as TranscriptParams, type index_TranscriptParamsAllOf as TranscriptParamsAllOf, type index_TranscriptPunctuate as TranscriptPunctuate, type index_TranscriptReadyNotification as TranscriptReadyNotification, index_TranscriptReadyStatus as TranscriptReadyStatus, type index_TranscriptRedactPiiAudio as TranscriptRedactPiiAudio, type index_TranscriptRedactPiiAudioQuality as TranscriptRedactPiiAudioQuality, type index_TranscriptRedactPiiPolicies as TranscriptRedactPiiPolicies, type index_TranscriptSentence as TranscriptSentence, type index_TranscriptSentenceChannel as TranscriptSentenceChannel, type index_TranscriptSentenceSpeaker as TranscriptSentenceSpeaker, type index_TranscriptSentimentAnalysis as TranscriptSentimentAnalysis, type index_TranscriptSentimentAnalysisResults as TranscriptSentimentAnalysisResults, type index_TranscriptSpeakerLabels as TranscriptSpeakerLabels, type index_TranscriptSpeakersExpected as TranscriptSpeakersExpected, type index_TranscriptSpeechModel as TranscriptSpeechModel, type index_TranscriptSpeechThreshold as TranscriptSpeechThreshold, type index_TranscriptSpeedBoost as TranscriptSpeedBoost, index_TranscriptStatus as TranscriptStatus, type index_TranscriptSummary as TranscriptSummary, type index_TranscriptSummaryModel as TranscriptSummaryModel, type index_TranscriptSummaryType as TranscriptSummaryType, type index_TranscriptText as TranscriptText, type index_TranscriptThrottled as TranscriptThrottled, type index_TranscriptUtterance as TranscriptUtterance, type index_TranscriptUtteranceChannel as TranscriptUtteranceChannel, type index_TranscriptUtterances as TranscriptUtterances, type index_TranscriptWebhookAuthHeaderName as TranscriptWebhookAuthHeaderName, type index_TranscriptWebhookNotification as TranscriptWebhookNotification, type index_TranscriptWebhookStatusCode as TranscriptWebhookStatusCode, type index_TranscriptWebhookUrl as TranscriptWebhookUrl, type index_TranscriptWord as TranscriptWord, type index_TranscriptWordChannel as TranscriptWordChannel, type index_TranscriptWordSpeaker as TranscriptWordSpeaker, type index_TranscriptWords as TranscriptWords, type index_UnauthorizedResponse as UnauthorizedResponse, type index_UploadedFile as UploadedFile, type index_WordSearchMatch as WordSearchMatch, type index_WordSearchParams as WordSearchParams, type index_WordSearchResponse as WordSearchResponse, type index_WordSearchTimestamp as WordSearchTimestamp };
12559
12594
  }
12560
12595
 
12561
- export { AssemblyAIAdapter, type AssemblyAIStreamingOptions, index as AssemblyAITypes, AssemblyAIWebhookHandler, type AudioChunk, type AudioInput, AudioResponseFormat, AudioTranscriptionModel, AzureSTTAdapter, AzureWebhookHandler, BaseAdapter, BaseWebhookHandler, type BatchOnlyProvider, DeepgramAdapter, type DeepgramStreamingOptions, DeepgramWebhookHandler, GladiaAdapter, type GladiaStreamingOptions, index$1 as GladiaTypes, GladiaWebhookHandler, ListenV1EncodingParameter, type ListenV1LanguageParameter, type ListenV1ModelParameter, type ListenV1VersionParameter, OpenAIWhisperAdapter, type ProviderCapabilities, type ProviderConfig, type ProviderRawResponseMap, type ProviderStreamingOptions, type SessionStatus, SpeakV1ContainerParameter, SpeakV1EncodingParameter, SpeakV1SampleRateParameter, type Speaker, SpeechmaticsAdapter, SpeechmaticsWebhookHandler, type StreamEvent, type StreamEventType, type StreamingCallbacks, type StreamingOptions, type StreamingOptionsForProvider, type StreamingProvider, type StreamingSession, StreamingSupportedBitDepthEnum, StreamingSupportedEncodingEnum, StreamingSupportedSampleRateEnum, type TranscribeOptions, type TranscribeStreamParams, type TranscriptionAdapter, type TranscriptionProvider, type TranscriptionStatus, type UnifiedTranscriptResponse, type UnifiedWebhookEvent, type Utterance, VoiceRouter, type VoiceRouterConfig, type WebhookEventType, WebhookRouter, type WebhookRouterOptions, type WebhookRouterResult, type WebhookValidation, type WebhookVerificationOptions, type Word, createAssemblyAIAdapter, createAssemblyAIWebhookHandler, createAzureSTTAdapter, createAzureWebhookHandler, createDeepgramAdapter, createDeepgramWebhookHandler, createGladiaAdapter, createGladiaWebhookHandler, createOpenAIWhisperAdapter, createSpeechmaticsAdapter, createVoiceRouter, createWebhookRouter };
12596
+ export { AssemblyAIAdapter, type AssemblyAIStreamingOptions, index as AssemblyAITypes, AssemblyAIWebhookHandler, type AudioChunk, type AudioInput, AudioResponseFormat, AudioTranscriptionModel, AzureSTTAdapter, AzureWebhookHandler, BaseAdapter, BaseWebhookHandler, type BatchOnlyProvider, DeepgramAdapter, type DeepgramStreamingOptions, DeepgramWebhookHandler, GladiaAdapter, type GladiaStreamingOptions, index$1 as GladiaTypes, GladiaWebhookHandler, ListenV1EncodingParameter, type ListenV1LanguageParameter, type ListenV1ModelParameter, type ListenV1VersionParameter, OpenAIWhisperAdapter, type ProviderCapabilities, type ProviderConfig, type ProviderRawResponseMap, type ProviderStreamingOptions, type SessionStatus, SpeakV1ContainerParameter, SpeakV1EncodingParameter, SpeakV1SampleRateParameter, type Speaker, SpeechmaticsAdapter, SpeechmaticsWebhookHandler, type StreamEvent, type StreamEventType, type StreamingCallbacks, type StreamingOptions, type StreamingOptionsForProvider, type StreamingProvider, type StreamingSession, StreamingSupportedBitDepthEnum, StreamingSupportedEncodingEnum, StreamingSupportedSampleRateEnum, type TranscribeOptions, type TranscribeStreamParams, type TranscriptionAdapter, type TranscriptionModel, type TranscriptionProvider, type TranscriptionStatus, type UnifiedTranscriptResponse, type UnifiedWebhookEvent, type Utterance, VoiceRouter, type VoiceRouterConfig, type WebhookEventType, WebhookRouter, type WebhookRouterOptions, type WebhookRouterResult, type WebhookValidation, type WebhookVerificationOptions, type Word, createAssemblyAIAdapter, createAssemblyAIWebhookHandler, createAzureSTTAdapter, createAzureWebhookHandler, createDeepgramAdapter, createDeepgramWebhookHandler, createGladiaAdapter, createGladiaWebhookHandler, createOpenAIWhisperAdapter, createSpeechmaticsAdapter, createVoiceRouter, createWebhookRouter };
package/dist/index.js CHANGED
@@ -2106,7 +2106,8 @@ var GladiaAdapter = class extends BaseAdapter {
2106
2106
  encoding: options?.encoding ? mapEncodingToProvider(options.encoding, "gladia") : void 0,
2107
2107
  sample_rate: validatedSampleRate,
2108
2108
  channels: options?.channels,
2109
- endpointing: options?.endpointing
2109
+ endpointing: options?.endpointing,
2110
+ model: options?.model
2110
2111
  };
2111
2112
  if (options?.language) {
2112
2113
  streamingRequest.language_config = {
@@ -3368,6 +3369,7 @@ var DeepgramAdapter = class extends BaseAdapter {
3368
3369
  if (options?.sampleRate) params.append("sample_rate", options.sampleRate.toString());
3369
3370
  if (options?.channels) params.append("channels", options.channels.toString());
3370
3371
  if (options?.language) params.append("language", options.language);
3372
+ if (options?.model) params.append("model", options.model);
3371
3373
  if (options?.languageDetection) params.append("detect_language", "true");
3372
3374
  if (options?.diarization) params.append("diarize", "true");
3373
3375
  if (options?.interimResults) params.append("interim_results", "true");
@@ -4353,15 +4355,46 @@ var GladiaWebhookHandler = class extends BaseWebhookHandler {
4353
4355
  super(...arguments);
4354
4356
  this.provider = "gladia";
4355
4357
  }
4358
+ /**
4359
+ * Convert Gladia WordDTO to unified Word type
4360
+ */
4361
+ mapWord(word) {
4362
+ return {
4363
+ text: word.word,
4364
+ start: word.start,
4365
+ end: word.end,
4366
+ confidence: word.confidence
4367
+ };
4368
+ }
4369
+ /**
4370
+ * Convert Gladia UtteranceDTO to unified Utterance type
4371
+ */
4372
+ mapUtterance(utterance) {
4373
+ return {
4374
+ text: utterance.text,
4375
+ start: utterance.start,
4376
+ end: utterance.end,
4377
+ confidence: utterance.confidence,
4378
+ speaker: utterance.speaker !== void 0 ? String(utterance.speaker) : void 0,
4379
+ words: utterance.words?.map((w) => this.mapWord(w))
4380
+ };
4381
+ }
4356
4382
  /**
4357
4383
  * Check if payload matches Gladia webhook format
4384
+ *
4385
+ * Gladia callbacks have the structure:
4386
+ * - { id, event: "transcription.success", payload: TranscriptionResultDTO, custom_metadata? }
4387
+ * - { id, event: "transcription.error", error: ErrorDTO, custom_metadata? }
4358
4388
  */
4359
4389
  matches(payload, _options) {
4360
4390
  if (!payload || typeof payload !== "object") {
4361
4391
  return false;
4362
4392
  }
4363
4393
  const obj = payload;
4364
- if (!("event" in obj) || !("payload" in obj)) {
4394
+ if (!("id" in obj) || !("event" in obj)) {
4395
+ return false;
4396
+ }
4397
+ if (typeof obj.id !== "string") {
4365
4398
  return false;
4366
4399
  }
4367
4400
  if (typeof obj.event !== "string") {
@@ -4370,11 +4403,13 @@ var GladiaWebhookHandler = class extends BaseWebhookHandler {
4370
4403
  if (!obj.event.startsWith("transcription.")) {
4371
4404
  return false;
4372
4405
  }
4373
- if (!obj.payload || typeof obj.payload !== "object") {
4406
+ if (obj.event === "transcription.success" && !("payload" in obj)) {
4407
+ return false;
4408
+ }
4409
+ if (obj.event === "transcription.error" && !("error" in obj)) {
4374
4410
  return false;
4375
4411
  }
4376
- const payloadObj = obj.payload;
4377
- return typeof payloadObj.id === "string";
4412
+ return true;
4378
4413
  }
4379
4414
  /**
4380
4415
  * Parse Gladia webhook payload to unified format
@@ -4383,38 +4418,57 @@ var GladiaWebhookHandler = class extends BaseWebhookHandler {
4383
4418
  if (!this.matches(payload)) {
4384
4419
  return this.createErrorEvent(payload, "Invalid Gladia webhook payload");
4385
4420
  }
4386
- const webhookPayload = payload;
4387
- const jobId = webhookPayload.payload.id;
4388
- const event = webhookPayload.event;
4389
- if (event === "transcription.created") {
4390
- return {
4391
- success: true,
4392
- provider: this.provider,
4393
- eventType: "transcription.created",
4394
- data: {
4395
- id: jobId,
4396
- status: "queued"
4397
- },
4398
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
4399
- raw: payload
4400
- };
4401
- }
4421
+ const obj = payload;
4422
+ const jobId = obj.id;
4423
+ const event = obj.event;
4402
4424
  if (event === "transcription.success") {
4425
+ const successPayload = payload;
4426
+ const result = successPayload.payload;
4427
+ const transcription = result.transcription;
4428
+ const metadata = result.metadata;
4429
+ const utterances = transcription?.utterances?.map(
4430
+ (u) => this.mapUtterance(u)
4431
+ );
4432
+ const words = transcription?.utterances?.flatMap(
4433
+ (u) => u.words?.map((w) => this.mapWord(w)) ?? []
4434
+ );
4435
+ const speakerIds = /* @__PURE__ */ new Set();
4436
+ transcription?.utterances?.forEach((u) => {
4437
+ if (u.speaker !== void 0) {
4438
+ speakerIds.add(u.speaker);
4439
+ }
4440
+ });
4441
+ const speakers = speakerIds.size > 0 ? Array.from(speakerIds).map((id) => ({ id: String(id) })) : void 0;
4442
+ const summary = result.summarization?.success && result.summarization.results ? result.summarization.results : void 0;
4403
4443
  return {
4404
4444
  success: true,
4405
4445
  provider: this.provider,
4406
4446
  eventType: "transcription.completed",
4407
4447
  data: {
4408
4448
  id: jobId,
4409
- status: "completed"
4410
- // Note: Full transcript data needs to be fetched via API
4411
- // using GladiaAdapter.getTranscript(jobId)
4449
+ status: "completed",
4450
+ text: transcription?.full_transcript,
4451
+ duration: metadata?.audio_duration,
4452
+ language: transcription?.languages?.[0],
4453
+ speakers,
4454
+ words,
4455
+ utterances,
4456
+ summary,
4457
+ metadata: {
4458
+ transcription_time: metadata?.transcription_time,
4459
+ billing_time: metadata?.billing_time,
4460
+ number_of_distinct_channels: metadata?.number_of_distinct_channels,
4461
+ custom_metadata: successPayload.custom_metadata
4462
+ },
4463
+ completedAt: (/* @__PURE__ */ new Date()).toISOString()
4412
4464
  },
4413
4465
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
4414
4466
  raw: payload
4415
4467
  };
4416
4468
  }
4417
4469
  if (event === "transcription.error") {
4470
+ const errorPayload = payload;
4471
+ const error = errorPayload.error;
4418
4472
  return {
4419
4473
  success: false,
4420
4474
  provider: this.provider,
@@ -4422,7 +4476,11 @@ var GladiaWebhookHandler = class extends BaseWebhookHandler {
4422
4476
  data: {
4423
4477
  id: jobId,
4424
4478
  status: "error",
4425
- error: "Transcription failed"
4479
+ error: error?.message || "Transcription failed",
4480
+ metadata: {
4481
+ error_code: error?.code,
4482
+ custom_metadata: errorPayload.custom_metadata
4483
+ }
4426
4484
  },
4427
4485
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
4428
4486
  raw: payload