Download scripts\check_models.py from aionaion/chatdoc: direct link, hf CLI and curl.
- Browser
- Download file 914 Bytes
-
https://huggingface.co/spaces/aionaion/chatdoc/resolve/main/scripts%5Ccheck_models.py
- Command line
-
hf download 'hf://spaces/aionaion/chatdoc/scripts\check_models.py'
-
curl -L -o 'scripts\check_models.py' https://huggingface.co/spaces/aionaion/chatdoc/resolve/main/scripts%5Ccheck_models.py
914 Bytes
| import os | |
| import google.generativeai as genai | |
| from dotenv import load_dotenv | |
| # Carrega variáveis de ambiente | |
| load_dotenv() | |
| api_key = os.getenv("GOOGLE_API_KEY") | |
| if not api_key: | |
| print("❌ Erro: GOOGLE_API_KEY não encontrada no arquivo .env") | |
| exit(1) | |
| print(f"🔑 Chave encontrada: {api_key[:5]}...{api_key[-5:]}") | |
| try: | |
| genai.configure(api_key=api_key) | |
| print("\n🔍 Listando modelos disponíveis...") | |
| models = list(genai.list_models()) | |
| chat_models = [] | |
| for m in models: | |
| print(f" - {m.name}") | |
| if 'generateContent' in m.supported_generation_methods: | |
| chat_models.append(m.name) | |
| print("\n✅ Modelos compatíveis com Chat (generateContent):") | |
| for model_name in chat_models: | |
| print(f" -> {model_name}") | |
| except Exception as e: | |
| print(f"\n❌ Erro ao listar modelos: {e}") | |