async with await client.connect() as chat:
new, answer = await chat.new_chat(
char, me.id
)
print(f'{answer.name}: {answer.text}')
while True:
text = input('YOU: ')
message = await chat.send_message(
char, new.chat_id, text
)
print(f'{message.name}: {message.text}')
asyncio.run(main())
I meet the following error:
Traceback (most recent call last):
File "/home/ubuntu/CBT3.0/character.ai/character_ai.py", line 49, in
asyncio.run(main())
File "/home/ubuntu/anaconda3/envs/characterai/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/home/ubuntu/anaconda3/envs/characterai/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/ubuntu/CBT3.0/character.ai/character_ai.py", line 32, in main
async with await client.connect() as chat:
File "/home/ubuntu/anaconda3/envs/characterai/lib/python3.10/site-packages/characterai/aiocai/methods/chat2.py", line 440, in call
return await self.aenter(self.token)
File "/home/ubuntu/anaconda3/envs/characterai/lib/python3.10/site-packages/characterai/aiocai/methods/chat2.py", line 447, in aenter
self.ws = await websockets.connect(
File "/home/ubuntu/anaconda3/envs/characterai/lib/python3.10/site-packages/websockets/asyncio/client.py", line 441, in __await_impl__
self.connection = await self.create_connection()
File "/home/ubuntu/anaconda3/envs/characterai/lib/python3.10/site-packages/websockets/asyncio/client.py", line 367, in createconnection
, connection = await loop.create_connection(factory, **kwargs)
TypeError: BaseEventLoop.create_connection() got an unexpected keyword argument 'extra_headers'
I can't figure it out.Could you please help me with it?
My packages are as follows:
characterai:1.0.1
pydantic:2.7.1
websockets:14.0
When run the examples:
from characterai import aiocai import asyncio
async def main(): char = "" client = aiocai.Client("") me = await client.get_me()
asyncio.run(main()) I meet the following error: Traceback (most recent call last): File "/home/ubuntu/CBT3.0/character.ai/character_ai.py", line 49, in
asyncio.run(main())
File "/home/ubuntu/anaconda3/envs/characterai/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/home/ubuntu/anaconda3/envs/characterai/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/ubuntu/CBT3.0/character.ai/character_ai.py", line 32, in main
async with await client.connect() as chat:
File "/home/ubuntu/anaconda3/envs/characterai/lib/python3.10/site-packages/characterai/aiocai/methods/chat2.py", line 440, in call
return await self.aenter(self.token)
File "/home/ubuntu/anaconda3/envs/characterai/lib/python3.10/site-packages/characterai/aiocai/methods/chat2.py", line 447, in aenter
self.ws = await websockets.connect(
File "/home/ubuntu/anaconda3/envs/characterai/lib/python3.10/site-packages/websockets/asyncio/client.py", line 441, in __await_impl__
self.connection = await self.create_connection()
File "/home/ubuntu/anaconda3/envs/characterai/lib/python3.10/site-packages/websockets/asyncio/client.py", line 367, in createconnection
, connection = await loop.create_connection(factory, **kwargs)
TypeError: BaseEventLoop.create_connection() got an unexpected keyword argument 'extra_headers'
I can't figure it out.Could you please help me with it?
My packages are as follows:
characterai:1.0.1
pydantic:2.7.1
websockets:14.0