forked from namefailed/CodeMechanic-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_all.py
More file actions
35 lines (31 loc) · 1.08 KB
/
verify_all.py
File metadata and controls
35 lines (31 loc) · 1.08 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
import time
import requests
import sys
def verify():
print("Verifying Ollama and Gemma3:4b...")
# Wait for Ollama model to be available
for i in range(300): # Wait up to 5 minutes
try:
response = requests.post(
"http://localhost:11434/api/generate",
json={
"model": "gemma3:4b",
"prompt": "Say 'hello world'",
"stream": False
},
timeout=10
)
if response.status_code == 200:
print("Success! Ollama is responding locally with gemma3:4b.")
print("Response:", response.json().get("response"))
return
except requests.exceptions.RequestException:
pass
# Only print every 10 seconds to avoid spamming logs
if i % 10 == 0:
print(f"Waiting for gemma3:4b... (Attempt {i+1}/300)")
time.sleep(1)
print("Failed to verify Ollama model after 5 minutes.")
sys.exit(1)
if __name__ == "__main__":
verify()