I came to run Gemini AI in Jupyter Notebook in Google Colab according to the Google guide, but I encountered an error in the list modules step: (I don't have a Google Cloud account and Colab Pro)
ERROR:tornado.access:500 GET /v1beta/models?pageSize=50&%24alt=json%3Benum-encoding%3Dint (127.0.0.1) 3290.39ms
---------------------------------------------------------------------------
InternalServerError Traceback (most recent call last)
<ipython-input-20-77709e92acfe> in <cell line: 1>()
----> 1 for m in genai.list_models():
2 if 'generateContent' in m.supported_generation_methods:
3 print(m.name)
7 frames
/usr/local/lib/python3.10/dist-packages/google/ai/generativelanguage_v1beta/services/model_service/transports/rest.py in __call__(self, request, retry, timeout, metadata)
826 # subclass.
827 if response.status_code >= 400:
--> 828 raise core_exceptions.from_http_response(response)
829
830 # Return the response
InternalServerError: 500 GET http://localhost:38257/v1beta/models?pageSize=50&%24alt=json%3Benum-encoding%3Dint: TypeError: NetworkError when attempting to fetch resource.
First, I open Google Colab with this Gemini guide
Then I opened Google Colab and entered all the commands one by one received the API key from vertex ai placed it here and put the gemini
value in GOOGLE_API_KEY
and I reached the List models stage and encountered the mentioned error.