🚀🔗 Leveraging CamelAI with Composio
Facilitate the integration of Camel Agents with Composio to empower the agents to directly interact with external applications, broadening their capabilities and application scope.
Objective
- Automate starring a GitHub repository using conversational instructions via Camel's Tool Usage ability.
Installation and Setup
Ensure you have the necessary packages installed and connect your GitHub account to allow your agents to utilize GitHub functionalities.
# Install Composio LangChain package
pip install composio-camel
# Connect your GitHub account
composio-cli add github
# View available applications you can connect with
composio-cli show-apps
Usage Steps
1. Import Base Packages
Prepare your environment by initializing necessary imports from Composio & Camel.
from colorama import Fore
from camel.agents import ChatAgent
from camel.configs import ChatGPTConfig
from camel.messages import BaseMessage
from camel.models import ModelFactory
from camel.types import ModelPlatformType, ModelType
from camel.utils import print_text_animated
from composio_camel import ComposioToolSet, Action
Step 2: Integrating GitHub Tools with Composio
This step involves fetching and integrating GitHub tools provided by Composio, enabling enhanced functionality for Camel operations.
composio_toolset = ComposioToolSet()
tools = composio_toolset.get_actions(
actions=[Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER]
)
Step 3: Camel Agent Setup
This step involves configuring and executing the agent to carry out actions, such as starring a GitHub repository.
# set up LLM model
assistant_model_config = ChatGPTConfig(
temperature=0.0,
tools=tools,
)
model = ModelFactory.create(
model_platform=ModelPlatformType.OPENAI,
model_type=ModelType.GPT_3_5_TURBO,
model_config_dict=assistant_model_config.__dict__,
)
# set up agent
assistant_sys_msg = BaseMessage.make_assistant_message(
role_name="Developer",
content=(
"You are a programmer as well an experienced github user. "
"When asked given a instruction, "
"you try to use available tools, and execute it"
),
)
agent = ChatAgent(
assistant_sys_msg,
model,
tools=tools,
)
agent.reset()
Step 4: Execute with your prompt/task.
Execute the following code to execute the agent, ensuring that the intended task has been successfully completed.
prompt = (
"I have created a new Github Repo,"
"Please star my github repository: camel-ai/camel"
)
user_msg = BaseMessage.make_user_message(role_name="User", content=prompt)
print(Fore.YELLOW + f"user prompt:\n{prompt}\n")
response = agent.step(user_msg)
for msg in response.msgs:
print_text_animated(Fore.GREEN + f"Agent response:\n{msg.content}\n")
Release files for composio-camel 0.7.20
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| composio_camel-0.7.20.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| composio_camel-0.7.20-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / composio_camel-0.7.20.tar.gz
| Download URL | composio_camel-0.7.20.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fc69d9e89ce015ac961ac9f438f600f4ae7167924d9c2db7789cf821562bf46
|
|
BLAKE2b-256 checksum How to use checksums |
42b5e519224f276c9c35646e92de965f6c0f3bc3a77c5c3f684f4a0f16846289
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / composio_camel-0.7.20-py3-none-any.whl
| Download URL | composio_camel-0.7.20-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fdb3070722fb6521f4992018c0e80c91d63b0786b307ea16824bb31dcbc4e80b
|
|
BLAKE2b-256 checksum How to use checksums |
7fe89c9054c9eb332a073617253d8fedc2c53e072aa78dd54470017434616f3a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|