Skip to content

Commit 411ef06

Browse files
committed
feat: simplify meta tool function names to match Node SDK
- Rename create_meta_search_tools_filter_tool() to create_meta_search_tools() - Rename create_meta_search_tools_execute_tool() to create_meta_execute_tool() - Update file names: meta_search_tools.py to meta_tools.py - Update method name: meta_search_tools() to meta_tools() - Standardize terminology: use "meta tools" in comments/docs - Keep tool names as meta_search_tools and meta_execute_tool This aligns the Python SDK with the Node SDK naming conventions while maintaining the same functionality.
1 parent 8b6de99 commit 411ef06

File tree

4 files changed

+28
-24
lines changed

4 files changed

+28
-24
lines changed

examples/meta_tools_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def example_meta_tools_basic():
3131
meta_tools = all_tools.meta_tools()
3232

3333
# Get the filter tool to search for relevant tools
34-
filter_tool = meta_tools.get_tool("meta_filter_relevant_tools")
34+
filter_tool = meta_tools.get_tool("meta_search_tools")
3535
if filter_tool:
3636
# Search for employee management tools
3737
result = filter_tool.call(query="manage employees create update list", limit=5, minScore=0.0)
@@ -55,7 +55,7 @@ def example_meta_tools_with_execution():
5555
meta_tools = all_tools.meta_tools()
5656

5757
# Step 1: Search for relevant tools
58-
filter_tool = meta_tools.get_tool("meta_filter_relevant_tools")
58+
filter_tool = meta_tools.get_tool("meta_search_tools")
5959
execute_tool = meta_tools.get_tool("meta_execute_tool")
6060

6161
if filter_tool and execute_tool:
@@ -138,7 +138,7 @@ def example_with_openai():
138138
messages=[
139139
{
140140
"role": "system",
141-
"content": "You are an HR assistant. Use meta_filter_relevant_tools to find appropriate tools, then meta_execute_tool to execute them.",
141+
"content": "You are an HR assistant. Use meta_search_tools to find appropriate tools, then meta_execute_tool to execute them.",
142142
},
143143
{"role": "user", "content": "Can you help me find tools for managing employee records?"},
144144
],

stackone_ai/meta_tools.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
class MetaToolSearchResult(BaseModel):
19-
"""Result from meta_filter_relevant_tools"""
19+
"""Result from meta_search_tools"""
2020

2121
name: str
2222
description: str
@@ -106,16 +106,16 @@ 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:
110-
"""Create the meta_filter_relevant_tools tool
109+
def create_meta_search_tools(index: ToolIndex) -> StackOneTool:
110+
"""Create the meta_search_tools tool
111111
112112
Args:
113113
index: Tool search index
114114
115115
Returns:
116-
Meta tool for filtering relevant tools
116+
Meta tool for searching relevant tools
117117
"""
118-
name = "meta_filter_relevant_tools"
118+
name = "meta_search_tools"
119119
description = (
120120
"Searches for relevant tools based on a natural language query. "
121121
"This tool should be called first to discover available tools before executing them."
@@ -180,8 +180,8 @@ def execute_filter(arguments: str | JsonDict | None = None) -> JsonDict:
180180
)
181181

182182
# Create a wrapper class that delegates execute to our custom function
183-
class MetaFilterTool(StackOneTool):
184-
"""Meta tool for filtering relevant tools"""
183+
class MetaSearchTool(StackOneTool):
184+
"""Meta tool for searching relevant tools"""
185185

186186
def __init__(self) -> None:
187187
super().__init__(
@@ -195,7 +195,7 @@ def __init__(self) -> None:
195195
def execute(self, arguments: str | JsonDict | None = None) -> JsonDict:
196196
return execute_filter(arguments)
197197

198-
return MetaFilterTool()
198+
return MetaSearchTool()
199199

200200

201201
def create_meta_execute_tool(tools_collection: Tools) -> StackOneTool:
@@ -210,7 +210,7 @@ def create_meta_execute_tool(tools_collection: Tools) -> StackOneTool:
210210
name = "meta_execute_tool"
211211
description = (
212212
"Executes a tool by name with the provided parameters. "
213-
"Use this after discovering tools with meta_filter_relevant_tools."
213+
"Use this after discovering tools with meta_search_tools."
214214
)
215215

216216
parameters = ToolParameters(

stackone_ai/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,22 +486,22 @@ def meta_tools(self) -> "Tools":
486486
Meta tools enable dynamic tool discovery and execution based on natural language queries.
487487
488488
Returns:
489-
Tools collection containing meta_filter_relevant_tools and meta_execute_tool
489+
Tools collection containing meta_search_tools and meta_execute_tool
490490
491491
Note:
492492
This feature is in beta and may change in future versions
493493
"""
494494
from stackone_ai.meta_tools import (
495495
ToolIndex,
496496
create_meta_execute_tool,
497-
create_meta_filter_tool,
497+
create_meta_search_tools,
498498
)
499499

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

503503
# Create meta tools
504-
filter_tool = create_meta_filter_tool(index)
504+
filter_tool = create_meta_search_tools(index)
505505
execute_tool = create_meta_execute_tool(self)
506506

507507
return Tools([filter_tool, execute_tool])

tests/test_meta_tools.py

Lines changed: 13 additions & 9 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_execute_tool,
10+
create_meta_search_tools,
11+
)
812
from stackone_ai.models import ExecuteConfig, ToolParameters
913

1014

@@ -128,21 +132,21 @@ def test_search_limit(self, sample_tools):
128132
assert len(results) <= 3
129133

130134

131-
class TestMetaFilterTool:
132-
"""Test the meta_filter_relevant_tools functionality"""
135+
class TestMetaSearchTool:
136+
"""Test the meta_search_tools functionality"""
133137

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(index)
138142

139-
assert filter_tool.name == "meta_filter_relevant_tools"
143+
assert filter_tool.name == "meta_search_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(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(index)
171175

172176
# Call with kwargs
173177
result = filter_tool.call(query="candidate", limit=2)
@@ -237,15 +241,15 @@ def test_meta_tools_creation(self, tools_collection):
237241

238242
# Check tool names
239243
tool_names = [tool.name for tool in meta_tools.tools]
240-
assert "meta_filter_relevant_tools" in tool_names
244+
assert "meta_search_tools" in tool_names
241245
assert "meta_execute_tool" in tool_names
242246

243247
def test_meta_tools_functionality(self, tools_collection):
244248
"""Test that meta tools work correctly"""
245249
meta_tools = tools_collection.meta_tools()
246250

247251
# Get the filter tool
248-
filter_tool = meta_tools.get_tool("meta_filter_relevant_tools")
252+
filter_tool = meta_tools.get_tool("meta_search_tools")
249253
assert filter_tool is not None
250254

251255
# Search for tools

0 commit comments

Comments
 (0)