Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: BaseEventLoop.create_connection() got an unexpected keyword argument 'extra_headers' #123

Open
xhrt opened this issue Nov 12, 2024 · 5 comments

Comments

@xhrt
Copy link

xhrt commented Nov 12, 2024

When run the examples:

from characterai import aiocai
import asyncio

async def main():
char = ""
client = aiocai.Client("")
me = await client.get_me()

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 create_connection
_, 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

@dmytro-varich
Copy link

Have the same problem. 😕

@1000MilesAway
Copy link

installing websockets==11.0.3 solved this issue.

@KhunChaiyakorn
Copy link

how to fix?

@dmytro-varich
Copy link

how to fix?

installing websockets==11.0.3 solved this issue.

Kajitsy added a commit to Kajitsy/Emilia that referenced this issue Dec 3, 2024
The problem and its correction are described here kramcat/CharacterAI#123
@Zectxr
Copy link

Zectxr commented Dec 7, 2024

how to fix?

installing websockets==11.0.3 solved this issue.

thank you it wworks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants