adds ability to pass in api key for every transcriber agent and synthesizer

This commit is contained in:
Ajay Raj 2023-03-28 23:33:36 -07:00
commit ecebe4c1a5
11 changed files with 71 additions and 17 deletions

View file

@ -3,6 +3,7 @@ import time
import queue
from google.cloud import speech
import threading
from vocode import getenv
from vocode.streaming.models.audio_encoding import AudioEncoding
from vocode.streaming.transcriber.base_transcriber import (
@ -18,6 +19,10 @@ class GoogleTranscriber(BaseTranscriber):
super().__init__(transcriber_config)
self._queue = queue.Queue()
self._ended = False
if not getenv("GOOGLE_APPLICATION_CREDENTIALS"):
raise Exception(
"Please set GOOGLE_APPLICATION_CREDENTIALS environment variable"
)
self.google_streaming_config = self.create_google_streaming_config()
self.client = speech.SpeechClient()
self.warmed_up = False