This repository demonstrates how to use Composio to integrate with GitHub API and perform actions like retrieving the authenticated user's information.
- Node.js (v16 or higher recommended)
- npm or yarn
- OpenAI API key
- Composio account and API key
- Clone this repository:
git clone https://github.com/cycle-sync-ai/composio-get-started
cd composio-get-started
npm install
- Create a
.env
file in the root directory with your API keys:
echo "OPENAI_API_KEY=your_openai_api_key_here" > .env
echo "COMPOSIO_API_KEY=your_composio_api_key_here" >> .env
This example demonstrates how to use Composio's toolsets with OpenAI to interact with GitHub. The sample code retrieves the authenticated user's GitHub username.
Run the example:
npm run dev
The application uses Composio's OpenAIToolSet to provide GitHub integration capabilities to OpenAI models. The code:
- Initializes the Composio toolset
- Configures the OpenAI client
- Requests specific GitHub actions (in this case,
GITHUB_GET_THE_AUTHENTICATED_USER
) - Sends a prompt to OpenAI with the tools attached
- Handles the tool call response
For more detailed information about Composio, check out the official documentation:
👻 Please follow me for new updates Dev.to | Github | Github Org
😉 Please join our discord server Discord
💫 Please have an interesting relationship with me Telegram | Email