langfuse-python
langfuse-python copied to clipboard
feat: Add functionality to pass custom serializer
Introduce BaseEventSerializer as an abstract base class
This refactoring introduces a new BaseEventSerializer abstract base class that provides a common interface and shared functionality for JSON serialization. Key changes include:
-
Creating an abstract base class with common serialization methods
-
Moving shared serialization logic to the base class
-
Adding an abstract default method for object serialization
-
Implementing safe integer range checking
-
Updating references in other files to use the new base class
-
[ ] documentation with explanation
-
[ ] JS SDK
Greptile Summary
Disclaimer: Experimental PR review
Introduces a new BaseEventSerializer abstract base class to standardize JSON serialization across the codebase, enabling custom serializer implementations while maintaining existing functionality.
- Missing initialization of
_serializerfield inLangfuseClient.__init__inlangfuse/request.pyneeds to be added to prevent runtime errors IngestionConsumer._serializerdefined as class variable could cause shared state issues with multiple instances- No constructor parameter in
IngestionConsumerto configure custom serializers without subclassing - Added abstract
BaseEventSerializerwith requireddefault()method inlangfuse/serializer.py - Test case for custom serializer extension needs pandas dependency added to test requirements
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
Thanks again for your contribution! Closing this PR as stale / no longer mergeable in Python SDK v3. If you have specific requirements for a separate serializer, please open a Github issue for us to conduct the discussion there