Skip to content

Commit

Permalink
Add Important note in the top
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickloeber committed Feb 6, 2025
1 parent 9df1d55 commit 81eda54
Showing 1 changed file with 24 additions and 35 deletions.
59 changes: 24 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,23 @@
![PyPI - Downloads](https://img.shields.io/pypi/dd/google-generativeai)

> [!IMPORTANT]
> This SDK has been deprecated in favor of the new SDK `google-genai` ([github](https://github.com/googleapis/python-genai),
[pypi](https://pypi.org/project/google-genai/)). From Gemini 2.0 onwards the old SDK, `google-generativeai`, will no longer be
developing new features. The old SDK can run a subset of Gemini-2.0 model
features. Any new code should be written using the new SDK, `google-genai`.
> From Gemini 2.0 onwards this SDK will no longer be
developing new features. Any new code should be written using the new SDK, `google-genai` ([github](https://github.com/googleapis/python-genai),
[pypi](https://pypi.org/project/google-genai/)). See the migration guide below to upgrade to the new SDK.

Use the new SDK, [google-genai]((https://github.com/googleapis/python-genai)), for any new code from Gemini 2.0 onwards:
The Google AI Python SDK is an easy way for Python developers to build with the Gemini API. The Gemini API gives you access to Gemini [models](https://ai.google.dev/models/gemini) created by [Google DeepMind](https://deepmind.google/technologies/gemini/#introduction). Gemini models are built from the ground up to be multimodal, so you can reason seamlessly across text, images, and code.

<table align="left">
<td>
<a target="_blank" href="https://colab.research.google.com/github/google-gemini/cookbook/blob/main/quickstarts/Get_started.ipynb">
<img src="https://ai.google.dev/site-assets/images/docs/colab_logo_32px.png" />
Try the new SDK in Google Colab
</a>
</td>
</table>
<br><br>
## Get started with the Gemini API
1. Go to [Google AI Studio](https://aistudio.google.com/).
2. Login with your Google account.
3. [Create](https://aistudio.google.com/app/apikey) an API key.
4. Try a Python SDK [quickstart](https://github.com/google-gemini/gemini-api-cookbook/blob/main/quickstarts/Prompting.ipynb) in the [Gemini API Cookbook](https://github.com/google-gemini/gemini-api-cookbook/).
5. For detailed instructions, try the
[Python SDK tutorial](https://ai.google.dev/tutorials/python_quickstart) on [ai.google.dev](https://ai.google.dev).

## Upgrade to the new Google Gen AI SDK for Python

Follow the migration guide below to upgrade your code to the new SDK.

<details>
<summary>Migration guide</summary>

Until now, the `google-generativeai` SDK package has been the recommended tool
Until now, the `google-generativeai` SDK package has been the recommended tool
for accessing the Gemini API from Python. While this package gets the job done,
the long incremental development process (starting from the PaLM API in 2023)
made it impossible to implement some important high level features without
Expand All @@ -47,9 +39,19 @@ resolve these problems. Among other things, the new package:
* Follows the API layout closely; paths and data structures mostly match
between the SDK and the REST interface.

Any new code should be written using the new SDK, `google-genai`.
From Gemini 2.0 onwards the old SDK, `google-generativeai`, will no longer be
developing new features. The old SDK can run a subset of Gemini-2.0 model
features. Any new new code should be written using the new SDK, `google-genai`.

To upgrade your code to use the new SDK, follow these steps:
<table align="left">
<td>
<a target="_blank" href="https://colab.research.google.com/github/google-gemini/cookbook/blob/main/quickstarts/Get_started.ipynb">
<img src="https://ai.google.dev/site-assets/images/docs/colab_logo_32px.png" />
Try the new SDK in Google Colab
</a>
</td>
</table>
<br><br>

### Install the SDK

Expand Down Expand Up @@ -950,16 +952,3 @@ response = client.models.generate_content(
contents='55',
)
```

</details>

## Get started with the Gemini API

If you still want to build with this old SDK, follow these steps:

1. Go to [Google AI Studio](https://aistudio.google.com/).
2. Login with your Google account.
3. [Create](https://aistudio.google.com/app/apikey) an API key.
4. Try a Python SDK [quickstart](https://github.com/google-gemini/gemini-api-cookbook/blob/main/quickstarts/Prompting.ipynb) in the [Gemini API Cookbook](https://github.com/google-gemini/gemini-api-cookbook/).
5. For detailed instructions, try the
[Python SDK tutorial](https://ai.google.dev/tutorials/python_quickstart) on [ai.google.dev](https://ai.google.dev).

0 comments on commit 81eda54

Please sign in to comment.