Skip to content

Commit 79f841b

Browse files
authored
SDK directions
1 parent 8dc78c6 commit 79f841b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

.gemini/styleguide.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ This guide is mostly about the python content and the notebook, but don't forget
1919

2020
# Cookbook notebook specific instructions
2121

22+
## Common mistakes
23+
24+
* There are multiple SDKs to use the Gemini APIs. The correct and most recent one is the [Python genai](https://github.com/googleapis/python-genai) one.
25+
* `%pip install -U -q 'google-genai>=1.0.0'` is the right way to install the SDK. The version indicated should reflect the minimum version needed to use the features used in the notebook (1.0.0 by default or in doubt).
26+
* `from google import genai` is the right way to import the official SDK.
27+
* `from google.genai import types` is the right way to uimport the types.
28+
* `import google.generativeai` is incorrect, this is the old one that was deprecated early 2025.
29+
30+
2231
## Hard-coded API keys
2332

2433
Very important: notebooks must not contain hard-coded API keys. If you find one, immediately tell the author to cancel their submission, revoke the compromised key, and create a new one. Exposed keys are quickly collected and can lead to unauthorized usage and costs for the author.
@@ -42,8 +51,8 @@ Most of the cookbook content is Colab notebooks, which are stored as Json.
4251
where `URL` should be `https://colab.research.google.com/github/google-gemini/cookbook/blob/main/` followed by the notebook
4352
location in the cookbook
4453
* Include an overview section before any code.
45-
* use %pip instead of !pip
46-
* Put the imports when they are first used.
54+
* use `%pip` instead of `!pip`
55+
* Put the imports when they are first used. Try to avoid having a big "import" cell at the beginning.
4756
* Keep code as brief as possible.
4857
* Break text cells at headings
4958
* Break code cells between "building" and "running".

0 commit comments

Comments
 (0)