lsempe commited on
Commit
79c57f4
·
1 Parent(s): f68044a

Switch to google-genai package and fix TTS config building

Browse files
Files changed (2) hide show
  1. requirements.txt +1 -1
  2. tts_provider.py +2 -2
requirements.txt CHANGED
@@ -5,7 +5,7 @@ scikit-learn>=1.3.0
5
  faiss-cpu>=1.7.4
6
  plotly>=5.15.0
7
  folium>=0.14.0
8
- google-generativeai==0.8.5
9
  openai>=1.0.0
10
  anthropic>=0.21.3
11
  langchain-core>=0.1.0
 
5
  faiss-cpu>=1.7.4
6
  plotly>=5.15.0
7
  folium>=0.14.0
8
+ google-genai==0.8.5
9
  openai>=1.0.0
10
  anthropic>=0.21.3
11
  langchain-core>=0.1.0
tts_provider.py CHANGED
@@ -119,7 +119,7 @@ def generate_tts(text: str, speaker_voice_configs=None, model: str = 'models/gem
119
  if speaker_voice_configs and len(speaker_voice_configs) > 0:
120
  logger.info(f'Building multi-speaker config for {len(speaker_voice_configs)} speakers')
121
  # Add speech config for multi-speaker TTS
122
- if types is not None:
123
  logger.info('Using typed objects for speech config')
124
  # Use typed objects if available
125
  speaker_configs = []
@@ -141,7 +141,7 @@ def generate_tts(text: str, speaker_voice_configs=None, model: str = 'models/gem
141
  )
142
  )
143
  else:
144
- logger.warning('Types module not available, using dict fallback')
145
  # Fallback to dict structure if types not available
146
  config['speech_config'] = {
147
  'multi_speaker_voice_config': {
 
119
  if speaker_voice_configs and len(speaker_voice_configs) > 0:
120
  logger.info(f'Building multi-speaker config for {len(speaker_voice_configs)} speakers')
121
  # Add speech config for multi-speaker TTS
122
+ if types is not None and hasattr(types, 'SpeakerVoiceConfig') and hasattr(types, 'VoiceConfig') and hasattr(types, 'PrebuiltVoiceConfig') and hasattr(types, 'SpeechConfig') and hasattr(types, 'MultiSpeakerVoiceConfig'):
123
  logger.info('Using typed objects for speech config')
124
  # Use typed objects if available
125
  speaker_configs = []
 
141
  )
142
  )
143
  else:
144
+ logger.warning('Types module not available or missing TTS types, using dict fallback')
145
  # Fallback to dict structure if types not available
146
  config['speech_config'] = {
147
  'multi_speaker_voice_config': {