Skip to content

Commit baf70dc

Browse files
committed
change rebuild logic
1 parent 7ad2ec3 commit baf70dc

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ All RAG examples share these common parameters. **Interactive mode** is availabl
179179
# Core Parameters (General preprocessing for all examples)
180180
--index-dir DIR # Directory to store the index (default: current directory)
181181
--query "YOUR QUESTION" # Single query mode. Omit for interactive chat (type 'quit' to exit)
182-
--max-items N # Limit data preprocessing (default: 1000 items, use -1 to process all data)
182+
--max-items N # Limit data preprocessing (default: -1, process all data)
183183
--force-rebuild # Force rebuild index even if it exists
184184

185185
# Embedding Parameters

examples/base_rag_example.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ def _create_parser(self) -> argparse.ArgumentParser:
5050
help="Query to run (if not provided, will run in interactive mode)",
5151
)
5252
# Allow subclasses to override default max_items
53-
max_items_default = getattr(self, "max_items_default", 1000)
53+
max_items_default = getattr(self, "max_items_default", -1)
5454
core_group.add_argument(
5555
"--max-items",
5656
type=int,
5757
default=max_items_default,
58-
help=f"Maximum number of items to process (default: {max_items_default}, -1 for all)",
58+
help="Maximum number of items to process -1 for all, means index all documents, and you should set it to a reasonable number if you have a large dataset and try at the first time)",
5959
)
6060
core_group.add_argument(
6161
"--force-rebuild", action="store_true", help="Force rebuild index even if it exists"
@@ -256,7 +256,7 @@ async def run(self):
256256

257257
# Check if index exists
258258
index_path = str(Path(args.index_dir) / f"{self.default_index_name}.leann")
259-
index_exists = Path(index_path).exists()
259+
index_exists = Path(args.index_dir).exists()
260260

261261
if not index_exists or args.force_rebuild:
262262
# Load data and build index
@@ -268,9 +268,8 @@ async def run(self):
268268
return
269269

270270
index_path = await self.build_index(args, texts)
271-
print(f"Index saved to: {index_path}")
272271
else:
273-
print(f"\nUsing existing index: {index_path}")
272+
print(f"\nUsing existing index in {args.index_dir}")
274273

275274
# Run query or interactive mode
276275
if args.query:

0 commit comments

Comments
 (0)