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

Commit

Permalink
chore: style black
Browse files Browse the repository at this point in the history
  • Loading branch information
dsdanielpark committed Jan 1, 2024
1 parent a38f26f commit 51064ca
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions bardapi/core_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def __init__(
self.conversation_id = conversation_id or ""
self.response_id = ""
self.choice_id = ""
self.client = self._get_client(client) # Creating an httpx async client for asynchronous core code
self.client = self._get_client(
client
) # Creating an httpx async client for asynchronous core code
self.language = language
self.cookie_dict = {"__Secure-1PSID": self.token}
self.run_code = run_code or False
Expand Down Expand Up @@ -157,18 +159,17 @@ async def _get_client(self, session: Optional[AsyncClient]) -> AsyncClient:
"""
if session is None:
async_client = AsyncClient(
http2=True,
headers=SESSION_HEADERS,
cookies={"__Secure-1PSID": self.token},
timeout=self.timeout,
proxies=self.proxies,
http2=True,
headers=SESSION_HEADERS,
cookies={"__Secure-1PSID": self.token},
timeout=self.timeout,
proxies=self.proxies,
)
return async_client
else:
assert type(session)==AsyncClient
assert type(session) == AsyncClient
return session


async def get_answer(self, input_text: str) -> dict:
"""
Get an answer from the Bard API for the given input text.
Expand Down Expand Up @@ -679,7 +680,12 @@ async def ask_about_image(
input_data_struct = [
None,
[
[translated_input_text, 0, None, [[[image_url, 1], "uploaded_photo.jpg"]]],
[
translated_input_text,
0,
None,
[[[image_url, 1], "uploaded_photo.jpg"]],
],
[lang if lang is not None else self.language],
["", "", ""],
"", # Unknown random string value (1000 characters +)
Expand Down

0 comments on commit 51064ca

Please sign in to comment.