isage-tooluse 0.1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 IntelliStream Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.4
2
+ Name: isage-tooluse
3
+ Version: 0.1.0.0
4
+ Summary: Tool retrieval and ranking algorithms for LLM agents
5
+ Author-email: IntelliStream Team <shuhao_zhang@hust.edu.cn>
6
+ Project-URL: Homepage, https://github.com/intellistream/sage-tooluse
7
+ Project-URL: Documentation, https://intellistream.github.io/SAGE-Pub/
8
+ Project-URL: Repository, https://github.com/intellistream/sage-tooluse
9
+ Project-URL: Issues, https://github.com/intellistream/sage-tooluse/issues
10
+ Keywords: sage,tool-selection,tool-use,tool-retrieval,tool-ranking,llm,agents,intellistream
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: numpy<2.3.0,>=1.26.0
26
+ Requires-Dist: typing-extensions>=4.0.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
29
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
30
+ Requires-Dist: ruff>=0.8.4; extra == "dev"
31
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
32
+ Provides-Extra: embedding
33
+ Requires-Dist: sentence-transformers>=2.0.0; extra == "embedding"
34
+ Requires-Dist: faiss-cpu>=1.7.0; extra == "embedding"
35
+ Provides-Extra: all
36
+ Requires-Dist: isage-tooluse[dev,embedding]; extra == "all"
37
+ Dynamic: license-file
38
+
39
+ # SAGE Tool Use
40
+
41
+ **Tool retrieval and ranking algorithms for LLM agents**
42
+
43
+ [![PyPI version](https://badge.fury.io/py/isage-tooluse.svg)](https://badge.fury.io/py/isage-tooluse)
44
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
45
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
46
+
47
+ ## 🎯 Overview
48
+
49
+ `sage-tooluse` provides a comprehensive suite of tool selection and ranking algorithms for LLM agents:
50
+
51
+ - **Keyword Selector**: Fast matching based on keyword overlap
52
+ - **Embedding Selector**: Semantic similarity using embeddings
53
+ - **Hybrid Selector**: Combines keyword and embedding approaches
54
+ - **DFS-DT Selector**: Decision tree-based tool selection
55
+ - **Gorilla Adapter**: Gorilla-style tool retrieval
56
+
57
+ ## 📦 Installation
58
+
59
+ ```bash
60
+ # Basic installation
61
+ pip install isage-tooluse
62
+
63
+ # With embedding support
64
+ pip install isage-tooluse[embedding]
65
+
66
+ # Development installation
67
+ pip install isage-tooluse[dev]
68
+ ```
69
+
70
+ ## 🚀 Quick Start
71
+
72
+ ### Keyword-based Tool Selection
73
+
74
+ ```python
75
+ from sage_libs.sage_tooluse import KeywordToolSelector
76
+
77
+ # Create selector
78
+ selector = KeywordToolSelector(tools=available_tools)
79
+
80
+ # Select tools for a query
81
+ selected = selector.select(
82
+ query="Get current weather in New York",
83
+ top_k=5
84
+ )
85
+
86
+ for tool in selected:
87
+ print(f"Tool: {tool.name}, Score: {tool.score}")
88
+ ```
89
+
90
+ ### Embedding-based Tool Selection
91
+
92
+ ```python
93
+ from sage_libs.sage_tooluse import EmbeddingToolSelector
94
+
95
+ # Create selector with embedding model
96
+ selector = EmbeddingToolSelector(
97
+ tools=available_tools,
98
+ model_name="sentence-transformers/all-MiniLM-L6-v2"
99
+ )
100
+
101
+ # Select tools based on semantic similarity
102
+ selected = selector.select(
103
+ query="What's the weather like?",
104
+ top_k=5
105
+ )
106
+ ```
107
+
108
+ ### Hybrid Tool Selection
109
+
110
+ ```python
111
+ from sage_libs.sage_tooluse import HybridToolSelector
112
+
113
+ # Combine keyword and embedding approaches
114
+ selector = HybridToolSelector(
115
+ tools=available_tools,
116
+ keyword_weight=0.3,
117
+ embedding_weight=0.7
118
+ )
119
+
120
+ selected = selector.select(query="...", top_k=5)
121
+ ```
122
+
123
+ ## 📚 Key Components
124
+
125
+ ### Selectors
126
+
127
+ - **KeywordToolSelector**: Fast keyword-based matching
128
+ - **EmbeddingToolSelector**: Semantic similarity using embeddings
129
+ - **HybridToolSelector**: Weighted combination of multiple selectors
130
+ - **DFSDTToolSelector**: Decision tree-based selection
131
+ - **GorillaAdapter**: Gorilla-style API-centric retrieval
132
+
133
+ ### Base Classes
134
+
135
+ - **BaseToolSelector**: Abstract base for all selectors
136
+ - **ToolRegistry**: Central registry for selector implementations
137
+
138
+ ### Schemas
139
+
140
+ - **Tool**: Tool representation with metadata
141
+ - **ToolSelection**: Selection result with scores
142
+ - **SelectionContext**: Context for tool selection
143
+
144
+ ## 🏗️ Architecture
145
+
146
+ ```
147
+ sage_libs.sage_tooluse/
148
+ ├── __init__.py # Public API exports
149
+ ├── base.py # Base selector interface
150
+ ├── keyword_selector.py # Keyword-based selection
151
+ ├── embedding_selector.py # Embedding-based selection
152
+ ├── hybrid_selector.py # Hybrid selection strategy
153
+ ├── dfsdt_selector.py # Decision tree selector
154
+ ├── gorilla_selector.py # Gorilla-style retrieval
155
+ ├── registry.py # Selector registry
156
+ ├── schemas.py # Data schemas
157
+ └── retriever/ # Retrieval utilities
158
+ ```
159
+
160
+ ## 🎓 Use Cases
161
+
162
+ 1. **Agent Tool Selection**: Help agents choose the right tools
163
+ 2. **API Discovery**: Find relevant APIs for a task
164
+ 3. **Function Calling**: Select appropriate functions for LLMs
165
+ 4. **Tool Recommendation**: Recommend tools to users
166
+ 5. **Multi-step Planning**: Select tool sequences for complex tasks
167
+
168
+ ## 🔗 Integration with SAGE
169
+
170
+ This package is part of the SAGE ecosystem and can be used with SAGE agents:
171
+
172
+ ```python
173
+ # Standalone usage
174
+ from sage_libs.sage_tooluse import HybridToolSelector
175
+
176
+ # With SAGE (when available, through interface layer)
177
+ from sage.libs.tooluse import create_selector
178
+
179
+ selector = create_selector("hybrid", tools=available_tools)
180
+ ```
181
+
182
+ ## 📖 Documentation
183
+
184
+ - **Repository**: https://github.com/intellistream/sage-tooluse
185
+ - **SAGE Documentation**: https://intellistream.github.io/SAGE-Pub/
186
+ - **Issues**: https://github.com/intellistream/sage-tooluse/issues
187
+
188
+ ## 🤝 Contributing
189
+
190
+ Contributions are welcome! Please feel free to submit a Pull Request.
191
+
192
+ ## 📄 License
193
+
194
+ MIT License - see [LICENSE](LICENSE) file for details.
195
+
196
+ ## 🙏 Acknowledgments
197
+
198
+ Originally part of the [sage-agentic](https://github.com/intellistream/sage-agentic) package, now maintained as an independent repository for focused development and research.
199
+
200
+ ## 📧 Contact
201
+
202
+ - **Team**: IntelliStream Team
203
+ - **Email**: shuhao_zhang@hust.edu.cn
204
+ - **GitHub**: https://github.com/intellistream
205
+
206
+ ---
207
+
208
+ **Part of the SAGE ecosystem** - Stream Analytics for Generative AI Engines
@@ -0,0 +1,170 @@
1
+ # SAGE Tool Use
2
+
3
+ **Tool retrieval and ranking algorithms for LLM agents**
4
+
5
+ [![PyPI version](https://badge.fury.io/py/isage-tooluse.svg)](https://badge.fury.io/py/isage-tooluse)
6
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
+
9
+ ## 🎯 Overview
10
+
11
+ `sage-tooluse` provides a comprehensive suite of tool selection and ranking algorithms for LLM agents:
12
+
13
+ - **Keyword Selector**: Fast matching based on keyword overlap
14
+ - **Embedding Selector**: Semantic similarity using embeddings
15
+ - **Hybrid Selector**: Combines keyword and embedding approaches
16
+ - **DFS-DT Selector**: Decision tree-based tool selection
17
+ - **Gorilla Adapter**: Gorilla-style tool retrieval
18
+
19
+ ## 📦 Installation
20
+
21
+ ```bash
22
+ # Basic installation
23
+ pip install isage-tooluse
24
+
25
+ # With embedding support
26
+ pip install isage-tooluse[embedding]
27
+
28
+ # Development installation
29
+ pip install isage-tooluse[dev]
30
+ ```
31
+
32
+ ## 🚀 Quick Start
33
+
34
+ ### Keyword-based Tool Selection
35
+
36
+ ```python
37
+ from sage_libs.sage_tooluse import KeywordToolSelector
38
+
39
+ # Create selector
40
+ selector = KeywordToolSelector(tools=available_tools)
41
+
42
+ # Select tools for a query
43
+ selected = selector.select(
44
+ query="Get current weather in New York",
45
+ top_k=5
46
+ )
47
+
48
+ for tool in selected:
49
+ print(f"Tool: {tool.name}, Score: {tool.score}")
50
+ ```
51
+
52
+ ### Embedding-based Tool Selection
53
+
54
+ ```python
55
+ from sage_libs.sage_tooluse import EmbeddingToolSelector
56
+
57
+ # Create selector with embedding model
58
+ selector = EmbeddingToolSelector(
59
+ tools=available_tools,
60
+ model_name="sentence-transformers/all-MiniLM-L6-v2"
61
+ )
62
+
63
+ # Select tools based on semantic similarity
64
+ selected = selector.select(
65
+ query="What's the weather like?",
66
+ top_k=5
67
+ )
68
+ ```
69
+
70
+ ### Hybrid Tool Selection
71
+
72
+ ```python
73
+ from sage_libs.sage_tooluse import HybridToolSelector
74
+
75
+ # Combine keyword and embedding approaches
76
+ selector = HybridToolSelector(
77
+ tools=available_tools,
78
+ keyword_weight=0.3,
79
+ embedding_weight=0.7
80
+ )
81
+
82
+ selected = selector.select(query="...", top_k=5)
83
+ ```
84
+
85
+ ## 📚 Key Components
86
+
87
+ ### Selectors
88
+
89
+ - **KeywordToolSelector**: Fast keyword-based matching
90
+ - **EmbeddingToolSelector**: Semantic similarity using embeddings
91
+ - **HybridToolSelector**: Weighted combination of multiple selectors
92
+ - **DFSDTToolSelector**: Decision tree-based selection
93
+ - **GorillaAdapter**: Gorilla-style API-centric retrieval
94
+
95
+ ### Base Classes
96
+
97
+ - **BaseToolSelector**: Abstract base for all selectors
98
+ - **ToolRegistry**: Central registry for selector implementations
99
+
100
+ ### Schemas
101
+
102
+ - **Tool**: Tool representation with metadata
103
+ - **ToolSelection**: Selection result with scores
104
+ - **SelectionContext**: Context for tool selection
105
+
106
+ ## 🏗️ Architecture
107
+
108
+ ```
109
+ sage_libs.sage_tooluse/
110
+ ├── __init__.py # Public API exports
111
+ ├── base.py # Base selector interface
112
+ ├── keyword_selector.py # Keyword-based selection
113
+ ├── embedding_selector.py # Embedding-based selection
114
+ ├── hybrid_selector.py # Hybrid selection strategy
115
+ ├── dfsdt_selector.py # Decision tree selector
116
+ ├── gorilla_selector.py # Gorilla-style retrieval
117
+ ├── registry.py # Selector registry
118
+ ├── schemas.py # Data schemas
119
+ └── retriever/ # Retrieval utilities
120
+ ```
121
+
122
+ ## 🎓 Use Cases
123
+
124
+ 1. **Agent Tool Selection**: Help agents choose the right tools
125
+ 2. **API Discovery**: Find relevant APIs for a task
126
+ 3. **Function Calling**: Select appropriate functions for LLMs
127
+ 4. **Tool Recommendation**: Recommend tools to users
128
+ 5. **Multi-step Planning**: Select tool sequences for complex tasks
129
+
130
+ ## 🔗 Integration with SAGE
131
+
132
+ This package is part of the SAGE ecosystem and can be used with SAGE agents:
133
+
134
+ ```python
135
+ # Standalone usage
136
+ from sage_libs.sage_tooluse import HybridToolSelector
137
+
138
+ # With SAGE (when available, through interface layer)
139
+ from sage.libs.tooluse import create_selector
140
+
141
+ selector = create_selector("hybrid", tools=available_tools)
142
+ ```
143
+
144
+ ## 📖 Documentation
145
+
146
+ - **Repository**: https://github.com/intellistream/sage-tooluse
147
+ - **SAGE Documentation**: https://intellistream.github.io/SAGE-Pub/
148
+ - **Issues**: https://github.com/intellistream/sage-tooluse/issues
149
+
150
+ ## 🤝 Contributing
151
+
152
+ Contributions are welcome! Please feel free to submit a Pull Request.
153
+
154
+ ## 📄 License
155
+
156
+ MIT License - see [LICENSE](LICENSE) file for details.
157
+
158
+ ## 🙏 Acknowledgments
159
+
160
+ Originally part of the [sage-agentic](https://github.com/intellistream/sage-agentic) package, now maintained as an independent repository for focused development and research.
161
+
162
+ ## 📧 Contact
163
+
164
+ - **Team**: IntelliStream Team
165
+ - **Email**: shuhao_zhang@hust.edu.cn
166
+ - **GitHub**: https://github.com/intellistream
167
+
168
+ ---
169
+
170
+ **Part of the SAGE ecosystem** - Stream Analytics for Generative AI Engines
@@ -0,0 +1,91 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "isage-tooluse"
7
+ version = "0.1.0.0"
8
+ description = "Tool retrieval and ranking algorithms for LLM agents"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ authors = [
12
+ { name = "IntelliStream Team", email = "shuhao_zhang@hust.edu.cn" },
13
+ ]
14
+ keywords = [
15
+ "sage",
16
+ "tool-selection",
17
+ "tool-use",
18
+ "tool-retrieval",
19
+ "tool-ranking",
20
+ "llm",
21
+ "agents",
22
+ "intellistream",
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 4 - Beta",
26
+ "Intended Audience :: Developers",
27
+ "Intended Audience :: Science/Research",
28
+ "License :: OSI Approved :: MIT License",
29
+ "Programming Language :: Python :: 3",
30
+ "Programming Language :: Python :: 3.10",
31
+ "Programming Language :: Python :: 3.11",
32
+ "Programming Language :: Python :: 3.12",
33
+ "Programming Language :: Python :: 3 :: Only",
34
+ "Topic :: Software Development :: Libraries :: Python Modules",
35
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
36
+ ]
37
+
38
+ dependencies = [
39
+ "numpy>=1.26.0,<2.3.0",
40
+ "typing-extensions>=4.0.0",
41
+ ]
42
+
43
+ [project.optional-dependencies]
44
+ dev = [
45
+ "pytest>=7.0.0",
46
+ "pytest-cov>=4.0.0",
47
+ "ruff>=0.8.4",
48
+ "mypy>=1.0.0",
49
+ ]
50
+
51
+ embedding = [
52
+ "sentence-transformers>=2.0.0",
53
+ "faiss-cpu>=1.7.0",
54
+ ]
55
+
56
+ all = [
57
+ "isage-tooluse[dev,embedding]",
58
+ ]
59
+
60
+ [project.urls]
61
+ Homepage = "https://github.com/intellistream/sage-tooluse"
62
+ Documentation = "https://intellistream.github.io/SAGE-Pub/"
63
+ Repository = "https://github.com/intellistream/sage-tooluse"
64
+ Issues = "https://github.com/intellistream/sage-tooluse/issues"
65
+
66
+ [tool.setuptools]
67
+ package-dir = {"" = "src"}
68
+ packages = ["sage_libs.sage_tooluse"]
69
+
70
+ [tool.setuptools.package-data]
71
+ "sage_libs.sage_tooluse" = ["py.typed"]
72
+
73
+ [tool.ruff]
74
+ line-length = 100
75
+ target-version = "py310"
76
+
77
+ [tool.ruff.lint]
78
+ select = ["E", "F", "I", "W", "UP"]
79
+ ignore = ["E501"]
80
+
81
+ [tool.mypy]
82
+ python_version = "3.10"
83
+ warn_return_any = true
84
+ warn_unused_configs = true
85
+ disallow_untyped_defs = false
86
+
87
+ [[tool.mypy.overrides]]
88
+ module = "sage_libs.sage_tooluse.*"
89
+ ignore_missing_imports = true
90
+
91
+ license = "MIT"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,208 @@
1
+ Metadata-Version: 2.4
2
+ Name: isage-tooluse
3
+ Version: 0.1.0.0
4
+ Summary: Tool retrieval and ranking algorithms for LLM agents
5
+ Author-email: IntelliStream Team <shuhao_zhang@hust.edu.cn>
6
+ Project-URL: Homepage, https://github.com/intellistream/sage-tooluse
7
+ Project-URL: Documentation, https://intellistream.github.io/SAGE-Pub/
8
+ Project-URL: Repository, https://github.com/intellistream/sage-tooluse
9
+ Project-URL: Issues, https://github.com/intellistream/sage-tooluse/issues
10
+ Keywords: sage,tool-selection,tool-use,tool-retrieval,tool-ranking,llm,agents,intellistream
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: numpy<2.3.0,>=1.26.0
26
+ Requires-Dist: typing-extensions>=4.0.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
29
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
30
+ Requires-Dist: ruff>=0.8.4; extra == "dev"
31
+ Requires-Dist: mypy>=1.0.0; extra == "dev"
32
+ Provides-Extra: embedding
33
+ Requires-Dist: sentence-transformers>=2.0.0; extra == "embedding"
34
+ Requires-Dist: faiss-cpu>=1.7.0; extra == "embedding"
35
+ Provides-Extra: all
36
+ Requires-Dist: isage-tooluse[dev,embedding]; extra == "all"
37
+ Dynamic: license-file
38
+
39
+ # SAGE Tool Use
40
+
41
+ **Tool retrieval and ranking algorithms for LLM agents**
42
+
43
+ [![PyPI version](https://badge.fury.io/py/isage-tooluse.svg)](https://badge.fury.io/py/isage-tooluse)
44
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
45
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
46
+
47
+ ## 🎯 Overview
48
+
49
+ `sage-tooluse` provides a comprehensive suite of tool selection and ranking algorithms for LLM agents:
50
+
51
+ - **Keyword Selector**: Fast matching based on keyword overlap
52
+ - **Embedding Selector**: Semantic similarity using embeddings
53
+ - **Hybrid Selector**: Combines keyword and embedding approaches
54
+ - **DFS-DT Selector**: Decision tree-based tool selection
55
+ - **Gorilla Adapter**: Gorilla-style tool retrieval
56
+
57
+ ## 📦 Installation
58
+
59
+ ```bash
60
+ # Basic installation
61
+ pip install isage-tooluse
62
+
63
+ # With embedding support
64
+ pip install isage-tooluse[embedding]
65
+
66
+ # Development installation
67
+ pip install isage-tooluse[dev]
68
+ ```
69
+
70
+ ## 🚀 Quick Start
71
+
72
+ ### Keyword-based Tool Selection
73
+
74
+ ```python
75
+ from sage_libs.sage_tooluse import KeywordToolSelector
76
+
77
+ # Create selector
78
+ selector = KeywordToolSelector(tools=available_tools)
79
+
80
+ # Select tools for a query
81
+ selected = selector.select(
82
+ query="Get current weather in New York",
83
+ top_k=5
84
+ )
85
+
86
+ for tool in selected:
87
+ print(f"Tool: {tool.name}, Score: {tool.score}")
88
+ ```
89
+
90
+ ### Embedding-based Tool Selection
91
+
92
+ ```python
93
+ from sage_libs.sage_tooluse import EmbeddingToolSelector
94
+
95
+ # Create selector with embedding model
96
+ selector = EmbeddingToolSelector(
97
+ tools=available_tools,
98
+ model_name="sentence-transformers/all-MiniLM-L6-v2"
99
+ )
100
+
101
+ # Select tools based on semantic similarity
102
+ selected = selector.select(
103
+ query="What's the weather like?",
104
+ top_k=5
105
+ )
106
+ ```
107
+
108
+ ### Hybrid Tool Selection
109
+
110
+ ```python
111
+ from sage_libs.sage_tooluse import HybridToolSelector
112
+
113
+ # Combine keyword and embedding approaches
114
+ selector = HybridToolSelector(
115
+ tools=available_tools,
116
+ keyword_weight=0.3,
117
+ embedding_weight=0.7
118
+ )
119
+
120
+ selected = selector.select(query="...", top_k=5)
121
+ ```
122
+
123
+ ## 📚 Key Components
124
+
125
+ ### Selectors
126
+
127
+ - **KeywordToolSelector**: Fast keyword-based matching
128
+ - **EmbeddingToolSelector**: Semantic similarity using embeddings
129
+ - **HybridToolSelector**: Weighted combination of multiple selectors
130
+ - **DFSDTToolSelector**: Decision tree-based selection
131
+ - **GorillaAdapter**: Gorilla-style API-centric retrieval
132
+
133
+ ### Base Classes
134
+
135
+ - **BaseToolSelector**: Abstract base for all selectors
136
+ - **ToolRegistry**: Central registry for selector implementations
137
+
138
+ ### Schemas
139
+
140
+ - **Tool**: Tool representation with metadata
141
+ - **ToolSelection**: Selection result with scores
142
+ - **SelectionContext**: Context for tool selection
143
+
144
+ ## 🏗️ Architecture
145
+
146
+ ```
147
+ sage_libs.sage_tooluse/
148
+ ├── __init__.py # Public API exports
149
+ ├── base.py # Base selector interface
150
+ ├── keyword_selector.py # Keyword-based selection
151
+ ├── embedding_selector.py # Embedding-based selection
152
+ ├── hybrid_selector.py # Hybrid selection strategy
153
+ ├── dfsdt_selector.py # Decision tree selector
154
+ ├── gorilla_selector.py # Gorilla-style retrieval
155
+ ├── registry.py # Selector registry
156
+ ├── schemas.py # Data schemas
157
+ └── retriever/ # Retrieval utilities
158
+ ```
159
+
160
+ ## 🎓 Use Cases
161
+
162
+ 1. **Agent Tool Selection**: Help agents choose the right tools
163
+ 2. **API Discovery**: Find relevant APIs for a task
164
+ 3. **Function Calling**: Select appropriate functions for LLMs
165
+ 4. **Tool Recommendation**: Recommend tools to users
166
+ 5. **Multi-step Planning**: Select tool sequences for complex tasks
167
+
168
+ ## 🔗 Integration with SAGE
169
+
170
+ This package is part of the SAGE ecosystem and can be used with SAGE agents:
171
+
172
+ ```python
173
+ # Standalone usage
174
+ from sage_libs.sage_tooluse import HybridToolSelector
175
+
176
+ # With SAGE (when available, through interface layer)
177
+ from sage.libs.tooluse import create_selector
178
+
179
+ selector = create_selector("hybrid", tools=available_tools)
180
+ ```
181
+
182
+ ## 📖 Documentation
183
+
184
+ - **Repository**: https://github.com/intellistream/sage-tooluse
185
+ - **SAGE Documentation**: https://intellistream.github.io/SAGE-Pub/
186
+ - **Issues**: https://github.com/intellistream/sage-tooluse/issues
187
+
188
+ ## 🤝 Contributing
189
+
190
+ Contributions are welcome! Please feel free to submit a Pull Request.
191
+
192
+ ## 📄 License
193
+
194
+ MIT License - see [LICENSE](LICENSE) file for details.
195
+
196
+ ## 🙏 Acknowledgments
197
+
198
+ Originally part of the [sage-agentic](https://github.com/intellistream/sage-agentic) package, now maintained as an independent repository for focused development and research.
199
+
200
+ ## 📧 Contact
201
+
202
+ - **Team**: IntelliStream Team
203
+ - **Email**: shuhao_zhang@hust.edu.cn
204
+ - **GitHub**: https://github.com/intellistream
205
+
206
+ ---
207
+
208
+ **Part of the SAGE ecosystem** - Stream Analytics for Generative AI Engines