diff --git a/quickstarts/Models.ipynb b/quickstarts/Models.ipynb index af49ad3ca..985ad6e38 100644 --- a/quickstarts/Models.ipynb +++ b/quickstarts/Models.ipynb @@ -18,7 +18,7 @@ }, "outputs": [], "source": [ - "#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n", + "# @title Licensed under the Apache License, Version 2.0 (the \"License\");\n", "# you may not use this file except in compliance with the License.\n", "# You may obtain a copy of the License at\n", "#\n", @@ -104,7 +104,8 @@ "outputs": [], "source": [ "from google.colab import userdata\n", - "GOOGLE_API_KEY=userdata.get('GOOGLE_API_KEY')\n", + "\n", + "GOOGLE_API_KEY = userdata.get(\"GOOGLE_API_KEY\")\n", "genai.configure(api_key=GOOGLE_API_KEY)" ] }, @@ -128,8 +129,8 @@ "outputs": [], "source": [ "for m in genai.list_models():\n", - " if 'generateContent' in m.supported_generation_methods:\n", - " print(m.name)" + " if \"generateContent\" in m.supported_generation_methods:\n", + " print(m.name)" ] }, { @@ -150,8 +151,8 @@ "outputs": [], "source": [ "for m in genai.list_models():\n", - " if 'embedContent' in m.supported_generation_methods:\n", - " print(m.name)" + " if \"embedContent\" in m.supported_generation_methods:\n", + " print(m.name)" ] }, { @@ -174,8 +175,31 @@ "outputs": [], "source": [ "for m in genai.list_models():\n", - " if m.name == 'models/gemini-1.5-pro-latest':\n", - " print(m)" + " if m.name == \"models/gemini-1.5-pro-latest\":\n", + " print(m)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "00a56cb21953" + }, + "source": [ + "## Get model\n", + "\n", + "Use `get_model()` to retrieve the specific details of a model. You can iterate over all available models using `list_models()`, but if you already know the model name you can retrieve it directly with `get_model()`." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "6786759016dc" + }, + "outputs": [], + "source": [ + "model_info = genai.get_model(\"models/aqa\")\n", + "print(model_info)" ] }, {