rhythmic-furniture-71949
08/16/2025, 6:52 PMtall-airline-16756
08/16/2025, 6:52 PMtall-airline-16756
08/16/2025, 6:52 PMNameError: name 'google' is not defined
usually pops up when the Google plugin isn’t properly imported or set up in your script. No worries though, here’s how you can fix it:
1. Install the Google Plugin: First, make sure you have the LiveKit Google plugin installed by running:
pip install "livekit-agents[google]~=1.0"
2. Import the Plugin: Then, add this import line to your script:
from livekit.plugins import google
3. Check Your Authentication: Make sure your Google API key is set up in your environment variables. You can do this in a .env
file or directly in your code as GOOGLE_API_KEY
.
Here’s a simple example of how to use the Google plugin in your `AgentSession`:
from livekit.plugins import google
session = AgentSession(
llm=google.LLM(
model="gemini-2.0-flash",
),
# Feel free to add other components like STT, TTS, etc. as you need
)
Just double-check that your GOOGLE_API_KEY
environment variable is set up correctly with your API key, and you should be good to go!