From 4924f4436925e30211bce666a8b8c8dce9091e71 Mon Sep 17 00:00:00 2001
From: Utkarsh Dixit
Date: Tue, 4 Jun 2024 17:37:05 +0530
Subject: [PATCH 01/23] feat: add tests for examples back
---
plugins/autogen/autogen_demo.py | 37 ++++++++++++-----------
tests/test_examples/__init__.py | 0
tests/test_examples/test_autogen.py | 46 +++++++++++++++++++++++++++++
3 files changed, 66 insertions(+), 17 deletions(-)
create mode 100644 tests/test_examples/__init__.py
create mode 100644 tests/test_examples/test_autogen.py
diff --git a/plugins/autogen/autogen_demo.py b/plugins/autogen/autogen_demo.py
index 21e7e6b31..0d947792f 100644
--- a/plugins/autogen/autogen_demo.py
+++ b/plugins/autogen/autogen_demo.py
@@ -19,30 +19,33 @@
]
},
)
-composio_toolset = ComposioToolSet()
-
def is_termination_msg(content: dict) -> bool:
"""Check if a message contains termination message."""
return "TERMINATE" in (content.get("content", "") or "")
-# Create a user proxy agent
-user_proxy = UserProxyAgent(
- "user_proxy",
- is_termination_msg=is_termination_msg,
- human_input_mode="NEVER",
- code_execution_config={"use_docker": False},
-)
+def main():
+ composio_toolset = ComposioToolSet()
+ # Create a user proxy agent
+ user_proxy = UserProxyAgent(
+ "user_proxy",
+ is_termination_msg=is_termination_msg,
+ human_input_mode="NEVER",
+ code_execution_config={"use_docker": False},
+ )
+
+ # Register the preferred Applications, with right executor.
+ composio_toolset.register_tools(tools=[App.GITHUB], caller=chatbot, executor=user_proxy)
-# Register the preferred Applications, with right executor.
-composio_toolset.register_tools(tools=[App.GITHUB], caller=chatbot, executor=user_proxy)
+ # Define task.
+ task = "Star a repo SamparkAI/composio on GitHub"
-# Define task.
-task = "Star a repo SamparkAI/composio on GitHub"
+ # Execute task.
+ response = user_proxy.initiate_chat(chatbot, message=task)
-# Execute task.
-response = user_proxy.initiate_chat(chatbot, message=task)
+ # Print response
+ print(response.chat_history)
-# Print response
-print(response.chat_history)
+if __name__ == "__main__":
+ main()
diff --git a/tests/test_examples/__init__.py b/tests/test_examples/__init__.py
new file mode 100644
index 000000000..e69de29bb
diff --git a/tests/test_examples/test_autogen.py b/tests/test_examples/test_autogen.py
new file mode 100644
index 000000000..5fca192b6
--- /dev/null
+++ b/tests/test_examples/test_autogen.py
@@ -0,0 +1,46 @@
+import json
+import sys
+import unittest.mock as mock
+import click
+
+import pytest
+
+from composio.cli import composio as composio_cli
+
+
+def run_autogen_script():
+ from plugins.autogen.autogen_demo import main
+ main()
+
+
+@pytest.fixture(scope="session", autouse=True)
+def pytest_sessionstart_autogen():
+ """
+ Called after the Session object has been created and
+ before performing collection and entering the run test loop.
+ """
+ original_argv = sys.argv # Backup the original arguments
+ sys.argv = [
+ "composio",
+ "logout",
+ ]
+ try:
+ composio_cli()
+ except SystemExit as e:
+ print(f"SystemExit ignored: {e}")
+ except Exception as e:
+ print(f"Error ignored: {e}")
+ finally:
+ sys.argv = original_argv # Restore original arguments
+
+def test_autogen_script_not_authorized_error():
+ with pytest.raises(click.ClickException) as exc_info:
+ run_autogen_script()
+ assert "User not logged in, please login using `composio login`" in str(
+ exc_info.value
+ )
+
+def test_autogen_script_is_working():
+ import os
+ os.environ['COMPOSIO_API_KEY'] = 'kwrjjvgedmuw5jt1fet2'
+ run_autogen_script()
\ No newline at end of file
From 4bfadb31fb53f0695b98307907b56134bbdf323d Mon Sep 17 00:00:00 2001
From: Utkarsh Dixit
Date: Wed, 5 Jun 2024 13:27:26 +0530
Subject: [PATCH 02/23] fix: tests
---
tests/test_examples/test_autogen.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/test_examples/test_autogen.py b/tests/test_examples/test_autogen.py
index 5fca192b6..40ab14e57 100644
--- a/tests/test_examples/test_autogen.py
+++ b/tests/test_examples/test_autogen.py
@@ -6,6 +6,7 @@
import pytest
from composio.cli import composio as composio_cli
+from composio.exceptions import ApiKeyNotProvidedError
def run_autogen_script():
@@ -34,9 +35,9 @@ def pytest_sessionstart_autogen():
sys.argv = original_argv # Restore original arguments
def test_autogen_script_not_authorized_error():
- with pytest.raises(click.ClickException) as exc_info:
+ with pytest.raises(ApiKeyNotProvidedError) as exc_info:
run_autogen_script()
- assert "User not logged in, please login using `composio login`" in str(
+ assert "API Key not provided" in str(
exc_info.value
)
From 0791698b7ed696119bbbb2d1c46e82a9c497b9cc Mon Sep 17 00:00:00 2001
From: sawradip
Date: Fri, 7 Jun 2024 13:40:50 +0600
Subject: [PATCH 03/23] Local tools tutorial+ example added
---
composio/local_tools/README.md | 4 +++
examples/local_tools/autogen_math.py | 48 ++++++++++++++++++++++++++++
2 files changed, 52 insertions(+)
create mode 100644 composio/local_tools/README.md
create mode 100644 examples/local_tools/autogen_math.py
diff --git a/composio/local_tools/README.md b/composio/local_tools/README.md
new file mode 100644
index 000000000..180d33c4c
--- /dev/null
+++ b/composio/local_tools/README.md
@@ -0,0 +1,4 @@
+Composio is your one-stop solution for all kind of LLM tools and functionalities. And a very important step on that front is the ability of adding your own custom tools. Once we add a tool(or Action).
+
+
+This page contains necessary details for using Local Tools: [Local Tools Page](https://docs.composio.dev/sdk/python/local_tools)
diff --git a/examples/local_tools/autogen_math.py b/examples/local_tools/autogen_math.py
new file mode 100644
index 000000000..efe22e363
--- /dev/null
+++ b/examples/local_tools/autogen_math.py
@@ -0,0 +1,48 @@
+import os
+
+import dotenv
+from autogen import AssistantAgent, UserProxyAgent
+from composio_autogen import App, ComposioToolSet
+
+
+# Load environment variables from .env
+dotenv.load_dotenv()
+
+
+# Initialize tools.
+chatbot = AssistantAgent(
+ "chatbot",
+ system_message="Reply TERMINATE when the task is done or when user's content is empty",
+ llm_config={
+ "config_list": [
+ {"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]},
+ ]
+ },
+)
+composio_toolset = ComposioToolSet()
+
+
+def is_termination_msg(content: dict) -> bool:
+ """Check if a message contains termination message."""
+ return "TERMINATE" in (content.get("content", "") or "")
+
+
+# Create a user proxy agent
+user_proxy = UserProxyAgent(
+ "user_proxy",
+ is_termination_msg=is_termination_msg,
+ human_input_mode="NEVER",
+ code_execution_config={"use_docker": False},
+)
+
+# Register the preferred Applications, with right executor.
+composio_toolset.register_tools(tools=[App.MATHEMATICAL], caller=chatbot, executor=user_proxy)
+
+# Define task.
+task = "What is 230 multilpied by 52 and added with 233 devided by 91?"
+
+# Execute task.
+response = user_proxy.initiate_chat(chatbot, message=task)
+
+# Print response
+print(response.chat_history)
From 2d240bdd62e54ccf75b675d61d2e17eb8ba64441 Mon Sep 17 00:00:00 2001
From: sawradip
Date: Fri, 7 Jun 2024 13:46:26 +0600
Subject: [PATCH 04/23] Typo fix
---
examples/local_tools/autogen_math.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/local_tools/autogen_math.py b/examples/local_tools/autogen_math.py
index efe22e363..709d0fdb6 100644
--- a/examples/local_tools/autogen_math.py
+++ b/examples/local_tools/autogen_math.py
@@ -39,7 +39,7 @@ def is_termination_msg(content: dict) -> bool:
composio_toolset.register_tools(tools=[App.MATHEMATICAL], caller=chatbot, executor=user_proxy)
# Define task.
-task = "What is 230 multilpied by 52 and added with 233 devided by 91?"
+task = "What is 230 multiplied by 52 and added with 233 divided by 91?"
# Execute task.
response = user_proxy.initiate_chat(chatbot, message=task)
From 3413f6c1e44527946ca7495f6964b3e8a593ea02 Mon Sep 17 00:00:00 2001
From: sohamganatra
Date: Fri, 7 Jun 2024 16:46:29 +0530
Subject: [PATCH 05/23] fix readme order
---
README.md | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/README.md b/README.md
index b99ddf618..9fdc1d2e7 100644
--- a/README.md
+++ b/README.md
@@ -29,7 +29,7 @@
-Dashboard|
+Try on Dashboard|Homepage|
@@ -59,10 +59,10 @@
- [📋 Table of contents](#-table-of-contents)
- [🤔 Why Composio?](#-why-composio)
+- [🔥 Key Features](#-key-features)
- [🚀 Getting Started](#-getting-started)
- [1. Installation](#1-installation)
- [2. Testing Composio in Action](#2-testing-composio-in-action)
-- [🔥 Key Features](#-key-features)
- [💡 Examples](#-examples)
- [Competitor Researcher](#competitor-researcher)
- [Todolist to Calendar](#todolist-to-calendar)
@@ -80,6 +80,23 @@ Composio is the best toolset to integrate AI Agents to best Agentic Tools and us
+## 🔥 Key Features
+
+- **100+ Tools**: Support for a range of different categories
+
+ - **Softwares**: Do anything on GitHub, Notion, Linear, Gmail, Slack, Hubspot, Salesforce, & 90 more.
+ - **OS**: Click anywhere, Type anything, Copy to Clipboard, & more.
+ - **Browser**: Smart Search, Take a screenshot, MultiOn, Download, Upload, & more.
+ - **Search**: Google Search, Perplexity Search, Tavily, Exa & more.
+ - **SWE**: Ngrok, Database, Redis, Vercel, Git, etc.
+ - **RAG**: Agentic RAG for any type of data on the fly!
+
+- **Frameworks**: Use tools with agent frameworks like **OpenAI, Claude, LlamaIndex, Langchain, CrewAI, Autogen, Gemini, Julep, Lyzr**, and more in a single line of code.
+- **Managed Authorisation**: Supports six different auth protocols. _Access Token, Refresh token, OAuth, API Keys, JWT, and more_ abstracted out so you can focus on the building agents.
+- **Accuracy**: Get _upto 40% better agentic accuracy_ in your tool calls due to better tool designs.
+- **Embeddable**: Whitelabel in the backend of your applications managing Auth & Integrations for all your users & agents and maintain a consistent experience.
+- **Pluggable**: Designed to be extended with additional Tools, Frameworks and Authorisation Protocols very easily.
+
## 🚀 Getting Started
### 1. Installation
@@ -156,23 +173,6 @@ response_after_tool_calls = composio_tool_set.wait_and_handle_assistant_tool_cal
print(response_after_tool_calls)
```
-## 🔥 Key Features
-
-- **100+ Tools**: Support for a range of different categories
-
- - **Softwares**: Do anything on GitHub, Notion, Linear, Gmail, Slack, Hubspot, Salesforce, & 90 more.
- - **OS**: Click anywhere, Type anything, Copy to Clipboard, & more.
- - **Browser**: Smart Search, Take a screenshot, MultiOn, Download, Upload, & more.
- - **Search**: Google Search, Perplexity Search, Tavily, Exa & more.
- - **SWE**: Ngrok, Database, Redis, Vercel, Git, etc.
- - **RAG**: Agentic RAG for any type of data on the fly!
-
-- **Frameworks**: Use tools with agent frameworks like **OpenAI, Claude, LlamaIndex, Langchain, CrewAI, Autogen, Gemini, Julep, Lyzr**, and more in a single line of code.
-- **Managed Authorisation**: Supports six different auth protocols. _Access Token, Refresh token, OAuth, API Keys, JWT, and more_ abstracted out so you can focus on the building agents.
-- **Accuracy**: Get _upto 40% better agentic accuracy_ in your tool calls due to better tool designs.
-- **Embeddable**: Whitelabel in the backend of your applications managing Auth & Integrations for all your users & agents and maintain a consistent experience.
-- **Pluggable**: Designed to be extended with additional Tools, Frameworks and Authorisation Protocols very easily.
-
## 💡 Examples
### [Competitor Researcher](https://docs.composio.dev/guides/examples/CompetitorResearcher)
From 255e58b1817c6b7d3649123281af099e3445e876 Mon Sep 17 00:00:00 2001
From: sohamganatra
Date: Fri, 7 Jun 2024 17:17:15 +0530
Subject: [PATCH 06/23] changed logo and added gif
---
README.md | 6 +++---
docs/imgs/banner.gif | Bin 0 -> 6940007 bytes
docs/imgs/composio_black_font.svg | 18 ++++++++++++++++++
docs/imgs/composio_white_font.svg | 18 ++++++++++++++++++
4 files changed, 39 insertions(+), 3 deletions(-)
create mode 100644 docs/imgs/banner.gif
create mode 100644 docs/imgs/composio_black_font.svg
create mode 100644 docs/imgs/composio_white_font.svg
diff --git a/README.md b/README.md
index 9fdc1d2e7..63243b315 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
-
-
+
+
@@ -78,7 +78,7 @@
We believe AI Based Agents/Workflows are the future.
Composio is the best toolset to integrate AI Agents to best Agentic Tools and use them to accomplish tasks.
-
+
## 🔥 Key Features
diff --git a/docs/imgs/banner.gif b/docs/imgs/banner.gif
new file mode 100644
index 0000000000000000000000000000000000000000..6cd15e658b015c822b0f4f5ffec6d144417ae0bf
GIT binary patch
literal 6940007
zcmeF2^-~mH)c<#vExNmw4gnWLL~>cWQ$i3yT0%fda%m8O1tmqKy96X8T)IQLyIVvA
z1@`$o^Zhfv&zU=S&QJHw+?n?|b6)Scs_H6|kF6!alHfle000040AT<;00e@7>{39{
zC!q9sFoYP4-~_8xfOP`F#vdRs76=hBgwYccHw1-}!(fCk7&Qz|4MH9^ek{jJ~)dUoK1)jMob8Y5mK`g!HI|nNr?Vm5K|J7vJ;VU
z5|Q%}QQRY<<|Kxb6BCgT6Oj}D7o?=b#K0uPz=~vGm1AI6Vx(tgV!6-6CdK4_
z&CIFB0-)*yjgR@rxJ>+}FCN
zt94HgBjoW^DCAmLSWH;lRz%$NJ|z`WN)BmeD*8ZLOhW5{ApL{4LE_934<9~$sOa!e
z%S6J_^^u&(BL%diyq1)_qKve>0s#qHK}A{JT2)O$RqwT`)pONXuhn&})I)z7s;C