nucliadb-models 6.7.0.post4806__py3-none-any.whl → 6.7.0.post4811__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of nucliadb-models might be problematic. Click here for more details.
- nucliadb_models/conversation.py +27 -5
- {nucliadb_models-6.7.0.post4806.dist-info → nucliadb_models-6.7.0.post4811.dist-info}/METADATA +1 -1
- {nucliadb_models-6.7.0.post4806.dist-info → nucliadb_models-6.7.0.post4811.dist-info}/RECORD +5 -5
- {nucliadb_models-6.7.0.post4806.dist-info → nucliadb_models-6.7.0.post4811.dist-info}/WHEEL +0 -0
- {nucliadb_models-6.7.0.post4806.dist-info → nucliadb_models-6.7.0.post4811.dist-info}/top_level.txt +0 -0
nucliadb_models/conversation.py
CHANGED
|
@@ -93,11 +93,20 @@ class InputMessageContent(BaseModel):
|
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
class InputMessage(BaseModel):
|
|
96
|
-
timestamp: Optional[datetime] =
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
timestamp: Optional[datetime] = Field(
|
|
97
|
+
default=None, description="Time at which the message was sent, in ISO 8601 format."
|
|
98
|
+
)
|
|
99
|
+
who: Optional[str] = Field(
|
|
100
|
+
default=None, description="Sender of the message, e.g. 'user' or 'assistant'"
|
|
101
|
+
)
|
|
102
|
+
to: List[str] = Field(
|
|
103
|
+
default_factory=list,
|
|
104
|
+
description="List of recipients of the message, e.g. ['assistant'] or ['user']",
|
|
105
|
+
)
|
|
99
106
|
content: InputMessageContent
|
|
100
|
-
ident: str
|
|
107
|
+
ident: str = Field(
|
|
108
|
+
description="Unique identifier for the message. Must be unique within the conversation."
|
|
109
|
+
)
|
|
101
110
|
type_: Optional[MessageType] = Field(None, alias="type")
|
|
102
111
|
|
|
103
112
|
@field_validator("ident", mode="after")
|
|
@@ -111,7 +120,10 @@ class InputMessage(BaseModel):
|
|
|
111
120
|
|
|
112
121
|
|
|
113
122
|
class InputConversationField(BaseModel):
|
|
114
|
-
messages: List[InputMessage] =
|
|
123
|
+
messages: List[InputMessage] = Field(
|
|
124
|
+
default_factory=list,
|
|
125
|
+
description="List of messages in the conversation field. Each message must have a unique ident.",
|
|
126
|
+
)
|
|
115
127
|
extract_strategy: Optional[str] = Field(
|
|
116
128
|
default=None,
|
|
117
129
|
description="Id of the Nuclia extract strategy used at processing time. If not set, the default strategy was used. Extract strategies are defined at the learning configuration api.",
|
|
@@ -120,3 +132,13 @@ class InputConversationField(BaseModel):
|
|
|
120
132
|
default=None,
|
|
121
133
|
description="Id of the Nuclia split strategy used at processing time. If not set, the default strategy was used. Split strategies are defined at the learning configuration api.",
|
|
122
134
|
)
|
|
135
|
+
|
|
136
|
+
@field_validator("messages", mode="after")
|
|
137
|
+
@classmethod
|
|
138
|
+
def idents_are_unique(cls, value: List[InputMessage]) -> List[InputMessage]:
|
|
139
|
+
seen_idents = set()
|
|
140
|
+
for message in value:
|
|
141
|
+
if message.ident in seen_idents:
|
|
142
|
+
raise ValueError(f'Message ident "{message.ident}" is not unique')
|
|
143
|
+
seen_idents.add(message.ident)
|
|
144
|
+
return value
|
{nucliadb_models-6.7.0.post4806.dist-info → nucliadb_models-6.7.0.post4811.dist-info}/RECORD
RENAMED
|
@@ -2,7 +2,7 @@ nucliadb_models/__init__.py,sha256=3y8-htogKuCZcbhaUZdSjTeEjUSeec9aRWyL8AlKCyM,1
|
|
|
2
2
|
nucliadb_models/common.py,sha256=YW84w1NAQARObs2nXw6YBgdxQJeVCmTZZr5lSqj-IdQ,7904
|
|
3
3
|
nucliadb_models/configuration.py,sha256=aTV5mBwYFlwiV1_nWyVAXaCh7F6lDVTVh28Xfwy8ox8,2448
|
|
4
4
|
nucliadb_models/content_types.py,sha256=36Ga-iGf4ivCqgtXC7imFgegrwHB117s9eqP62JtGv0,3456
|
|
5
|
-
nucliadb_models/conversation.py,sha256=
|
|
5
|
+
nucliadb_models/conversation.py,sha256=_qs1r5X2_1q-0fSlVNnrE3f9N_OTrZEHVEJ_yiMqPxU,4666
|
|
6
6
|
nucliadb_models/entities.py,sha256=i-7Y8qmFRRTih5zw0ajv1U_iiXexe66M3TK8hUikQZk,2356
|
|
7
7
|
nucliadb_models/export_import.py,sha256=mNm9IArOLnC6TLupkwqVFhxD5d08mpIVOVFneECv8UA,1073
|
|
8
8
|
nucliadb_models/external_index_providers.py,sha256=IIKjJjLixWQC1zrbzam2FDcAo5UUxShZfueZSxqZu8Y,1535
|
|
@@ -32,7 +32,7 @@ nucliadb_models/graph/responses.py,sha256=Sdq8OgFAL1YT-1lJyLLrkqcScvj7YTEqAUwQ-k
|
|
|
32
32
|
nucliadb_models/internal/__init__.py,sha256=zG33bUz1rHFPtvqQPWn4rDwBJt3FJodGuQYD45quiQg,583
|
|
33
33
|
nucliadb_models/internal/predict.py,sha256=Pnx6MmLfK65eExe1XnVxqmSlvMwdowewwks9BOEoqMw,2029
|
|
34
34
|
nucliadb_models/internal/shards.py,sha256=__y1OZtWGiNcPQEWfSFOj8yw458WGi7mM4vZe0K-L1Y,1691
|
|
35
|
-
nucliadb_models-6.7.0.
|
|
36
|
-
nucliadb_models-6.7.0.
|
|
37
|
-
nucliadb_models-6.7.0.
|
|
38
|
-
nucliadb_models-6.7.0.
|
|
35
|
+
nucliadb_models-6.7.0.post4811.dist-info/METADATA,sha256=_8xfPMjbuusxtLAq6rpcz5jLI-fljzH-5QStauMhx_4,794
|
|
36
|
+
nucliadb_models-6.7.0.post4811.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
37
|
+
nucliadb_models-6.7.0.post4811.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
|
|
38
|
+
nucliadb_models-6.7.0.post4811.dist-info/RECORD,,
|
|
File without changes
|
{nucliadb_models-6.7.0.post4806.dist-info → nucliadb_models-6.7.0.post4811.dist-info}/top_level.txt
RENAMED
|
File without changes
|