diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 2170d838..fb4f032c 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -20,7 +20,7 @@ If you are still having issues, please be sure to include as much information as - OS type and version: - Python version: `python --version` - pip version: `pip --version` - - `toolbox-langchain-sdk` version: `pip show toolbox-langchain-sdk` + - `toolbox-langchain` version: `pip show toolbox-langchain` #### Steps to reproduce diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index a77f8627..8ad5dd04 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -75,4 +75,4 @@ jobs: - name: Run type-check env: MYPYPATH: './src' - run: mypy --install-types --non-interactive --cache-dir=.mypy_cache/ -p toolbox_langchain_sdk \ No newline at end of file + run: mypy --install-types --non-interactive --cache-dir=.mypy_cache/ -p toolbox_langchain \ No newline at end of file diff --git a/README.md b/README.md index b156bd1e..30ada14d 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ applications, enabling advanced orchestration and interaction with GenAI models. Here's a minimal example to get you started: ```py -from toolbox_langchain_sdk import ToolboxClient +from toolbox_langchain import ToolboxClient from langchain_google_vertexai import ChatVertexAI toolbox = ToolboxClient("http://127.0.0.1:5000") @@ -60,7 +60,7 @@ print(result) You can install the Toolbox SDK for LangChain using `pip`. ```bash -pip install toolbox-langchain-sdk +pip install toolbox-langchain ``` ## Usage @@ -68,7 +68,7 @@ pip install toolbox-langchain-sdk Import and initialize the toolbox client. ```py -from toolbox_langchain_sdk import ToolboxClient +from toolbox_langchain import ToolboxClient # Replace with your Toolbox service's URL toolbox = ToolboxClient("http://127.0.0.1:5000") @@ -126,7 +126,7 @@ guide](https://langchain-ai.github.io/langgraph/) with minimal changes. Represent each tool as a LangGraph node, encapsulating the tool's execution within the node's functionality: ```py -from toolbox_langchain_sdk import ToolboxClient +from toolbox_langchain import ToolboxClient from langgraph.graph import StateGraph, MessagesState from langgraph.prebuilt import ToolNode @@ -245,7 +245,8 @@ auth_tools = toolbox.load_toolset(auth_tokens={"my_auth": get_auth_token}) ### Complete Example ```py -from toolbox_langchain_sdk import ToolboxClient +import asyncio +from toolbox_langchain import ToolboxClient async def get_auth_token(): # ... Logic to retrieve ID token (e.g., from local storage, OAuth flow) @@ -324,7 +325,7 @@ use the asynchronous interfaces of the `ToolboxClient`. ```py import asyncio -from toolbox_langchain_sdk import ToolboxClient +from toolbox_langchain import ToolboxClient async def main(): toolbox = ToolboxClient("http://127.0.0.1:5000") diff --git a/pyproject.toml b/pyproject.toml index 8a75956a..e4a68d9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "toolbox-langchain-sdk" +name = "toolbox-langchain" version="0.0.1" description = "Python SDK for interacting with the Toolbox service with LangChain" license = {file = "LICENSE"} diff --git a/src/toolbox_langchain_sdk/__init__.py b/src/toolbox_langchain/__init__.py similarity index 100% rename from src/toolbox_langchain_sdk/__init__.py rename to src/toolbox_langchain/__init__.py diff --git a/src/toolbox_langchain_sdk/async_client.py b/src/toolbox_langchain/async_client.py similarity index 100% rename from src/toolbox_langchain_sdk/async_client.py rename to src/toolbox_langchain/async_client.py diff --git a/src/toolbox_langchain_sdk/async_tools.py b/src/toolbox_langchain/async_tools.py similarity index 100% rename from src/toolbox_langchain_sdk/async_tools.py rename to src/toolbox_langchain/async_tools.py diff --git a/src/toolbox_langchain_sdk/client.py b/src/toolbox_langchain/client.py similarity index 100% rename from src/toolbox_langchain_sdk/client.py rename to src/toolbox_langchain/client.py diff --git a/src/toolbox_langchain_sdk/tools.py b/src/toolbox_langchain/tools.py similarity index 100% rename from src/toolbox_langchain_sdk/tools.py rename to src/toolbox_langchain/tools.py diff --git a/src/toolbox_langchain_sdk/utils.py b/src/toolbox_langchain/utils.py similarity index 100% rename from src/toolbox_langchain_sdk/utils.py rename to src/toolbox_langchain/utils.py diff --git a/tests/test_async_client.py b/tests/test_async_client.py index 18957cc5..520c5237 100644 --- a/tests/test_async_client.py +++ b/tests/test_async_client.py @@ -19,9 +19,9 @@ import pytest from aiohttp import ClientSession -from toolbox_langchain_sdk.async_client import AsyncToolboxClient -from toolbox_langchain_sdk.async_tools import AsyncToolboxTool -from toolbox_langchain_sdk.utils import ManifestSchema +from toolbox_langchain.async_client import AsyncToolboxClient +from toolbox_langchain.async_tools import AsyncToolboxTool +from toolbox_langchain.utils import ManifestSchema URL = "http://test_url" MANIFEST_JSON = { @@ -68,7 +68,7 @@ def mock_client(self, mock_session): async def test_create_with_existing_session(self, mock_client, mock_session): assert mock_client._AsyncToolboxClient__session == mock_session - @patch("toolbox_langchain_sdk.async_client._load_manifest") + @patch("toolbox_langchain.async_client._load_manifest") async def test_aload_tool( self, mock_load_manifest, mock_client, mock_session, manifest_schema ): @@ -83,7 +83,7 @@ async def test_aload_tool( assert isinstance(tool, AsyncToolboxTool) assert tool.name == tool_name - @patch("toolbox_langchain_sdk.async_client._load_manifest") + @patch("toolbox_langchain.async_client._load_manifest") async def test_aload_tool_auth_headers_deprecated( self, mock_load_manifest, mock_client, manifest_schema ): @@ -99,7 +99,7 @@ async def test_aload_tool_auth_headers_deprecated( assert issubclass(w[-1].category, DeprecationWarning) assert "auth_headers" in str(w[-1].message) - @patch("toolbox_langchain_sdk.async_client._load_manifest") + @patch("toolbox_langchain.async_client._load_manifest") async def test_aload_tool_auth_headers_and_tokens( self, mock_load_manifest, mock_client, manifest_schema ): @@ -117,7 +117,7 @@ async def test_aload_tool_auth_headers_and_tokens( assert issubclass(w[-1].category, DeprecationWarning) assert "auth_headers" in str(w[-1].message) - @patch("toolbox_langchain_sdk.async_client._load_manifest") + @patch("toolbox_langchain.async_client._load_manifest") async def test_aload_toolset( self, mock_load_manifest, mock_client, mock_session, manifest_schema ): @@ -131,7 +131,7 @@ async def test_aload_toolset( assert isinstance(tool, AsyncToolboxTool) assert tool.name in ["test_tool_1", "test_tool_2"] - @patch("toolbox_langchain_sdk.async_client._load_manifest") + @patch("toolbox_langchain.async_client._load_manifest") async def test_aload_toolset_with_toolset_name( self, mock_load_manifest, mock_client, mock_session, manifest_schema ): @@ -148,7 +148,7 @@ async def test_aload_toolset_with_toolset_name( assert isinstance(tool, AsyncToolboxTool) assert tool.name in ["test_tool_1", "test_tool_2"] - @patch("toolbox_langchain_sdk.async_client._load_manifest") + @patch("toolbox_langchain.async_client._load_manifest") async def test_aload_toolset_auth_headers_deprecated( self, mock_load_manifest, mock_client, manifest_schema ): @@ -163,7 +163,7 @@ async def test_aload_toolset_auth_headers_deprecated( assert issubclass(w[-1].category, DeprecationWarning) assert "auth_headers" in str(w[-1].message) - @patch("toolbox_langchain_sdk.async_client._load_manifest") + @patch("toolbox_langchain.async_client._load_manifest") async def test_aload_toolset_auth_headers_and_tokens( self, mock_load_manifest, mock_client, manifest_schema ): diff --git a/tests/test_async_tools.py b/tests/test_async_tools.py index 7e98bcb7..13fca7ee 100644 --- a/tests/test_async_tools.py +++ b/tests/test_async_tools.py @@ -18,7 +18,7 @@ import pytest_asyncio from pydantic import ValidationError -from toolbox_langchain_sdk.async_tools import AsyncToolboxTool +from toolbox_langchain.async_tools import AsyncToolboxTool @pytest.mark.asyncio diff --git a/tests/test_client.py b/tests/test_client.py index 184afc43..c9cd262a 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -17,8 +17,8 @@ import pytest from pydantic import BaseModel -from toolbox_langchain_sdk.client import ToolboxClient -from toolbox_langchain_sdk.tools import ToolboxTool +from toolbox_langchain.client import ToolboxClient +from toolbox_langchain.tools import ToolboxTool URL = "http://test_url" @@ -36,7 +36,7 @@ def toolbox_client(self): return client - @patch("toolbox_langchain_sdk.client.AsyncToolboxClient.aload_tool") + @patch("toolbox_langchain.client.AsyncToolboxClient.aload_tool") def test_load_tool(self, mock_aload_tool, toolbox_client): mock_tool = Mock(spec=ToolboxTool) mock_tool.name = "mock-tool" @@ -51,7 +51,7 @@ def test_load_tool(self, mock_aload_tool, toolbox_client): assert tool.args_schema == mock_tool.args_schema mock_aload_tool.assert_called_once_with("test_tool", {}, None, {}, True) - @patch("toolbox_langchain_sdk.client.AsyncToolboxClient.aload_toolset") + @patch("toolbox_langchain.client.AsyncToolboxClient.aload_toolset") def test_load_toolset(self, mock_aload_toolset, toolbox_client): mock_tools = [Mock(spec=ToolboxTool), Mock(spec=ToolboxTool)] mock_tools[0].name = "mock-tool-0" @@ -73,7 +73,7 @@ def test_load_toolset(self, mock_aload_toolset, toolbox_client): mock_aload_toolset.assert_called_once_with(None, {}, None, {}, True) @pytest.mark.asyncio - @patch("toolbox_langchain_sdk.client.AsyncToolboxClient.aload_tool") + @patch("toolbox_langchain.client.AsyncToolboxClient.aload_tool") async def test_aload_tool(self, mock_aload_tool, toolbox_client): mock_tool = Mock(spec=ToolboxTool) mock_tool.name = "mock-tool" @@ -88,7 +88,7 @@ async def test_aload_tool(self, mock_aload_tool, toolbox_client): mock_aload_tool.assert_called_once_with("test_tool", {}, None, {}, True) @pytest.mark.asyncio - @patch("toolbox_langchain_sdk.client.AsyncToolboxClient.aload_toolset") + @patch("toolbox_langchain.client.AsyncToolboxClient.aload_toolset") async def test_aload_toolset(self, mock_aload_toolset, toolbox_client): mock_tools = [Mock(spec=ToolboxTool), Mock(spec=ToolboxTool)] mock_tools[0].name = "mock-tool-0" @@ -109,7 +109,7 @@ async def test_aload_toolset(self, mock_aload_toolset, toolbox_client): ) mock_aload_toolset.assert_called_once_with(None, {}, None, {}, True) - @patch("toolbox_langchain_sdk.client.AsyncToolboxClient.aload_tool") + @patch("toolbox_langchain.client.AsyncToolboxClient.aload_tool") def test_load_tool_with_args(self, mock_aload_tool, toolbox_client): mock_tool = Mock(spec=ToolboxTool) mock_tool.name = "mock-tool" @@ -135,7 +135,7 @@ def test_load_tool_with_args(self, mock_aload_tool, toolbox_client): "test_tool_name", auth_tokens, auth_headers, bound_params, False ) - @patch("toolbox_langchain_sdk.client.AsyncToolboxClient.aload_toolset") + @patch("toolbox_langchain.client.AsyncToolboxClient.aload_toolset") def test_load_toolset_with_args(self, mock_aload_toolset, toolbox_client): mock_tools = [Mock(spec=ToolboxTool), Mock(spec=ToolboxTool)] mock_tools[0].name = "mock-tool-0" @@ -170,7 +170,7 @@ def test_load_toolset_with_args(self, mock_aload_toolset, toolbox_client): ) @pytest.mark.asyncio - @patch("toolbox_langchain_sdk.client.AsyncToolboxClient.aload_tool") + @patch("toolbox_langchain.client.AsyncToolboxClient.aload_tool") async def test_aload_tool_with_args(self, mock_aload_tool, toolbox_client): mock_tool = Mock(spec=ToolboxTool) mock_tool.name = "mock-tool" @@ -193,7 +193,7 @@ async def test_aload_tool_with_args(self, mock_aload_tool, toolbox_client): ) @pytest.mark.asyncio - @patch("toolbox_langchain_sdk.client.AsyncToolboxClient.aload_toolset") + @patch("toolbox_langchain.client.AsyncToolboxClient.aload_toolset") async def test_aload_toolset_with_args(self, mock_aload_toolset, toolbox_client): mock_tools = [Mock(spec=ToolboxTool), Mock(spec=ToolboxTool)] mock_tools[0].name = "mock-tool-0" diff --git a/tests/test_e2e.py b/tests/test_e2e.py index 946b12d2..75ff3de9 100644 --- a/tests/test_e2e.py +++ b/tests/test_e2e.py @@ -39,7 +39,7 @@ from aiohttp import ClientResponseError from pydantic import ValidationError -from toolbox_langchain_sdk.client import ToolboxClient +from toolbox_langchain.client import ToolboxClient @pytest.mark.asyncio diff --git a/tests/test_tools.py b/tests/test_tools.py index 1ecd61e6..a866f9be 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -17,8 +17,8 @@ import pytest from pydantic import BaseModel -from toolbox_langchain_sdk.async_tools import AsyncToolboxTool -from toolbox_langchain_sdk.tools import ToolboxTool +from toolbox_langchain.async_tools import AsyncToolboxTool +from toolbox_langchain.tools import ToolboxTool class TestToolboxTool: diff --git a/tests/test_utils.py b/tests/test_utils.py index 2ce6fced..5e481dc7 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -23,7 +23,7 @@ import pytest from pydantic import BaseModel -from toolbox_langchain_sdk.utils import ( +from toolbox_langchain.utils import ( ParameterSchema, _convert_none_to_empty_string, _get_auth_headers,