google: allow using GOOGLE_APPLICATION_CREDENTIALS
This commit is contained in:
@@ -53,7 +53,6 @@ async def main():
|
|||||||
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"))
|
stt = DeepgramSTTService(api_key=os.getenv("DEEPGRAM_API_KEY"))
|
||||||
|
|
||||||
tts = GoogleTTSService(
|
tts = GoogleTTSService(
|
||||||
credentials=os.getenv("GOOGLE_CREDENTIALS"),
|
|
||||||
voice_id="en-US-Neural2-J",
|
voice_id="en-US-Neural2-J",
|
||||||
params=GoogleTTSService.InputParams(language="en-US", rate="1.05"),
|
params=GoogleTTSService.InputParams(language="en-US", rate="1.05"),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ try:
|
|||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.error(f"Exception: {e}")
|
logger.error(f"Exception: {e}")
|
||||||
logger.error(
|
logger.error(
|
||||||
"In order to use Google AI, you need to `pip install pipecat-ai[google]`. Also, set `GOOGLE_API_KEY` environment variable."
|
"In order to use Google AI, you need to `pip install pipecat-ai[google]`. Also, set `GOOGLE_APPLICATION_CREDENTIALS` environment variable."
|
||||||
)
|
)
|
||||||
raise Exception(f"Missing module: {e}")
|
raise Exception(f"Missing module: {e}")
|
||||||
|
|
||||||
@@ -287,8 +287,6 @@ class GoogleTTSService(TTSService):
|
|||||||
elif credentials_path:
|
elif credentials_path:
|
||||||
# Use service account JSON file if provided
|
# Use service account JSON file if provided
|
||||||
creds = service_account.Credentials.from_service_account_file(credentials_path)
|
creds = service_account.Credentials.from_service_account_file(credentials_path)
|
||||||
else:
|
|
||||||
raise ValueError("Either 'credentials' or 'credentials_path' must be provided.")
|
|
||||||
|
|
||||||
return texttospeech_v1.TextToSpeechAsyncClient(credentials=creds)
|
return texttospeech_v1.TextToSpeechAsyncClient(credentials=creds)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user