Skip to main content

Google Generative AI High level API client library and tools.

Project description

Google AI Python SDK for the Gemini API

PyPI version Python support PyPI - Downloads

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 created by Google DeepMind. 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.
  2. Login with your Google account.
  3. Create an API key.
  4. Try a Python SDK quickstart in the Gemini API Cookbook.
  5. For detailed instructions, try the Python SDK tutorial on ai.google.dev.

Usage example

See the Gemini API Cookbook or ai.google.dev for complete code.

  1. Install from PyPI.

pip install -U google-generativeai

  1. Import the SDK and configure your API key.
import google.generativeai as genai
import os

genai.configure(api_key=os.environ["GEMINI_API_KEY"])
  1. Create a model and run a prompt.
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 or ai.google.dev for complete documentation.

Contributing

See Contributing 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

google_generativeai-0.8.0-py3-none-any.whl (164.0 kB view details)

Uploaded Python 3

File details

Details for the file google_generativeai-0.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for google_generativeai-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7a76f72a2736f5c0960be836c5e864aea32b08105b51cab81835522eb62938b
MD5 d5ade5c7018dca9b47d6a661ae255f68
BLAKE2b-256 52f0da3d88f7db3f6e2327e5a186b5a71caf32cf608ded0d4de93d0aa5f806ef

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page