diff --git a/.changeset/little-phones-drive.md b/.changeset/little-phones-drive.md new file mode 100644 index 000000000..76fd81fde --- /dev/null +++ b/.changeset/little-phones-drive.md @@ -0,0 +1,5 @@ +--- +"livekit-plugins-google": patch +--- + +Update to support passing chirp_2 location for other STT credentials diff --git a/livekit-plugins/install_plugins_editable.sh b/livekit-plugins/install_plugins_editable.sh index 0072e5a17..7b6a5bb8a 100755 --- a/livekit-plugins/install_plugins_editable.sh +++ b/livekit-plugins/install_plugins_editable.sh @@ -11,6 +11,7 @@ pip install -e ./livekit-plugins-azure --config-settings editable_mode=strict pip install -e ./livekit-plugins-cartesia --config-settings editable_mode=strict pip install -e ./livekit-plugins-deepgram --config-settings editable_mode=strict pip install -e ./livekit-plugins-elevenlabs --config-settings editable_mode=strict +pip install -e ./livekit-plugins-fal --config-settings editable_mode=strict pip install -e ./livekit-plugins-google --config-settings editable_mode=strict pip install -e ./livekit-plugins-minimal --config-settings editable_mode=strict pip install -e ./livekit-plugins-nltk --config-settings editable_mode=strict diff --git a/livekit-plugins/livekit-plugins-google/livekit/plugins/google/stt.py b/livekit-plugins/livekit-plugins-google/livekit/plugins/google/stt.py index b5b81c9f4..e94c82db1 100644 --- a/livekit-plugins/livekit-plugins-google/livekit/plugins/google/stt.py +++ b/livekit-plugins/livekit-plugins-google/livekit/plugins/google/stt.py @@ -127,23 +127,26 @@ def __init__( ) def _ensure_client(self) -> SpeechAsyncClient: + # Add support for passing a specific location that matches recognizer + # see: https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages + client_options = None + if self._location != "global": + client_options = ClientOptions( + api_endpoint=f"{self._location}-speech.googleapis.com" + ) if self._credentials_info: self._client = SpeechAsyncClient.from_service_account_info( - self._credentials_info + self._credentials_info, + client_options=client_options, ) elif self._credentials_file: self._client = SpeechAsyncClient.from_service_account_file( - self._credentials_file + self._credentials_file, + client_options=client_options, ) - elif self._location == "global": - self._client = SpeechAsyncClient() else: - # Add support for passing a specific location that matches recognizer - # see: https://cloud.google.com/speech-to-text/v2/docs/speech-to-text-supported-languages self._client = SpeechAsyncClient( - client_options=ClientOptions( - api_endpoint=f"{self._location}-speech.googleapis.com" - ) + client_options=client_options, ) assert self._client is not None return self._client