feat(tools): semantic tool-name suggestion for registry misses - #215
Open
raymondginger2018-sudo wants to merge 1 commit into
Open
feat(tools): semantic tool-name suggestion for registry misses#215raymondginger2018-sudo wants to merge 1 commit into
raymondginger2018-sudo wants to merge 1 commit into
Conversation
When the LLM hallucinates or misremembers a tool name, the registry returns 'not found'. This module adds a cheap first mitigation: given the missed name and available tool names, suggest the closest candidates by token-overlap similarity (no LLM, no embeddings — pure static scoring via difflib.SequenceMatcher). Design guard: semantic discovery is only a hint fed back to the model as an error message; execution still requires the exact registered name plus the permission engine. It never widens the callable surface.
Contributor
Author
设计说明问题:当 agent 调用工具名拼写有微小偏差(如 解法:用 关键设计决策:
测试建议:提供几个已知 miss case 作为回归测试即可( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the LLM hallucinates or misremembers a tool name, the registry returns "not found". This PR adds a cheap, deterministic first mitigation: given the missed name and the available tool names, suggest the closest candidates by token-overlap + sequence similarity.
Design
difflib.SequenceMatcher+ token-overlap scoring.Files
core/agent_runtime/tools/semantic_hint.py(new, 82 lines)Testing
Inspired by GenAI lesson 17 (P2-A7): Taskweaver-style semantic plugin discovery, adapted as a non-executable hint.