@@ -231,21 +231,26 @@ class StorageEvent(Base):
231231
232232 invocation_id : Mapped [str ] = mapped_column (String (DEFAULT_MAX_VARCHAR_LENGTH ))
233233 author : Mapped [str ] = mapped_column (String (DEFAULT_MAX_VARCHAR_LENGTH ))
234+ actions : Mapped [MutableDict [str , Any ]] = mapped_column (DynamicPickleType )
235+ long_running_tool_ids_json : Mapped [Optional [str ]] = mapped_column (
236+ Text , nullable = True
237+ )
234238 branch : Mapped [str ] = mapped_column (
235239 String (DEFAULT_MAX_VARCHAR_LENGTH ), nullable = True
236240 )
237241 timestamp : Mapped [PreciseTimestamp ] = mapped_column (
238242 PreciseTimestamp , default = func .now ()
239243 )
240- content : Mapped [dict [str , Any ]] = mapped_column (DynamicJSON , nullable = True )
241- actions : Mapped [MutableDict [str , Any ]] = mapped_column (DynamicPickleType )
242244
243- long_running_tool_ids_json : Mapped [Optional [str ]] = mapped_column (
244- Text , nullable = True
245- )
245+ # === Fileds from llm_response.py ===
246+ content : Mapped [dict [str , Any ]] = mapped_column (DynamicJSON , nullable = True )
246247 grounding_metadata : Mapped [dict [str , Any ]] = mapped_column (
247248 DynamicJSON , nullable = True
248249 )
250+ custom_metadata : Mapped [dict [str , Any ]] = mapped_column (
251+ DynamicJSON , nullable = True
252+ )
253+
249254 partial : Mapped [bool ] = mapped_column (Boolean , nullable = True )
250255 turn_complete : Mapped [bool ] = mapped_column (Boolean , nullable = True )
251256 error_code : Mapped [str ] = mapped_column (
@@ -309,6 +314,8 @@ def from_event(cls, session: Session, event: Event) -> StorageEvent:
309314 storage_event .grounding_metadata = event .grounding_metadata .model_dump (
310315 exclude_none = True , mode = "json"
311316 )
317+ if event .custom_metadata :
318+ storage_event .custom_metadata = event .custom_metadata
312319 return storage_event
313320
314321 def to_event (self ) -> Event :
@@ -329,6 +336,7 @@ def to_event(self) -> Event:
329336 grounding_metadata = _session_util .decode_grounding_metadata (
330337 self .grounding_metadata
331338 ),
339+ custom_metadata = self .custom_metadata ,
332340 )
333341
334342
0 commit comments