-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/composio-workspace
- Loading branch information
Showing
138 changed files
with
7,422 additions
and
6,101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,7 @@ jobs: | |
praisonai, | ||
langgraph, | ||
phidata, | ||
google, | ||
] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
--- | ||
title: "Using Composio With Google AI" | ||
sidebarTitle: "Google AI" | ||
icon: "robot" | ||
description: "Enable Google AI models to seamlessly interact with external apps via Composio for enhanced functionality" | ||
--- | ||
|
||
**Composio enables** your **Google AI models** to **connect** with many **tools**! | ||
|
||
### Install Packages & Connect a Tool | ||
|
||
<Tip> | ||
Goal: Enable Google AI models to perform tasks like starring a repository on | ||
GitHub via natural language commands | ||
</Tip> | ||
|
||
These steps prepare your environment to enable interactions between Google AI and GitHub through Composio. | ||
|
||
<CodeGroup> | ||
```bash Run Command | ||
pip install composio-google | ||
|
||
# Connect your GitHub so models can interact with it | ||
|
||
composio add github | ||
|
||
# Check all supported apps | ||
|
||
composio apps | ||
``` | ||
</CodeGroup> | ||
|
||
<Steps> | ||
|
||
<Step title="Import Base Packages & Initialize Google AI Model"> | ||
Replace `{google_api_key}` with your actual API key. | ||
<CodeGroup> | ||
```python Default Imports & Configuration | ||
import dotenv | ||
from composio_google import App, ComposioToolset | ||
from vertexai.generative_models import GenerativeModel | ||
# Load environment variables from .env | ||
dotenv.load_dotenv() | ||
# Initialize the Composio Toolset | ||
composio_toolset = ComposioToolset() | ||
# Get GitHub tools that are pre-configured | ||
tool = composio_toolset.get_tool(apps=[App.GITHUB]) | ||
# Initialize the Google AI Gemini model | ||
model = GenerativeModel("gemini-1.5-pro", tools=[tool]) | ||
``` | ||
</CodeGroup> | ||
</Step> | ||
|
||
<Step title="Start a Chat Session with the Model"> | ||
<CodeGroup> | ||
```python Start Chat Session | ||
# Start a chat session | ||
chat = model.start_chat() | ||
``` | ||
</CodeGroup> | ||
</Step> | ||
|
||
<Step title="Execute the Task via Google AI Model"> | ||
<CodeGroup> | ||
```python Execute Task | ||
# Define task | ||
task = "Star a repo composiohq/composio on GitHub" | ||
# Send a message to the model | ||
response = chat.send_message(task) | ||
print("Model response:") | ||
print(response) | ||
``` | ||
</CodeGroup> | ||
</Step> | ||
|
||
<Step title="Handle the Tool Calls"> | ||
<CodeGroup> | ||
```python Handle Tool Calls | ||
result = composio_toolset.handle_response(response) | ||
print("Function call result:") | ||
print(result) | ||
``` | ||
</CodeGroup> | ||
</Step> | ||
|
||
</Steps> | ||
|
||
### Use Specific Actions | ||
|
||
<CodeGroup> | ||
```python Filter Specific Action | ||
# To restrict models from executing any actions, filter specific actions | ||
actions = composio_toolset.get_tool(actions=[Action.GITHUB_CREATE_ISSUE]) | ||
``` | ||
</CodeGroup> | ||
|
||
### Use Specific Apps | ||
|
||
<CodeGroup> | ||
```python Filter Specific App | ||
# To restrict models from using all tools, filter specific tools | ||
actions = composio_toolset.get_tool(apps=[App.ASANA, App.GITHUB]) | ||
``` | ||
</CodeGroup> | ||
|
||
### Filter apps actions by tags | ||
|
||
<CodeGroup> | ||
```python Filter Actions by Tags | ||
actions = composio_toolset.get_tool(apps=[App.ASANA], tags=[Tag.ASANA_TASKS]) | ||
``` | ||
</CodeGroup> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.