Skip to content

Commit 42cb694

Browse files
markmcdGiom-V
andauthored
Update import advice in template (#691)
* Updated template notebook with newer guidance * Minimum version --------- Co-authored-by: Guillaume Vernade <[email protected]>
1 parent cd57b34 commit 42cb694

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

quickstarts/Template.ipynb

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,26 @@
7575
},
7676
"outputs": [],
7777
"source": [
78-
"%pip install -U -q \"google-genai>=1.0.0\" # Install the Python SDK\n",
78+
"%pip install -U -q \"google-genai>=1.0.0\" # Install the Python SDK\n",
7979
"\n",
8080
"# Always set at least 1.0.0 as the minimal version as there were breaking\n",
8181
"# changes through the previous versions\n",
8282
"# Of course, if your notebook uses a new feature and needs a more recent\n",
8383
"# version, set the right minimum version to indicate when the feature was\n",
84-
"# introduced"
84+
"# introduced.\n",
85+
"# Always test your notebook with that fixed version (eg. '==1.0.0') to make.\n",
86+
"# sure it's really the minimum version.\n",
87+
]
88+
},
89+
{
90+
"cell_type": "code",
91+
"execution_count": 7,
92+
"metadata": {
93+
"id": "iQSKjF5WH5N9"
94+
},
95+
"outputs": [],
96+
"source": [
97+
"from google import genai"
8598
]
8699
},
87100
{
@@ -141,12 +154,7 @@
141154
"source": [
142155
"## [Write your guide]\n",
143156
"\n",
144-
"1. Élément de liste\n",
145-
"2. Élément de liste\n",
146-
"\n",
147-
"\n",
148-
"\n",
149-
"[Add as many high level sections as needed to step through your guide. Try to introduce new concepts incrementally, and remember that notebooks need to be executable from start to finish using `Runtime -> Run all` in Colab.]"
157+
"[Add as many high level sections as needed to step through your guide. Try to introduce new concepts incrementally, including explanatory text at every step. Remember that notebooks need to be executable from start to finish using `Runtime -> Run all` in Colab.]"
150158
]
151159
},
152160
{
@@ -195,11 +203,12 @@
195203
"* Use one `H1` header for the title.\n",
196204
"* Include the button-bar immediately after the `H1`.\n",
197205
"* Include an overview section before any code.\n",
198-
"* Put all your installs and imports in a setup section.\n",
206+
"* Keep your installs and imports close to the code that first uses them. If they are used throughout (such as the SDK), they can go at the start of the guide.\n",
199207
"* Keep code and text cells as brief as possible.\n",
200208
"* Break text cells at headings\n",
201209
"* Break code cells between \"building\" and \"running\", and between \"printing one result\" and \"printing another result\".\n",
202-
"* Necessary but uninteresting code should be hidden in a toggleable code cell by putting `# @title` as the first line."
210+
"* Necessary but uninteresting code should be hidden in a toggleable code cell by putting `# @title` as the first line.\n",
211+
"* You can optionally add a byline for content in `examples/` that you wrote, including one link to your GitHub, social, or site of your choice."
203212
]
204213
},
205214
{
@@ -224,7 +233,7 @@
224233
"* Demonstrate small parts before combining them into something more complex.\n",
225234
"* Keep the code as simple as possible, only use extra parameters like temperature when needed, and in that case, explain why\n",
226235
"* To ensure notebook text remains accurate, present model metadata by executing code.\n",
227-
" * For example, instead of saying \"1M token context\" in the text, display the output of `genai.get_model('models/...').input_token_limit`.\n"
236+
" * For example, instead of saying \"1M token context\" in the text, display the output of `client.models.get(model='...').input_token_limit`.\n"
228237
]
229238
},
230239
{

0 commit comments

Comments
 (0)