composio-gemini 0.7.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- composio_gemini-0.7.1/PKG-INFO +96 -0
- composio_gemini-0.7.1/README.md +72 -0
- composio_gemini-0.7.1/composio_gemini/__init__.py +16 -0
- composio_gemini-0.7.1/composio_gemini/toolset.py +118 -0
- composio_gemini-0.7.1/composio_gemini.egg-info/PKG-INFO +96 -0
- composio_gemini-0.7.1/composio_gemini.egg-info/SOURCES.txt +9 -0
- composio_gemini-0.7.1/composio_gemini.egg-info/dependency_links.txt +1 -0
- composio_gemini-0.7.1/composio_gemini.egg-info/requires.txt +2 -0
- composio_gemini-0.7.1/composio_gemini.egg-info/top_level.txt +1 -0
- composio_gemini-0.7.1/setup.cfg +4 -0
- composio_gemini-0.7.1/setup.py +30 -0
@@ -0,0 +1,96 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: composio_gemini
|
3
|
+
Version: 0.7.1
|
4
|
+
Summary: Use Composio to get an array of tools with your Gemini agent.
|
5
|
+
Home-page: https://github.com/ComposioHQ/composio
|
6
|
+
Author: Composio
|
7
|
+
Author-email: tech@composio.dev
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Requires-Python: >=3.9,<4
|
12
|
+
Description-Content-Type: text/markdown
|
13
|
+
Requires-Dist: composio_core<0.8.0,>=0.7.0
|
14
|
+
Requires-Dist: google-genai
|
15
|
+
Dynamic: author
|
16
|
+
Dynamic: author-email
|
17
|
+
Dynamic: classifier
|
18
|
+
Dynamic: description
|
19
|
+
Dynamic: description-content-type
|
20
|
+
Dynamic: home-page
|
21
|
+
Dynamic: requires-dist
|
22
|
+
Dynamic: requires-python
|
23
|
+
Dynamic: summary
|
24
|
+
|
25
|
+
## 🚀🔗 Integrating Composio with Google's Gemini SDK
|
26
|
+
|
27
|
+
Streamline the integration of Composio with Google AI Python to enhance the capabilities of Gemini models, allowing them to interact directly with external applications and expanding their operational scope.
|
28
|
+
|
29
|
+
### Objective
|
30
|
+
|
31
|
+
- **Automate starring a GitHub repository** using conversational instructions via Google AI Python's Function Calling feature.
|
32
|
+
|
33
|
+
### Installation and Setup
|
34
|
+
|
35
|
+
Ensure you have the necessary packages installed and connect your GitHub account to allow your agents to utilize GitHub functionalities.
|
36
|
+
|
37
|
+
```bash
|
38
|
+
# Install Composio Gemini package
|
39
|
+
pip install composio-gemini
|
40
|
+
|
41
|
+
# Connect your GitHub account
|
42
|
+
composio add github
|
43
|
+
|
44
|
+
# View available applications you can connect with
|
45
|
+
composio apps
|
46
|
+
```
|
47
|
+
|
48
|
+
### Usage Steps
|
49
|
+
|
50
|
+
#### 1. Import Base Packages
|
51
|
+
|
52
|
+
Prepare your environment by initializing necessary imports from Google AI Python and setting up your client.
|
53
|
+
|
54
|
+
```python
|
55
|
+
from google import genai
|
56
|
+
|
57
|
+
# Create google client
|
58
|
+
client = genai.Client()
|
59
|
+
```
|
60
|
+
|
61
|
+
### Step 2: Integrating GitHub Tools with Composio
|
62
|
+
|
63
|
+
This step involves fetching and integrating GitHub tools provided by Composio, enabling enhanced functionality for Google AI Python operations.
|
64
|
+
```python
|
65
|
+
from google.genai import types
|
66
|
+
|
67
|
+
from composio_gemini import Action, ComposioToolSet
|
68
|
+
|
69
|
+
# Create composio client
|
70
|
+
toolset = ComposioToolSet()
|
71
|
+
|
72
|
+
# Create tools
|
73
|
+
tools = toolset.get_tools(
|
74
|
+
actions=[
|
75
|
+
Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER,
|
76
|
+
]
|
77
|
+
)
|
78
|
+
|
79
|
+
# Create genai client config
|
80
|
+
config = types.GenerateContentConfig(
|
81
|
+
tools=tools, # type: ignore
|
82
|
+
)
|
83
|
+
```
|
84
|
+
|
85
|
+
### Step 3: Agent Execution
|
86
|
+
|
87
|
+
This step involves configuring and executing the agent to carry out actions, such as starring a GitHub repository.
|
88
|
+
|
89
|
+
```python
|
90
|
+
# Use the chat interface.
|
91
|
+
chat = client.chats.create(model="gemini-2.0-flash", config=config)
|
92
|
+
response = chat.send_message(
|
93
|
+
"Can you star composiohq/composio repository on github",
|
94
|
+
)
|
95
|
+
print(response.text)
|
96
|
+
```
|
@@ -0,0 +1,72 @@
|
|
1
|
+
## 🚀🔗 Integrating Composio with Google's Gemini SDK
|
2
|
+
|
3
|
+
Streamline the integration of Composio with Google AI Python to enhance the capabilities of Gemini models, allowing them to interact directly with external applications and expanding their operational scope.
|
4
|
+
|
5
|
+
### Objective
|
6
|
+
|
7
|
+
- **Automate starring a GitHub repository** using conversational instructions via Google AI Python's Function Calling feature.
|
8
|
+
|
9
|
+
### Installation and Setup
|
10
|
+
|
11
|
+
Ensure you have the necessary packages installed and connect your GitHub account to allow your agents to utilize GitHub functionalities.
|
12
|
+
|
13
|
+
```bash
|
14
|
+
# Install Composio Gemini package
|
15
|
+
pip install composio-gemini
|
16
|
+
|
17
|
+
# Connect your GitHub account
|
18
|
+
composio add github
|
19
|
+
|
20
|
+
# View available applications you can connect with
|
21
|
+
composio apps
|
22
|
+
```
|
23
|
+
|
24
|
+
### Usage Steps
|
25
|
+
|
26
|
+
#### 1. Import Base Packages
|
27
|
+
|
28
|
+
Prepare your environment by initializing necessary imports from Google AI Python and setting up your client.
|
29
|
+
|
30
|
+
```python
|
31
|
+
from google import genai
|
32
|
+
|
33
|
+
# Create google client
|
34
|
+
client = genai.Client()
|
35
|
+
```
|
36
|
+
|
37
|
+
### Step 2: Integrating GitHub Tools with Composio
|
38
|
+
|
39
|
+
This step involves fetching and integrating GitHub tools provided by Composio, enabling enhanced functionality for Google AI Python operations.
|
40
|
+
```python
|
41
|
+
from google.genai import types
|
42
|
+
|
43
|
+
from composio_gemini import Action, ComposioToolSet
|
44
|
+
|
45
|
+
# Create composio client
|
46
|
+
toolset = ComposioToolSet()
|
47
|
+
|
48
|
+
# Create tools
|
49
|
+
tools = toolset.get_tools(
|
50
|
+
actions=[
|
51
|
+
Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER,
|
52
|
+
]
|
53
|
+
)
|
54
|
+
|
55
|
+
# Create genai client config
|
56
|
+
config = types.GenerateContentConfig(
|
57
|
+
tools=tools, # type: ignore
|
58
|
+
)
|
59
|
+
```
|
60
|
+
|
61
|
+
### Step 3: Agent Execution
|
62
|
+
|
63
|
+
This step involves configuring and executing the agent to carry out actions, such as starring a GitHub repository.
|
64
|
+
|
65
|
+
```python
|
66
|
+
# Use the chat interface.
|
67
|
+
chat = client.chats.create(model="gemini-2.0-flash", config=config)
|
68
|
+
response = chat.send_message(
|
69
|
+
"Can you star composiohq/composio repository on github",
|
70
|
+
)
|
71
|
+
print(response.text)
|
72
|
+
```
|
@@ -0,0 +1,16 @@
|
|
1
|
+
from composio import WorkspaceType, action
|
2
|
+
|
3
|
+
from composio_langchain import Action, App, Tag, Trigger
|
4
|
+
|
5
|
+
from .toolset import ComposioToolSet
|
6
|
+
|
7
|
+
|
8
|
+
__all__ = (
|
9
|
+
"Action",
|
10
|
+
"App",
|
11
|
+
"Tag",
|
12
|
+
"Trigger",
|
13
|
+
"WorkspaceType",
|
14
|
+
"action",
|
15
|
+
"ComposioToolSet",
|
16
|
+
)
|
@@ -0,0 +1,118 @@
|
|
1
|
+
import types
|
2
|
+
import typing as t
|
3
|
+
from inspect import Signature
|
4
|
+
|
5
|
+
from composio import ActionType, AppType, TagType
|
6
|
+
from composio.client.collections import ActionModel
|
7
|
+
from composio.tools import ComposioToolSet as BaseComposioToolSet
|
8
|
+
from composio.utils.shared import get_signature_format_from_schema_params
|
9
|
+
|
10
|
+
|
11
|
+
class ComposioToolSet(
|
12
|
+
BaseComposioToolSet,
|
13
|
+
runtime="google_gemini",
|
14
|
+
description_char_limit=1024,
|
15
|
+
action_name_char_limit=64,
|
16
|
+
):
|
17
|
+
"""
|
18
|
+
Composio toolset for Google AI Python Gemini framework.
|
19
|
+
|
20
|
+
Example:
|
21
|
+
```python
|
22
|
+
from google import genai
|
23
|
+
from google.genai import types
|
24
|
+
|
25
|
+
from composio_gemini import Action, ComposioToolSet
|
26
|
+
|
27
|
+
|
28
|
+
# Create composio client
|
29
|
+
toolset = ComposioToolSet()
|
30
|
+
|
31
|
+
# Create google client
|
32
|
+
client = genai.Client()
|
33
|
+
|
34
|
+
# Create genai client config
|
35
|
+
config = types.GenerateContentConfig(
|
36
|
+
tools=toolset.get_tools( # type: ignore
|
37
|
+
actions=[
|
38
|
+
Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER,
|
39
|
+
]
|
40
|
+
)
|
41
|
+
)
|
42
|
+
# Use the chat interface.
|
43
|
+
chat = client.chats.create(model="gemini-2.0-flash", config=config)
|
44
|
+
response = chat.send_message(
|
45
|
+
"Can you star composiohq/composio repository on github",
|
46
|
+
)
|
47
|
+
print(response.text)
|
48
|
+
```
|
49
|
+
"""
|
50
|
+
|
51
|
+
def _wrap_tool(
|
52
|
+
self,
|
53
|
+
schema: ActionModel,
|
54
|
+
entity_id: t.Optional[str] = None,
|
55
|
+
) -> t.Callable:
|
56
|
+
"""Wraps composio tool as Google Genai SDK compatible function calling object."""
|
57
|
+
|
58
|
+
docstring = schema.description
|
59
|
+
docstring += "\nArgs:"
|
60
|
+
for _param, _schema in schema.parameters.properties.items():
|
61
|
+
docstring += "\n "
|
62
|
+
docstring += _param + ": " + _schema.get("description", _param.title())
|
63
|
+
|
64
|
+
docstring += "\nReturns:"
|
65
|
+
docstring += "\n A dictionary containing response from the action"
|
66
|
+
|
67
|
+
def _execute(**kwargs: t.Any) -> t.Dict:
|
68
|
+
return self.execute_action(
|
69
|
+
action=schema.name,
|
70
|
+
params=kwargs,
|
71
|
+
entity_id=entity_id,
|
72
|
+
)
|
73
|
+
|
74
|
+
function = types.FunctionType(
|
75
|
+
code=_execute.__code__,
|
76
|
+
name=schema.name,
|
77
|
+
globals=globals(),
|
78
|
+
closure=_execute.__closure__,
|
79
|
+
)
|
80
|
+
parameters = get_signature_format_from_schema_params(
|
81
|
+
schema_params=schema.parameters.model_dump(),
|
82
|
+
)
|
83
|
+
setattr(function, "__signature__", Signature(parameters=parameters))
|
84
|
+
setattr(
|
85
|
+
function,
|
86
|
+
"__annotations__",
|
87
|
+
{p.name: p.annotation for p in parameters} | {"return": dict},
|
88
|
+
)
|
89
|
+
function.__doc__ = docstring
|
90
|
+
return function
|
91
|
+
|
92
|
+
def get_tools(
|
93
|
+
self,
|
94
|
+
actions: t.Optional[t.Sequence[ActionType]] = None,
|
95
|
+
apps: t.Optional[t.Sequence[AppType]] = None,
|
96
|
+
tags: t.Optional[t.List[TagType]] = None,
|
97
|
+
entity_id: t.Optional[str] = None,
|
98
|
+
) -> t.List[t.Callable]:
|
99
|
+
"""
|
100
|
+
Get composio tools wrapped as Google Genai SDK compatible function calling object.
|
101
|
+
|
102
|
+
:param actions: List of actions to wrap
|
103
|
+
:param apps: List of apps to wrap
|
104
|
+
:param tags: Filter the apps by given tags
|
105
|
+
:param entity_id: Entity ID for the function wrapper
|
106
|
+
|
107
|
+
:return: Composio tools wrapped as python callable
|
108
|
+
"""
|
109
|
+
self.validate_tools(apps=apps, actions=actions, tags=tags)
|
110
|
+
return [
|
111
|
+
self._wrap_tool(schema=tool, entity_id=entity_id)
|
112
|
+
for tool in self.get_action_schemas(
|
113
|
+
actions=actions,
|
114
|
+
apps=apps,
|
115
|
+
tags=tags,
|
116
|
+
_populate_requested=True,
|
117
|
+
)
|
118
|
+
]
|
@@ -0,0 +1,96 @@
|
|
1
|
+
Metadata-Version: 2.2
|
2
|
+
Name: composio_gemini
|
3
|
+
Version: 0.7.1
|
4
|
+
Summary: Use Composio to get an array of tools with your Gemini agent.
|
5
|
+
Home-page: https://github.com/ComposioHQ/composio
|
6
|
+
Author: Composio
|
7
|
+
Author-email: tech@composio.dev
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Requires-Python: >=3.9,<4
|
12
|
+
Description-Content-Type: text/markdown
|
13
|
+
Requires-Dist: composio_core<0.8.0,>=0.7.0
|
14
|
+
Requires-Dist: google-genai
|
15
|
+
Dynamic: author
|
16
|
+
Dynamic: author-email
|
17
|
+
Dynamic: classifier
|
18
|
+
Dynamic: description
|
19
|
+
Dynamic: description-content-type
|
20
|
+
Dynamic: home-page
|
21
|
+
Dynamic: requires-dist
|
22
|
+
Dynamic: requires-python
|
23
|
+
Dynamic: summary
|
24
|
+
|
25
|
+
## 🚀🔗 Integrating Composio with Google's Gemini SDK
|
26
|
+
|
27
|
+
Streamline the integration of Composio with Google AI Python to enhance the capabilities of Gemini models, allowing them to interact directly with external applications and expanding their operational scope.
|
28
|
+
|
29
|
+
### Objective
|
30
|
+
|
31
|
+
- **Automate starring a GitHub repository** using conversational instructions via Google AI Python's Function Calling feature.
|
32
|
+
|
33
|
+
### Installation and Setup
|
34
|
+
|
35
|
+
Ensure you have the necessary packages installed and connect your GitHub account to allow your agents to utilize GitHub functionalities.
|
36
|
+
|
37
|
+
```bash
|
38
|
+
# Install Composio Gemini package
|
39
|
+
pip install composio-gemini
|
40
|
+
|
41
|
+
# Connect your GitHub account
|
42
|
+
composio add github
|
43
|
+
|
44
|
+
# View available applications you can connect with
|
45
|
+
composio apps
|
46
|
+
```
|
47
|
+
|
48
|
+
### Usage Steps
|
49
|
+
|
50
|
+
#### 1. Import Base Packages
|
51
|
+
|
52
|
+
Prepare your environment by initializing necessary imports from Google AI Python and setting up your client.
|
53
|
+
|
54
|
+
```python
|
55
|
+
from google import genai
|
56
|
+
|
57
|
+
# Create google client
|
58
|
+
client = genai.Client()
|
59
|
+
```
|
60
|
+
|
61
|
+
### Step 2: Integrating GitHub Tools with Composio
|
62
|
+
|
63
|
+
This step involves fetching and integrating GitHub tools provided by Composio, enabling enhanced functionality for Google AI Python operations.
|
64
|
+
```python
|
65
|
+
from google.genai import types
|
66
|
+
|
67
|
+
from composio_gemini import Action, ComposioToolSet
|
68
|
+
|
69
|
+
# Create composio client
|
70
|
+
toolset = ComposioToolSet()
|
71
|
+
|
72
|
+
# Create tools
|
73
|
+
tools = toolset.get_tools(
|
74
|
+
actions=[
|
75
|
+
Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER,
|
76
|
+
]
|
77
|
+
)
|
78
|
+
|
79
|
+
# Create genai client config
|
80
|
+
config = types.GenerateContentConfig(
|
81
|
+
tools=tools, # type: ignore
|
82
|
+
)
|
83
|
+
```
|
84
|
+
|
85
|
+
### Step 3: Agent Execution
|
86
|
+
|
87
|
+
This step involves configuring and executing the agent to carry out actions, such as starring a GitHub repository.
|
88
|
+
|
89
|
+
```python
|
90
|
+
# Use the chat interface.
|
91
|
+
chat = client.chats.create(model="gemini-2.0-flash", config=config)
|
92
|
+
response = chat.send_message(
|
93
|
+
"Can you star composiohq/composio repository on github",
|
94
|
+
)
|
95
|
+
print(response.text)
|
96
|
+
```
|
@@ -0,0 +1,9 @@
|
|
1
|
+
README.md
|
2
|
+
setup.py
|
3
|
+
composio_gemini/__init__.py
|
4
|
+
composio_gemini/toolset.py
|
5
|
+
composio_gemini.egg-info/PKG-INFO
|
6
|
+
composio_gemini.egg-info/SOURCES.txt
|
7
|
+
composio_gemini.egg-info/dependency_links.txt
|
8
|
+
composio_gemini.egg-info/requires.txt
|
9
|
+
composio_gemini.egg-info/top_level.txt
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
composio_gemini
|
@@ -0,0 +1,30 @@
|
|
1
|
+
"""
|
2
|
+
Setup configuration for Composio Gemin plugin
|
3
|
+
"""
|
4
|
+
|
5
|
+
from pathlib import Path
|
6
|
+
|
7
|
+
from setuptools import setup
|
8
|
+
|
9
|
+
|
10
|
+
setup(
|
11
|
+
name="composio_gemini",
|
12
|
+
version="0.7.1",
|
13
|
+
author="Composio",
|
14
|
+
author_email="tech@composio.dev",
|
15
|
+
description="Use Composio to get an array of tools with your Gemini agent.",
|
16
|
+
long_description=(Path(__file__).parent / "README.md").read_text(encoding="utf-8"),
|
17
|
+
long_description_content_type="text/markdown",
|
18
|
+
url="https://github.com/ComposioHQ/composio",
|
19
|
+
classifiers=[
|
20
|
+
"Programming Language :: Python :: 3",
|
21
|
+
"License :: OSI Approved :: Apache Software License",
|
22
|
+
"Operating System :: OS Independent",
|
23
|
+
],
|
24
|
+
python_requires=">=3.9,<4",
|
25
|
+
install_requires=[
|
26
|
+
"composio_core>=0.7.0,<0.8.0",
|
27
|
+
"google-genai",
|
28
|
+
],
|
29
|
+
include_package_data=True,
|
30
|
+
)
|