PyCharacterAI icon indicating copy to clipboard operation
PyCharacterAI copied to clipboard

Sync version

Open GearStarter opened this issue 1 year ago • 1 comments

Hi. Will there be a sync api version in the future? I understand that async is a priority, sometimes it is more convenient to work with sync.

For example, communication between two characters. I can't call two asyncio.run(main()) at the same time.

asyncio.run(char_first())
asyncio.run(char_sec())

GearStarter avatar Nov 01 '24 05:11 GearStarter

I don't think that's planned in the near future. The current library used for working with websockets (aiohttp) is asynchronous, as the name implies, and I can't use other libraries as they don't support proxies, which was the main reason for switching to aiohttp and dropping the sychronous version. If anything, I'm open to any suggestions.

What about communication with two characters, you don't need to call asyncio.run() multiple times, you can use asynchronous tasks asyncio.create_task() to run multiple coroutines concurrently.

I hope it helped.

Xtr4F avatar Nov 08 '24 01:11 Xtr4F