File tree Expand file tree Collapse file tree 2 files changed +6
-10
lines changed
Expand file tree Collapse file tree 2 files changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,12 @@ def default(self, obj: Any) -> Any:
4848 if hasattr (obj , "__vellum_encode__" ) and callable (getattr (obj , "__vellum_encode__" )):
4949 return obj .__vellum_encode__ ()
5050
51+ if isinstance (obj , (bytes , bytearray )):
52+ raise TypeError (
53+ "bytes are not JSON-serializable; convert to text (e.g., .decode('utf-8')) "
54+ "or base64-encode before returning from a node output"
55+ )
56+
5157 if isinstance (obj , UUID ):
5258 return str (obj )
5359
Original file line number Diff line number Diff line change @@ -572,16 +572,6 @@ def initiate_node_streaming_output(
572572
573573 with execution_context (parent_context = updated_parent_context , trace_id = execution .trace_id ):
574574 for output in node_run_response :
575- try :
576- default_serializer (output )
577- except (TypeError , ValueError ) as exc :
578- raise NodeException (
579- message = (
580- f"Node { node .__class__ .__name__ } produced output: "
581- f"'{ output .name } ' that could not be serialized to JSON: { exc } "
582- ),
583- code = WorkflowErrorCode .INVALID_OUTPUTS ,
584- ) from exc
585575 invoked_ports = output > ports
586576 if output .is_initiated :
587577 yield from initiate_node_streaming_output (output )
You can’t perform that action at this time.
0 commit comments