Skip to content

Commit d272460

Browse files
committed
refactor: rename meta tool creator functions for consistency
- Rename create_meta_filter_tool to create_meta_search_tools_filter_tool - Rename create_meta_execute_tool to create_meta_search_tools_execute_tool - Update all imports and function calls accordingly - Auto-fix import formatting in tests - All tests pass with the new function names
1 parent e3c4372 commit d272460

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

stackone_ai/meta_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def search(self, query: str, limit: int = 5, min_score: float = 0.0) -> list[Met
106106
return search_results
107107

108108

109-
def create_meta_filter_tool(index: ToolIndex) -> StackOneTool:
109+
def create_meta_search_tools_filter_tool(index: ToolIndex) -> StackOneTool:
110110
"""Create the meta_filter_relevant_tools tool
111111
112112
Args:
@@ -198,7 +198,7 @@ def execute(self, arguments: str | JsonDict | None = None) -> JsonDict:
198198
return MetaFilterTool()
199199

200200

201-
def create_meta_execute_tool(tools_collection: Tools) -> StackOneTool:
201+
def create_meta_search_tools_execute_tool(tools_collection: Tools) -> StackOneTool:
202202
"""Create the meta_execute_tool
203203
204204
Args:

stackone_ai/models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,15 +493,15 @@ def meta_search_tools(self) -> "Tools":
493493
"""
494494
from stackone_ai.meta_tools import (
495495
ToolIndex,
496-
create_meta_execute_tool,
497-
create_meta_filter_tool,
496+
create_meta_search_tools_execute_tool,
497+
create_meta_search_tools_filter_tool,
498498
)
499499

500500
# Create search index
501501
index = ToolIndex(self.tools)
502502

503503
# Create meta tools
504-
filter_tool = create_meta_filter_tool(index)
505-
execute_tool = create_meta_execute_tool(self)
504+
filter_tool = create_meta_search_tools_filter_tool(index)
505+
execute_tool = create_meta_search_tools_execute_tool(self)
506506

507507
return Tools([filter_tool, execute_tool])

tests/test_meta_tools.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
import responses
55

66
from stackone_ai import StackOneTool, Tools
7-
from stackone_ai.meta_tools import ToolIndex, create_meta_execute_tool, create_meta_filter_tool
7+
from stackone_ai.meta_tools import (
8+
ToolIndex,
9+
create_meta_search_tools_execute_tool,
10+
create_meta_search_tools_filter_tool,
11+
)
812
from stackone_ai.models import ExecuteConfig, ToolParameters
913

1014

@@ -134,15 +138,15 @@ class TestMetaFilterTool:
134138
def test_filter_tool_creation(self, sample_tools):
135139
"""Test creating the filter tool"""
136140
index = ToolIndex(sample_tools)
137-
filter_tool = create_meta_filter_tool(index)
141+
filter_tool = create_meta_search_tools_filter_tool(index)
138142

139143
assert filter_tool.name == "meta_filter_relevant_tools"
140144
assert "natural language query" in filter_tool.description.lower()
141145

142146
def test_filter_tool_execute(self, sample_tools):
143147
"""Test executing the filter tool"""
144148
index = ToolIndex(sample_tools)
145-
filter_tool = create_meta_filter_tool(index)
149+
filter_tool = create_meta_search_tools_filter_tool(index)
146150

147151
# Execute with a query
148152
result = filter_tool.execute(
@@ -167,7 +171,7 @@ def test_filter_tool_execute(self, sample_tools):
167171
def test_filter_tool_call(self, sample_tools):
168172
"""Test calling the filter tool with call method"""
169173
index = ToolIndex(sample_tools)
170-
filter_tool = create_meta_filter_tool(index)
174+
filter_tool = create_meta_search_tools_filter_tool(index)
171175

172176
# Call with kwargs
173177
result = filter_tool.call(query="candidate", limit=2)
@@ -181,21 +185,21 @@ class TestMetaExecuteTool:
181185

182186
def test_execute_tool_creation(self, tools_collection):
183187
"""Test creating the execute tool"""
184-
execute_tool = create_meta_execute_tool(tools_collection)
188+
execute_tool = create_meta_search_tools_execute_tool(tools_collection)
185189

186190
assert execute_tool.name == "meta_execute_tool"
187191
assert "executes a tool" in execute_tool.description.lower()
188192

189193
def test_execute_tool_missing_name(self, tools_collection):
190194
"""Test execute tool with missing tool name"""
191-
execute_tool = create_meta_execute_tool(tools_collection)
195+
execute_tool = create_meta_search_tools_execute_tool(tools_collection)
192196

193197
with pytest.raises(ValueError, match="toolName is required"):
194198
execute_tool.execute({"params": {}})
195199

196200
def test_execute_tool_invalid_name(self, tools_collection):
197201
"""Test execute tool with invalid tool name"""
198-
execute_tool = create_meta_execute_tool(tools_collection)
202+
execute_tool = create_meta_search_tools_execute_tool(tools_collection)
199203

200204
with pytest.raises(ValueError, match="Tool 'invalid_tool' not found"):
201205
execute_tool.execute(
@@ -207,7 +211,7 @@ def test_execute_tool_invalid_name(self, tools_collection):
207211

208212
def test_execute_tool_call(self, tools_collection):
209213
"""Test calling the execute tool with call method"""
210-
execute_tool = create_meta_execute_tool(tools_collection)
214+
execute_tool = create_meta_search_tools_execute_tool(tools_collection)
211215

212216
# Mock the actual tool execution by patching the requests
213217
with responses.RequestsMock() as rsps:

0 commit comments

Comments
 (0)