mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-11-12 22:20:33 +00:00
* feat(benchmark): add offline memory vs project-context comparison suite (part of #7884) * fix(benchmark): route prompts through DynamicContextMiddleware, flatten rows, and share test run * refactor(benchmark): run through local Gateway and simplify first-pass suite (#7884) * docs(agents): keep context memory benchmark guidance within chain budget * fix(benchmark): verify DeerMem scope rejection --------- Co-authored-by: Totoro <msy626836554@gmail.com> Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
28 lines
973 B
Python
28 lines
973 B
Python
from __future__ import annotations
|
|
|
|
import argparse
|
|
import json
|
|
from collections.abc import Sequence
|
|
from pathlib import Path
|
|
from tempfile import TemporaryDirectory
|
|
|
|
from .runner import run_offline
|
|
|
|
|
|
def main(argv: Sequence[str] | None = None) -> int:
|
|
parser = argparse.ArgumentParser(description="Compare DeerMem and project context through an offline Gateway.")
|
|
parser.add_argument("command", choices=["run-offline"])
|
|
parser.add_argument("--output-dir", type=Path, required=True)
|
|
args = parser.parse_args(argv)
|
|
|
|
report = run_offline()
|
|
output_dir = args.output_dir
|
|
output_dir.mkdir(parents=True, exist_ok=True)
|
|
target = output_dir / "report.json"
|
|
with TemporaryDirectory(dir=output_dir) as staging:
|
|
path = Path(staging) / target.name
|
|
path.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
|
path.replace(target)
|
|
print(f"Wrote {target}")
|
|
return 0 if report["passed"] else 1
|