Skip to content

Commit

Permalink
Fix default of file type (#457)
Browse files Browse the repository at this point in the history
Co-authored-by: angrybayblade <[email protected]>
  • Loading branch information
kaavee315 and angrybayblade authored Aug 19, 2024
1 parent 43e4e6c commit 3a14439
Show file tree
Hide file tree
Showing 27 changed files with 63 additions and 48 deletions.
3 changes: 2 additions & 1 deletion python/.pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ignore-patterns=
ignore=

[MESSAGES CONTROL]
disable=C0114,C0115,C0116,C0301,C0103,W0603,R1715,W0621,R0903,W0237,W0511,W0622,R0913,R0902,W0221,C0302,R0801,C0411,C0412,W0719,W0718,R0914,R0916,R0912,R0911,W0102,C0325,E0401,W0246,E0611
disable=C0114,C0115,C0116,C0301,C0103,W0603,R1715,W0621,R0903,W0237,W0511,W0622,R0913,R0902,W0221,C0302,R0801,C0411,C0412,W0719,W0718,R0914,R0916,R0912,R0911,W0102,C0325,E0401,W0246,E0611,R0401

# To discuss
# W0621: redefined-outer-name
Expand All @@ -19,6 +19,7 @@ disable=C0114,C0115,C0116,C0301,C0103,W0603,R1715,W0621,R0903,W0237,W0511,W0622,
# E0401: import-error
# W0246: useless-parent-delegation
# E0611: no-name-in-module
# R0401: cyclic-import

# Design issues to discuss
# R0914: too-many-locals
Expand Down
2 changes: 1 addition & 1 deletion python/composio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
"action",
)

__version__ = "0.4.4"
__version__ = "0.4.5"
15 changes: 12 additions & 3 deletions python/composio/client/enums/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from composio.constants import LOCAL_CACHE_DIRECTORY
from composio.exceptions import ComposioSDKError
from composio.storage.base import LocalStorage
from composio.utils.logging import get_logger


_model_cache: t.Dict[str, LocalStorage] = {}
Expand Down Expand Up @@ -152,10 +153,18 @@ def load(self) -> EntityType:
if self._slug in _runtime_actions:
return _runtime_actions[self._slug] # type: ignore
if not (self._path / self._slug).exists():
raise MetadataFileNotFound(
f"Metadata file for `{self._slug}` not found, "
"Please run `composio apps update` to fix this"
from composio.cli.apps import ( # pylint: disable=import-outside-toplevel
update,
)
from composio.cli.context import ( # pylint: disable=import-outside-toplevel
get_context,
)

logger = get_logger()
logger.debug(
f"Metadata file for `{self._slug}` not found, updating metadata"
)
update(context=get_context())
if self._slug not in _model_cache:
_model_cache[self._slug] = self._model.load(self._path / self._slug)
return t.cast(EntityType, _model_cache[self._slug])
Expand Down
4 changes: 3 additions & 1 deletion python/composio/tools/local/base/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ def _parse_docstring(
) -> t.Tuple[str, t.Dict[str, str], t.Optional[t.Tuple[str, str]],]:
"""Parse docstring for descriptions."""
if docstr is None:
raise ValueError("Docstring is None, Please provide a docstring for runtime tools")
raise ValueError(
"Docstring is None, Please provide a docstring for runtime tools"
)
header, *descriptions = docstr.lstrip().rstrip().split("\n")
params = {}
returns = None
Expand Down
10 changes: 4 additions & 6 deletions python/composio/tools/toolset.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,9 @@ def execute_action(
action = Action(action)
is_runtime = action.is_runtime
self.logger.debug(f"Action: {action}, runtime: {is_runtime}")
params = self._serialize_execute_params(param=params)
if not is_runtime:
params = self._process_request(
action=action,
request=self._serialize_execute_params(
param=params,
),
)
params = self._process_request(action=action, request=params)
metadata = self._add_metadata(action=action, metadata=metadata)
response = (
self._execute_local(
Expand Down Expand Up @@ -582,6 +578,7 @@ def action_preprocessing(self, action_item: ActionModel) -> ActionModel:
if param_details.get("properties") == FileType.schema().get("properties"):
action_item.parameters.properties[param_name].pop("properties")
action_item.parameters.properties[param_name] = {
"default": param_details.get("default"),
"type": "string",
"format": "file-path",
"description": f"File path to {param_details.get('description', '')}",
Expand All @@ -592,6 +589,7 @@ def action_preprocessing(self, action_item: ActionModel) -> ActionModel:
action_item.parameters.properties[param_name].pop("allOf")
action_item.parameters.properties[param_name].update(
{
"default": param_details.get("default"),
"type": "string",
"format": "file-path",
"description": f"File path to {param_details.get('description', '')}",
Expand Down
3 changes: 3 additions & 0 deletions python/composio/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,6 @@ def __init__(
def logger(self) -> logging.Logger:
"""Get the component logger."""
return t.cast(logging.Logger, self._logger)


get_logger = get
2 changes: 1 addition & 1 deletion python/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.4.4 fastapi playwright uvicorn
RUN python -m pip install composio-core[all]==0.4.5 fastapi playwright uvicorn

# Install playwright deps
RUN playwright install-deps
Expand Down
2 changes: 1 addition & 1 deletion python/dockerfiles/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN export PATH=$PATH:$(pwd)/.composio/venv/bin

# Install composio for dependency caching
# Install composio
RUN python -m pip install composio-core[all]==0.4.4 fastapi playwright uvicorn
RUN python -m pip install composio-core[all]==0.4.5 fastapi playwright uvicorn

# Install playwright deps
RUN playwright install-deps
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/autogen/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_autogen",
version="0.4.4",
version="0.4.5",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Autogen agent.",
Expand All @@ -22,6 +22,6 @@
"Operating System :: OS Independent",
],
python_requires=">=3.9,<4",
install_requires=["composio_core==0.4.4", "pyautogen>=0.2.19"],
install_requires=["composio_core==0.4.5", "pyautogen>=0.2.19"],
include_package_data=True,
)
4 changes: 2 additions & 2 deletions python/plugins/camel/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_camel",
version="0.4.4",
version="0.4.5",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Claude LLMs.",
Expand All @@ -22,6 +22,6 @@
"Operating System :: OS Independent",
],
python_requires=">=3.9,<4",
install_requires=["composio_core==0.4.4", "camel-ai>=0.1.5.7"],
install_requires=["composio_core==0.4.5", "camel-ai>=0.1.5.7"],
include_package_data=True,
)
4 changes: 2 additions & 2 deletions python/plugins/claude/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_claude",
version="0.4.4",
version="0.4.5",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Claude LLMs.",
Expand All @@ -22,6 +22,6 @@
"Operating System :: OS Independent",
],
python_requires=">=3.9,<4",
install_requires=["composio_openai==0.4.4", "anthropic>=0.25.7"],
install_requires=["composio_openai==0.4.5", "anthropic>=0.25.7"],
include_package_data=True,
)
4 changes: 2 additions & 2 deletions python/plugins/crew_ai/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_crewai",
version="0.4.4",
version="0.4.5",
author="Himanshu",
author_email="[email protected]",
description="Use Composio to get an array of tools with your CrewAI agent.",
Expand All @@ -22,6 +22,6 @@
"Operating System :: OS Independent",
],
python_requires=">=3.9,<4",
install_requires=["composio_langchain==0.4.4", "crewai"],
install_requires=["composio_langchain==0.4.5", "crewai"],
include_package_data=True,
)
4 changes: 2 additions & 2 deletions python/plugins/griptape/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_griptape",
version="0.4.4",
version="0.4.5",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Griptape wokflow.",
Expand All @@ -22,6 +22,6 @@
"Operating System :: OS Independent",
],
python_requires=">=3.9,<4",
install_requires=["composio_core==0.4.4", "griptape>=0.24.2"],
install_requires=["composio_core==0.4.5", "griptape>=0.24.2"],
include_package_data=True,
)
4 changes: 2 additions & 2 deletions python/plugins/julep/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_julep",
version="0.4.4",
version="0.4.5",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Julep wokflow.",
Expand All @@ -22,6 +22,6 @@
"Operating System :: OS Independent",
],
python_requires=">=3.9,<4",
install_requires=["composio_openai==0.4.4", "julep>=0.3.2"],
install_requires=["composio_openai==0.4.5", "julep>=0.3.2"],
include_package_data=True,
)
4 changes: 2 additions & 2 deletions python/plugins/langchain/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_langchain",
version="0.4.4",
version="0.4.5",
author="Karan",
author_email="[email protected]",
description="Use Composio to get an array of tools with your LangChain agent.",
Expand All @@ -27,7 +27,7 @@
"langchain-openai>=0.0.2.post1",
"pydantic>=2.6.4",
"langchainhub>=0.1.15",
"composio_core==0.4.4",
"composio_core==0.4.5",
],
include_package_data=True,
)
4 changes: 2 additions & 2 deletions python/plugins/langgraph/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_langgraph",
version="0.4.4",
version="0.4.5",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get array of tools with LnagGraph Agent Workflows",
Expand All @@ -23,7 +23,7 @@
],
python_requires=">=3.9,<4",
install_requires=[
"composio_langchain==0.4.4",
"composio_langchain==0.4.5",
"langgraph",
],
include_package_data=True,
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/llamaindex/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_llamaindex",
version="0.4.4",
version="0.4.5",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your LlamaIndex agent.",
Expand All @@ -24,7 +24,7 @@
python_requires=">=3.9,<4",
install_requires=[
"llama_index>=0.10.43",
"composio_langchain==0.4.4",
"composio_langchain==0.4.5",
],
include_package_data=True,
)
4 changes: 2 additions & 2 deletions python/plugins/lyzr/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_lyzr",
version="0.4.4",
version="0.4.5",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Lyzr workflow.",
Expand All @@ -25,7 +25,7 @@
install_requires=[
"lyzr-automata>=0.1.3",
"pydantic>=2.6.4",
"composio_core==0.4.4",
"composio_core==0.4.5",
"langchain>=0.1.0",
],
include_package_data=True,
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/openai/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_openai",
version="0.4.4",
version="0.4.5",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your OpenAI Function Call.",
Expand All @@ -22,6 +22,6 @@
"Operating System :: OS Independent",
],
python_requires=">=3.9,<4",
install_requires=["composio_core==0.4.4"],
install_requires=["composio_core==0.4.5"],
include_package_data=True,
)
6 changes: 3 additions & 3 deletions python/plugins/phidata/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_phidata",
version="0.4.4",
version="0.4.5",
author="Sawradip",
author_email="[email protected]",
description="Use Composio to get an array of tools with your Phidata Plugin.",
Expand All @@ -23,8 +23,8 @@
],
python_requires=">=3.9,<4",
install_requires=[
"composio_core==0.4.4",
"composio_openai==0.4.4",
"composio_core==0.4.5",
"composio_openai==0.4.5",
"phidata",
],
include_package_data=True,
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/praisonai/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="composio_praisonai",
version="0.4.4",
version="0.4.5",
author="Sawradip",
author_email="[email protected]",
description="Use Composio Tools to enhance your PraisonAI agents capabilities.",
Expand All @@ -22,6 +22,6 @@
"Operating System :: OS Independent",
],
python_requires=">=3.9",
install_requires=["composio_core==0.4.4", "PraisonAI>=0.0.2"],
install_requires=["composio_core==0.4.5", "PraisonAI>=0.0.2"],
include_package_data=True,
)
2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def scan_for_package_data(

setup(
name="composio_core",
version="0.4.4",
version="0.4.5",
author="Utkarsh",
author_email="[email protected]",
description="Core package to act as a bridge between composio platform and other services.",
Expand Down
3 changes: 2 additions & 1 deletion python/swe/examples/langgraph_agent/benchmark.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import argparse

from agent import composio_toolset, graph
from langchain_core.messages import HumanMessage

from composio_langgraph import Action

from swekit.benchmark.run_evaluation import evaluate
from swekit.config.store import IssueConfig

from agent import composio_toolset, graph


def bench(workspace_id: str, issue_config: IssueConfig) -> str:
"""Run benchmark on the agent."""
Expand Down
4 changes: 2 additions & 2 deletions python/swe/examples/langgraph_agent/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import typing as t
from pathlib import Path

from agent import composio_toolset

from composio import Action

from agent import composio_toolset


InputType = t.TypeVar("InputType")

Expand Down
3 changes: 2 additions & 1 deletion python/swe/examples/langgraph_agent/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from agent import composio_toolset, graph
from inputs import from_github
from langchain_core.messages import HumanMessage

from composio_langgraph import Action

from agent import composio_toolset, graph


def main() -> None:
"""Run the agent."""
Expand Down
Loading

0 comments on commit 3a14439

Please sign in to comment.