@@ -6,10 +6,7 @@ use golem_tts::{
66 AudioSample , Guest as AdvancedGuest , LanguageCode , LongFormOperation ,
77 PronunciationEntry , PronunciationLexicon , TtsError , Voice , VoiceDesignParams ,
88 } ,
9- synthesis:: {
10- Guest as SynthesisGuest , SynthesisOptions , SynthesisResult , TextInput , TimingInfo ,
11- ValidationResult ,
12- } ,
9+ synthesis:: { Guest as SynthesisGuest , SynthesisOptions , SynthesisResult , TextInput , TimingInfo , ValidationResult } ,
1310 voices:: { Guest as VoicesGuest , LanguageInfo , VoiceFilter } ,
1411 } ,
1512} ;
@@ -115,7 +112,8 @@ impl AdvancedGuest for DeepgramComponent {
115112 entries : Option < Vec < PronunciationEntry > > ,
116113 ) -> Result < PronunciationLexicon , TtsError > {
117114 let deepgram = Deepgram :: new ( ) ?;
118- deepgram. create_lexicon ( name, language, entries)
115+ let lexicon = deepgram. create_lexicon ( name, language, entries) ?;
116+ Ok ( PronunciationLexicon :: new ( lexicon) )
119117 }
120118
121119 #[ doc = " Long-form content synthesis with optimization (removed async)" ]
@@ -133,28 +131,6 @@ impl AdvancedGuest for DeepgramComponent {
133131 }
134132}
135133
136- impl ExtendedAdvancedTrait for DeepgramComponent {
137- fn unwrappered_created_lexicon (
138- name : String ,
139- language : LanguageCode ,
140- entries : Option < Vec < PronunciationEntry > > ,
141- ) -> Result < Self :: PronunciationLexicon , TtsError > {
142- let deepgram = Deepgram :: new ( ) ?;
143- deepgram. create_lexicon_unwrapped ( name, language, entries)
144- }
145-
146- fn unwrappered_synthesize_long_form (
147- content : String ,
148- voice : Voice ,
149- output_location : String ,
150- chapter_breaks : Option < Vec < u32 > > ,
151- ) -> Result < Self :: LongFormOperation , TtsError > {
152- let deepgram = Deepgram :: new ( ) ?;
153- let voice_id = voice. id . clone ( ) ;
154- deepgram. synthesize_long_form_unwrapped ( content, voice_id, output_location, chapter_breaks)
155- }
156- }
157-
158134impl VoicesGuest for DeepgramComponent {
159135 #[ doc = " List available voices with filtering and pagination" ]
160136 fn list_voices ( filter : Option < VoiceFilter > ) -> Result < Vec < Voice > , TtsError > {
@@ -175,10 +151,31 @@ impl VoicesGuest for DeepgramComponent {
175151 }
176152}
177153
178- #[ cfg( not( feature = "durability" ) ) ]
179- type DurableDeepgramComponent = DurableTTS < Deepgram > ;
154+ impl ExtendedAdvancedTrait for DeepgramComponent {
155+ fn unwrappered_created_lexicon (
156+ name : String ,
157+ language : LanguageCode ,
158+ entries : Option < Vec < PronunciationEntry > > ,
159+ ) -> Result < Self :: PronunciationLexicon , golem_tts:: golem:: tts:: types:: TtsError > {
160+ let client = Deepgram :: new ( ) ?;
161+ client. create_lexicon ( name, language, entries)
162+ }
163+
164+ fn unwrappered_synthesize_long_form (
165+ content : String ,
166+ voice : Voice ,
167+ output_location : String ,
168+ chapter_breaks : Option < Vec < u32 > > ,
169+ ) -> Result < Self :: LongFormOperation , golem_tts:: golem:: tts:: types:: TtsError > {
170+ let client = Deepgram :: new ( ) ?;
171+ let voice_id = voice. id . clone ( ) ;
172+ client. synthesize_long_form ( content, voice_id, output_location, chapter_breaks)
173+ }
174+ }
175+
176+
177+
180178
181- #[ cfg( feature = "durability" ) ]
182179type DurableDeepgramComponent = DurableTTS < DeepgramComponent > ;
183180
184181golem_tts:: export_tts!( DurableDeepgramComponent with_types_in golem_tts) ;
0 commit comments