feat(google): add Cloud TTS API and migrate speech generation#90
Conversation
- Add celeste.providers entry point for auth type registration - Add register_provider() to register GoogleADC auth type - Add requests dependency for google-auth transport - Remove unused type ignore comments in cloud_tts client
- Switch from Gemini content generation to Cloud TTS synthesize endpoint - Update model IDs to gemini-2.5-flash-tts and gemini-2.5-pro-tts - Add language and output_format parameter support - Update voice definitions with personality descriptions - Use Language enum instead of locale strings for multilingual support
- Add GoogleADC authentication class for OAuth/ADC - Add Cloud TTS API config and endpoints - Add parameter mappers for voice, language, prompt, and audio encoding
PR Review: Google Cloud TTS API MigrationSummaryThis PR successfully migrates Google speech generation from the Gemini content API to the Cloud TTS API, adding OAuth/ADC authentication and expanding parameter support. The implementation is well-structured with good separation of concerns. Code Quality & Best Practices ✅Strengths
Minor Issues
Potential Bugs 🐛
Performance Considerations ⚡
Security Concerns 🔒Good Security Practices
Concerns
Test Coverage 📊Current Coverage
Missing Coverage
Recommendations# Example test cases to add:
- test_google_adc_token_refresh()
- test_google_adc_invalid_credentials()
- test_language_mapper_unsupported_language()
- test_output_format_mapper_invalid_format()
- test_voice_mapper_with_invalid_voice()
- test_concurrent_token_refresh() # For race conditionAdditional ObservationsPositive Changes
Breaking Changes
Users will need to update their code. Consider documenting this in release notes. Documentation Needed
RecommendationsHigh Priority
Medium Priority
Low Priority
VerdictThis is a solid PR with clean architecture and good separation of concerns. The migration is well-executed, but needs:
Once the high-priority items are addressed, this will be ready to merge. Great work overall! 🚀 |
Summary
GoogleADCclass for OAuth/Application Default Credentialstext:synthesizeendpointProvider Package (
celeste-google)New Authentication (
GoogleADC)GOOGLE_APPLICATION_CREDENTIALSenvironment variablegcloud auth application-default logingoogle-authlibrary withrequeststransportx-goog-user-project)Cloud TTS API (
GoogleCloudTTSClient)https://texttospeech.googleapis.com/v1/text:synthesizeaudioContentfieldGoogleADC(Cloud TTS requires OAuth, not API key)LIST_VOICES,CREATE_LONG_AUDIO, etc.)Parameter Mappers
voice.namefieldLanguageenum to BCP-47 locale codes (voice.languageCode)input.promptfor style controlAudioMimeTypeto Cloud TTS encoding stringsConfiguration
https://texttospeech.googleapis.com/v1/text:synthesizeceleste.providersfor auth type registrationDependencies
requestsforgoogle-authtransport layerCapability Integration (
celeste-speech-generation)Client Migration
GoogleSpeechGenerationClientnow inherits fromGoogleCloudTTSClientmixininput.text,voice.modelName,audioConfig)Model Updates
gemini-2.5-flash-preview-tts→gemini-2.5-flash-ttsgemini-2.5-pro-preview-tts→gemini-2.5-pro-ttsLANGUAGEparameter constraint with 20 supported languagesOUTPUT_FORMATparameter constraint (MP3, WAV, OGG, PCM)Voice Definitions (30 voices)
All voices now include personality descriptions:
Language Support (20 languages)
Uses
Languageenum (ISO 639-1) with BCP-47 locale mapping:Output Formats
audio/mpegaudio/wavaudio/oggaudio/pcmFixes
Gradium Client
httpximport required for_make_requestreturn type annotationProvider Package Cleanup
__all__fromceleste_openai/__init__.py__all__fromceleste_xai/__init__.pyCode Statistics
Breaking Changes
gemini-2.5-flash-preview-ttsorgemini-2.5-pro-preview-ttsmust update togemini-2.5-flash-tts/gemini-2.5-pro-ttsgcloud auth application-default loginto authenticate.Test Plan
make cipasses (linting, formatting, type checking, security, unit tests)tts-1)gemini-2.5-flash-tts)eleven_flash_v2_5)default)