Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update model get model #113

Merged
merged 6 commits into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading