feat: remove organization from tool pydantic schema (#3430)
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
from typing import Dict
|
||||
|
||||
from marshmallow import post_dump, pre_load
|
||||
|
||||
from letta.orm import Tool
|
||||
from letta.schemas.tool import Tool as PydanticTool
|
||||
from letta.serialize_schemas.marshmallow_base import BaseSchema
|
||||
@@ -10,6 +14,24 @@ class SerializedToolSchema(BaseSchema):
|
||||
|
||||
__pydantic_model__ = PydanticTool
|
||||
|
||||
@post_dump
|
||||
def sanitize_ids(self, data: Dict, **kwargs) -> Dict:
|
||||
# delete id
|
||||
del data["id"]
|
||||
del data["_created_by_id"]
|
||||
del data["_last_updated_by_id"]
|
||||
|
||||
return data
|
||||
|
||||
@pre_load
|
||||
def regenerate_ids(self, data: Dict, **kwargs) -> Dict:
|
||||
if self.Meta.model:
|
||||
data["id"] = self.generate_id()
|
||||
data["_created_by_id"] = self.actor.id
|
||||
data["_last_updated_by_id"] = self.actor.id
|
||||
|
||||
return data
|
||||
|
||||
class Meta(BaseSchema.Meta):
|
||||
model = Tool
|
||||
exclude = BaseSchema.Meta.exclude + ("is_deleted",)
|
||||
exclude = BaseSchema.Meta.exclude + ("is_deleted", "organization")
|
||||
|
||||
Reference in New Issue
Block a user