Skip to content

Fix : Applies fuzzy matching for LLM slight mis-types for metadata fields for tool calling - #2769

Open
TheeJamesLee wants to merge 8 commits into
netclaw-dev:devfrom
TheeJamesLee:fix/additional-tool-call-rationale-values
Open

TheeJamesLee wants to merge 8 commits into
netclaw-dev:devfrom
TheeJamesLee:fix/additional-tool-call-rationale-values

Conversation

@TheeJamesLee

Copy link
Copy Markdown
Contributor

PR Summary — Fuzzy Matching for ToolCallMeta Field Resolution

Problem

ToolArgumentHelper.ResolveMetaField only resolved keys against NormalizedMetaFields — a precomputed exact + alias map. Misspelled or near-miss model-emitted keys (e.g. rationale, rationl, timeout-like variants) that weren't an exact or alias hit returned null, so those args were silently dropped instead of being extracted as tool-call meta (rationale / timeout / background).

Change

Kept the first-pass exact + normalized alias resolution (strongly-typed match), then added a dependency-free fuzzy fallback (FuzzyMatcher, new in the same folder) only after that pass misses, using FuzzyMatcher.FindBestMatch against ToolCallMeta.MetaFieldNames:

  • Levenshtein similarity with a 0.75 minimum score threshold.
  • 0.85 bonus when the normalized candidate contains the normalized input.
  • Returns null for weak/empty input (never guessing).

Net result: misspelled _rationale / _timeout_seconds / _background variants are now recovered, while exact-match behavior and all existing aliases stay unchanged.

Scope & Validation

  • All work confined to src/Netclaw.Tools.Abstractions (FuzzyMatcher.cs new; ToolArgumentHelper.ResolveMetaField + FuzzyMatchUnmatched).
  • Abstractions build: clean (0 warnings, 0 errors).
  • Targeted tests pass: MetaFieldResolutionTests, ToolArgumentHelperStrictTests, ToolArgumentValidatorTests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant