Goal: Enable Google AI models to perform tasks like starring a repository on
GitHub via natural language commands
These steps prepare your environment to enable interactions between Google AI and GitHub through Composio.
pip install composio-google# Connect your GitHub so models can interact with itcomposio add github# Check all supported appscomposio apps
1
Import Base Packages & Initialize Google AI Model
Replace {google_api_key} with your actual API key.
import dotenvfrom composio_google import App, ComposioToolsetfrom vertexai.generative_models import GenerativeModel# Load environment variables from .envdotenv.load_dotenv()# Initialize the Composio Toolsetcomposio_toolset = ComposioToolset()# Get GitHub tools that are pre-configuredtool = composio_toolset.get_tool(apps=[App.GITHUB])# Initialize the Google AI Gemini modelmodel = GenerativeModel("gemini-1.5-pro", tools=[tool])
2
Start a Chat Session with the Model
# Start a chat sessionchat = model.start_chat()
3
Execute the Task via Google AI Model
# Define tasktask = "Star a repo composiohq/composio on GitHub"# Send a message to the modelresponse = chat.send_message(task)print("Model response:")print(response)
4
Handle the Tool Calls
result = composio_toolset.handle_response(response)print("Function call result:")print(result)