acheong08 / Bard

Python SDK/API for reverse engineered Google Bard
MIT License
1.42k stars 177 forks source link

Add Async Support #44

Closed Delamcode closed 1 year ago

Delamcode commented 1 year ago

title ;)

Delamcode commented 1 year ago

Unless it already exists and I'm stupid?

acheong08 commented 1 year ago

https://github.com/acheong08/Bard/releases/tag/1.3.0

I just finished it

Delamcode commented 1 year ago

Do you have docs for it?

Delamcode commented 1 year ago

Nvm I got it

Delamcode commented 1 year ago

I got the #31 error but works without async…

Delamcode commented 1 year ago

Now I’m getting “this event loop is already running” without even using async, but it’s trying to call async still!

acheong08 commented 1 year ago

Might happen if you run sync inside an async function

acheong08 commented 1 year ago

I got the #31 error but works without async…

That literally makes no sense. The sync class runs async code. It's just hiding it from you

Delamcode commented 1 year ago

Might happen if you run sync inside an async function

Oh…. Lol

Delamcode commented 1 year ago

D8F2B8FB-B5B8-4BB8-96B8-AC9447D4FB60

Delamcode commented 1 year ago

I got the #31 error but works without async…

That literally makes no sense. The sync class runs async code. It's just hiding it from you

Yeah yeah was using old version on that instance

acheong08 commented 1 year ago

D8F2B8FB-B5B8-4BB8-96B8-AC9447D4FB60

With async, you need to call create instead of the standard initialization.

acheong08 commented 1 year ago

It's a restriction of Python, you can't have async in class init

Delamcode commented 1 year ago

Could you explain how I’m supposed to do it then? With a code example please. On Jun 3, 2023, 3:58 AM +0200, Antonio Cheong @.***>, wrote:

It's a restriction of Python, you can't have async in class init — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

acheong08 commented 1 year ago

Replace chatbot = AsyncChatbot(...) with chatbot = await AsyncChatbot.create(...)