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

Validation Error #107

Open
hk92292831 opened this issue May 7, 2024 · 3 comments
Open

Validation Error #107

hk92292831 opened this issue May 7, 2024 · 3 comments

Comments

@hk92292831
Copy link

Anyone know how to fix the following error?

image

@GearStarter
Copy link

Recently, this code stopped working. Perhaps some kind of update from C.AI .
I get the same error.
devenv_Aw4v8Frkep

@GearStarter
Copy link

kramcat replied to me
pip install pydantic==2.7.0

But I got a new error.

2 validation errors for NewChat
participants.0.user.account.mobile_onboarding_complete
  Input should be a valid integer [type=int_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.7/v/int_type
speech
  Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.7/v/string_type

@GearStarter
Copy link

GearStarter commented May 28, 2024

It looks like there have been changes in the API.
Many functions do not work, both in sync and in async.

By some miracle, I managed to run the old code on async.
I hope the author will fix everything soon.

from characterai import aiocai
import asyncio

my_token = "my_token"
my_character = "my_character"

async def chating():
    chat_data = await client.get_chat(my_character)
    async with await client.connect() as chat:
        while True:
            message_user = input("You: ")
            ai_message = await chat.send_message(my_character, chat_data.chat_id, message_user)
            print("AI: " + ai_message.text)
    
client = aiocai.Client(my_token)
asyncio.run(chating())

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

2 participants