python/providers/anthropic/README.md
Facilitate the integration of Claude with Composio to empower Claude models to directly interact with external applications, broadening their capabilities and application scope.
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-claude
# Connect your GitHub account
composio-cli add github
# View available applications you can connect with
composio-cli show-apps
Prepare your environment by initializing necessary imports from Claude and setting up your client.
import anthropic
# Initialize Claude client
client = anthropic.Anthropic()
This step involves fetching and integrating GitHub tools provided by Composio, enabling enhanced functionality for LangChain operations.
from composio_claude import App, ComposioToolSet
toolset = ComposioToolSet()
actions = toolset.get_tools(tools=App.GITHUB)
This step involves configuring and executing the agent to carry out actions, such as starring a GitHub repository.
my_task = "Star a repo composiohq/composio on GitHub"
# Create a chat completion request to decide on the action
response = client.beta.tools.messages.create(
model="claude-3-opus-20240229",
max_tokens=1024,
tools= actions,
messages=[{"role": "user", "content": "Star me composiohq/composio repo in github."}],
)
pprint(response)
Execute the following code to validate the response, ensuring that the intended task has been successfully completed.
result = toolset.handle_tool_calls(response)
pprint(result)