Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Integrate Composio with OpenAI Assistants to let them seamlessly interact with external apps
Install Packages
pip install composio-openai openai
Import Libraries & Initialize ComposioToolSet & LLM
from openai import OpenAI from composio_openai import ComposioToolSet, Action openai_client = OpenAI() composio_toolset = ComposioToolSet()
Connect Your GitHub Account
composio login composio add github
COMPOSIO_API_KEY
OPENAI_API_KEY
Get All Github Tools
tools = composio_toolset.get_tools(apps=[App.GITHUB])
Define the Assistant
assistant_instruction = "You are a super intelligent personal assistant" assistant = openai_client.beta.assistants.create( name="Personal Assistant", instructions=assistant_instruction, model="gpt-4-turbo-preview", tools=tools, ) thread = openai_client.beta.threads.create() my_task = "Star a repo composiohq/composio on GitHub" message = openai_client.beta.threads.messages.create(thread_id=thread.id,role="user",content=my_task) run = openai_client.beta.threads.runs.create(thread_id=thread.id,assistant_id=assistant.id) response_after_tool_calls = composio_toolset.wait_and_handle_assistant_tool_calls( client=openai_client, run=run, thread=thread, )
Execute the Agent
print(response_after_tool_calls)
Was this page helpful?