You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 16, 2025. It is now read-only.
Context:
The recent integration of the Symfony Serializer has standardized object normalization within the library. However, the current design presents challenges for developers aiming to extend message functionalities with business-specific metadata, such as timestamps for session continuity.
Identified Challenges:
Final Message Class:
The *Message class is declared as final, preventing inheritance and thus limiting the ability to introduce custom properties or behaviors tailored to specific business needs.
Similar final declarations exist for UserMessage, AssistantMessage, and ToolCallMessage. Because these classes cannot be extended, it is difficult to attach additional state (timestamp example) while still leveraging the library’s serializer.
Serializer Accessibility:
The serializer instance is currently private and inlined within the Platform class, restricting the injection of custom normalizers or encoders necessary for handling extended message structures.
Since there is no public API to inject additional normalizers after a Platform is constructed, customizing serialization for extended message classes requires rebuilding the entire serializer.
Adding custom normalizers requires modifications across multiple platform factories or constructors, increasing the complexity and maintenance overhead for developers seeking to customize serialization behavior.
Make the Message Classes Extensible:
Remove the final keyword from the *Message specific classes to allow developers to subclass and introduce additional properties, such as timestamps or other business specific context data, facilitating richer context management.
Expose Platform Serializer for decoration:
Expose the constructed serializers so that user-land code can decorate and use their own extra normalizers if needed.
Optional: Streamline Normalizer Integration:
Introduce a more flexible system for registering custom normalizers, possibly through service tagging or configuration options, to simplify the process of extending serialization logic across different platforms.
Benefits:
Empowers developers to tailor message structures to their specific business requirements.
Enhances the modularity and maintainability of the codebase by promoting cleaner extension points.
Context:
The recent integration of the Symfony Serializer has standardized object normalization within the library. However, the current design presents challenges for developers aiming to extend message functionalities with business-specific metadata, such as timestamps for session continuity.
Identified Challenges:
The
*Messageclass is declared asfinal, preventing inheritance and thus limiting the ability to introduce custom properties or behaviors tailored to specific business needs.Similar final declarations exist for
UserMessage,AssistantMessage, andToolCallMessage. Because these classes cannot be extended, it is difficult to attach additional state (timestamp example) while still leveraging the library’s serializer.The serializer instance is currently private and inlined within the
Platformclass, restricting the injection of custom normalizers or encoders necessary for handling extended message structures.Rigid Normalizer Configuration:
Since there is no public API to inject additional normalizers after a Platform is constructed, customizing serialization for extended message classes requires rebuilding the entire serializer.
Adding custom normalizers requires modifications across multiple platform factories or constructors, increasing the complexity and maintenance overhead for developers seeking to customize serialization behavior.
Proposed Enhancements:
Make the Message Classes Extensible:
Remove the
finalkeyword from the*Messagespecific classes to allow developers to subclass and introduce additional properties, such as timestamps or other business specific context data, facilitating richer context management.Expose Platform Serializer for decoration:
Expose the constructed serializers so that user-land code can decorate and use their own extra normalizers if needed.
Optional: Streamline Normalizer Integration:
Introduce a more flexible system for registering custom normalizers, possibly through service tagging or configuration options, to simplify the process of extending serialization logic across different platforms.
Benefits: