Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 03:37 UTC
| 1 | """ |
| 2 | Anthropic claude demo.7 |
| 3 | """ |
| 4 | |
| 5 | import anthropic |
| 6 | from composio_anthropic import AnthropicProvider |
| 7 | |
| 8 | from composio import Composio |
| 9 | |
| 10 | # Initialize tools. |
| 11 | anthropic_client = anthropic.Anthropic() |
| 12 | composio = Composio(provider=AnthropicProvider()) |
| 13 | |
| 14 | # Get GitHub tools that are pre-configured |
| 15 | tools = composio.tools.get(user_id="default", toolkits=["GITHUB"]) |
| 16 | |
| 17 | # Get response from the LLM |
| 18 | response = anthropic_client.messages.create( |
| 19 | model="claude-opus-5-5", |
| 20 | max_tokens=1024, |
| 21 | tools=tools, |
| 22 | messages=[ |
| 23 | {"role": "user", "content": "Star me composiohq/composio repo in github."}, |
| 24 | ], |
| 25 | ) |
| 26 | |
| 27 | # Execute the function calls. |
| 28 | result = composio.provider.handle_tool_calls(user_id="default", response=response) |
| 29 | print(result) |