25 lines
511 B
Python
25 lines
511 B
Python
import riva.client
|
|
|
|
from livekit.agents.utils import is_given
|
|
|
|
|
|
def create_riva_auth(
|
|
*,
|
|
api_key: str | None,
|
|
function_id: str,
|
|
server: str,
|
|
use_ssl: bool = True,
|
|
) -> riva.client.Auth:
|
|
metadata_args = []
|
|
|
|
if is_given(api_key) and api_key:
|
|
metadata_args.append(["authorization", f"Bearer {api_key}"])
|
|
|
|
metadata_args.append(["function-id", function_id])
|
|
|
|
return riva.client.Auth(
|
|
uri=server,
|
|
use_ssl=use_ssl,
|
|
metadata_args=metadata_args,
|
|
)
|