mirror of
https://github.com/outbackdingo/optimclaw.git
synced 2026-08-30 08:17:53 +00:00
* fix(llm): nudge LLM when it expresses tool intent without calling tools
Non-Anthropic models (especially GLM-5 via NEAR AI) frequently output
text like "Let me search for X" without including tool_calls, creating
a frustrating loop where the user waits but nothing happens.
Add llm_signals_tool_intent() detection that matches intent phrases
("let me search", "I'll fetch") while excluding conversational phrases
("let me explain", "let me know") and content inside code blocks.
When detected, inject a nudge message telling the model to actually
call the tool. Cap at 2 consecutive nudges to avoid infinite loops.
Applied to all three agentic loops: dispatcher (interactive chat),
agent/worker (background jobs), and worker/runtime (sandbox containers).
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* fix(nudge): address PR #653 review comments
1. Update doc comment to match implementation (code blocks only, not quotes)
2. Use match_indices() instead of find() to check all prefix occurrences
3. Add !available_tools.is_empty() guard in dispatcher nudge check
4. Reset consecutive_tool_intent_nudges on non-intent text responses
5. Add regression test for shadowed prefix detection
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* fix(nudge): address second round of PR #653 review comments
1. Strip double-quoted strings in tool-intent detection to avoid false
positives on quoted prose like `"Let me search the database"`.
2. Only reset consecutive_tool_intent_nudges when text does NOT signal
intent — preserves the 2-nudge cap when intent is detected but cap
is already reached.
3. Fix assertion message in nudge_cap test to report correct call index.
4. Add regression test for quoted strings outside code blocks.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
---------
Co-authored-by: Claude Opus 4.6 <[email protected]>
35 lines
825 B
JSON
35 lines
825 B
JSON
{
|
|
"model_name": "advanced-tool-intent-nudge-cap",
|
|
"steps": [
|
|
{
|
|
"response": {
|
|
"type": "text",
|
|
"content": "I'll fetch the data right away.",
|
|
"input_tokens": 50,
|
|
"output_tokens": 10
|
|
}
|
|
},
|
|
{
|
|
"request_hint": { "last_user_message_contains": "tool_calls mechanism" },
|
|
"response": {
|
|
"type": "text",
|
|
"content": "I'm going to query the database now.",
|
|
"input_tokens": 100,
|
|
"output_tokens": 10
|
|
}
|
|
},
|
|
{
|
|
"request_hint": { "last_user_message_contains": "tool_calls mechanism" },
|
|
"response": {
|
|
"type": "text",
|
|
"content": "Let me run the search for you.",
|
|
"input_tokens": 150,
|
|
"output_tokens": 10
|
|
}
|
|
}
|
|
],
|
|
"expects": {
|
|
"response_contains": ["run the search"]
|
|
}
|
|
}
|