From d4ec4653d3e3f8f8e70ec80bd503f913ee79609f Mon Sep 17 00:00:00 2001 From: Himanshu Dixit Date: Thu, 20 Feb 2025 11:27:30 +0530 Subject: [PATCH 1/8] fix: file uploadable with empty path (#1349) Co-authored-by: samvit --- python/composio/__version__.py | 2 +- python/composio/client/files.py | 16 +++++++++++++++- python/composio/tools/toolset.py | 7 +++++++ python/dockerfiles/Dockerfile | 2 +- python/plugins/agno/setup.py | 2 +- python/plugins/autogen/setup.py | 2 +- python/plugins/camel/setup.py | 2 +- python/plugins/claude/setup.py | 2 +- python/plugins/crew_ai/setup.py | 2 +- python/plugins/gemini/setup.py | 2 +- python/plugins/google/setup.py | 2 +- python/plugins/griptape/setup.py | 2 +- python/plugins/julep/setup.py | 2 +- python/plugins/langchain/setup.py | 2 +- python/plugins/langgraph/setup.py | 2 +- python/plugins/llamaindex/setup.py | 2 +- python/plugins/lyzr/setup.py | 2 +- python/plugins/openai/setup.py | 2 +- python/plugins/phidata/setup.py | 2 +- python/plugins/praisonai/setup.py | 2 +- python/plugins/pydanticai/setup.py | 2 +- python/plugins/smolagent/setup.py | 2 +- python/setup.py | 2 +- python/swe/setup.py | 2 +- 24 files changed, 44 insertions(+), 23 deletions(-) diff --git a/python/composio/__version__.py b/python/composio/__version__.py index bc8c296f6a5..4910b9ec3ee 100644 --- a/python/composio/__version__.py +++ b/python/composio/__version__.py @@ -1 +1 @@ -__version__ = "0.7.2" +__version__ = "0.7.3" diff --git a/python/composio/client/files.py b/python/composio/client/files.py index c0e5385e81e..c3b20837c7d 100644 --- a/python/composio/client/files.py +++ b/python/composio/client/files.py @@ -1,6 +1,7 @@ from __future__ import annotations import hashlib +import os import typing as t from pathlib import Path @@ -56,9 +57,22 @@ def from_path( action: str, app: str, ) -> te.Self: + file = Path(file) if not file.exists(): - raise SDKFileNotFoundError(f"File not found: {file}") + raise SDKFileNotFoundError( + f"File not found: {file}. Please provide a valid file path." + ) + + if not file.is_file(): + raise SDKFileNotFoundError( + f"Not a file: {file}. Please provide a valid file path." + ) + + if not os.access(file, os.R_OK): + raise SDKFileNotFoundError( + f"File not readable: {file}. Please check the file permissions." + ) mimetype = mimetypes.guess(file=file) s3meta = client.actions.create_file_upload( diff --git a/python/composio/tools/toolset.py b/python/composio/tools/toolset.py index c5b61bbcf05..2402c3e09fc 100644 --- a/python/composio/tools/toolset.py +++ b/python/composio/tools/toolset.py @@ -665,12 +665,19 @@ def _substitute_file_uploads_recursively( request: t.Dict, action: Action, ) -> t.Dict: + if "properties" not in schema: + return request + params = schema["properties"] for _param in request: if _param not in params: continue if self._file_uploadable(schema=params[_param]): + # skip if the file is not provided + if request[_param] is None or request[_param] == "": + continue + request[_param] = FileUploadable.from_path( file=request[_param], client=self._client(), diff --git a/python/dockerfiles/Dockerfile b/python/dockerfiles/Dockerfile index d812d6dfdc9..8643188014a 100644 --- a/python/dockerfiles/Dockerfile +++ b/python/dockerfiles/Dockerfile @@ -19,7 +19,7 @@ RUN /bin/python3 -m venv .composio/venv RUN export PATH=$PATH:$(pwd)/.composio/venv/bin # Install composio -RUN python -m pip install composio-core[all]==0.7.2 fastapi playwright uvicorn +RUN python -m pip install composio-core[all]==0.7.3 fastapi playwright uvicorn # Install playwright deps RUN playwright install-deps diff --git a/python/plugins/agno/setup.py b/python/plugins/agno/setup.py index 2a5c6e07640..2ccad216251 100644 --- a/python/plugins/agno/setup.py +++ b/python/plugins/agno/setup.py @@ -9,7 +9,7 @@ setup( name="composio_agno", - version="0.7.2", + version="0.7.3", author="Devanshu", author_email="tech@composio.dev", description="Use Composio to get an array of tools with your Agno Plugin.", diff --git a/python/plugins/autogen/setup.py b/python/plugins/autogen/setup.py index d553c2eb32a..90dfcb5493a 100644 --- a/python/plugins/autogen/setup.py +++ b/python/plugins/autogen/setup.py @@ -9,7 +9,7 @@ setup( name="composio_autogen", - version="0.7.2", + version="0.7.3", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Autogen agent.", diff --git a/python/plugins/camel/setup.py b/python/plugins/camel/setup.py index 95a622dbbd8..7c089a607b2 100644 --- a/python/plugins/camel/setup.py +++ b/python/plugins/camel/setup.py @@ -9,7 +9,7 @@ setup( name="composio_camel", - version="0.7.2", + version="0.7.3", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Claude LLMs.", diff --git a/python/plugins/claude/setup.py b/python/plugins/claude/setup.py index 05ee84e005e..78748e4d90d 100644 --- a/python/plugins/claude/setup.py +++ b/python/plugins/claude/setup.py @@ -9,7 +9,7 @@ setup( name="composio_claude", - version="0.7.2", + version="0.7.3", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Claude LLMs.", diff --git a/python/plugins/crew_ai/setup.py b/python/plugins/crew_ai/setup.py index c104c3883b0..7f3baf127bf 100644 --- a/python/plugins/crew_ai/setup.py +++ b/python/plugins/crew_ai/setup.py @@ -9,7 +9,7 @@ setup( name="composio_crewai", - version="0.7.2", + version="0.7.3", author="Himanshu", author_email="himanshu@composio.dev", description="Use Composio to get an array of tools with your CrewAI agent.", diff --git a/python/plugins/gemini/setup.py b/python/plugins/gemini/setup.py index 8105107d535..bdbb9de7b17 100644 --- a/python/plugins/gemini/setup.py +++ b/python/plugins/gemini/setup.py @@ -9,7 +9,7 @@ setup( name="composio_gemini", - version="0.7.2", + version="0.7.3", author="Composio", author_email="tech@composio.dev", description="Use Composio to get an array of tools with your Gemini agent.", diff --git a/python/plugins/google/setup.py b/python/plugins/google/setup.py index d98c259b1af..d71dad72dbc 100644 --- a/python/plugins/google/setup.py +++ b/python/plugins/google/setup.py @@ -9,7 +9,7 @@ setup( name="composio_google", - version="0.7.2", + version="0.7.3", author="Assistant", author_email="karan@composio.dev", description="Use Composio to get an array of tools with your Google AI Python Gemini model.", diff --git a/python/plugins/griptape/setup.py b/python/plugins/griptape/setup.py index e1aa5f7f924..a5e28f2592e 100644 --- a/python/plugins/griptape/setup.py +++ b/python/plugins/griptape/setup.py @@ -9,7 +9,7 @@ setup( name="composio_griptape", - version="0.7.2", + version="0.7.3", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Griptape workflow.", diff --git a/python/plugins/julep/setup.py b/python/plugins/julep/setup.py index 7acd790071c..88e158d3b5c 100644 --- a/python/plugins/julep/setup.py +++ b/python/plugins/julep/setup.py @@ -9,7 +9,7 @@ setup( name="composio_julep", - version="0.7.2", + version="0.7.3", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Julep workflow.", diff --git a/python/plugins/langchain/setup.py b/python/plugins/langchain/setup.py index a4b2cc09270..b489f983669 100644 --- a/python/plugins/langchain/setup.py +++ b/python/plugins/langchain/setup.py @@ -9,7 +9,7 @@ setup( name="composio_langchain", - version="0.7.2", + version="0.7.3", author="Karan", author_email="karan@composio.dev", description="Use Composio to get an array of tools with your LangChain agent.", diff --git a/python/plugins/langgraph/setup.py b/python/plugins/langgraph/setup.py index 034fb9b1b4c..feff0c9cc2b 100644 --- a/python/plugins/langgraph/setup.py +++ b/python/plugins/langgraph/setup.py @@ -9,7 +9,7 @@ setup( name="composio_langgraph", - version="0.7.2", + version="0.7.3", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get array of tools with LangGraph Agent Workflows", diff --git a/python/plugins/llamaindex/setup.py b/python/plugins/llamaindex/setup.py index d3b2a506e47..0bf53a7fb40 100644 --- a/python/plugins/llamaindex/setup.py +++ b/python/plugins/llamaindex/setup.py @@ -9,7 +9,7 @@ setup( name="composio_llamaindex", - version="0.7.2", + version="0.7.3", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your LlamaIndex agent.", diff --git a/python/plugins/lyzr/setup.py b/python/plugins/lyzr/setup.py index 38b6c8b88e2..9d37c601bb6 100644 --- a/python/plugins/lyzr/setup.py +++ b/python/plugins/lyzr/setup.py @@ -9,7 +9,7 @@ setup( name="composio_lyzr", - version="0.7.2", + version="0.7.3", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Lyzr workflow.", diff --git a/python/plugins/openai/setup.py b/python/plugins/openai/setup.py index c852a7ea8f9..0d074b3aede 100644 --- a/python/plugins/openai/setup.py +++ b/python/plugins/openai/setup.py @@ -9,7 +9,7 @@ setup( name="composio_openai", - version="0.7.2", + version="0.7.3", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your OpenAI Function Call.", diff --git a/python/plugins/phidata/setup.py b/python/plugins/phidata/setup.py index e61213f2fc3..acb3aab8bc0 100644 --- a/python/plugins/phidata/setup.py +++ b/python/plugins/phidata/setup.py @@ -9,7 +9,7 @@ setup( name="composio_phidata", - version="0.7.2", + version="0.7.3", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Phidata Plugin.", diff --git a/python/plugins/praisonai/setup.py b/python/plugins/praisonai/setup.py index d60b8f12d6c..93febb46957 100644 --- a/python/plugins/praisonai/setup.py +++ b/python/plugins/praisonai/setup.py @@ -9,7 +9,7 @@ setup( name="composio_praisonai", - version="0.7.2", + version="0.7.3", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio Tools to enhance your PraisonAI agents capabilities.", diff --git a/python/plugins/pydanticai/setup.py b/python/plugins/pydanticai/setup.py index c867286d4e8..a5828a47a7c 100644 --- a/python/plugins/pydanticai/setup.py +++ b/python/plugins/pydanticai/setup.py @@ -9,7 +9,7 @@ setup( name="composio_pydanticai", - version="0.7.2", + version="0.7.3", author="Siddharth", author_email="tech@composio.dev", description="Use Composio to get array of strongly typed tools for Pydantic AI", diff --git a/python/plugins/smolagent/setup.py b/python/plugins/smolagent/setup.py index 16022342541..d2c1996b308 100644 --- a/python/plugins/smolagent/setup.py +++ b/python/plugins/smolagent/setup.py @@ -9,7 +9,7 @@ setup( name="composio_smol", - version="0.7.2", + version="0.7.3", author="Composio", author_email="tech@composio.dev", description="Use Composio to get array of strongly typed tools for Smol Agents", diff --git a/python/setup.py b/python/setup.py index 0eedf35642d..d0566767233 100644 --- a/python/setup.py +++ b/python/setup.py @@ -89,7 +89,7 @@ def scan_for_package_data( setup( name="composio_core", - version="0.7.2", + version="0.7.3", author="Utkarsh", author_email="utkarsh@composio.dev", description="Core package to act as a bridge between composio platform and other services.", diff --git a/python/swe/setup.py b/python/swe/setup.py index d007a81d2bf..b18304a97c7 100644 --- a/python/swe/setup.py +++ b/python/swe/setup.py @@ -35,7 +35,7 @@ def scan_for_package_data( setup( name="swekit", - version="0.4.2", + version="0.4.3", author="Shubhra", author_email="shubhra@composio.dev", description="Tools for running a SWE agent using Composio platform", From 1102dffb5ca380bda81539453134bd1cae5bc5fe Mon Sep 17 00:00:00 2001 From: Samvit Jatia <57254078+sjd9021@users.noreply.github.com> Date: Thu, 20 Feb 2025 14:02:39 +0530 Subject: [PATCH 2/8] fix: handling empty attachment field (#1351) --- python/composio/tools/toolset.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/composio/tools/toolset.py b/python/composio/tools/toolset.py index 2402c3e09fc..1ebce96c2ec 100644 --- a/python/composio/tools/toolset.py +++ b/python/composio/tools/toolset.py @@ -669,13 +669,15 @@ def _substitute_file_uploads_recursively( return request params = schema["properties"] - for _param in request: + params_to_process = list(request.keys()) + for _param in params_to_process: if _param not in params: continue if self._file_uploadable(schema=params[_param]): # skip if the file is not provided if request[_param] is None or request[_param] == "": + del request[_param] continue request[_param] = FileUploadable.from_path( From 7b01d3eac9afd4b2c678784a91c9b1445fdc40e3 Mon Sep 17 00:00:00 2001 From: Samvit Jatia <57254078+sjd9021@users.noreply.github.com> Date: Thu, 20 Feb 2025 14:18:00 +0530 Subject: [PATCH 3/8] chore: bumping sdk 0.7.3 -> 0.7.4 (#1352) --- python/composio/__version__.py | 2 +- python/dockerfiles/Dockerfile | 2 +- python/plugins/agno/setup.py | 2 +- python/plugins/autogen/setup.py | 2 +- python/plugins/camel/setup.py | 2 +- python/plugins/claude/setup.py | 2 +- python/plugins/crew_ai/setup.py | 2 +- python/plugins/gemini/setup.py | 2 +- python/plugins/google/setup.py | 2 +- python/plugins/griptape/setup.py | 2 +- python/plugins/julep/setup.py | 2 +- python/plugins/langchain/setup.py | 2 +- python/plugins/langgraph/setup.py | 2 +- python/plugins/llamaindex/setup.py | 2 +- python/plugins/lyzr/setup.py | 2 +- python/plugins/openai/setup.py | 2 +- python/plugins/phidata/setup.py | 2 +- python/plugins/praisonai/setup.py | 2 +- python/plugins/pydanticai/setup.py | 2 +- python/plugins/smolagent/setup.py | 2 +- python/setup.py | 2 +- python/swe/setup.py | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/python/composio/__version__.py b/python/composio/__version__.py index 4910b9ec3ee..ed9d4d87b64 100644 --- a/python/composio/__version__.py +++ b/python/composio/__version__.py @@ -1 +1 @@ -__version__ = "0.7.3" +__version__ = "0.7.4" diff --git a/python/dockerfiles/Dockerfile b/python/dockerfiles/Dockerfile index 8643188014a..1c807bdea36 100644 --- a/python/dockerfiles/Dockerfile +++ b/python/dockerfiles/Dockerfile @@ -19,7 +19,7 @@ RUN /bin/python3 -m venv .composio/venv RUN export PATH=$PATH:$(pwd)/.composio/venv/bin # Install composio -RUN python -m pip install composio-core[all]==0.7.3 fastapi playwright uvicorn +RUN python -m pip install composio-core[all]==0.7.4 fastapi playwright uvicorn # Install playwright deps RUN playwright install-deps diff --git a/python/plugins/agno/setup.py b/python/plugins/agno/setup.py index 2ccad216251..8a3601a5902 100644 --- a/python/plugins/agno/setup.py +++ b/python/plugins/agno/setup.py @@ -9,7 +9,7 @@ setup( name="composio_agno", - version="0.7.3", + version="0.7.4", author="Devanshu", author_email="tech@composio.dev", description="Use Composio to get an array of tools with your Agno Plugin.", diff --git a/python/plugins/autogen/setup.py b/python/plugins/autogen/setup.py index 90dfcb5493a..4c6fca6d408 100644 --- a/python/plugins/autogen/setup.py +++ b/python/plugins/autogen/setup.py @@ -9,7 +9,7 @@ setup( name="composio_autogen", - version="0.7.3", + version="0.7.4", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Autogen agent.", diff --git a/python/plugins/camel/setup.py b/python/plugins/camel/setup.py index 7c089a607b2..6670890febe 100644 --- a/python/plugins/camel/setup.py +++ b/python/plugins/camel/setup.py @@ -9,7 +9,7 @@ setup( name="composio_camel", - version="0.7.3", + version="0.7.4", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Claude LLMs.", diff --git a/python/plugins/claude/setup.py b/python/plugins/claude/setup.py index 78748e4d90d..ff447a333ee 100644 --- a/python/plugins/claude/setup.py +++ b/python/plugins/claude/setup.py @@ -9,7 +9,7 @@ setup( name="composio_claude", - version="0.7.3", + version="0.7.4", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Claude LLMs.", diff --git a/python/plugins/crew_ai/setup.py b/python/plugins/crew_ai/setup.py index 7f3baf127bf..3ffc099563c 100644 --- a/python/plugins/crew_ai/setup.py +++ b/python/plugins/crew_ai/setup.py @@ -9,7 +9,7 @@ setup( name="composio_crewai", - version="0.7.3", + version="0.7.4", author="Himanshu", author_email="himanshu@composio.dev", description="Use Composio to get an array of tools with your CrewAI agent.", diff --git a/python/plugins/gemini/setup.py b/python/plugins/gemini/setup.py index bdbb9de7b17..96f3e1755ae 100644 --- a/python/plugins/gemini/setup.py +++ b/python/plugins/gemini/setup.py @@ -9,7 +9,7 @@ setup( name="composio_gemini", - version="0.7.3", + version="0.7.4", author="Composio", author_email="tech@composio.dev", description="Use Composio to get an array of tools with your Gemini agent.", diff --git a/python/plugins/google/setup.py b/python/plugins/google/setup.py index d71dad72dbc..ca2de6625a8 100644 --- a/python/plugins/google/setup.py +++ b/python/plugins/google/setup.py @@ -9,7 +9,7 @@ setup( name="composio_google", - version="0.7.3", + version="0.7.4", author="Assistant", author_email="karan@composio.dev", description="Use Composio to get an array of tools with your Google AI Python Gemini model.", diff --git a/python/plugins/griptape/setup.py b/python/plugins/griptape/setup.py index a5e28f2592e..93a868a9c33 100644 --- a/python/plugins/griptape/setup.py +++ b/python/plugins/griptape/setup.py @@ -9,7 +9,7 @@ setup( name="composio_griptape", - version="0.7.3", + version="0.7.4", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Griptape workflow.", diff --git a/python/plugins/julep/setup.py b/python/plugins/julep/setup.py index 88e158d3b5c..52c337d0011 100644 --- a/python/plugins/julep/setup.py +++ b/python/plugins/julep/setup.py @@ -9,7 +9,7 @@ setup( name="composio_julep", - version="0.7.3", + version="0.7.4", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Julep workflow.", diff --git a/python/plugins/langchain/setup.py b/python/plugins/langchain/setup.py index b489f983669..66644c935ea 100644 --- a/python/plugins/langchain/setup.py +++ b/python/plugins/langchain/setup.py @@ -9,7 +9,7 @@ setup( name="composio_langchain", - version="0.7.3", + version="0.7.4", author="Karan", author_email="karan@composio.dev", description="Use Composio to get an array of tools with your LangChain agent.", diff --git a/python/plugins/langgraph/setup.py b/python/plugins/langgraph/setup.py index feff0c9cc2b..a89b7d2bb0a 100644 --- a/python/plugins/langgraph/setup.py +++ b/python/plugins/langgraph/setup.py @@ -9,7 +9,7 @@ setup( name="composio_langgraph", - version="0.7.3", + version="0.7.4", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get array of tools with LangGraph Agent Workflows", diff --git a/python/plugins/llamaindex/setup.py b/python/plugins/llamaindex/setup.py index 0bf53a7fb40..60355efe3af 100644 --- a/python/plugins/llamaindex/setup.py +++ b/python/plugins/llamaindex/setup.py @@ -9,7 +9,7 @@ setup( name="composio_llamaindex", - version="0.7.3", + version="0.7.4", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your LlamaIndex agent.", diff --git a/python/plugins/lyzr/setup.py b/python/plugins/lyzr/setup.py index 9d37c601bb6..a76a9f119b7 100644 --- a/python/plugins/lyzr/setup.py +++ b/python/plugins/lyzr/setup.py @@ -9,7 +9,7 @@ setup( name="composio_lyzr", - version="0.7.3", + version="0.7.4", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Lyzr workflow.", diff --git a/python/plugins/openai/setup.py b/python/plugins/openai/setup.py index 0d074b3aede..e1f9eeb06b6 100644 --- a/python/plugins/openai/setup.py +++ b/python/plugins/openai/setup.py @@ -9,7 +9,7 @@ setup( name="composio_openai", - version="0.7.3", + version="0.7.4", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your OpenAI Function Call.", diff --git a/python/plugins/phidata/setup.py b/python/plugins/phidata/setup.py index acb3aab8bc0..e6ba61dfd06 100644 --- a/python/plugins/phidata/setup.py +++ b/python/plugins/phidata/setup.py @@ -9,7 +9,7 @@ setup( name="composio_phidata", - version="0.7.3", + version="0.7.4", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio to get an array of tools with your Phidata Plugin.", diff --git a/python/plugins/praisonai/setup.py b/python/plugins/praisonai/setup.py index 93febb46957..626f220d2ae 100644 --- a/python/plugins/praisonai/setup.py +++ b/python/plugins/praisonai/setup.py @@ -9,7 +9,7 @@ setup( name="composio_praisonai", - version="0.7.3", + version="0.7.4", author="Sawradip", author_email="sawradip@composio.dev", description="Use Composio Tools to enhance your PraisonAI agents capabilities.", diff --git a/python/plugins/pydanticai/setup.py b/python/plugins/pydanticai/setup.py index a5828a47a7c..d6a7c05f444 100644 --- a/python/plugins/pydanticai/setup.py +++ b/python/plugins/pydanticai/setup.py @@ -9,7 +9,7 @@ setup( name="composio_pydanticai", - version="0.7.3", + version="0.7.4", author="Siddharth", author_email="tech@composio.dev", description="Use Composio to get array of strongly typed tools for Pydantic AI", diff --git a/python/plugins/smolagent/setup.py b/python/plugins/smolagent/setup.py index d2c1996b308..6c82273e63f 100644 --- a/python/plugins/smolagent/setup.py +++ b/python/plugins/smolagent/setup.py @@ -9,7 +9,7 @@ setup( name="composio_smol", - version="0.7.3", + version="0.7.4", author="Composio", author_email="tech@composio.dev", description="Use Composio to get array of strongly typed tools for Smol Agents", diff --git a/python/setup.py b/python/setup.py index d0566767233..a5343ad394a 100644 --- a/python/setup.py +++ b/python/setup.py @@ -89,7 +89,7 @@ def scan_for_package_data( setup( name="composio_core", - version="0.7.3", + version="0.7.4", author="Utkarsh", author_email="utkarsh@composio.dev", description="Core package to act as a bridge between composio platform and other services.", diff --git a/python/swe/setup.py b/python/swe/setup.py index b18304a97c7..060c93ec493 100644 --- a/python/swe/setup.py +++ b/python/swe/setup.py @@ -35,7 +35,7 @@ def scan_for_package_data( setup( name="swekit", - version="0.4.3", + version="0.4.4", author="Shubhra", author_email="shubhra@composio.dev", description="Tools for running a SWE agent using Composio platform", From 54ca5428526cba7ed24a40cd3ffbd4b3ed56f098 Mon Sep 17 00:00:00 2001 From: Apoorv Taneja Date: Thu, 20 Feb 2025 22:07:44 +0530 Subject: [PATCH 4/8] feat: Add session information (#1343) --- js/src/sdk/models/actions.ts | 11 ++++++++++- js/src/sdk/types/action.ts | 5 +++++ js/src/sdk/utils/telemetry/index.ts | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/js/src/sdk/models/actions.ts b/js/src/sdk/models/actions.ts index 0744e32a511..550591f7682 100644 --- a/js/src/sdk/models/actions.ts +++ b/js/src/sdk/models/actions.ts @@ -15,6 +15,7 @@ import { ZGetListActionsParams, ZParameter, } from "../types/action"; +import ComposioSDKContext from "../utils/composioContext"; import { CEG } from "../utils/error"; import { TELEMETRY_LOGGER } from "../utils/telemetry"; import { TELEMETRY_EVENTS } from "../utils/telemetry/events"; @@ -151,7 +152,15 @@ export class Actions { try { const parsedData = ZExecuteParams.parse(data); const { data: res } = await apiClient.actionsV2.executeActionV2({ - body: parsedData.requestBody as unknown as ActionExecutionReqDTO, + body: { + ...parsedData.requestBody, + sessionInfo: { + ...(parsedData.requestBody?.sessionInfo || {}), + sessionId: + parsedData.requestBody?.sessionInfo?.sessionId || + ComposioSDKContext.sessionId, + }, + } as ActionExecutionReqDTO, path: { actionId: parsedData.actionName, }, diff --git a/js/src/sdk/types/action.ts b/js/src/sdk/types/action.ts index 4f0ed86496e..38ea925f80b 100644 --- a/js/src/sdk/types/action.ts +++ b/js/src/sdk/types/action.ts @@ -42,6 +42,11 @@ export const ZExecuteParams = z.object({ appName: z.string().optional(), text: z.string().optional(), authConfig: ZCustomAuthParams.optional(), + sessionInfo: z + .object({ + sessionId: z.string().optional(), + }) + .optional(), }), }); diff --git a/js/src/sdk/utils/telemetry/index.ts b/js/src/sdk/utils/telemetry/index.ts index b8a384820da..0283c106f7c 100644 --- a/js/src/sdk/utils/telemetry/index.ts +++ b/js/src/sdk/utils/telemetry/index.ts @@ -20,6 +20,7 @@ export class TELEMETRY_LOGGER { composioVersion: ComposioSDKContext.composioVersion, frameworkRuntime: ComposioSDKContext.frameworkRuntime, source: ComposioSDKContext.source, + sessionId: ComposioSDKContext.sessionId, isBrowser: typeof window !== "undefined", }, }; From a5777fc50964ba3bc0260470814fd7263c0e6814 Mon Sep 17 00:00:00 2001 From: Apoorv Taneja Date: Fri, 21 Feb 2025 16:39:48 +0530 Subject: [PATCH 5/8] feat: Added props for controlling tracing (#1356) --- js/config/getTestConfig.ts | 34 +++++++++++++++++++--------------- js/src/sdk/models/actions.ts | 10 +++++++--- js/src/sdk/types/action.ts | 1 + 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/js/config/getTestConfig.ts b/js/config/getTestConfig.ts index abbefd83b41..03b55d63e39 100644 --- a/js/config/getTestConfig.ts +++ b/js/config/getTestConfig.ts @@ -1,20 +1,24 @@ -export const env = process.env.TEST_ENV || "staging" +export const env = "staging"; const CURRENT_FILE_DIR = __dirname; export type BACKEND_CONFIG = { - COMPOSIO_API_KEY: string; - BACKEND_HERMES_URL: string; - drive: { - downloadable_file_id: string; - } -} + COMPOSIO_API_KEY: string; + BACKEND_HERMES_URL: string; + drive: { + downloadable_file_id: string; + }; +}; export const getTestConfig = (): BACKEND_CONFIG => { - const path = `${CURRENT_FILE_DIR}/test.config.${env}.json`; - try { - return JSON.parse(JSON.stringify(require(path))) as unknown as BACKEND_CONFIG; - } catch (error) { - console.error("Error loading test config file:", error); - throw new Error(`Error loading test config file. You can create test.config.${env}.json file in the config folder.`); - } -} + const path = `${CURRENT_FILE_DIR}/test.config.${env}.json`; + try { + return JSON.parse( + JSON.stringify(require(path)) + ) as unknown as BACKEND_CONFIG; + } catch (error) { + console.error("Error loading test config file:", error); + throw new Error( + `Error loading test config file. You can create test.config.${env}.json file in the config folder.` + ); + } +}; diff --git a/js/src/sdk/models/actions.ts b/js/src/sdk/models/actions.ts index 550591f7682..8512f3e77ab 100644 --- a/js/src/sdk/models/actions.ts +++ b/js/src/sdk/models/actions.ts @@ -156,9 +156,13 @@ export class Actions { ...parsedData.requestBody, sessionInfo: { ...(parsedData.requestBody?.sessionInfo || {}), - sessionId: - parsedData.requestBody?.sessionInfo?.sessionId || - ComposioSDKContext.sessionId, + ...(parsedData.requestBody?.allowTracing + ? { + sessionId: + parsedData.requestBody?.sessionInfo?.sessionId || + ComposioSDKContext.sessionId, + } + : {}), }, } as ActionExecutionReqDTO, path: { diff --git a/js/src/sdk/types/action.ts b/js/src/sdk/types/action.ts index 38ea925f80b..b823cbea4f2 100644 --- a/js/src/sdk/types/action.ts +++ b/js/src/sdk/types/action.ts @@ -42,6 +42,7 @@ export const ZExecuteParams = z.object({ appName: z.string().optional(), text: z.string().optional(), authConfig: ZCustomAuthParams.optional(), + allowTracing: z.boolean().optional(), sessionInfo: z .object({ sessionId: z.string().optional(), From d82a9bfe020969aa0efe3aacb6b2078f7d92fd40 Mon Sep 17 00:00:00 2001 From: Himanshu Dixit Date: Fri, 21 Feb 2025 17:07:11 +0530 Subject: [PATCH 6/8] feat: silent logging level (#1357) --- js/src/utils/logger.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/js/src/utils/logger.ts b/js/src/utils/logger.ts index 53250f0976d..8a82e948d78 100644 --- a/js/src/utils/logger.ts +++ b/js/src/utils/logger.ts @@ -2,6 +2,7 @@ import { getEnvVariable } from "./shared"; // Define log levels with corresponding priorities export const LOG_LEVELS = { + silent: -1, // No logs error: 0, // Highest priority - critical errors warn: 1, // Warning messages info: 2, // General information From efb6de98e423352f2dd257d2c37bbd5ef8a40385 Mon Sep 17 00:00:00 2001 From: Shrey Singla <62649026+shreysingla11@users.noreply.github.com> Date: Mon, 24 Feb 2025 12:05:48 +0530 Subject: [PATCH 7/8] fix: description humanised (#1353) --- python/composio/tools/base/abs.py | 3 ++- python/tests/test_example.py | 7 ++++--- python/tests/test_tools/test_base/test_abs.py | 4 ++-- python/tests/test_tools/test_plugins.py | 12 ++++++------ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/python/composio/tools/base/abs.py b/python/composio/tools/base/abs.py index 49b0ccd22d9..da742d1ae6f 100644 --- a/python/composio/tools/base/abs.py +++ b/python/composio/tools/base/abs.py @@ -290,8 +290,9 @@ def _get_description(obj) -> str: .strip() ), ) + description = " ".join(description.split()) description, separator, enum = description.partition(DEPRECATED_MARKER) - return inflection.titleize(description) + separator + enum + return inflection.humanize(description) + separator + enum class ActionMeta(type): diff --git a/python/tests/test_example.py b/python/tests/test_example.py index a8747f822f7..c604ed9aa45 100644 --- a/python/tests/test_example.py +++ b/python/tests/test_example.py @@ -218,6 +218,7 @@ def test_example( ), f"Please provide value for `{key}` for testing `{example['file']}`" filepath = Path(example["file"]) + original_source = filepath.read_text(encoding="utf-8") code = filepath.read_text(encoding="utf-8") if plugin_to_test != "lyzr": @@ -236,10 +237,10 @@ def test_example( # Wait for 2 minutes for example to run proc.wait(timeout=180) + filepath.write_text(original_source, encoding="utf-8") + # Check if process exited with success - assert proc.returncode == 0, ( - t.cast(t.IO[bytes], proc.stderr).read().decode(encoding="utf-8") - ) + assert proc.returncode == 0 # Validate output output = ( diff --git a/python/tests/test_tools/test_base/test_abs.py b/python/tests/test_tools/test_base/test_abs.py index b5774f4ae13..10de87a2fca 100644 --- a/python/tests/test_tools/test_base/test_abs.py +++ b/python/tests/test_tools/test_base/test_abs.py @@ -58,7 +58,7 @@ def execute(self, request: Request, metadata: Dict) -> Response: assert SomeAction.name == "some_action" assert SomeAction.enum == "SOME_ACTION" assert SomeAction.display_name == "Some action" - assert SomeAction.description == "Some Action" + assert SomeAction.description == "Some action" assert str(SomeAction.file) == __file__ def test_deprecated_marker(self) -> None: @@ -76,7 +76,7 @@ def execute(self, request: Request, metadata: Dict) -> Response: return Response() assert ( - SomeAction.description == "Some Action <>" + SomeAction.description == "Some action <>" ) assert DEPRECATED_MARKER in SomeAction.description diff --git a/python/tests/test_tools/test_plugins.py b/python/tests/test_tools/test_plugins.py index c9e4530fae7..5bb40bc4128 100644 --- a/python/tests/test_tools/test_plugins.py +++ b/python/tests/test_tools/test_plugins.py @@ -82,8 +82,8 @@ def test_openai_toolset() -> None: assert tools == [ { "function": { - "description": "A Tool That Allows Interaction With The Screen, Keyboard, And " - "Mouse Of The Current Computer. Adapted For Mac Os And Linux.", + "description": "A tool that allows interaction with the screen, keyboard, and " + "mouse of the current computer. adapted for macos and linux.", "name": "computer", "parameters": { "properties": { @@ -192,8 +192,8 @@ def test_crewai_toolset() -> None: "'Text to type or key sequence to press. Please provide a value of " "type string.', 'type': 'str'}, 'coordinate': {'description': " "'X,Y coordinates for mouse actions', 'type': 'list'}}\nTool " - "Description: A Tool That Allows Interaction With The Screen, " - "Keyboard, And Mouse Of The Current Computer. Adapted For Mac Os And Linux." + "Description: A tool that allows interaction with the screen, " + "keyboard, and mouse of the current computer. adapted for macos and linux." ) assert set(tool.args_schema.model_json_schema().get("properties", {}).keys()) == { "action", @@ -241,7 +241,7 @@ def test_langchain_toolset() -> None: tool = tools[0] assert ( tool.description - == "A Tool That Allows Interaction With The Screen, Keyboard, And Mouse Of The Current Computer. Adapted For Mac Os And Linux." + == "A tool that allows interaction with the screen, keyboard, and mouse of the current computer. adapted for macos and linux." ) assert set(tool.args_schema.model_json_schema().get("properties", {}).keys()) == { @@ -358,7 +358,7 @@ def test_llamaindex_toolset() -> None: tool = tools[0] assert ( tool.metadata.description - == "A Tool That Allows Interaction With The Screen, Keyboard, And Mouse Of The Current Computer. Adapted For Mac Os And Linux." + == "A tool that allows interaction with the screen, keyboard, and mouse of the current computer. adapted for macos and linux." ) assert tool.metadata.fn_schema is not None assert tool.metadata.fn_schema.model_json_schema() == { From f9da75fed1c16dd86065e4ff8b2d7b399984e508 Mon Sep 17 00:00:00 2001 From: Abhishek Patil <83769052+abhishekpatil4@users.noreply.github.com> Date: Mon, 24 Feb 2025 14:30:19 +0530 Subject: [PATCH 8/8] fix: VercelAIToolset toolset (#1362) --- js/src/frameworks/vercel.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/js/src/frameworks/vercel.ts b/js/src/frameworks/vercel.ts index 6e130ff168d..d040d05efd2 100644 --- a/js/src/frameworks/vercel.ts +++ b/js/src/frameworks/vercel.ts @@ -39,7 +39,10 @@ export class VercelAIToolSet extends BaseComposioToolSet { }); } - private generateVercelTool(schema: RawActionData) { + private generateVercelTool( + schema: RawActionData, + entityId: Optional = null + ) { return tool({ description: schema.description, // @ts-ignore the type are JSONSchemV7. Internally it's resolved @@ -50,7 +53,7 @@ export class VercelAIToolSet extends BaseComposioToolSet { name: schema.name, arguments: JSON.stringify(params), }, - this.entityId + entityId || this.entityId ); }, }); @@ -99,7 +102,10 @@ export class VercelAIToolSet extends BaseComposioToolSet { const tools: { [key: string]: CoreTool } = {}; actionsList.forEach((actionSchema) => { - tools[actionSchema.name!] = this.generateVercelTool(actionSchema); + tools[actionSchema.name!] = this.generateVercelTool( + actionSchema, + entityId + ); }); return tools;