View source on GitHub |
Google AI Python SDK
Setup
pip install google-generativeai
GenerativeModel
Use genai.GenerativeModel
to access the API:
import google.generativeai as genai
import os
genai.configure(api_key=os.environ['API_KEY'])
model = genai.GenerativeModel('gemini-pro')
response = model.generate_content('Please summarise this document: ...')
print(response.text)
See the python quickstart for more details.
Modules
types
module: A collection of type definitions used throughout the library.
Classes
class GenerativeModel
: The genai.GenerativeModel
class wraps default parameters for calls to GenerativeModel.generate_content
, GenerativeModel.count_tokens
, and GenerativeModel.start_chat
.
Other Members | |
---|---|
version |
'0.3.0'
|
annotations |
Instance of __future__._Feature
|