diff --git a/llama-index-core/llama_index/core/schema.py b/llama-index-core/llama_index/core/schema.py index b196ef4276b61..c608c1f6a5b9e 100644 --- a/llama-index-core/llama_index/core/schema.py +++ b/llama-index-core/llama_index/core/schema.py @@ -969,7 +969,8 @@ def custom_model_dump( ) -> Dict[str, Any]: """For full backward compatibility with the text field, we customize the model serializer.""" data = super().custom_model_dump(handler, info) - if "text" not in info.exclude: + exclude_set = set(info.exclude or []) + if "text" not in exclude_set: data["text"] = self.text return data