Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Fix misc #273

Merged
merged 4 commits into from
Feb 6, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix initialize client first
  • Loading branch information
jjkoh95 committed Feb 5, 2024
commit cab2a5514ac618d68f191b08543078999fa4605d
6 changes: 4 additions & 2 deletions bardapi/core_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ async def async_setup(self) -> None:
"""
Set up the BardAsync instance asynchronously.
"""
self.SNlM0e = await self._get_snim0e()
# Note:
# we have to initialize client first, since _get_snim0e requires client
if not self.client:
self.client = await self._initialize_client() # Ensure this is awaited
self.SNlM0e = await self._get_snim0e()

async def _get_snim0e(self) -> Optional[str]:
"""
Expand Down Expand Up @@ -835,7 +837,7 @@ async def ask(
image_name: Optional[str] = None,
tool: Optional[Tool] = None,
) -> BardResult:
if not isinstance(self.SNlM0e, str):
if not isinstance(self.SNlM0e, str) and self.SNlM0e is not None:
self.SNlM0e = await self.SNlM0e

if image is not None:
Expand Down