File size: 1,135 Bytes
033ead0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""List available Gemini models"""

import os
import google.generativeai as genai
from dotenv import load_dotenv

load_dotenv()

try:
    # Настройка API ключа
    api_key = os.environ.get("GEMINI_API_KEY")
    if not api_key:
        print("GEMINI_API_KEY not found in environment variables")
        exit(1)
        
    genai.configure(api_key=api_key)

    # Получение списка моделей
    models = list(genai.list_models())
    print(f"Found {len(models)} models:")
    for model in models:
        print(f"\nModel name: {model.name}")
        print(f"Display name: {model.display_name}")
        print(f"Description: {model.description}")
        print(f"Generation methods: {', '.join(model.supported_generation_methods) if hasattr(model, 'supported_generation_methods') else 'Not specified'}")
        print(f"Input token limit: {model.input_token_limit}")
        print(f"Output token limit: {model.output_token_limit}")
        print(f"Temperature: {model.temperature}") 
        print("=" * 80)
        
except Exception as e:
    print(f"Error listing models: {e}")