@@ -27,6 +27,9 @@ def create_argument_parser() -> ArgumentParser:
2727 - -v / --verbose: enable verbose output
2828 - -d / --dump-configuration: dump the loaded configuration to JSON and exit
2929 - -s / --dump-schema: dump the configuration schema to OpenAPI JSON and exit
30+ - -m / --dump-models: dump schemas for all models into OpenAPI-compatible file and quit
31+ - -gr / --dump-models-group DUMP_MODELS_GROUP
32+ dump schemas for selected models group into OpenAPI-compatible file and quit
3033 - -c / --config: path to the configuration file (default "lightspeed-stack.yaml")
3134 - -g / --generate-llama-stack-configuration: generate a Llama Stack
3235 configuration from the service configuration
@@ -69,6 +72,14 @@ def create_argument_parser() -> ArgumentParser:
6972 action = "store_true" ,
7073 default = False ,
7174 )
75+ parser .add_argument (
76+ "-gr" ,
77+ "--dump-models-group" ,
78+ dest = "dump_models_group" ,
79+ help = "dump schemas for selected models group into OpenAPI-compatible file and quit" ,
80+ action = "store" ,
81+ default = None ,
82+ )
7283 parser .add_argument (
7384 "-c" ,
7485 "--config" ,
@@ -213,6 +224,18 @@ def main() -> None:
213224 raise SystemExit (1 ) from e
214225 return
215226
227+ # -gr or --dump-models-group CLI parameter is used to dump schema for
228+ # selected models into a JSON file that is compatible with OpenAPI schema
229+ # specification
230+ if args .dump_models_group is not None :
231+ try :
232+ models_dumper .dump_models_group (args .dump_models_group )
233+ logger .info ("Schema for group %s of models dumped" , args .dump_models_group )
234+ except Exception as e :
235+ logger .error ("Failed to dump schema for models: %s" , e )
236+ raise SystemExit (1 ) from e
237+ return
238+
216239 # Store config path in env so each uvicorn worker can load it
217240 # (step is needed because process context isn't shared).
218241 os .environ [constants .CONFIG_PATH_ENV_VAR ] = args .config_file
0 commit comments