composio-openai (original) (raw)

Project description

🚀🔗 Leveraging OpenAI with Composio

Facilitate the integration of OpenAI with Composio to empower OpenAI models to directly interact with external applications, broadening their capabilities and application scope.

Objective

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-openai

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 OpenAI and setting up your client.

from openai import OpenAI

Initialize OpenAI client

openai_client = OpenAI()

Step 2: Integrating GitHub Tools with Composio

This step involves fetching and integrating GitHub tools provided by Composio, enabling enhanced functionality for LangChain operations.

from composio_openai import App, ComposioToolSet

toolset = ComposioToolSet() actions = toolset.get_tools(apps=[App.GITHUB])

Step 3: Agent Execution

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 = openai_client.chat.completions.create(model="gpt-5", tools=actions, # Passing actions we fetched earlier. messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": my_task} ] )

pprint(response)

Step 4: Validate Execution 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)

Download files

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

Source Distribution

Built Distribution

Filter files by name, interpreter, ABI, and platform.

If you're not sure about the file name format, learn more about wheel file names.

Copy a direct link to the current filters

File details

Details for the file composio_openai-0.13.0.tar.gz.

File metadata

File hashes

Hashes for composio_openai-0.13.0.tar.gz | Algorithm | Hash digest | | | ----------- | ---------------------------------------------------------------- | | | SHA256 | cf2634ca0e01d49cf93f61af131fc06e2a2db69e9d39d0ff07d38d742fdea343 | | | MD5 | 0aa5b8f8a32682c1f2102802636ad324 | | | BLAKE2b-256 | a8e1c17ecc972f4679513c8e6c16bef78503fa963877f2d5ddabf235ab0ac2d5 | |

See more details on using hashes here.

File details

Details for the file composio_openai-0.13.0-py3-none-any.whl.

File metadata

File hashes

Hashes for composio_openai-0.13.0-py3-none-any.whl | Algorithm | Hash digest | | | ----------- | ---------------------------------------------------------------- | | | SHA256 | 2f313e68b7d038f71fb066c4c32a9bafcb8c0bedd32d7e046bd77c91904a4f28 | | | MD5 | 8fcb093a8b3288e93182c7951bd21179 | | | BLAKE2b-256 | 189ff8b1437ef3307092437efeba92fa9c4da812f6ab1f433f30aae2f39cf3b5 | |

See more details on using hashes here.