Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix: convert none to empty string in create block schema (#3919)

cthomasbb60dd891283
diff --git a/letta/schemas/block.py b/letta/schemas/block.py
index 056045759..4dd315f0e 100644
--- a/letta/schemas/block.py
+++ b/letta/schemas/block.py
@@ -131,6 +131,14 @@ class CreateBlock(BaseBlock):
is_template: bool = False
template_name: Optional[str] = Field(None, description="Name of the block if it is a template.", alias="name")
+ @model_validator(mode="before")
+ @classmethod
+ def ensure_value_is_string(cls, data):
+ """Convert None value to empty string"""
+ if data and isinstance(data, dict) and data.get("value") is None:
+ data["value"] = ""
+ return data
+
class CreateHuman(CreateBlock):
"""Create a human block"""