Skip to content

Commit

Permalink
Update model get model (#113)
Browse files Browse the repository at this point in the history
* add get_model method details

* update get_model method details

* update get_model method details

* update paragraph and variable name

* nbfmt

* pyink

---------

Co-authored-by: Mark McDonald <[email protected]>
  • Loading branch information
karthidec and markmcd authored May 7, 2024
1 parent e121976 commit 2cf7d47
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions quickstarts/Models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)"
]
},
Expand All @@ -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)"
]
},
{
Expand All @@ -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)"
]
},
{
Expand All @@ -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)"
]
},
{
Expand Down

0 comments on commit 2cf7d47

Please sign in to comment.