if client.initialize fails, the example should exit (#954)

# What does this PR do?

the example script can gracefully exit if the boolean returned from
initialize is used properly

Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
Charlie Doern 2025-02-04 16:54:21 -05:00 committed by GitHub
parent 981bb52b59
commit 26aef50bc5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -196,7 +196,7 @@ class AsyncLlamaStackAsLibraryClient(AsyncLlamaStackClient):
self.custom_provider_registry = custom_provider_registry
self.provider_data = provider_data
async def initialize(self):
async def initialize(self) -> bool:
try:
self.impls = await construct_stack(self.config, self.custom_provider_registry)
except ModuleNotFoundError as _e: