-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathverify_aistudio.py
More file actions
76 lines (59 loc) · 2.43 KB
/
verify_aistudio.py
File metadata and controls
76 lines (59 loc) · 2.43 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import os
import sys
import time
from pathlib import Path
from dotenv import load_dotenv
load_dotenv()
# Add src to path so we can import without installing
sys.path.append(str(Path(__file__).parent / "python" / "src"))
# Fallback if running from inside python folder
sys.path.append(str(Path(__file__).parent / "src"))
from llm_session import Automator
import logging
# 1. Configure Standard Logging
logging.basicConfig(level=logging.INFO)
def main():
print("--- Starting AI Studio Verification ---")
# CREDENTIALS: Set these or ensure they are in your Environment Variables
# You can also hardcode them here for a quick test, but don't commit them!
email = os.getenv("LLM_EMAIL", "your_email@gmail.com")
password = os.getenv("LLM_PASSWORD", "your_password")
if email == "your_email@gmail.com":
print("WARNING: Using default/dummy credentials. Login will likely fail.")
print("Please set LLM_EMAIL and LLM_PASSWORD environment variables or edit the script.")
try:
# Initialize Automator with 'aistudio' provider
# headless=False is CRITICAL for the first run to handle Google Login manually
print("Initializing Automator (aistudio)...")
bot = Automator(
provider="aistudio",
headless=False,
credentials={
"email": email,
"password": password
}
)
# Test 1: Single Prompt
print("\n[Test 1] Single Prompt")
prompt = "Explain the concept of recursion in one sentence."
print(f"Sending: {prompt}")
response = bot.process_prompt(prompt)
print(f"\nResponse received:\n{response}")
# Test 2: Chained Context
# We verify that the session remembers context
print("\n[Test 2] Follow-up Prompt (Context Check)")
follow_up = "Give me a Python code example of it."
print(f"Sending: {follow_up}")
response_2 = bot.process_chain([follow_up])
print(f"\nResponse received:\n{response_2[0]}")
print("\n>> Verification PASSED if you see meaningful responses above.")
# Keep browser open for a moment to see the result
time.sleep(2)
bot.close()
print("\n--- Verification Complete ---")
except Exception as e:
print(f"\nERROR during verification: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
main()