[Feat] Support scalar types in AdditionalInformationEntry (#2105)
Signed-off-by: Nick Cao <ncao@redhat.com>
This commit is contained in:
1 parent
c7c1c3b04a
commit
47ba887b93
5 files changed
+92
-72
No files matched your search
@@ -29,10 +29,11 @@ class PromptEmbedsPayload(msgspec.Struct):
|
||||
class AdditionalInformationEntry(msgspec.Struct):
|
||||
"""One entry of additional_information.
|
||||
|
||||
Two supported forms are encoded:
|
||||
Three supported forms are encoded:
|
||||
- tensor: data/shape/dtype
|
||||
- list: a Python list (msgspec-serializable)
|
||||
Exactly one of (tensor_data, list_data) should be non-None.
|
||||
- scalar: a Python scalar (msgspec-serializable)
|
||||
Exactly one of (tensor_data, list_data, scalar_data) should be non-None.
|
||||
"""
|
||||
|
||||
# Tensor form
|
||||
@@ -43,6 +44,9 @@ class AdditionalInformationEntry(msgspec.Struct):
|
||||
# List form
|
||||
list_data: list[Any] | None = None
|
||||
|
||||
# Scalar form
|
||||
scalar_data: Any | None = None
|
||||
|
||||
|
||||
class AdditionalInformationPayload(msgspec.Struct):
|
||||
"""Serialized dictionary payload for additional_information.
|
||||
|
||||
Reference in new issue
Block a user