Skip to main content

Use Composio to get an array of tools with your Claude LLMs.

Project description

🚀🔗 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")

Project details


Download files

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

Source Distribution

composio_camel-0.5.37rc1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

composio_camel-0.5.37rc1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file composio_camel-0.5.37rc1.tar.gz.

File metadata

  • Download URL: composio_camel-0.5.37rc1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for composio_camel-0.5.37rc1.tar.gz
Algorithm Hash digest
SHA256 001c41d7ad04db487f972bed86f9caba79e6d8b1f244bffe8ec3cc5562e23ed6
MD5 295b163cfd4b0599ba6603f987480b6b
BLAKE2b-256 97170f626b383ed2ce23a4874048fbddc522e7ade7db26fb56e3878322c949b4

See more details on using hashes here.

File details

Details for the file composio_camel-0.5.37rc1-py3-none-any.whl.

File metadata

File hashes

Hashes for composio_camel-0.5.37rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 2aee91a2e6ed3747aa7988a71e4b7330a2d84983f4f3133156ad7619ca5e79e7
MD5 7cc36cda812a3f4d64e574c15be0a088
BLAKE2b-256 160e2de4a1ddbfb6ed32e79d9f1dd305ef6975fb84d9408296cd6dd59e97f5e3

See more details on using hashes here.

Supported by

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