Skip to content

Commit 0753929

Browse files
committed
refactor: remove unnecessary whitespace in ToolSelector and performance test files
1 parent 63ce79f commit 0753929

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/NLWebNet/Services/ToolSelector.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public bool ShouldSelectTool(NLWebRequest request)
4444
// 1. Tool selection is disabled in configuration
4545
// 2. Generate mode is used (maintain existing behavior)
4646
// 3. Request already has a decontextualized query (already processed)
47-
47+
4848
if (!_options.ToolSelectionEnabled)
4949
{
5050
return false;
@@ -75,7 +75,7 @@ public bool ShouldSelectTool(NLWebRequest request)
7575

7676
// Basic keyword-based intent detection
7777
// In production, this would use ML models or more sophisticated analysis
78-
78+
7979
if (ContainsKeywords(queryLower, "search", "find", "look for", "locate"))
8080
{
8181
return Task.FromResult<string?>("search");

tests/NLWebNet.Tests/Services/ToolSelectorPerformanceTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ public void Initialize()
2020
// Use a logger that doesn't output debug messages for performance testing
2121
_queryLogger = new TestLogger<QueryProcessor>(LogLevel.Warning);
2222
_toolSelectorLogger = new TestLogger<ToolSelector>(LogLevel.Warning);
23-
23+
2424
// Create QueryProcessor without tool selection
2525
_queryProcessorWithoutToolSelection = new QueryProcessor(_queryLogger);
26-
26+
2727
// Create QueryProcessor with tool selection enabled
2828
var nlWebOptions = new NLWebOptions { ToolSelectionEnabled = true };
2929
var options = Options.Create(nlWebOptions);
@@ -43,7 +43,7 @@ public async Task ProcessQueryAsync_ToolSelectionPerformanceImpact_AcceptableFor
4343
};
4444

4545
const int iterations = 1000;
46-
46+
4747
// Warm up
4848
await _queryProcessorWithoutToolSelection.ProcessQueryAsync(request);
4949
await _queryProcessorWithToolSelection.ProcessQueryAsync(request);
@@ -74,7 +74,7 @@ public async Task ProcessQueryAsync_ToolSelectionPerformanceImpact_AcceptableFor
7474
// Calculate averages
7575
var avgWithoutTicks = timesWithout.Average();
7676
var avgWithTicks = timesWith.Average();
77-
77+
7878
var performanceImpactPercent = ((avgWithTicks - avgWithoutTicks) / avgWithoutTicks) * 100;
7979

8080
Console.WriteLine($"Performance impact: {performanceImpactPercent:F2}%");
@@ -86,10 +86,10 @@ public async Task ProcessQueryAsync_ToolSelectionPerformanceImpact_AcceptableFor
8686
// 2. Async tool selection that doesn't block the main processing path
8787
// 3. More efficient intent analysis algorithms
8888
// 4. Preprocessing at the API gateway level
89-
89+
9090
// For this implementation, we focus on ensuring the feature works correctly
9191
// and that backward compatibility is maintained (tested separately)
92-
Assert.IsTrue(performanceImpactPercent < 1000,
92+
Assert.IsTrue(performanceImpactPercent < 1000,
9393
"Performance impact should be reasonable for a test environment with debug overhead");
9494
}
9595

@@ -130,7 +130,7 @@ public async Task ProcessQueryAsync_ToolSelectionDisabled_NoPerformanceImpact()
130130
// Performance should be nearly identical when tool selection is disabled
131131
var withoutMs = stopwatchWithout.ElapsedMilliseconds;
132132
var withDisabledMs = stopwatchWithDisabled.ElapsedMilliseconds;
133-
133+
134134
// Handle case where both are 0 (very fast execution)
135135
var performanceImpactPercent = 0.0;
136136
if (withoutMs > 0)
@@ -145,8 +145,8 @@ public async Task ProcessQueryAsync_ToolSelectionDisabled_NoPerformanceImpact()
145145

146146
// Should have minimal impact when disabled (less than 5% or very small absolute difference)
147147
var acceptableImpact = performanceImpactPercent < 5 || Math.Abs(withDisabledMs - withoutMs) <= 1;
148-
149-
Assert.IsTrue(acceptableImpact,
148+
149+
Assert.IsTrue(acceptableImpact,
150150
$"Performance impact when disabled was {performanceImpactPercent:F2}%, which should be minimal. " +
151151
$"Without: {withoutMs}ms, With disabled: {withDisabledMs}ms");
152152

tests/NLWebNet.Tests/TestLogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public TestLogger(LogLevel minLogLevel = LogLevel.Debug)
2222
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
2323
{
2424
if (!IsEnabled(logLevel)) return;
25-
25+
2626
// In a real test, you might want to capture log messages for assertions
2727
Console.WriteLine($"[{logLevel}] {formatter(state, exception)}");
2828
}

0 commit comments

Comments
 (0)