playht / pyht

PlayHT Python SDK - AI Text-to-Speech Streaming & Voice Cloning API
https://play.ht/
Apache License 2.0
178 stars 23 forks source link

Add on_prem_endpoint as an advanced option for sync and async pyht clients #36

Closed mtenpow closed 8 months ago

mtenpow commented 8 months ago

Add on_prem_endpoint as an advanced option for sync and async pyht clients

Customers will now set AdvancedOptions.on_prem_endpoint="customer-name.on-prem.play.ht:11045" instead of setting grpc_addr="customer-name.on-prem.play.ht:11045" and insecure=True.

Add a fallback option (default is on) so that TTS requests to an on-prem appliance that is over capacity or down can fallback to the shared PlayHT endpoint.

So, client configuration goes from:

client = Client( 
  user_id="<YOUR_USER_ID>", 
  api_key="<YOUR_API_KEY>", 
  advanced=client.Client.AdvancedOptions(grpc_addr="customer-name-00000001.on-prem.play.ht:11045", insecure=True)
)

..to:

client = Client( 
  user_id="<YOUR_USER_ID>", 
  api_key="<YOUR_API_KEY>", 
  advanced=client.Client.AdvancedOptions(on_prem_endpoint="customer-name-00000001.on-prem.play.ht:11045")
)

Customers that don't want the fallback option can do the following:

client = Client( 
  user_id="<YOUR_USER_ID>", 
  api_key="<YOUR_API_KEY>", 
  advanced=client.Client.AdvancedOptions(on_prem_endpoint="customer-name-00000001.on-prem.play.ht:11045", on_prem_fallback=False)
)
mtenpow commented 8 months ago

I've got an access error I need to fix. Working on it now - but please still review.

mtenpow commented 8 months ago

I've got an access error I need to fix. Working on it now - but please still review.

Fixed.