I am struggeling with loading the massage object back from json. What am i doing wrong ?
original_message = ell.Message(role='assistant', content='Hello, this is a test message.', tool_result=None)
message_json = json.dumps(original_message.model_dump_json())
message_data = json.loads(message_json)
loaded_message = ell.Message.model_validate(message_data)
ell-ai==0.0.14
pydantic==2.9.2
pydantic_core._pydantic_core.ValidationError: 1 validation error for Message
Input should be a valid dictionary or instance of Message [type=model_type, input_value='{"role":"assistant","con...l,"tool_result":null}]}', input_type=str]
For further information visit https://errors.pydantic.dev/2.9/v/model_type
Not sure what’s going on here exactly. Maybe we need a custom pedantic serialize/deserialize/validate hook?
From Merlin von Trott via Discord:
Not sure what’s going on here exactly. Maybe we need a custom pedantic serialize/deserialize/validate hook?