66from pydantic import BaseModel , ConfigDict , Field , model_validator
77
88from .tool_call import ToolCall
9- from ..enumeration import Role , ContentBlockType
9+ from ..enumeration import Role
1010
1111
1212class ContentBlock (BaseModel ):
@@ -35,7 +35,7 @@ class ContentBlock(BaseModel):
3535
3636 model_config = ConfigDict (extra = "allow" )
3737
38- type : ContentBlockType = Field (default = "" )
38+ type : str = Field (default = "" )
3939 content : str | dict | list = Field (default = "" )
4040
4141 @model_validator (mode = "before" )
@@ -51,8 +51,8 @@ def init_block(cls, data: dict):
5151 def simple_dump (self ) -> dict :
5252 """Convert ContentBlock to a simple dictionary format."""
5353 result = {
54- "type" : self .type . value ,
55- self .type . value : self .content ,
54+ "type" : self .type ,
55+ self .type : self .content ,
5656 ** self .model_extra ,
5757 }
5858
@@ -95,11 +95,6 @@ def simple_dump(self, add_reasoning: bool = True) -> dict:
9595
9696 return result
9797
98- @property
99- def string_buffer (self ) -> str :
100- """Get a string representation of the message with role and content."""
101- return f"{ self .role .value } : { self .dump_content ()} "
102-
10398
10499class Trajectory (BaseModel ):
105100 """Represents a conversation trajectory with messages and optional scoring."""
0 commit comments