Code snippet for google STT for hebrew language
# ask-ai
r
Code snippet for google STT for hebrew language
t
Thanks for reaching out, pritesh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm glad you're interested in integrating Google Speech-to-Text (STT) with Hebrew language support in LiveKit! To help you get started smoothly, you can use the
livekit-agents[google]
Python plugin. Below, I've shared a friendly code snippet that demonstrates how to set up Google STT for Hebrew and integrate it into a LiveKit agent pipeline:
Copy code
from livekit.plugins import google
from livekit.agents import AgentContext, JobContext, WorkerOptions, cli, llm, stt, tts, JobRequest

# Create instances of Google STT, LLM, and TTS
stt_instance = google.STT(
    languages="he-IL",      # Use Hebrew language
    model="chirp",          # Use advanced 'chirp' model for better accuracy
    spoken_punctuation=True # Convert spoken punctuation into symbols
)

llm_instance = google.LLM(
    model="gemini-2.0-flash-exp",
    temperature=0.8
)

tts_instance = google.TTS(
    language="he-IL",       # Output Hebrew speech
    gender="female",
    voice_name="he-IL-Standard-A"
)

# Define agent behavior in the entrypoint
async def entrypoint(ctx: JobContext):
    await ctx.connect()
    agent_session = ctx.session

    # Set up the agent pipeline with STT, LLM, and TTS
    await agent_session.connect(
        stt=stt_instance,
        llm=llm_instance,
        tts=tts_instance,
        allow_interruptions=True,
        intellivence_settings={},
        # agent instructions can be added here
    )

# Worker options to register the agent
if __name__ == "__main__":
    cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))
Setup Instructions: • First, make sure to install the plugin with:
pip install "livekit-agents[google]~=1.2"
• Then, set up your Google Cloud credentials. You can do this in a few ways: ◦ Set the
GOOGLE_APPLICATION_CREDENTIALS
environment variable to point to your service account key file ◦ Pass credentials directly using the
credentials_info
or
credentials_file
parameters ◦ Or simply use Application Default Credentials (ADC) If you want to dive deeper or need more details, I recommend checking out the Google Cloud STT integration guide as well as the list of supported languages. Feel free to reach out if you have any questions or need further assistance—I'm here to help! Sources: livekit-plugins/livekit-plugins-spitch/livekit/plugins/spitch/stt.py | Google Cloud STT integration guide | LiveKit Docs | Google Cloud STT integration guide | LiveKit Docs
r
livekit.agents._exceptions.APIStatusError: The model "chirp" does not exist in the location named "global".. [] (status_code=400, request_id=None, body=None, retryable=False) {"message": "failed to recognize speech, retrying in 2.0s\nTraceback (most recent call last):\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py\", line 106, in _wrapped_aiter\n async for response in self._call: # pragma: no branch\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/grpc/aio/_call.py\", line 365, in _fetch_stream_responses\n await self._raise_for_status()\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/grpc/aio/_call.py\", line 272, in _raise_for_status\n raise _create_rpc_error(\ngrpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with:\n\tstatus = StatusCode.INVALID_ARGUMENT\n\tdetails = \"The model \"chirp\" does not exist in the location named \"global\"..\"\n\tdebug_error_string = \"UNKNOWN:Error received from peer ipv4142.250.183.106443 {grpc_status:3, grpc_message:\"The model \\\"chirp\\\" does not exist in the location named \\\"global\\\"..\"}\"\n>\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py\", line 529, in _run\n task.result()\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py\", line 430, in process_stream\n async for resp in stream:\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py\", line 109, in _wrapped_aiter\n raise exceptions.from_grpc_error(rpc_error) from rpc_error\ngoogle.api_core.exceptions.InvalidArgument: 400 The model \"chirp\" does not exist in the location named \"global\"..\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/agents/stt/stt.py\", line 253, in _main_task\n return await self._run()\n ^^^^^^^^^^^^^^^^^\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py\", line 550, in _run\n raise APIStatusError(\nlivekit.agents._exceptions.APIStatusError: The model \"chirp\" does not exist in the location named \"global\".. [] (status_code=400, request_id=None, body=None, retryable=False)", "level": "WARNING", "name": "livekit.agents", "tts": "livekit.plugins.google.stt.STT", "attempt": 2, "streamed": true, "pid": 94189, "job_id": "AJ_kwHrxHohX4Vf", "timestamp": "2025-09-17T115959.981029+00:00"} 2025-09-17 173002,550 - orb-agent-inbound - INFO - Unrecoverable error occurred: type='stt_error' timestamp=1758110402.550122 label='livekit.plugins.google.stt.STT' error=APIStatusError('The model "chirp" does not exist in the location named "global".. []') recoverable=False 2025-09-17 173002,550 - orb-agent-inbound - INFO - Unrecoverable error occurred: type='stt_error' timestamp=1758110402.550122 label='livekit.plugins.google.stt.STT' error=APIStatusError('The model "chirp" does not exist in the location named "global".. []') recoverable=False {"message": "Unrecoverable error occurred: type='stt_error' timestamp=1758110402.550122 label='livekit.plugins.google.stt.STT' error=APIStatusError('The model \"chirp\" does not exist in the location named \"global\".. []') recoverable=False", "level": "INFO", "name": "orb-agent-inbound", "pid": 94189, "job_id": "AJ_kwHrxHohX4Vf", "timestamp": "2025-09-17T120002.550822+00:00"} 2025-09-17 173002,551 - livekit.agents - ERROR - AgentSession is closing due to unrecoverable error Traceback (most recent call last): File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py", line 106, in _wrapped_aiter async for response in self._call: # pragma: no branch File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/grpc/aio/_call.py", line 365, in _fetch_stream_responses await self._raise_for_status() File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/grpc/aio/_call.py", line 272, in _raise_for_status raise _create_rpc_error( grpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with: status = StatusCode.INVALID_ARGUMENT details = "The model "chirp" does not exist in the location named "global".." debug_error_string = "UNKNOWN:Error received from peer ipv4142.250.183.42443 {grpc_status:3, grpc_message:"The model \"chirp\" does not exist in the location named \"global\".."}"
The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py", line 529, in _run task.result() File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py", line 430, in process_stream async for resp in stream: File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py", line 109, in _wrapped_aiter raise exceptions.from_grpc_error(rpc_error) from rpc_error google.api_core.exceptions.InvalidArgument: 400 The model "chirp" does not exist in the location named "global".. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/agents/stt/stt.py", line 253, in _main_task return await self._run() ^^^^^^^^^^^^^^^^^ File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py", line 550, in _run raise APIStatusError( livekit.agents._exceptions.APIStatusError: The model "chirp" does not exist in the location named "global".. [] (status_code=400, request_id=None, body=None, retryable=False) 2025-09-17 173002,551 - livekit.agents - ERROR - AgentSession is closing due to unrecoverable error Traceback (most recent call last): File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py", line 106, in _wrapped_aiter async for response in self._call: # pragma: no branch File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/grpc/aio/_call.py", line 365, in _fetch_stream_responses await self._raise_for_status() File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/grpc/aio/_call.py", line 272, in _raise_for_status raise _create_rpc_error( grpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with: status = StatusCode.INVALID_ARGUMENT details = "The model "chirp" does not exist in the location named "global".." debug_error_string = "UNKNOWN:Error received from peer ipv4142.250.183.42443 {grpc_status:3, grpc_message:"The model \"chirp\" does not exist in the location named \"global\".."}"
The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py", line 529, in _run task.result() File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py", line 430, in process_stream async for resp in stream: File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py", line 109, in _wrapped_aiter raise exceptions.from_grpc_error(rpc_error) from rpc_error google.api_core.exceptions.InvalidArgument: 400 The model "chirp" does not exist in the location named "global".. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/agents/stt/stt.py", line 253, in _main_task return await self._run() ^^^^^^^^^^^^^^^^^ File "/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py", line 550, in _run raise APIStatusError( livekit.agents._exceptions.APIStatusError: The model "chirp" does not exist in the location named "global".. [] (status_code=400, request_id=None, body=None, retryable=False) {"message": "AgentSession is closing due to unrecoverable error\nTraceback (most recent call last):\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py\", line 106, in _wrapped_aiter\n async for response in self._call: # pragma: no branch\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/grpc/aio/_call.py\", line 365, in _fetch_stream_responses\n await self._raise_for_status()\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/grpc/aio/_call.py\", line 272, in _raise_for_status\n raise _create_rpc_error(\ngrpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with:\n\tstatus = StatusCode.INVALID_ARGUMENT\n\tdetails = \"The model \"chirp\" does not exist in the location named \"global\"..\"\n\tdebug_error_string = \"UNKNOWN:Error received from peer ipv4142.250.183.42443 {grpc_status:3, grpc_message:\"The model \\\"chirp\\\" does not exist in the location named \\\"global\\\"..\"}\"\n>\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py\", line 529, in _run\n task.result()\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py\", line 430, in process_stream\n async for resp in stream:\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py\", line 109, in _wrapped_aiter\n raise exceptions.from_grpc_error(rpc_error) from rpc_error\ngoogle.api_core.exceptions.InvalidArgument: 400 The model \"chirp\" does not exist in the location named \"global\"..\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/agents/stt/stt.py\", line 253, in _main_task\n return await self._run()\n ^^^^^^^^^^^^^^^^^\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py\", line 550, in _run\n raise APIStatusError(\nlivekit.agents._exceptions.APIStatusError: The model \"chirp\" does not exist in the location named \"global\".. [] (status_code=400, request_id=None, body=None, retryable=False)", "level": "ERROR", "name": "livekit.agents", "pid": 94189, "job_id": "AJ_kwHrxHohX4Vf", "timestamp": "2025-09-17T120002.551592+00:00"}
t
It looks like the error is happening because the "chirp" model isn’t available in the "global" location. No worries though! To fix this, you just need to specify a valid regional location where the "chirp" model is supported. A great example is using the "us-central1" location. Here’s a friendly guide on how you can update your configuration:
Copy code
from livekit.plugins import google

# Update the location parameter to a valid region
stt_instance = google.STT(
    languages="he-IL",      # Use Hebrew language
    model="chirp",          # Use the chirp model
    location="us-central1", # Specify the correct location
    spoken_punctuation=True  # Convert spoken punctuation into symbols
)
To make sure everything is set up smoothly, here are a few helpful steps: • Double-check that your Google Cloud project has the Speech-to-Text API enabled for the "us-central1" region. • Make sure your credentials are valid and linked to a project with access to the regional endpoint you’re specifying. • Take a look at the Google Speech-to-Text supported languages and locations to confirm the "chirp" model is available in your chosen region. Once you’ve made these updates, please try the integration again. If you run into any other issues or have questions, I’m here to help—just let me know! Sources: Google Cloud STT integration guide | LiveKit Docs | livekit-plugins/livekit-plugins-cartesia/livekit/plugins/cartesia/stt.py | plugins/google/src/beta/gemini_tts.ts
r
{"message": "failed to recognize speech, retrying in 2.0s\nTraceback (most recent call last):\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py\", line 106, in _wrapped_aiter\n async for response in self._call: # pragma: no branch\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/grpc/aio/_call.py\", line 365, in _fetch_stream_responses\n await self._raise_for_status()\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/grpc/aio/_call.py\", line 272, in _raise_for_status\n raise _create_rpc_error(\ngrpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with:\n\tstatus = StatusCode.INVALID_ARGUMENT\n\tdetails = \"Config contains unsupported fields. See
error_details_ext
extension for details.\"\n\tdebug_error_string = \"UNKNOWN:Error received from peer ipv4142.250.207.170443 {grpc_status:3, grpc_message:\"Config contains unsupported fields. See
error_details_ext
extension for details.\"}\"\n>\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py\", line 529, in _run\n task.result()\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py\", line 430, in process_stream\n async for resp in stream:\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py\", line 109, in _wrapped_aiter\n raise exceptions.from_grpc_error(rpc_error) from rpc_error\ngoogle.api_core.exceptions.InvalidArgument: 400 Config contains unsupported fields. See
error_details_ext
extension for details. [field_violations {\n field: \"config.features.enable_spoken_punctuation\"\n description: \"Recognizer does not support feature: spoken_punctuation\"\n}\n]\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/agents/stt/stt.py\", line 253, in _main_task\n return await self._run()\n ^^^^^^^^^^^^^^^^^\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py\", line 550, in _run\n raise APIStatusError(\nlivekit.agents._exceptions.APIStatusError: Config contains unsupported fields. See
error_details_ext
extension for details. [field_violations {\n field: \"config.features.enable_spoken_punctuation\"\n description: \"Recognizer does not support feature: spoken_punctuation\"\n}\n] (status_code=400, request_id=None, body=None, retryable=False)", "level": "WARNING", "name": "livekit.agents", "tts": "livekit.plugins.google.stt.STT", "attempt": 2, "streamed": true, "pid": 94468, "job_id": "AJ_neaw5cypwafP", "timestamp": "2025-09-17T120823.595026+00:00"}
t
It looks like the error is happening because the "spoken_punctuation" feature isn’t supported by the Google Cloud Speech-to-Text API. No worries though! To fix this, you’ll just need to disable the "spoken_punctuation" parameter in your configuration. Here’s a simple way to update your code:
Copy code
from livekit.plugins import google

# Disable the unsupported spoken_punctuation parameter
stt_instance = google.STT(
    languages="he-IL",      # Use Hebrew language
    model="chirp",          # Use the chirp model
    spoken_punctuation=False # Disable spoken punctuation
)
A couple of helpful notes: • The "punctuate" feature (which is enabled by default) will still take care of automatic punctuation for you. • Just double-check that the other parameters you’re using are valid and supported by the Google STT API. Once you make this update, please try the integration again. If you run into any other issues or have questions, I’m here to help—just let me know! Sources: livekit-plugins/livekit-plugins-soniox/livekit/plugins/soniox/stt.py | Google Cloud STT integration guide | LiveKit Docs
r
livekit.agents._exceptions.APIConnectionError: failed to recognize speech after 3 attempts (body=None, retryable=True) {"message": "Error in _stt_task\nTraceback (most recent call last):\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py\", line 106, in _wrapped_aiter\n async for response in self._call: # pragma: no branch\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/grpc/aio/_call.py\", line 365, in _fetch_stream_responses\n await self._raise_for_status()\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/grpc/aio/_call.py\", line 272, in _raise_for_status\n raise _create_rpc_error(\ngrpc.aio._call.AioRpcError: <AioRpcError of RPC that terminated with:\n\tstatus = StatusCode.CANCELLED\n\tdetails = \"The operation was cancelled.\"\n\tdebug_error_string = \"UNKNOWN:Error received from peer ipv4142.250.70.42443 {grpc_status:1, grpc_message:\"The operation was cancelled.\"}\"\n>\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py\", line 529, in _run\n task.result()\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py\", line 430, in process_stream\n async for resp in stream:\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/google/api_core/grpc_helpers_async.py\", line 109, in _wrapped_aiter\n raise exceptions.from_grpc_error(rpc_error) from rpc_error\ngoogle.api_core.exceptions.Cancelled: 499 The operation was cancelled.\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/agents/stt/stt.py\", line 253, in _main_task\n return await self._run()\n ^^^^^^^^^^^^^^^^^\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/plugins/google/stt.py\", line 550, in _run\n raise APIStatusError(\nlivekit.agents._exceptions.APIStatusError: The operation was cancelled. [] (status_code=499, request_id=None, body=None, retryable=False)\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/agents/utils/log.py\", line 16, in async_fn_logs\n return await fn(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/agents/voice/audio_recognition.py\", line 474, in _stt_task\n async for ev in node:\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/agents/voice/agent.py\", line 356, in stt_node\n async for event in stream:\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/agents/stt/stt.py\", line 372, in __anext__\n raise exc # noqa: B904\n ^^^^^^^^^\n File \"/Users/omkaricare/projects/orb-worker/venv/lib/python3.12/site-packages/livekit/agents/stt/stt.py\", line 260, in _main_task\n raise APIConnectionError(\nlivekit.agents._exceptions.APIConnectionError: failed to recognize speech after 3 attempts (body=None, retryable=True)", "level": "ERROR", "name": "livekit.agents", "pid": 94602, "job_id": "AJ_4G8pdyBsVeSE", "timestamp": "2025-09-17T121529.965882+00:00"}
t
It looks like the error you're seeing means the speech recognition process couldn't complete after several tries, leading to an APIConnectionError. This often happens because of issues with your Google Cloud credentials or network connectivity. Here are some steps that might help you resolve this: • First, please double-check that your Google Cloud credentials are set up correctly. You can provide credentials in a few ways: ◦ `credentials_file`: The path to your service account key file. ◦ `credentials_info`: A JSON object containing your credentials. ◦ Application Default Credentials (ADC): Make sure the
GOOGLE_APPLICATION_CREDENTIALS
environment variable points to your key file. • Make sure your network connection is stable and that it allows access to Google Cloud endpoints. • You might also want to try using the LiveKit FallbackAdapter. This lets you switch between multiple STT providers if one runs into issues, which can be a great way to handle temporary connection problems. Once you've checked these, please try the integration again. If you still run into trouble or have any questions, feel free to reach out—I’m here to help! Sources: livekit-plugins/livekit-plugins-google/livekit/plugins/google/tts.py