Main entry point for the demo script.
()
| 331 | |
| 332 | |
| 333 | def main(): |
| 334 | """Main entry point for the demo script.""" |
| 335 | parser = argparse.ArgumentParser( |
| 336 | description="LocalGPT Batch Indexing Demo", |
| 337 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 338 | epilog=""" |
| 339 | Examples: |
| 340 | python demo_batch_indexing.py --config batch_indexing_config.json |
| 341 | python demo_batch_indexing.py --create-sample-config |
| 342 | |
| 343 | This demo showcases the advanced batch indexing capabilities of LocalGPT, |
| 344 | including multi-index creation, advanced configuration options, and |
| 345 | comprehensive processing pipelines. |
| 346 | """ |
| 347 | ) |
| 348 | |
| 349 | parser.add_argument( |
| 350 | "--config", |
| 351 | type=str, |
| 352 | default="batch_indexing_config.json", |
| 353 | help="Path to batch indexing configuration file" |
| 354 | ) |
| 355 | |
| 356 | parser.add_argument( |
| 357 | "--create-sample-config", |
| 358 | action="store_true", |
| 359 | help="Create a sample configuration file" |
| 360 | ) |
| 361 | |
| 362 | args = parser.parse_args() |
| 363 | |
| 364 | if args.create_sample_config: |
| 365 | create_sample_config() |
| 366 | return |
| 367 | |
| 368 | if not os.path.exists(args.config): |
| 369 | print(f"❌ Configuration file not found: {args.config}") |
| 370 | print(f"💡 Create a sample config with: python {sys.argv[0]} --create-sample-config") |
| 371 | sys.exit(1) |
| 372 | |
| 373 | try: |
| 374 | demo = BatchIndexingDemo(args.config) |
| 375 | demo.run_demo() |
| 376 | |
| 377 | except KeyboardInterrupt: |
| 378 | print("\n\n❌ Demo cancelled by user.") |
| 379 | except Exception as e: |
| 380 | print(f"❌ Demo failed: {e}") |
| 381 | import traceback |
| 382 | traceback.print_exc() |
| 383 | |
| 384 | |
| 385 | if __name__ == "__main__": |
no test coverage detected