Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Feature: requests channel #1391

Open
Quantum-Shield007 opened this issue Mar 5, 2025 · 0 comments
Open

🚀 Feature: requests channel #1391

Quantum-Shield007 opened this issue Mar 5, 2025 · 0 comments

Comments

@Quantum-Shield007
Copy link

from openai import OpenAI
from composio_openai import ComposioToolSet, App, Action

openai_client = OpenAI(
api_key="{{OPENAIKEY}}"
)

Initialise the Composio Tool Set

composio_tool_set = ComposioToolSet()

Get GitHub tools that are pre-configured

actions = composio_tool_set.get_actions(
actions=[Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER]
)

my_task = "Star a repo composiodev/composio on GitHub"

Setup openai 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",
tools=actions,
)

create a thread

thread = openai_client.beta.threads.create()

message = openai_client.beta.threads.messages.create(
thread_id=thread.id,
role="user",
content=my_task
)

Execute Agent with integrations

run = openai_client.beta.threads.runs.create(
thread_id=thread.id,
assistant_id=assistant.id
)

Execute Function calls

response_after_tool_calls = composio_tool_set.wait_and_handle_assistant_tool_calls(
client=openai_client,
run=run,
thread=thread,
)

print(response_after_tool_calls)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant