Preserve Leo subject anchors across long followups (#187)
Some checks are pending
CI / lint-and-test (push) Waiting to run
Some checks are pending
CI / lint-and-test (push) Waiting to run
This commit is contained in:
parent
20e2f60b0e
commit
8144d6b554
2 changed files with 31 additions and 1 deletions
|
|
@ -26,7 +26,7 @@ MAX_EVIDENCE_EXCERPT_CHARS = 600
|
|||
MAX_RETRIEVAL_ANCHORS = 8
|
||||
MAX_RETRIEVAL_SUBJECT_ANCHORS = 2
|
||||
MAX_RETRIEVAL_FALLBACK_ANCHORS = 3
|
||||
RETRIEVAL_HISTORY_USER_TURNS = 6
|
||||
RETRIEVAL_HISTORY_USER_TURNS = 12
|
||||
DATABASE_REASONING_PROTOCOL_VERSION = "leo-db-reasoning-v2"
|
||||
WORD_RE = re.compile(r"\b\w+(?:[-']\w+)*\b")
|
||||
LIST_PREFIX_RE = re.compile(r"^(\s*(?:[-*]|\d+[.)])\s+)(.*)$")
|
||||
|
|
|
|||
|
|
@ -484,6 +484,36 @@ def test_plugin_anchors_followup_retrieval_to_recent_user_topics_without_assista
|
|||
assert len(anchors) <= module.MAX_RETRIEVAL_ANCHORS
|
||||
|
||||
|
||||
def test_plugin_preserves_explicit_subject_across_a_long_followup_chain() -> None:
|
||||
module = load_plugin()
|
||||
query = (
|
||||
"Turn the surviving claim into a review-only proposal: exact body, confidence, falsifier, required "
|
||||
"sources, and links to claims that support or contradict it. Do not stage or write anything."
|
||||
)
|
||||
history = [
|
||||
{
|
||||
"role": "user",
|
||||
"content": "Under what conditions would LivingIP ownership make a culture worse?",
|
||||
},
|
||||
{"role": "assistant", "content": "UNRELATED_ASSISTANT_SECRET about another domain."},
|
||||
{"role": "user", "content": "challenge which mechanism is causal."},
|
||||
{"role": "user", "content": "compare the two designs."},
|
||||
{"role": "user", "content": "retract the strongest version."},
|
||||
{"role": "user", "content": "state the weaker surviving position."},
|
||||
{"role": "user", "content": "make the confidence explicit."},
|
||||
{"role": "user", "content": "add the smallest falsification test."},
|
||||
{"role": "user", "content": "separate direct support from analogy."},
|
||||
{"role": "user", "content": "keep the result proposed only."},
|
||||
{"role": "user", "content": query},
|
||||
]
|
||||
|
||||
retrieval_query, anchors = module._contextual_retrieval_query(query, history)
|
||||
|
||||
assert retrieval_query == query
|
||||
assert anchors == ["LivingIP"]
|
||||
assert "UNRELATED_ASSISTANT_SECRET" not in retrieval_query
|
||||
|
||||
|
||||
def test_plugin_keeps_operational_query_separate_from_contextual_anchors(tmp_path: Path) -> None:
|
||||
module = load_plugin()
|
||||
home = tmp_path / "profile"
|
||||
|
|
|
|||
Loading…
Reference in a new issue