@@ -41,23 +41,15 @@ class ModelsList(BaseModel):
4141 operation_id = "list_model_records" ,
4242)
4343async def list_model_records (
44- base_models : Optional [List [BaseModelType ]] = Query (
45- default = None , description = "Base models to include"
46- ),
47- model_type : Optional [ModelType ] = Query (
48- default = None , description = "The type of model to get"
49- ),
44+ base_models : Optional [List [BaseModelType ]] = Query (default = None , description = "Base models to include" ),
45+ model_type : Optional [ModelType ] = Query (default = None , description = "The type of model to get" ),
5046) -> ModelsList :
5147 """Get a list of models."""
5248 record_store = ApiDependencies .invoker .services .model_records
5349 found_models : list [AnyModelConfig ] = []
5450 if base_models :
5551 for base_model in base_models :
56- found_models .extend (
57- record_store .search_by_attr (
58- base_model = base_model , model_type = model_type
59- )
60- )
52+ found_models .extend (record_store .search_by_attr (base_model = base_model , model_type = model_type ))
6153 else :
6254 found_models .extend (record_store .search_by_attr (model_type = model_type ))
6355 return ModelsList (models = found_models )
@@ -97,9 +89,7 @@ async def get_model_record(
9789)
9890async def update_model_record (
9991 key : Annotated [str , Path (description = "Unique key of model" )],
100- info : Annotated [
101- AnyModelConfig , Body (description = "Model config" , discriminator = "type" )
102- ],
92+ info : Annotated [AnyModelConfig , Body (description = "Model config" , discriminator = "type" )],
10393) -> AnyModelConfig :
10494 """Update model contents with a new config. If the model name or base fields are changed, then the model is renamed."""
10595 logger = ApiDependencies .invoker .services .logger
@@ -145,17 +135,13 @@ async def del_model_record(
145135 operation_id = "add_model_record" ,
146136 responses = {
147137 201 : {"description" : "The model added successfully" },
148- 409 : {
149- "description" : "There is already a model corresponding to this path or repo_id"
150- },
138+ 409 : {"description" : "There is already a model corresponding to this path or repo_id" },
151139 415 : {"description" : "Unrecognized file/folder format" },
152140 },
153141 status_code = 201 ,
154142)
155143async def add_model_record (
156- config : Annotated [
157- AnyModelConfig , Body (description = "Model config" , discriminator = "type" )
158- ]
144+ config : Annotated [AnyModelConfig , Body (description = "Model config" , discriminator = "type" )]
159145) -> AnyModelConfig :
160146 """
161147 Add a model using the configuration information appropriate for its type.
0 commit comments