Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enh: Update to also pass ClientOptions to credentials args #1098

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/little-phones-drive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"livekit-plugins-google": patch
---

Update to support passing chirp_2 location for other STT credentials
1 change: 1 addition & 0 deletions livekit-plugins/install_plugins_editable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading