Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Pass kwargs to msgpack serializer , closes #932

davidmezzettia1df111bb887
diff --git a/src/python/txtai/serialize/messagepack.py b/src/python/txtai/serialize/messagepack.py
index 92397d54..943c9d97 100644
--- a/src/python/txtai/serialize/messagepack.py
+++ b/src/python/txtai/serialize/messagepack.py
@@ -15,16 +15,20 @@ class MessagePack(Serialize):
MessagePack serialization.
"""
- def __init__(self, streaming=False):
+ def __init__(self, streaming=False, **kwargs):
# Parent constructor
super().__init__()
+ # Streaming unpacker
self.streaming = streaming
+ # Additional streaming unpacker keyword arguments
+ self.kwargs = kwargs
+
def loadstream(self, stream):
try:
# Support both streaming and non-streaming unpacking of data
- return Unpacker(stream) if self.streaming else msgpack.unpack(stream)
+ return Unpacker(stream, **self.kwargs) if self.streaming else msgpack.unpack(stream)
except ExtraData as e:
raise SerializeError(e) from e