mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-10-19 22:41:43 +02:00
18 lines
425 B
Python
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:
|
|
...
|