From 8704c409af7df3ea67df9b49c6dd20fa15af18be Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Mon, 28 Apr 2025 14:42:06 +0530 Subject: [PATCH 1/5] docs: fix auth required error log --- packages/toolbox-langchain/tests/test_e2e.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/toolbox-langchain/tests/test_e2e.py b/packages/toolbox-langchain/tests/test_e2e.py index 940c01bd..a17f5d09 100644 --- a/packages/toolbox-langchain/tests/test_e2e.py +++ b/packages/toolbox-langchain/tests/test_e2e.py @@ -126,8 +126,9 @@ async def test_run_tool_no_auth(self, toolbox): "get-row-by-id-auth", ) with pytest.raises( - ToolException, - match="{'status': 'Unauthorized', 'error': 'tool invocation not authorized. Please make sure your specify correct auth headers'}", + PermissionError, + match="Tool get-row-by-id-auth requires authentication, but no valid authentication sources are registered. Please register the required sources before use.", + ): await tool.ainvoke({"id": "2"}) @@ -266,8 +267,8 @@ def test_run_tool_no_auth(self, toolbox): "get-row-by-id-auth", ) with pytest.raises( - ToolException, - match="{'status': 'Unauthorized', 'error': 'tool invocation not authorized. Please make sure your specify correct auth headers'}", + PermissionError, + match="Tool get-row-by-id-auth requires authentication, but no valid authentication sources are registered. Please register the required sources before use.", ): tool.invoke({"id": "2"}) From 5b28fcf51df1235b2e31848c9af9a61e6c41273b Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Mon, 28 Apr 2025 14:44:15 +0530 Subject: [PATCH 2/5] lint --- packages/toolbox-langchain/tests/test_e2e.py | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/toolbox-langchain/tests/test_e2e.py b/packages/toolbox-langchain/tests/test_e2e.py index a17f5d09..8945657a 100644 --- a/packages/toolbox-langchain/tests/test_e2e.py +++ b/packages/toolbox-langchain/tests/test_e2e.py @@ -128,7 +128,6 @@ async def test_run_tool_no_auth(self, toolbox): with pytest.raises( PermissionError, match="Tool get-row-by-id-auth requires authentication, but no valid authentication sources are registered. Please register the required sources before use.", - ): await tool.ainvoke({"id": "2"}) From c1706d7ae08217f0a8963c00b201cde97ac66aef Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Mon, 28 Apr 2025 14:59:11 +0530 Subject: [PATCH 3/5] try out --- packages/toolbox-langchain/tests/test_e2e.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/toolbox-langchain/tests/test_e2e.py b/packages/toolbox-langchain/tests/test_e2e.py index 8945657a..b130306c 100644 --- a/packages/toolbox-langchain/tests/test_e2e.py +++ b/packages/toolbox-langchain/tests/test_e2e.py @@ -125,11 +125,11 @@ async def test_run_tool_no_auth(self, toolbox): tool = await toolbox.aload_tool( "get-row-by-id-auth", ) - with pytest.raises( - PermissionError, - match="Tool get-row-by-id-auth requires authentication, but no valid authentication sources are registered. Please register the required sources before use.", - ): - await tool.ainvoke({"id": "2"}) + # with pytest.raises( + # PermissionError, + # match="Tool get-row-by-id-auth requires authentication, but no valid authentication sources are registered. Please register the required sources before use.", + # ): + await tool.ainvoke({"id": "2"}) async def test_run_tool_wrong_auth(self, toolbox, auth_token2): """Tests running a tool with incorrect auth.""" @@ -265,11 +265,11 @@ def test_run_tool_no_auth(self, toolbox): tool = toolbox.load_tool( "get-row-by-id-auth", ) - with pytest.raises( - PermissionError, - match="Tool get-row-by-id-auth requires authentication, but no valid authentication sources are registered. Please register the required sources before use.", - ): - tool.invoke({"id": "2"}) + # with pytest.raises( + # PermissionError, + # match="Tool get-row-by-id-auth requires authentication, but no valid authentication sources are registered. Please register the required sources before use.", + # ): + tool.invoke({"id": "2"}) def test_run_tool_wrong_auth(self, toolbox, auth_token2): """Tests running a tool with incorrect auth.""" From ee515a64044f5d5da0ef24e5079e7fe9903b9835 Mon Sep 17 00:00:00 2001 From: Twisha Bansal Date: Mon, 28 Apr 2025 15:01:20 +0530 Subject: [PATCH 4/5] fix --- packages/toolbox-langchain/tests/test_e2e.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/toolbox-langchain/tests/test_e2e.py b/packages/toolbox-langchain/tests/test_e2e.py index b130306c..8945657a 100644 --- a/packages/toolbox-langchain/tests/test_e2e.py +++ b/packages/toolbox-langchain/tests/test_e2e.py @@ -125,11 +125,11 @@ async def test_run_tool_no_auth(self, toolbox): tool = await toolbox.aload_tool( "get-row-by-id-auth", ) - # with pytest.raises( - # PermissionError, - # match="Tool get-row-by-id-auth requires authentication, but no valid authentication sources are registered. Please register the required sources before use.", - # ): - await tool.ainvoke({"id": "2"}) + with pytest.raises( + PermissionError, + match="Tool get-row-by-id-auth requires authentication, but no valid authentication sources are registered. Please register the required sources before use.", + ): + await tool.ainvoke({"id": "2"}) async def test_run_tool_wrong_auth(self, toolbox, auth_token2): """Tests running a tool with incorrect auth.""" @@ -265,11 +265,11 @@ def test_run_tool_no_auth(self, toolbox): tool = toolbox.load_tool( "get-row-by-id-auth", ) - # with pytest.raises( - # PermissionError, - # match="Tool get-row-by-id-auth requires authentication, but no valid authentication sources are registered. Please register the required sources before use.", - # ): - tool.invoke({"id": "2"}) + with pytest.raises( + PermissionError, + match="Tool get-row-by-id-auth requires authentication, but no valid authentication sources are registered. Please register the required sources before use.", + ): + tool.invoke({"id": "2"}) def test_run_tool_wrong_auth(self, toolbox, auth_token2): """Tests running a tool with incorrect auth.""" From 6f8d1cfde1cf99efe263b19dcbcec1f683e16bde Mon Sep 17 00:00:00 2001 From: Twisha Bansal <58483338+twishabansal@users.noreply.github.com> Date: Mon, 28 Apr 2025 15:03:48 +0530 Subject: [PATCH 5/5] Update integration.cloudbuild.yaml --- packages/toolbox-langchain/integration.cloudbuild.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/toolbox-langchain/integration.cloudbuild.yaml b/packages/toolbox-langchain/integration.cloudbuild.yaml index 247e1861..ee3a04b2 100644 --- a/packages/toolbox-langchain/integration.cloudbuild.yaml +++ b/packages/toolbox-langchain/integration.cloudbuild.yaml @@ -43,4 +43,4 @@ options: logging: CLOUD_LOGGING_ONLY substitutions: _VERSION: '3.13' - _TOOLBOX_VERSION: '0.3.0' + _TOOLBOX_VERSION: '0.4.0'