File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,10 +36,17 @@ async def load(self, llama_stack_config: LlamaStackConfiguration) -> None:
3636 if self ._lsc is not None : # early stopping - client already initialized
3737 return
3838
39- if llama_stack_config .use_as_library_client :
40- await self ._load_library_client (llama_stack_config )
41- else :
42- self ._load_service_client (llama_stack_config )
39+ try :
40+ if llama_stack_config .use_as_library_client :
41+ await self ._load_library_client (llama_stack_config )
42+ else :
43+ self ._load_service_client (llama_stack_config )
44+ except APIConnectionError as e :
45+ error_response = ServiceUnavailableResponse (
46+ backend_name = "Llama Stack" ,
47+ cause = str (e ),
48+ )
49+ raise HTTPException (** error_response .model_dump ()) from e
4350
4451 async def _load_library_client (self , config : LlamaStackConfiguration ) -> None :
4552 """Initialize client in library mode.
You can’t perform that action at this time.
0 commit comments