Initial SQL-only 1C adapter baseline
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
from common import build_lexical_index, read_jsonl, write_json
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
DEFAULT_CORPUS = ROOT / "plugins" / "1c" / "datasets" / "prepared" / "rag_corpus.jsonl"
|
||||
DEFAULT_INDEX = ROOT / "plugins" / "1c" / "datasets" / "prepared" / "rag_index.json"
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description="Build a simple lexical RAG index for the 1C corpus.")
|
||||
parser.add_argument("--corpus", type=Path, default=DEFAULT_CORPUS)
|
||||
parser.add_argument("--output", type=Path, default=DEFAULT_INDEX)
|
||||
args = parser.parse_args()
|
||||
|
||||
records = read_jsonl(args.corpus)
|
||||
index = build_lexical_index(records)
|
||||
write_json(args.output, index)
|
||||
print(f"Wrote index with {index['doc_count']} document chunk(s) to {args.output}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user