Skip to content

Google

pip install datapizza-ai-clients-google

datapizza.clients.google.GoogleClient

Bases: Client

A client for interacting with Google's Generative AI APIs.

This class provides methods for invoking the Google GenAI API to generate responses based on given input data. It extends the Client class.

__init__

__init__(
    api_key=None,
    model="gemini-2.0-flash",
    system_prompt="",
    temperature=None,
    cache=None,
    project_id=None,
    location=None,
    credentials_path=None,
    use_vertexai=False,
)

Parameters:

Name Type Description Default
api_key str | None

The API key for the Google API.

None
model str

The model to use for the Google API.

'gemini-2.0-flash'
system_prompt str

The system prompt to use for the Google API.

''
temperature float | None

The temperature to use for the Google API.

None
cache Cache | None

The cache to use for the Google API.

None
project_id str | None

The project ID for the Google API.

None
location str | None

The location for the Google API.

None
credentials_path str | None

The path to the credentials for the Google API.

None
use_vertexai bool

Whether to use Vertex AI for the Google API.

False

Usage example

import os

from datapizza.clients.google import GoogleClient
from dotenv import load_dotenv

load_dotenv()

client = GoogleClient(api_key=os.getenv("GOOGLE_API_KEY"))

response = client.invoke("Hello!")
print(response.text)