Socket
Socket
Sign inDemoInstall

google-generativeai

Package Overview
Dependencies
6
Maintainers
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-generativeai

Google Generative AI High level API client library and tools.


Maintainers
2

Readme

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.

Install from PyPI.

pip install -U google-generativeai

Import the SDK and configure your API key.

import google.generativeai as genai
import os

genai.configure(api_key=os.environ["GOOGLE_API_KEY"])

Create a model and run a prompt.

model = genai.GenerativeModel('gemini-1.0-pro-latest')
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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc