vj-codes / generative-ai-python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google Generative AI Python Client

PyPI version PyPI - Downloads

Get started using the PaLM API in Python. Check out the developer site for comprehensive documentation.

Installation and usage

Install from PyPI.

pip install google-generativeai

Get an API key from MakerSuite, then configure it here.

import google.generativeai as palm

palm.configure(api_key=os.environ['PALM_API_KEY'])

Use the palm.chat function to have a discussion with a model.

response = palm.chat(messages=["Hello."])
print(response.last) #  'Hello! What can I help you with?'
response.reply("Can you tell me a joke?")

Documentation

Checkout the full API docs, the guide and quick starts.

Colab magics

Once installed, use the Python client via the %%palm Colab magic. Read the full guide here.

%%palm
The best thing since sliced bread is

About

License:Apache License 2.0


Languages

Language:Python 100.0%