gnodet-bot commented on code in PR #26487:
URL: https://github.com/apache/camel/pull/26487#discussion_r4022971012
##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/AiPanelPromptBudgetTest.java:
##########
@@ -122,8 +125,28 @@ void systemPromptStaysShortAndFreeOfTheToolList() {
// the tool definitions already describe every tool; repeating them in
prose doubles the cost
// 450 before the file editing guidance (two bullets) was added
// 530 before the tools were split into camel_* and tui_* in the
introduction
- assertTrue(AiPanel.estimateTokens(prompt.length()) <= 545,
+ // 545 before the file-write and canonical YAML shape lines
(CAMEL-24760)
+ assertTrue(AiPanel.estimateTokens(prompt.length()) <= 620,
"system prompt grew to ~" +
AiPanel.estimateTokens(prompt.length()) + " tokens");
assertTrue(!prompt.contains("- tui_get_table:"), "system prompt must
not list the tools again");
}
+
+ @Test
+ void thePromptOnlyMentionsTheToolsOfTheActiveSet() {
+ // tui_set_log_level left the core set (CAMEL-24760): its prompt line
goes with it, a local model must not be
+ // told about a tool it cannot call
+ AiPanel panel = new AiPanel();
+ panel.setToolRegistryForTesting(new TuiToolRegistry(null));
+ panel.setToolModeForTesting(AiPanel.TOOL_MODE_CORE);
+ String core = panel.systemPromptForTesting();
+ panel.setToolModeForTesting(AiPanel.TOOL_MODE_FULL);
+ String full = panel.systemPromptForTesting();
+
+ assertTrue(full.contains("tui_set_log_level is the app's root
logger"), "the full set has the tool");
+ assertTrue(!core.contains("tui_set_log_level"), "the core set has
not");
Review Comment:
🔧 **Nit:** `assertTrue(!x)` is the double-negation form; `assertFalse(x)` is
the JUnit 5 idiom and produces a clearer failure message (`expected: false but
was: true` vs `expected: true but was: false` on `!x`).
```suggestion
assertFalse(core.contains("tui_set_log_level"), "the core set has
not");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]