Parse command line arguments
()
| 775 | |
| 776 | |
| 777 | def parse_args() -> argparse.Namespace: |
| 778 | """Parse command line arguments""" |
| 779 | parser = argparse.ArgumentParser( |
| 780 | description="LightRAG Ollama Compatibility Interface Testing", |
| 781 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 782 | epilog=""" |
| 783 | Configuration file (config.json): |
| 784 | { |
| 785 | "server": { |
| 786 | "host": "localhost", # Server address |
| 787 | "port": 9621, # Server port |
| 788 | "model": "lightrag:latest" # Default model name |
| 789 | }, |
| 790 | "test_cases": { |
| 791 | "basic": { |
| 792 | "query": "Test query", # Basic query text |
| 793 | "stream_query": "Stream query" # Stream query text |
| 794 | } |
| 795 | } |
| 796 | } |
| 797 | """, |
| 798 | ) |
| 799 | parser.add_argument( |
| 800 | "-q", |
| 801 | "--quiet", |
| 802 | action="store_true", |
| 803 | help="Silent mode, only display test result summary", |
| 804 | ) |
| 805 | parser.add_argument( |
| 806 | "-a", |
| 807 | "--ask", |
| 808 | type=str, |
| 809 | help="Specify query content, which will override the query settings in the configuration file", |
| 810 | ) |
| 811 | parser.add_argument( |
| 812 | "--init-config", action="store_true", help="Create default configuration file" |
| 813 | ) |
| 814 | parser.add_argument( |
| 815 | "--output", |
| 816 | type=str, |
| 817 | default="", |
| 818 | help="Test result output file path, default is not to output to a file", |
| 819 | ) |
| 820 | parser.add_argument( |
| 821 | "--tests", |
| 822 | nargs="+", |
| 823 | choices=list(get_test_cases().keys()) + ["all"], |
| 824 | default=["all"], |
| 825 | help="Test cases to run, options: %(choices)s. Use 'all' to run all tests (except error tests)", |
| 826 | ) |
| 827 | return parser.parse_args() |
| 828 | |
| 829 | |
| 830 | if __name__ == "__main__": |
no test coverage detected