mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-21 23:46:50 +00:00
* feat(memory): add structured reflection and correction detection * fix(memory): align sourceError schema and prompt guidance --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
This commit is contained in:
@@ -119,3 +119,38 @@ def test_format_memory_skips_non_string_content_facts() -> None:
|
||||
# The formatted line for a list content would be "- [knowledge | 0.85] ['list']".
|
||||
assert "| 0.85]" not in result
|
||||
assert "Valid fact" in result
|
||||
|
||||
|
||||
def test_format_memory_renders_correction_source_error() -> None:
|
||||
memory_data = {
|
||||
"facts": [
|
||||
{
|
||||
"content": "Use make dev for local development.",
|
||||
"category": "correction",
|
||||
"confidence": 0.95,
|
||||
"sourceError": "The agent previously suggested npm start.",
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
result = format_memory_for_injection(memory_data, max_tokens=2000)
|
||||
|
||||
assert "Use make dev for local development." in result
|
||||
assert "avoid: The agent previously suggested npm start." in result
|
||||
|
||||
|
||||
def test_format_memory_renders_correction_without_source_error_normally() -> None:
|
||||
memory_data = {
|
||||
"facts": [
|
||||
{
|
||||
"content": "Use make dev for local development.",
|
||||
"category": "correction",
|
||||
"confidence": 0.95,
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
result = format_memory_for_injection(memory_data, max_tokens=2000)
|
||||
|
||||
assert "Use make dev for local development." in result
|
||||
assert "avoid:" not in result
|
||||
|
||||
Reference in New Issue
Block a user