Setup parameters configure an app's initialization steps. Modifying these parameters triggers a full restart (re-running setup()).
Unlike input parameters which change per request, setup parameters control expensive, static resources:
Model weights
Hardware precision (fp16/fp32)
Database connections
System prompts or behavior flags
Defining Setup Parameters
Define an AppSetup class in inference.py. This schema validates configuration on startup.
pythoncopy
1frominferenceshimportBaseApp,BaseAppInput2frompydanticimportField34classAppSetup(BaseAppInput):5model_id:str=Field(default="gpt2",description="HuggingFace model ID")6precision:str=Field(default="fp16",description="Model precision")7enable_cache:bool=Field(default=True,description="Enable KV cache")89classApp(BaseApp):10asyncdefsetup(self,config:AppSetup):11# Access parameters via config object12self.model=load_model(13config.model_id,14precision=config.precision15)
Usage
Provide setup parameters when starting an app. If parameters match an existing running instance for that app, the request executes immediately. If they differ, the instance re-initializes.