# Google AI Python SDK for the Gemini API
[![PyPI version](https://badge.fury.io/py/google-generativeai.svg)](https://badge.fury.io/py/google-generativeai)
![Python support](https://img.shields.io/pypi/pyversions/google-generativeai)
![PyPI - Downloads](https://img.shields.io/pypi/dd/google-generativeai)
The Google AI Python SDK is the easiest 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.
## 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).
## Usage example
See the [Gemini API Cookbook](https://github.com/google-gemini/gemini-api-cookbook/) or [ai.google.dev](https://ai.google.dev) for complete code.
1. Install from [PyPI](https://pypi.org/project/google-generativeai).
`pip install -U google-generativeai`
2. Import the SDK and configure your API key.
```python
import google.generativeai as genai
import os
genai.configure(api_key=os.environ["GEMINI_API_KEY"])
```
3. Create a model and run a prompt.
```python
model = genai.GenerativeModel('gemini-1.5-flash')
response = model.generate_content("The opposite of hot is")
print(response.text)
```
## Documentation
See the [Gemini API Cookbook](https://github.com/google-gemini/gemini-api-cookbook/) or [ai.google.dev](https://ai.google.dev) for complete documentation.
## Contributing
See [Contributing](https://github.com/google/generative-ai-python/blob/main/CONTRIBUTING.md) for more information on contributing to the Google AI Python SDK.
## License
The contents of this repository are licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
Raw data
{
"_id": null,
"home_page": "https://github.com/google/generative-ai-python",
"name": "google-generativeai",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Google LLC",
"author_email": "googleapis-packages@google.com",
"download_url": null,
"platform": "Posix; MacOS X; Windows",
"description": "# Google AI Python SDK for the Gemini API\n\n[![PyPI version](https://badge.fury.io/py/google-generativeai.svg)](https://badge.fury.io/py/google-generativeai)\n![Python support](https://img.shields.io/pypi/pyversions/google-generativeai)\n![PyPI - Downloads](https://img.shields.io/pypi/dd/google-generativeai)\n\nThe Google AI Python SDK is the easiest 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. \n\n## Get started with the Gemini API\n1. Go to [Google AI Studio](https://aistudio.google.com/).\n2. Login with your Google account.\n3. [Create](https://aistudio.google.com/app/apikey) an API key.\n4. 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/).\n5. For detailed instructions, try the \n[Python SDK tutorial](https://ai.google.dev/tutorials/python_quickstart) on [ai.google.dev](https://ai.google.dev).\n\n## Usage example\nSee the [Gemini API Cookbook](https://github.com/google-gemini/gemini-api-cookbook/) or [ai.google.dev](https://ai.google.dev) for complete code.\n\n1. Install from [PyPI](https://pypi.org/project/google-generativeai).\n\n`pip install -U google-generativeai`\n\n2. Import the SDK and configure your API key.\n\n```python\nimport google.generativeai as genai\nimport os\n\ngenai.configure(api_key=os.environ[\"GEMINI_API_KEY\"])\n```\n\n3. Create a model and run a prompt.\n\n```python\nmodel = genai.GenerativeModel('gemini-1.5-flash')\nresponse = model.generate_content(\"The opposite of hot is\")\nprint(response.text)\n```\n\n## Documentation\n\nSee the [Gemini API Cookbook](https://github.com/google-gemini/gemini-api-cookbook/) or [ai.google.dev](https://ai.google.dev) for complete documentation.\n\n## Contributing\n\nSee [Contributing](https://github.com/google/generative-ai-python/blob/main/CONTRIBUTING.md) for more information on contributing to the Google AI Python SDK.\n\n## License\n\nThe contents of this repository are licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "Google Generative AI High level API client library and tools.",
"version": "0.8.3",
"project_urls": {
"Homepage": "https://github.com/google/generative-ai-python"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e92fb5c1d62e94409ed98d5425e83b8e6d3dd475b611be272f561b1a545d273a",
"md5": "167c9ccc48c2705418c72e1a3b9ea118",
"sha256": "1108ff89d5b8e59f51e63d1a8bf84701cd84656e17ca28d73aeed745e736d9b7"
},
"downloads": -1,
"filename": "google_generativeai-0.8.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "167c9ccc48c2705418c72e1a3b9ea118",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 160822,
"upload_time": "2024-10-07T15:46:08",
"upload_time_iso_8601": "2024-10-07T15:46:08.699989Z",
"url": "https://files.pythonhosted.org/packages/e9/2f/b5c1d62e94409ed98d5425e83b8e6d3dd475b611be272f561b1a545d273a/google_generativeai-0.8.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-07 15:46:08",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "google",
"github_project": "generative-ai-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "google-generativeai"
}