Skip to content

Commit

Permalink
feat: track framework usage and log to slack
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarsh-dixit committed Mar 27, 2024
1 parent cfa33ca commit 9d5e02a
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 20 deletions.
2 changes: 1 addition & 1 deletion autogen/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
dynamic = ["classifiers", "version", "readme", "authors", "requires-python", "description"]
dependencies = [
"composio_core===0.1.50",
"composio_core===0.1.54",
"pyautogen===0.2.19"
]
name = "composio_autogen"
Expand Down
2 changes: 1 addition & 1 deletion autogen/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def resolve_paths(*paths):

setup(
name="composio_autogen",
version="0.1.50",
version="0.1.54",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Autogen agent.",
Expand Down
2 changes: 1 addition & 1 deletion core/build/scripts-3.10/composio-cli
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def print_intro():

def auth_user(client: ComposioClient):
user_mac_address = get_mac()
unique_identifier = f"{user_mac_address}-autogen"
unique_identifier = f"{user_mac_address}"

return client.authenticate(unique_identifier)

Expand Down
2 changes: 1 addition & 1 deletion core/composio/composio_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def print_intro():

def auth_user(client: ComposioCore):
user_mac_address = get_mac()
unique_identifier = f"{user_mac_address}-autogen"
unique_identifier = f"{user_mac_address}"

return client.authenticate(unique_identifier)

Expand Down
11 changes: 9 additions & 2 deletions core/composio/sdk/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from .storage import get_user_connection, get_api_key, save_api_key
from .sdk import Composio
from .enums import TestIntegration, Action
from enum import Enum

class FrameworkEnum(Enum):
AUTOGEN = "autogen"
Expand All @@ -29,13 +30,19 @@ def __init__(self, base_url = "https://backend.composio.dev/api", manage_auth =
self.http_client.headers.update({
'Content-Type': 'application/json',
'x-api-key': api_key
})
});
self.sdk = Composio(api_key, base_url)
if framework is not None:
try:
self.http_client.post(f"{self.base_url}/v1/client/auth/track", json={
"framework": self.framework.value
});
except:
pass

def authenticate(self, hash: str):
resp = self.http_client.post(f"{self.base_url}/v1/client/auth/identify", json={
"hash": hash,
"framework": self.framework
});
if resp.status_code == 202:
api_key = resp.json().get('apiKey')
Expand Down
2 changes: 1 addition & 1 deletion core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def run(self):

setup(
name="composio_core",
version="0.1.50",
version="0.1.54",
author="Utkarsh",
author_email="[email protected]",
description="Core package to act as a bridge between composio platform and other services.",
Expand Down
2 changes: 1 addition & 1 deletion crew_ai/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
dynamic = ["classifiers", "version", "readme", "authors", "requires-python", "description"]
dependencies = [
"composio_langchain===0.1.50",
"composio_langchain===0.1.54",
]
name = "composio_crewai"

Expand Down
2 changes: 1 addition & 1 deletion crew_ai/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
composio_langchain===0.1.50
composio_langchain===0.1.54
2 changes: 1 addition & 1 deletion crew_ai/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def resolve_paths(*paths):

setup(
name="composio_crewai",
version="0.1.50",
version="0.1.54",
author="Himanshu",
author_email="[email protected]",
description="Use Composio to get an array of tools with your CrewAI agent.",
Expand Down
2 changes: 1 addition & 1 deletion langchain/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies = [
"langchain-openai===0.0.2.post1",
"langchainhub==0.1.15",
"pydantic===2.6.4",
"composio_core===0.1.50"
"composio_core===0.1.54"
]
name = "composio_langchain"

Expand Down
2 changes: 1 addition & 1 deletion langchain/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ langchain===0.1.0
langchain-openai===0.0.2.post1
pydantic===2.6.4
langchainhub==0.1.15
composio_core===0.1.50
composio_core===0.1.54
2 changes: 1 addition & 1 deletion langchain/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def resolve_paths(*paths):

setup(
name="composio_langchain",
version="0.1.50",
version="0.1.54",
author="Karan",
author_email="[email protected]",
description="Use Composio to get an array of tools with your LangChain agent.",
Expand Down
16 changes: 9 additions & 7 deletions test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from composio import Composio, TestIntegration
from composio_langchain import ComposioToolset
import json
from typing import Sequence, List

sdk_instance = Composio("7gvfr8u5jqp8v5h1v9dpg4")
github_integration = sdk_instance.get_integration(TestIntegration.GITHUB)
connection_request = github_integration.initiate_connection(user_uuid="karan")
print("Connection request", connection_request.redirectUrl)
connected_account = connection_request.wait_until_active(timeout=60)
from llama_index.llms.openai import OpenAI
from llama_index.core.llms import ChatMessage
from llama_index.core.tools import BaseTool, FunctionTool

print(sdk_instance.get_connected_accounts(user_uuid=["karan"]))
import nest_asyncio

nest_asyncio.apply()

0 comments on commit 9d5e02a

Please sign in to comment.