[Python] What is the Python code to check all the GenerativeAI models supported by Google...

Discussão em 'Python' iniciado por Stack, Março 28, 2025.

  1. Stack

    Stack Membro Participativo

    Being new to GenerativeAI world, I am trying to load a pre-trained text generation model and doing some stuff which is not working. This is how I load the GenerativeAI model.

    from vertexai.generative_models import GenerativeModel
    generation_model = GenerativeModel("gemini-pro")


    Since it does not work, I feel I might have to use some other GenerativeAI model, not "gemini-pro". Even I try following piece of code to check all the models supported by Gemini.

    import google.generativeai as genai
    for model in genai.list_models():
    if 'generateContent' in model.supported_generation_methods:
    print(model.name)


    But I get 'PermissionDenied' error as attached image shows. [​IMG]

    Now as a programmer I have 2 queries here.

    Q1. Can I see the GenerativeAI models supported by Gemini or not?

    Q2. If answer is 'Yes', what is the Python code?

    Continue reading...

Compartilhe esta Página