From 9d5e02acdae4d3f8449ab44214c7d7058a5ca282 Mon Sep 17 00:00:00 2001 From: Utkarsh Dixit Date: Wed, 27 Mar 2024 21:32:12 +0530 Subject: [PATCH] feat: track framework usage and log to slack --- autogen/pyproject.toml | 2 +- autogen/setup.py | 2 +- core/build/scripts-3.10/composio-cli | 2 +- core/composio/composio_cli.py | 2 +- core/composio/sdk/core.py | 11 +++++++++-- core/setup.py | 2 +- crew_ai/pyproject.toml | 2 +- crew_ai/requirements.txt | 2 +- crew_ai/setup.py | 2 +- langchain/pyproject.toml | 2 +- langchain/requirements.txt | 2 +- langchain/setup.py | 2 +- test.py | 16 +++++++++------- 13 files changed, 29 insertions(+), 20 deletions(-) diff --git a/autogen/pyproject.toml b/autogen/pyproject.toml index 0ce00978b0..24f069439a 100644 --- a/autogen/pyproject.toml +++ b/autogen/pyproject.toml @@ -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" diff --git a/autogen/setup.py b/autogen/setup.py index c93d99f4fb..05024251c3 100644 --- a/autogen/setup.py +++ b/autogen/setup.py @@ -14,7 +14,7 @@ def resolve_paths(*paths): setup( name="composio_autogen", - version="0.1.50", + version="0.1.54", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Autogen agent.", diff --git a/core/build/scripts-3.10/composio-cli b/core/build/scripts-3.10/composio-cli index 6ba6ad37d9..885f5775d1 100644 --- a/core/build/scripts-3.10/composio-cli +++ b/core/build/scripts-3.10/composio-cli @@ -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) diff --git a/core/composio/composio_cli.py b/core/composio/composio_cli.py index 4750ae4640..f78f4068cd 100755 --- a/core/composio/composio_cli.py +++ b/core/composio/composio_cli.py @@ -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) diff --git a/core/composio/sdk/core.py b/core/composio/sdk/core.py index c780880884..eb4e0a08e1 100644 --- a/core/composio/sdk/core.py +++ b/core/composio/sdk/core.py @@ -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" @@ -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') diff --git a/core/setup.py b/core/setup.py index 2ef0f86639..3befa4ab0d 100644 --- a/core/setup.py +++ b/core/setup.py @@ -25,7 +25,7 @@ def run(self): setup( name="composio_core", - version="0.1.50", + version="0.1.54", author="Utkarsh", author_email="utkarsh@composio.dev", description="Core package to act as a bridge between composio platform and other services.", diff --git a/crew_ai/pyproject.toml b/crew_ai/pyproject.toml index c170ff999f..0cf286c018 100644 --- a/crew_ai/pyproject.toml +++ b/crew_ai/pyproject.toml @@ -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" diff --git a/crew_ai/requirements.txt b/crew_ai/requirements.txt index dddfe3e39e..0781975afc 100644 --- a/crew_ai/requirements.txt +++ b/crew_ai/requirements.txt @@ -1 +1 @@ -composio_langchain===0.1.50 \ No newline at end of file +composio_langchain===0.1.54 \ No newline at end of file diff --git a/crew_ai/setup.py b/crew_ai/setup.py index 2bba76b1c2..6bd27f330d 100644 --- a/crew_ai/setup.py +++ b/crew_ai/setup.py @@ -14,7 +14,7 @@ def resolve_paths(*paths): setup( name="composio_crewai", - version="0.1.50", + version="0.1.54", author="Himanshu", author_email="himanshu@composio.dev", description="Use Composio to get an array of tools with your CrewAI agent.", diff --git a/langchain/pyproject.toml b/langchain/pyproject.toml index 959a806be0..92b6180359 100644 --- a/langchain/pyproject.toml +++ b/langchain/pyproject.toml @@ -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" diff --git a/langchain/requirements.txt b/langchain/requirements.txt index d9cdc83d72..5b436a408a 100644 --- a/langchain/requirements.txt +++ b/langchain/requirements.txt @@ -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 \ No newline at end of file +composio_core===0.1.54 \ No newline at end of file diff --git a/langchain/setup.py b/langchain/setup.py index a306f8cd13..9c9762b406 100644 --- a/langchain/setup.py +++ b/langchain/setup.py @@ -14,7 +14,7 @@ def resolve_paths(*paths): setup( name="composio_langchain", - version="0.1.50", + version="0.1.54", author="Karan", author_email="karan@composio.dev", description="Use Composio to get an array of tools with your LangChain agent.", diff --git a/test.py b/test.py index fbdff69b27..4ddea6e1c9 100644 --- a/test.py +++ b/test.py @@ -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"])) \ No newline at end of file +import nest_asyncio + +nest_asyncio.apply() \ No newline at end of file