Skip to main content

Use Composio to get an array of tools with your Google AI Python Gemini model.

Project description

composio-google

Adapts Composio tools to the Vertex AI SDK (vertexai.generative_models) as FunctionDeclaration objects for Gemini function calling.

Installation

pip install composio composio-google google-cloud-aiplatform

Set COMPOSIO_API_KEY (create one at https://dashboard.composio.dev/settings) in your environment. Vertex AI authenticates with Google Cloud credentials; run gcloud auth application-default login or set GOOGLE_APPLICATION_CREDENTIALS.

Quickstart

GoogleProvider is non-agentic: the model returns function calls, and composio.provider.handle_response executes every function call in the response and returns the results.

import vertexai
from vertexai.generative_models import GenerativeModel, Tool

from composio import Composio
from composio_google import GoogleProvider

vertexai.init(project="your-gcp-project", location="us-central1")

composio = Composio(provider=GoogleProvider())

# Create a session for your user
session = composio.create(user_id="user_123")
tools = session.tools()

model = GenerativeModel(
    "gemini-2.0-flash",
    tools=[Tool(function_declarations=tools)],
)
chat = model.start_chat()

response = chat.send_message(
    "Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'"
)

# Execute the function calls the model requested
results = composio.provider.handle_response(user_id="user_123", response=response)
print(results)

To execute a single call instead of the whole response, use composio.provider.execute_tool_call(user_id="user_123", function_call=part.function_call).

composio-google vs composio-gemini

This package targets the Vertex AI SDK (vertexai.generative_models, installed via google-cloud-aiplatform). composio-gemini targets the newer google-genai SDK with Automatic Function Calling. For new projects, use composio-gemini.

Links

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

composio_google-0.18.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

composio_google-0.18.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file composio_google-0.18.1.tar.gz.

File metadata

  • Download URL: composio_google-0.18.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for composio_google-0.18.1.tar.gz
Algorithm Hash digest
SHA256 73e56c7f7cb9e5d700007701857ec5e94fbff50f8c136fa2c68435d4a239dbbf
MD5 2c74ecd05d3295d30b4e699fa854005d
BLAKE2b-256 9ac71c0a134154236b2b153e2ea8b97fb47375e47e94e4964ec0e8e2fb575eb7

See more details on using hashes here.

File details

Details for the file composio_google-0.18.1-py3-none-any.whl.

File metadata

File hashes

Hashes for composio_google-0.18.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c76e53b06fc3e88c82eff8f0d569f0cd8bcf0ac879ba7bb7f04c7175ec805d60
MD5 15d9a6e1c4068a6383e714c5d3c531f7
BLAKE2b-256 213d438bf5a20987ace9c46497a9c0c5c91885089450ea8a5962cb2a8868dfe0

See more details on using hashes here.

Supported by

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