Using Composio With Together AI

Star A Repository on Github

In this example, we will use Together AI to star a repository on GitHub using Composio Tools

1

Install Packages

Python
$pip install composio-togetherai
2

Import Libraries & Initialize ComposioToolSet & Together Client

Python
1from composio_togetherai import ComposioToolSet, App
2from together import Together
3
4client = Together()
5toolset = ComposioToolSet()
3

Connect Your GitHub Account

You need to have an active GitHub Integration. Learn how to do this here
$composio login
>composio add github

Don’t forget to set your COMPOSIO_API_KEY and TOGETHER_API_KEY in your environment variables.

4

Get All Github Tools

You can get all the tools for a given app as shown below, but you can get specific actions and filter actions using usecase & tags. Learn more here

Python
1tools = toolset.get_tools(apps=[App.GITHUB])
5

Create a Chat Completion with Tools

Python
1response = client.chat.completions.create(
2 tools=tools,
3 model="mistralai/Mixtral-8x7B-Instruct-v0.1",
4 messages=[
5 {
6 "role": "user",
7 "content": "Star the repo 'composiohq/composio'",
8 }
9 ],
10)
11
12res = toolset.handle_tool_calls(response)
13print(res)
Built with