from google import genai import os from dotenv import load_dotenv # Load environment variables load_dotenv() print(f"API Key set: {bool(os.getenv('GOOGLE_API_KEY'))}") try: # Initialize client with API key api_key = os.getenv("GOOGLE_API_KEY") client = genai.Client(api_key=api_key) # Test connection response = client.models.generate_content( model='gemini-1.5-pro', contents='Test the API connection' ) print("API connection test successful!") print(f"Response: {response.text}") except Exception as e: print(f"API error: {e}")