Replies: 4 comments 4 replies
-
The error you're encountering is due to the fact that the keys in the To resolve this issue, you can modify the way the
This approach ensures that the keys are in a JSON-compatible format during serialization and are correctly converted back to class types during deserialization. Additionally, for the By following these steps, you should be able to serialize and deserialize your context without encountering the error. |
Beta Was this translation helpful? Give feedback.
-
@dosu I think there should be out of the box solution for passing nodes between events, without modifying the event handler so I am guessing that I am doing something wrong. How can I construct the events so that they are serializable? |
Beta Was this translation helpful? Give feedback.
-
@dosu can you show me the difference and what you have changed, it seems like the code is the same, but with this code I have the issue with serialization from the rerank |
Beta Was this translation helpful? Give feedback.
-
@dosu , I have tried to create a dummy workflow to see where the issue is and it still fails in the same way, I am starting to think that the issue is in sending two events which creates a dictionary of the two classes, here is my sample code, any suggestions would be welcomed. I think I am followingthe documentation on handling context:
This still fails on:
|
Beta Was this translation helpful? Give feedback.
-
Hello,
Thanks for the support in advance, I am trying to use llama deploy to deploy a workflow, the workflow runs fine however I reach this error:
ERROR:llama_deploy.services.workflow - Encountered error in task 0546b1fe-2041-4040-8bba-36bebc083379! keys must be str, int, float, bool or None, not ModelMetaclass
Which seems to stem from the attempt to serialize the context of the handler from set_workflow_state.
At first I though to serialize everything in json before passing it ot the context and then deserialize once collecting it from the context hoping that this would solve my issue.
However now, my events is a string and I still have the same issue...
Here is how the event is defined:
and the serialization fails on:
context_dict['events_buffer']
which shows has:
{<class '__main__.OutputDoc'>: [], <class '__main__.OutputQna'>: []}
As trying to understand it better, I tried constructing a dummy code:
Which I had the impression is what is supposed to happen, however this fails as well
although a.dict is present: {'data': 'dsadsadsa'}
Can you support me in understanding what I am doing wrong? It seems pretty straightforward to me that I'd like to pass List[NodesWithScore] around but even when serializing them I seem to be suffering :)
Beta Was this translation helpful? Give feedback.
All reactions