Spaces:
Runtime error
Runtime error
File size: 995 Bytes
609c821 | 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 | import google.generativeai as genai
import os
from dotenv import load_dotenv
load_dotenv()
api_key = os.getenv("GEMINI_API_KEY")
genai.configure(api_key=api_key)
candidates = [
"models/gemini-2.5-flash",
"models/gemini-3.0-flash-preview",
"models/gemini-3.0-flash-exp",
"models/gemini-3.0-flash",
"models/gemini-1.5-flash",
"models/gemini-2.0-flash-exp",
"models/gemini-flash-3-preview" # Guess
]
with open("results.txt", "w") as f:
f.write("Starting tests\n")
for model_name in candidates:
try:
model = genai.GenerativeModel(model_name)
# Try a simple generation (cheaper/faster than counting sometimes?)
# Counting is free.
res = model.count_tokens("hello")
f.write(f"SUCCESS: {model_name}\n")
print(f"S: {model_name}")
except Exception as e:
f.write(f"FAILED: {model_name} - {e}\n")
print(f"F: {model_name}")
|