Skip to content

Commit 6f7aab4

Browse files
committed
Refactor of query handlers
1 parent be812e7 commit 6f7aab4

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/client.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff 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.

0 commit comments

Comments
 (0)