🚀🔗 Leveraging Together AI with Composio
Facilitate the integration of Together AI with Composio to empower open source models to directly interact with external applications, broadening their capabilities and application scope.
Objective
- Automate starring a GitHub repository using conversational instructions via Together AI Function Calls.
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-togetherai
# Connect your GitHub account
composio add github
# View available applications you can connect with
composio apps
### Usage Steps
#### 1. Import Base Packages
Prepare your environment by initializing necessary imports from OpenAI and setting up your client.
```python
from together import Together
# Initialize OpenAI client
client = Together(api_key="<together-ai-api-key>")
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_togetherai import Action, ComposioToolSet, App
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 = client.chat.completions.create(model="gpt-4o",
tools=actions, # Passing actions we fetched earlier.
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": my_task}
]
)
print(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)
Release files for composio-togetherai 0.7.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| composio_togetherai-0.7.6.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| composio_togetherai-0.7.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.3 kB
Release files / composio_togetherai-0.7.6.tar.gz
| Download URL | composio_togetherai-0.7.6.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
49c804970070d91592389cf0d42b1d441527cd50d70af08a03b19a6e2bef832c
|
|
BLAKE2b-256 checksum How to use checksums |
ac0f6187c3db44f252aefc4b4ae68042b9c576664e3ea6fa3d90f936d0a0a1ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.15
|
Release files / composio_togetherai-0.7.6-py3-none-any.whl
| Download URL | composio_togetherai-0.7.6-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a88322246824ae615460f31d2ff6ffadd32fa653ad1a3e45611e4129e1d6058f
|
|
BLAKE2b-256 checksum How to use checksums |
e32d67038936f4aa03da71db9b32e9bac2046bb44cf55442799a57c2a440792f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.15
|