mirror of
https://github.com/HKUDS/OpenSpace.git
synced 2026-09-07 08:25:54 +00:00
fix(evolver): use stem-style matching for confirm/reject/skip keywords
Per reviewer feedback: keep strict \byes\b / \bno\b word boundaries to prevent false positives, but widen confirm/reject/skip to stem-style \bconfirm\w*\b etc. so common LLM variants like "confirmed", "rejected", "skipping" still parse correctly instead of falling through to the default False path.
This commit is contained in:
parent
9333eaed42
commit
1257f4cfee
1 changed files with 11 additions and 5 deletions
|
|
@ -652,15 +652,21 @@ class SkillEvolver:
|
|||
return bool(data.get("proceed", False))
|
||||
except (json.JSONDecodeError, ValueError):
|
||||
pass
|
||||
# Fallback: look for keywords (use word boundaries to avoid
|
||||
# false positives from substrings like "know" matching "no")
|
||||
# Fallback: look for keywords.
|
||||
# - yes/no use strict word boundaries to avoid false positives
|
||||
# (e.g. "know" matching "no").
|
||||
# - confirm/reject/skip use stem-style matching so that common
|
||||
# LLM variants like "confirmed", "rejected", "skipping" still
|
||||
# parse correctly.
|
||||
_wb = re.search # shorthand
|
||||
if any(w in response for w in ("\"proceed\": true", "proceed: true")) \
|
||||
or _wb(r"\byes\b", response) or _wb(r"\bconfirm\b", response):
|
||||
or _wb(r"\byes\b", response) \
|
||||
or _wb(r"\bconfirm\w*\b", response):
|
||||
return True
|
||||
if any(w in response for w in ("\"proceed\": false", "proceed: false")) \
|
||||
or _wb(r"\bno\b", response) or _wb(r"\breject\b", response) \
|
||||
or _wb(r"\bskip\b", response):
|
||||
or _wb(r"\bno\b", response) \
|
||||
or _wb(r"\breject\w*\b", response) \
|
||||
or _wb(r"\bskip\w*\b", response):
|
||||
return False
|
||||
# Default: skip — ambiguous response should not trigger costly evolution
|
||||
logger.debug("LLM confirmation response was ambiguous, defaulting to skip")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue