{"id":7459,"library":"nvidia-riva-client","title":"NVIDIA Riva Client","description":"The `nvidia-riva-client` library provides Python client APIs for interacting with NVIDIA Riva speech AI services, including Automatic Speech Recognition (ASR), Text-to-Speech (TTS), and Neural Machine Translation (NMT). It enables developers to integrate advanced conversational AI capabilities into their applications. The current version is 2.25.1, with releases typically tied to major Riva platform updates, leading to a moderately frequent release cadence.","status":"active","version":"2.25.1","language":"en","source_language":"en","source_url":"https://github.com/nvidia-riva/python-clients","tags":["AI","Speech-to-Text","ASR","Text-to-Speech","TTS","NLP","NVIDIA","Riva","gRPC","Speech AI"],"install":[{"cmd":"pip install nvidia-riva-client","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for gRPC communication with the Riva server. The client specifies a compatible version range.","package":"grpcio","optional":false}],"imports":[{"symbol":"ASRClient","correct":"from riva.client import ASRClient"},{"symbol":"TTSClient","correct":"from riva.client import TTSClient"},{"note":"While a subdirectory exists, the official examples and common practice import Auth directly from `riva.client`.","wrong":"from riva.client.auth import Auth","symbol":"Auth","correct":"from riva.client import Auth"},{"symbol":"AudioEncoding","correct":"from riva.client import AudioEncoding"},{"symbol":"RecognitionConfig","correct":"from riva.client import RecognitionConfig"}],"quickstart":{"code":"import os\nimport riva.client\nimport time\nimport wave\n\n# Configure Riva server connection\n# Ensure RIVA_URI is set in your environment (e.g., 'localhost:50051' or a remote address)\n# For authenticated connections, set RIVA_API_KEY if needed.\nriva_uri = os.environ.get('RIVA_URI', 'localhost:50051')\n\n# Simple WAV file for ASR (create a dummy one if not present)\ndummy_audio_file = 'dummy_audio.wav'\nif not os.path.exists(dummy_audio_file):\n    with wave.open(dummy_audio_file, 'wb') as wf:\n        wf.setnchannels(1)\n        wf.setsampwidth(2)\n        wf.setframerate(16000)\n        wf.writeframes(b'\\x00' * 16000 * 2) # 1 second of silence\n    print(f\"Created a dummy audio file: {dummy_audio_file}\")\n\ntry:\n    # Establish authentication (if needed, otherwise Auth() is sufficient)\n    auth = riva.client.Auth(uri=riva_uri)\n\n    # Initialize ASR client\n    asr_client = riva.client.ASRClient(auth)\n\n    # Configure ASR recognition\n    config = riva.client.RecognitionConfig(\n        encoding=riva.client.AudioEncoding.LINEAR_PCM, # or FLAC, MULAW, etc.\n        sample_rate_hertz=16000,\n        language_code=\"en-US\",\n        max_alternatives=1,\n        enable_automatic_punctuation=True,\n    )\n\n    # Perform ASR on a local audio file\n    print(f\"Transcribing {dummy_audio_file} from Riva server at {riva_uri}...\")\n    response = asr_client.recognize_file(dummy_audio_file, config)\n\n    # Print results\n    if response.results:\n        for result in response.results:\n            if result.alternatives:\n                print(f\"Transcription: {result.alternatives[0].transcript}\")\n            else:\n                print(\"No alternatives found for this segment.\")\n    else:\n        print(\"No speech recognized in the audio.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Please ensure the Riva server is running and accessible at the specified RIVA_URI.\")\n","lang":"python","description":"This quickstart demonstrates how to set up the Riva client, connect to a Riva server, and perform a simple Automatic Speech Recognition (ASR) task on a local WAV file. Ensure the `RIVA_URI` environment variable is set to your Riva server's address (e.g., `localhost:50051`). The script creates a dummy audio file if one isn't present for demonstration."},"warnings":[{"fix":"Always install `nvidia-riva-client` directly via pip; it will pull the correct `grpcio` version. If issues persist, verify the `grpcio` version manually (`pip show grpcio`) against the `nvidia-riva-client` PyPI dependencies. Upgrade `nvidia-riva-client` to the latest version to get the widest compatibility.","message":"The `grpcio` dependency often requires specific versions to match the `nvidia-riva-client` version. Incompatible `grpcio` versions can lead to `ImportError` or `AttributeError` during runtime, particularly with protobuf definitions or gRPC channel initialization.","severity":"breaking","affected_versions":"Various versions prior to 2.25.1 (e.g., 2.17.0 pinned to 1.64.1, 2.18.0 updated to 1.67.1). The current client generally specifies a compatible range."},{"fix":"Migrate any NLP tasks (e.g., intent recognition, named entity recognition) to the separate `nvidia-nemo-client` library or alternative NVIDIA NLP frameworks. Do not attempt to use `riva.client.NLPClient`.","message":"The NLP client APIs were deprecated and removed in Riva client versions starting from 2.15.0.","severity":"breaking","affected_versions":"2.15.0 and later"},{"fix":"Always check the NVIDIA Riva documentation for the recommended client-server version compatibility matrix. It is generally best practice to keep the client and server versions as closely aligned as possible.","message":"Riva client versions are generally designed to be compatible with a specific range of Riva server versions. Mismatched client and server versions can lead to unexpected errors, `gRPC UNAVAILABLE` status codes, or incorrect API behavior.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Refer to the latest NVIDIA Riva client documentation and examples for the current recommended authentication practices, especially when dealing with secure or token-based server deployments. Use the `riva.client.Auth` class and its methods as demonstrated in up-to-date quickstarts.","message":"Authentication methods and metadata retrieval (e.g., `get_auth_metadata`) have seen updates across versions, which might break older authentication patterns.","severity":"gotcha","affected_versions":"Versions around 2.19.0 (where `get_auth_metadata` was updated) and potentially earlier."}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Verify the Riva server is running and healthy. Check the `RIVA_URI` (e.g., `localhost:50051`, `your.server.ip:50051`) and ensure there are no firewall rules blocking the connection. If running in Docker, ensure ports are correctly mapped.","cause":"The Riva server is not running, is inaccessible, or the `RIVA_URI` is incorrect/firewalled. This indicates a network or server availability issue.","error":"grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with: status = StatusCode.UNAVAILABLE"},{"fix":"Install the package using `pip install nvidia-riva-client`. Ensure you are running your script in the same Python environment where the package was installed.","cause":"The `nvidia-riva-client` package is not installed or the Python environment is incorrect.","error":"ModuleNotFoundError: No module named 'riva.client'"},{"fix":"The NLP client was deprecated and removed in version 2.15.0 and later. If you need NLP capabilities, use `nvidia-nemo-client` or another dedicated NVIDIA NLP framework.","cause":"Attempting to use the NLP client, which has been removed in recent versions of the `nvidia-riva-client` library.","error":"AttributeError: module 'riva.client' has no attribute 'NLPClient'"},{"fix":"Try reinstalling the client and its dependencies: `pip uninstall -y nvidia-riva-client grpcio && pip install nvidia-riva-client`. Ensure your Python version meets the `nvidia-riva-client` requirements (`>=3.7`).","cause":"This error often occurs if there's a version mismatch between `nvidia-riva-client` and its `grpcio` dependency, or if the installed `nvidia-riva-client` is corrupted/incomplete.","error":"ImportError: cannot import name 'RecognitionConfig' from 'riva.client'"}]}