Skip to content

Commit 421467c

Browse files
Copilotjongalloway
andcommitted
šŸ› ļø Implement Advanced Tool System with Search, Details, Compare, Ensemble, and Recipe Tools
Co-authored-by: jongalloway <[email protected]>
1 parent ddec0fb commit 421467c

File tree

1 file changed

+139
-0
lines changed

1 file changed

+139
-0
lines changed
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Advanced Tool System Usage Guide
2+
3+
The Advanced Tool System provides enhanced query capabilities through specialized tool handlers that route queries to appropriate processors based on intent analysis.
4+
5+
## Configuration
6+
7+
Enable the tool system in your configuration:
8+
9+
```json
10+
{
11+
"NLWebNet": {
12+
"ToolSelectionEnabled": true,
13+
"DefaultMode": "List"
14+
}
15+
}
16+
```
17+
18+
## Available Tools
19+
20+
### 1. Search Tool (`search`)
21+
Enhanced keyword and semantic search with result optimization.
22+
23+
**Example Queries:**
24+
- "search for REST API documentation"
25+
- "find information about microservices"
26+
- "locate best practices for authentication"
27+
28+
**Features:**
29+
- Query optimization (removes redundant search terms)
30+
- Enhanced relevance scoring
31+
- Result sorting and filtering
32+
33+
### 2. Details Tool (`details`)
34+
Retrieves comprehensive information about specific named items.
35+
36+
**Example Queries:**
37+
- "tell me about GraphQL"
38+
- "what is Docker?"
39+
- "describe OAuth 2.0"
40+
- "information about React hooks"
41+
42+
**Features:**
43+
- Subject extraction from natural language queries
44+
- Detailed information focus
45+
- Comprehensive result filtering
46+
47+
### 3. Compare Tool (`compare`)
48+
Side-by-side comparison of two items or technologies.
49+
50+
**Example Queries:**
51+
- "compare React vs Vue"
52+
- "difference between REST and GraphQL"
53+
- "Node.js versus Python for backend"
54+
55+
**Features:**
56+
- Automatic item extraction from comparison queries
57+
- Structured comparison results
58+
- Side-by-side analysis
59+
60+
### 4. Ensemble Tool (`ensemble`)
61+
Creates cohesive sets of related recommendations.
62+
63+
**Example Queries:**
64+
- "recommend a full-stack JavaScript development setup"
65+
- "suggest tools for DevOps pipeline"
66+
- "I need a complete testing framework"
67+
68+
**Features:**
69+
- Multi-category recommendations
70+
- Coherent item grouping
71+
- Thematic organization
72+
73+
### 5. Recipe Tool (`recipe`)
74+
Specialized for cooking, recipes, and food-related queries.
75+
76+
**Example Queries:**
77+
- "substitute eggs in baking"
78+
- "what goes with grilled salmon?"
79+
- "recipe for chocolate chip cookies"
80+
81+
**Features:**
82+
- Ingredient substitution guidance
83+
- Food pairing suggestions
84+
- Cooking technique advice
85+
86+
## Integration
87+
88+
The tool system integrates automatically with your existing NLWebNet setup:
89+
90+
```csharp
91+
// Add NLWebNet services (includes tool system)
92+
services.AddNLWebNet(options =>
93+
{
94+
options.ToolSelectionEnabled = true;
95+
});
96+
```
97+
98+
## Backward Compatibility
99+
100+
When `ToolSelectionEnabled = false`, the system uses the standard query processing pipeline, maintaining full backward compatibility.
101+
102+
## Query Processing Flow
103+
104+
1. **Query Analysis**: The `IToolSelector` analyzes query intent
105+
2. **Tool Selection**: Appropriate tool is selected based on keywords and patterns
106+
3. **Tool Execution**: The `IToolExecutor` routes to the selected tool handler
107+
4. **Result Enhancement**: Each tool applies specialized processing
108+
5. **Response Generation**: Results are formatted and returned
109+
110+
## Custom Tool Development
111+
112+
To create custom tools, implement the `IToolHandler` interface:
113+
114+
```csharp
115+
public class CustomToolHandler : BaseToolHandler
116+
{
117+
public override string ToolType => "custom";
118+
119+
public override async Task<NLWebResponse> ExecuteAsync(
120+
NLWebRequest request,
121+
CancellationToken cancellationToken = default)
122+
{
123+
// Custom tool logic here
124+
return CreateSuccessResponse(request, results, processingTime);
125+
}
126+
127+
public override bool CanHandle(NLWebRequest request)
128+
{
129+
// Determine if this tool can handle the request
130+
return request.Query.Contains("custom");
131+
}
132+
}
133+
```
134+
135+
Register your custom tool:
136+
137+
```csharp
138+
services.AddScoped<IToolHandler, CustomToolHandler>();
139+
```

0 commit comments

Comments
Ā (0)