Files
langgraph/langgraph/serde/base.py
T
2024-04-24 15:40:48 -07:00

18 lines
425 B
Python

from typing import Any, Protocol
class SerializerProtocol(Protocol):
"""Protocol for serialization and deserialization of objects.
- `dumps`: Serialize an object to bytes.
- `loads`: Deserialize an object from bytes.
Valid implementations include the `pickle`, `json` and `orjson` modules.
"""
def dumps(self, obj: Any) -> bytes:
...
def loads(self, data: bytes) -> Any:
...