From 1902e5754c20442510ef1887661eaa1d15243751 Mon Sep 17 00:00:00 2001 From: ehhuang Date: Wed, 19 Mar 2025 13:43:51 -0700 Subject: [PATCH] fix: toolgroups unregister (#1704) # What does this PR do? FAILED tests/integration/tools/test_tools.py::test_toolsgroups_unregister[None] - AttributeError: 'coroutine' object has no attribute 'data' ## Test Plan LLAMA_STACK_CONFIG=fireworks pytest -s -v tests/integration/tools/test_tools.py --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/meta-llama/llama-stack/pull/1704). * #1705 * __->__ #1704 --- llama_stack/distribution/routers/routing_tables.py | 2 +- tests/integration/tools/test_tools.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/integration/tools/test_tools.py diff --git a/llama_stack/distribution/routers/routing_tables.py b/llama_stack/distribution/routers/routing_tables.py index 7aef2f8d5..6277096d8 100644 --- a/llama_stack/distribution/routers/routing_tables.py +++ b/llama_stack/distribution/routers/routing_tables.py @@ -575,7 +575,7 @@ class ToolGroupsRoutingTable(CommonRoutingTableImpl, ToolGroups): tool_group = await self.get_tool_group(toolgroup_id) if tool_group is None: raise ValueError(f"Tool group {toolgroup_id} not found") - tools = await self.list_tools(toolgroup_id).data + tools = (await self.list_tools(toolgroup_id)).data for tool in tools: await self.unregister_object(tool) await self.unregister_object(tool_group) diff --git a/tests/integration/tools/test_tools.py b/tests/integration/tools/test_tools.py new file mode 100644 index 000000000..162669bb4 --- /dev/null +++ b/tests/integration/tools/test_tools.py @@ -0,0 +1,12 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under the terms described in the LICENSE file in +# the root directory of this source tree. + + +def test_toolsgroups_unregister(llama_stack_client): + client = llama_stack_client + client.toolgroups.unregister( + toolgroup_id="builtin::websearch", + )