From 002b73244d488f7b093d275f6b6bea2b7f969c2b Mon Sep 17 00:00:00 2001 From: Maciej Majek Date: Tue, 20 Aug 2024 11:21:46 +0200 Subject: [PATCH] chore: add deprecation info --- poetry.lock | 25 +++++++++++++++++++++---- pyproject.toml | 1 + src/rai/rai/tools/utils.py | 4 ++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/poetry.lock b/poetry.lock index 13fd19b1..f50d168e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -760,6 +760,23 @@ files = [ {file = "defusedxml-0.7.1.tar.gz", hash = "sha256:1bb3032db185915b62d7c6209c5a8792be6a32ab2fedacc84e01b52c51aa3e69"}, ] +[[package]] +name = "deprecated" +version = "1.2.14" +description = "Python @deprecated decorator to deprecate old python classes, functions or methods." +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +files = [ + {file = "Deprecated-1.2.14-py2.py3-none-any.whl", hash = "sha256:6fac8b097794a90302bdbb17b9b815e732d3c4720583ff1b198499d78470466c"}, + {file = "Deprecated-1.2.14.tar.gz", hash = "sha256:e5323eb936458dccc2582dc6f9c322c852a775a27065ff2b0c4970b9d53d01b3"}, +] + +[package.dependencies] +wrapt = ">=1.10,<2" + +[package.extras] +dev = ["PyTest", "PyTest-Cov", "bump2version (<1)", "sphinx (<2)", "tox"] + [[package]] name = "distlib" version = "0.3.8" @@ -2791,9 +2808,9 @@ files = [ [package.dependencies] numpy = [ + {version = ">=1.23.5", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, {version = ">=1.21.4", markers = "python_version >= \"3.10\" and platform_system == \"Darwin\" and python_version < \"3.11\""}, {version = ">=1.21.2", markers = "platform_system != \"Darwin\" and python_version >= \"3.10\" and python_version < \"3.11\""}, - {version = ">=1.23.5", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, {version = ">=1.26.0", markers = "python_version >= \"3.12\""}, ] @@ -2815,9 +2832,9 @@ files = [ [package.dependencies] numpy = [ + {version = ">=1.23.5", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, {version = ">=1.21.4", markers = "python_version >= \"3.10\" and platform_system == \"Darwin\" and python_version < \"3.11\""}, {version = ">=1.21.2", markers = "platform_system != \"Darwin\" and python_version >= \"3.10\" and python_version < \"3.11\""}, - {version = ">=1.23.5", markers = "python_version >= \"3.11\" and python_version < \"3.12\""}, {version = ">=1.26.0", markers = "python_version >= \"3.12\""}, ] @@ -2965,8 +2982,8 @@ files = [ [package.dependencies] numpy = [ - {version = ">=1.22.4", markers = "python_version < \"3.11\""}, {version = ">=1.23.2", markers = "python_version == \"3.11\""}, + {version = ">=1.22.4", markers = "python_version < \"3.11\""}, {version = ">=1.26.0", markers = "python_version >= \"3.12\""}, ] python-dateutil = ">=2.8.2" @@ -5629,4 +5646,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = "^3.10, <3.13" -content-hash = "82ef220355b2cae5f09374ed45059868a7bbd25ecafed64c6ca028c3f18b16d7" +content-hash = "d1bc3be63a03d89358a0b71085cc08bbd303f04a154e5ce4588e35269b9d82fc" diff --git a/pyproject.toml b/pyproject.toml index fea22084..ce932693 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,7 @@ pypdf = "^4.2.0" langchain-ollama = "^0.1.1" streamlit = "^1.37.1" +deprecated = "^1.2.14" [tool.poetry.group.dev.dependencies] ipykernel = "^6.29.4" diff --git a/src/rai/rai/tools/utils.py b/src/rai/rai/tools/utils.py index 8ebd3270..e8797f25 100644 --- a/src/rai/rai/tools/utils.py +++ b/src/rai/rai/tools/utils.py @@ -22,6 +22,7 @@ import rclpy import rclpy.qos from cv_bridge import CvBridge +from deprecated import deprecated from langchain.tools import BaseTool from langchain_core.messages import AIMessage, BaseMessage, ToolCall, ToolMessage from rclpy.duration import Duration @@ -95,6 +96,7 @@ def wait_for_message( return False, None +@deprecated(reason="Multimodal images are handled using rai.messages.multimodal") def images_to_vendor_format(images: List[str], vendor: str) -> List[Dict[str, Any]]: if vendor == "openai": return [ @@ -110,6 +112,7 @@ def images_to_vendor_format(images: List[str], vendor: str) -> List[Dict[str, An raise ValueError(f"Vendor {vendor} not supported") +@deprecated(reason="Running tool is langchain.agent based now") def run_tool_call( tool_call: ToolCall, tools: Sequence[BaseTool], @@ -140,6 +143,7 @@ def run_tool_call( return tool_output +@deprecated(reason="Running tool is langchain.agent based now") def run_requested_tools( ai_msg: AIMessage, tools: Sequence[BaseTool],