-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_api.py
More file actions
53 lines (35 loc) Β· 1.42 KB
/
Copy pathtest_api.py
File metadata and controls
53 lines (35 loc) Β· 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python3
"""Test Google Realtime API connection"""
import os
import asyncio
from dotenv import load_dotenv
import sys
load_dotenv()
async def test_google_api():
"""Test if Google Realtime API is accessible"""
api_key = os.getenv("GOOGLE_API_KEY", "").strip().strip("'\"")
print(f"π API Key loaded: {api_key[:20]}...")
if not api_key or len(api_key) < 10:
print("β API Key is empty or invalid!")
return False
try:
print("π‘ Attempting to import Google plugin...")
from livekit.plugins import google
print("β Google plugin imported")
print("β³ Testing connection to Google Realtime API...")
# Simple test - create a model instance (doesn't connect yet)
model = google.beta.realtime.RealtimeModel(voice="Charon")
print("β Model created successfully")
print("\nβ
Google API configuration looks good!")
print("Note: Connection happens when LiveKit session starts with actual audio")
return True
except ImportError as e:
print(f"β Import error: {e}")
print("Run: pip install livekit-plugins-google")
return False
except Exception as e:
print(f"β Error: {type(e).__name__}: {e}")
return False
if __name__ == "__main__":
result = asyncio.run(test_google_api())
sys.exit(0 if result else 1)