MCPcopy Create free account
hub / github.com/nlweb-ai/NLWeb / create_argument_parser

Function create_argument_parser

AskAgent/python/testing/run_tests.py:138–241  ·  view source on GitHub ↗

Create and configure the argument parser.

()

Source from the content-addressed store, hash-verified

136
137
138def create_argument_parser():
139 """Create and configure the argument parser."""
140 parser = argparse.ArgumentParser(
141 description="NLWeb Test Dispatcher - Run different types of tests",
142 formatter_class=argparse.RawDescriptionHelpFormatter,
143 epilog="""
144Test Types:
145===========
1461. end_to_end - Full query-to-results tests via NLWebHandler
1472. site_retrieval - Test get_sites functionality
1483. query_retrieval - Test retrieval.search without LLM
149
150File Formats:
151=============
152Test files should be JSON arrays with objects containing:
153- test_type: Type of test (end_to_end, site_retrieval, query_retrieval)
154- Other fields specific to each test type
155
156Default Test Files:
157==================
158- end_to_end_tests.json - End-to-end test cases
159- site_retrieval_tests.json - Site retrieval test cases
160- query_retrieval_tests.json - Query retrieval test cases
161
162Examples:
163=========
164# Run all tests from a file
165python run_tests.py --file all_tests.json
166
167# Run only end-to-end tests from a file
168python run_tests.py --file end_to_end_tests.json --type end_to_end
169
170# Run a single end-to-end test
171python run_tests.py --type end_to_end --query "pasta recipes" --site all
172
173# Run a single site retrieval test
174python run_tests.py --type site_retrieval --db azure_ai_search
175
176# Run a single query retrieval test
177python run_tests.py --type query_retrieval --query "chocolate cake" --db qdrant
178
179# Run all default test files
180python run_tests.py --all
181 """)
182
183 # Mode selection
184 mode_group = parser.add_mutually_exclusive_group(required=True)
185
186 mode_group.add_argument(
187 '--file', '-f',
188 type=str,
189 help='JSON file containing test cases'
190 )
191
192 mode_group.add_argument(
193 '--all',
194 action='store_true',
195 help='Run all default test files'

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected