nucliadb-models 6.5.1.post4539__py3-none-any.whl → 6.6.1.post649__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.
- nucliadb_models/common.py +2 -2
- nucliadb_models/configuration.py +9 -15
- nucliadb_models/content_types.py +1 -0
- nucliadb_models/conversation.py +1 -1
- nucliadb_models/file.py +1 -1
- nucliadb_models/filters.py +37 -26
- nucliadb_models/graph/requests.py +17 -7
- nucliadb_models/metadata.py +1 -1
- nucliadb_models/notifications.py +2 -1
- nucliadb_models/search.py +71 -11
- {nucliadb_models-6.5.1.post4539.dist-info → nucliadb_models-6.6.1.post649.dist-info}/METADATA +2 -2
- {nucliadb_models-6.5.1.post4539.dist-info → nucliadb_models-6.6.1.post649.dist-info}/RECORD +14 -14
- {nucliadb_models-6.5.1.post4539.dist-info → nucliadb_models-6.6.1.post649.dist-info}/WHEEL +0 -0
- {nucliadb_models-6.5.1.post4539.dist-info → nucliadb_models-6.6.1.post649.dist-info}/top_level.txt +0 -0
nucliadb_models/common.py
CHANGED
@@ -88,7 +88,7 @@ class FieldID(BaseModel):
|
|
88
88
|
class File(BaseModel):
|
89
89
|
filename: Optional[str] = None
|
90
90
|
content_type: str = "application/octet-stream"
|
91
|
-
payload: Optional[str] = Field(None, description="Base64 encoded file content")
|
91
|
+
payload: Optional[str] = Field(default=None, description="Base64 encoded file content")
|
92
92
|
md5: Optional[str] = None
|
93
93
|
# These are to be used for external files
|
94
94
|
uri: Optional[str] = None
|
@@ -176,7 +176,7 @@ class CloudLink(BaseModel):
|
|
176
176
|
return DOWNLOAD_URI.format(**url_params).rstrip("/")
|
177
177
|
|
178
178
|
@field_serializer("uri")
|
179
|
-
def serialize_uri(uri):
|
179
|
+
def serialize_uri(self, uri: str):
|
180
180
|
return CloudLink.format_reader_download_uri(uri)
|
181
181
|
|
182
182
|
|
nucliadb_models/configuration.py
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
#
|
15
15
|
|
16
16
|
import warnings
|
17
|
-
from typing import Annotated, Literal, Optional, Union
|
17
|
+
from typing import Annotated, Any, Literal, Optional, Union
|
18
18
|
|
19
19
|
from pydantic import BaseModel, Field, create_model
|
20
20
|
|
@@ -38,16 +38,14 @@ class KBConfiguration(BaseModel):
|
|
38
38
|
#
|
39
39
|
# Search configurations
|
40
40
|
#
|
41
|
+
def _model_fields(model: type[BaseModel], skip: list[str]) -> dict[str, Any]:
|
42
|
+
return {
|
43
|
+
name: (field.annotation, field) for name, field in model.model_fields.items() if name not in skip
|
44
|
+
}
|
45
|
+
|
41
46
|
|
42
47
|
# FindConfig is a FindConfig without `search_configuration`
|
43
|
-
FindConfig = create_model(
|
44
|
-
"FindConfig",
|
45
|
-
**{
|
46
|
-
name: (field.annotation, field)
|
47
|
-
for name, field in FindRequest.model_fields.items()
|
48
|
-
if name not in ("search_configuration")
|
49
|
-
},
|
50
|
-
) # type: ignore[call-overload]
|
48
|
+
FindConfig = create_model("FindConfig", **_model_fields(FindRequest, skip=["search_configuration"]))
|
51
49
|
|
52
50
|
|
53
51
|
class FindSearchConfiguration(BaseModel):
|
@@ -58,13 +56,9 @@ class FindSearchConfiguration(BaseModel):
|
|
58
56
|
# AskConfig is an AskRequest where `query` is not mandatory and without `search_configuration`
|
59
57
|
AskConfig = create_model(
|
60
58
|
"AskConfig",
|
61
|
-
**
|
62
|
-
name: (field.annotation, field)
|
63
|
-
for name, field in AskRequest.model_fields.items()
|
64
|
-
if name not in ("query", "search_configuration")
|
65
|
-
},
|
59
|
+
**_model_fields(AskRequest, skip=["query", "search_configuration"]),
|
66
60
|
query=(Optional[str], None),
|
67
|
-
)
|
61
|
+
)
|
68
62
|
|
69
63
|
|
70
64
|
class AskSearchConfiguration(BaseModel):
|
nucliadb_models/content_types.py
CHANGED
nucliadb_models/conversation.py
CHANGED
@@ -18,7 +18,7 @@ from typing import List, Optional
|
|
18
18
|
|
19
19
|
from pydantic import BaseModel, Field, field_validator
|
20
20
|
|
21
|
-
from nucliadb_models import CloudLink, FieldRef, FileB64
|
21
|
+
from nucliadb_models.common import CloudLink, FieldRef, FileB64
|
22
22
|
from nucliadb_models.utils import DateTime
|
23
23
|
|
24
24
|
# Shared classes
|
nucliadb_models/file.py
CHANGED
nucliadb_models/filters.py
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
#
|
15
15
|
|
16
|
+
from collections.abc import Sequence
|
16
17
|
from enum import Enum
|
17
18
|
from typing import Any, Generic, Literal, Optional, TypeVar, Union
|
18
19
|
from uuid import UUID
|
@@ -31,25 +32,25 @@ F = TypeVar("F", bound=BaseModel)
|
|
31
32
|
class And(BaseModel, Generic[F], extra="forbid"):
|
32
33
|
"""AND of other expressions"""
|
33
34
|
|
34
|
-
operands:
|
35
|
+
operands: Sequence[F] = pydantic.Field(
|
35
36
|
serialization_alias="and", validation_alias=AliasChoices("operands", "and"), min_length=1
|
36
37
|
)
|
37
38
|
|
38
39
|
@pydantic.model_serializer
|
39
|
-
def serialize_boolean(self) -> dict[str, Any]:
|
40
|
-
return {"and": [op.model_dump() for op in self.operands]}
|
40
|
+
def serialize_boolean(self, info: pydantic.SerializationInfo) -> dict[str, Any]:
|
41
|
+
return {"and": [op.model_dump(exclude_unset=info.exclude_unset) for op in self.operands]}
|
41
42
|
|
42
43
|
|
43
44
|
class Or(BaseModel, Generic[F], extra="forbid"):
|
44
45
|
"""OR of other expressions"""
|
45
46
|
|
46
|
-
operands:
|
47
|
+
operands: Sequence[F] = pydantic.Field(
|
47
48
|
serialization_alias="or", validation_alias=AliasChoices("operands", "or"), min_length=1
|
48
49
|
)
|
49
50
|
|
50
51
|
@pydantic.model_serializer
|
51
|
-
def serialize_boolean(self) -> dict[str, Any]:
|
52
|
-
return {"or": [op.model_dump() for op in self.operands]}
|
52
|
+
def serialize_boolean(self, info: pydantic.SerializationInfo) -> dict[str, Any]:
|
53
|
+
return {"or": [op.model_dump(exclude_unset=info.exclude_unset) for op in self.operands]}
|
53
54
|
|
54
55
|
|
55
56
|
class Not(BaseModel, Generic[F], extra="forbid"):
|
@@ -60,11 +61,21 @@ class Not(BaseModel, Generic[F], extra="forbid"):
|
|
60
61
|
)
|
61
62
|
|
62
63
|
@pydantic.model_serializer
|
63
|
-
def serialize_boolean(self) -> dict[str, Any]:
|
64
|
-
return {"not": self.operand.model_dump()}
|
64
|
+
def serialize_boolean(self, info: pydantic.SerializationInfo) -> dict[str, Any]:
|
65
|
+
return {"not": self.operand.model_dump(exclude_unset=info.exclude_unset)}
|
65
66
|
|
66
67
|
|
67
|
-
class
|
68
|
+
class FilterProp(BaseModel):
|
69
|
+
prop: Any
|
70
|
+
|
71
|
+
@model_validator(mode="after")
|
72
|
+
def set_discriminator(self) -> Self:
|
73
|
+
# Ensure discriminator is explicitly set so it's always serialized
|
74
|
+
self.prop = self.prop
|
75
|
+
return self
|
76
|
+
|
77
|
+
|
78
|
+
class Resource(FilterProp, extra="forbid"):
|
68
79
|
"""Matches all fields of a resource given its id or slug"""
|
69
80
|
|
70
81
|
prop: Literal["resource"] = "resource"
|
@@ -91,7 +102,7 @@ class Resource(BaseModel, extra="forbid"):
|
|
91
102
|
return self
|
92
103
|
|
93
104
|
|
94
|
-
class Field(
|
105
|
+
class Field(FilterProp, extra="forbid"):
|
95
106
|
"""Matches a field or set of fields"""
|
96
107
|
|
97
108
|
prop: Literal["field"] = "field"
|
@@ -102,14 +113,14 @@ class Field(BaseModel, extra="forbid"):
|
|
102
113
|
)
|
103
114
|
|
104
115
|
|
105
|
-
class Keyword(
|
116
|
+
class Keyword(FilterProp, extra="forbid"):
|
106
117
|
"""Matches all fields that contain a keyword"""
|
107
118
|
|
108
119
|
prop: Literal["keyword"] = "keyword"
|
109
120
|
word: str = pydantic.Field(description="Keyword to find")
|
110
121
|
|
111
122
|
|
112
|
-
class DateCreated(
|
123
|
+
class DateCreated(FilterProp, extra="forbid"):
|
113
124
|
"""Matches all fields created in a date range"""
|
114
125
|
|
115
126
|
prop: Literal["created"] = "created"
|
@@ -127,7 +138,7 @@ class DateCreated(BaseModel, extra="forbid"):
|
|
127
138
|
return self
|
128
139
|
|
129
140
|
|
130
|
-
class DateModified(
|
141
|
+
class DateModified(FilterProp, extra="forbid"):
|
131
142
|
"""Matches all fields modified in a date range"""
|
132
143
|
|
133
144
|
prop: Literal["modified"] = "modified"
|
@@ -145,7 +156,7 @@ class DateModified(BaseModel, extra="forbid"):
|
|
145
156
|
return self
|
146
157
|
|
147
158
|
|
148
|
-
class Label(
|
159
|
+
class Label(FilterProp, extra="forbid"):
|
149
160
|
"""Matches fields/paragraphs with a label (or labelset)"""
|
150
161
|
|
151
162
|
prop: Literal["label"] = "label"
|
@@ -156,7 +167,7 @@ class Label(BaseModel, extra="forbid"):
|
|
156
167
|
)
|
157
168
|
|
158
169
|
|
159
|
-
class ResourceMimetype(
|
170
|
+
class ResourceMimetype(FilterProp, extra="forbid"):
|
160
171
|
"""Matches resources with a mimetype.
|
161
172
|
|
162
173
|
The mimetype of a resource can be assigned independently of the mimetype of its fields.
|
@@ -175,7 +186,7 @@ class ResourceMimetype(BaseModel, extra="forbid"):
|
|
175
186
|
)
|
176
187
|
|
177
188
|
|
178
|
-
class FieldMimetype(
|
189
|
+
class FieldMimetype(FilterProp, extra="forbid"):
|
179
190
|
"""Matches fields with a mimetype"""
|
180
191
|
|
181
192
|
prop: Literal["field_mimetype"] = "field_mimetype"
|
@@ -191,7 +202,7 @@ class FieldMimetype(BaseModel, extra="forbid"):
|
|
191
202
|
)
|
192
203
|
|
193
204
|
|
194
|
-
class Entity(
|
205
|
+
class Entity(FilterProp, extra="forbid"):
|
195
206
|
"""Matches fields that contains a detected entity"""
|
196
207
|
|
197
208
|
prop: Literal["entity"] = "entity"
|
@@ -202,7 +213,7 @@ class Entity(BaseModel, extra="forbid"):
|
|
202
213
|
)
|
203
214
|
|
204
215
|
|
205
|
-
class Language(
|
216
|
+
class Language(FilterProp, extra="forbid"):
|
206
217
|
"""Matches the language of the field"""
|
207
218
|
|
208
219
|
prop: Literal["language"] = "language"
|
@@ -213,14 +224,14 @@ class Language(BaseModel, extra="forbid"):
|
|
213
224
|
language: str = pydantic.Field(description="The code of the language to match, e.g: en")
|
214
225
|
|
215
226
|
|
216
|
-
class OriginTag(
|
227
|
+
class OriginTag(FilterProp, extra="forbid"):
|
217
228
|
"""Matches all fields with a given origin tag"""
|
218
229
|
|
219
230
|
prop: Literal["origin_tag"] = "origin_tag"
|
220
231
|
tag: str = pydantic.Field(description="The tag to match")
|
221
232
|
|
222
233
|
|
223
|
-
class OriginMetadata(
|
234
|
+
class OriginMetadata(FilterProp, extra="forbid"):
|
224
235
|
"""Matches metadata from the origin"""
|
225
236
|
|
226
237
|
prop: Literal["origin_metadata"] = "origin_metadata"
|
@@ -231,7 +242,7 @@ class OriginMetadata(BaseModel, extra="forbid"):
|
|
231
242
|
)
|
232
243
|
|
233
244
|
|
234
|
-
class OriginPath(
|
245
|
+
class OriginPath(FilterProp, extra="forbid"):
|
235
246
|
"""Matches the origin path"""
|
236
247
|
|
237
248
|
prop: Literal["origin_path"] = "origin_path"
|
@@ -244,21 +255,21 @@ class OriginPath(BaseModel, extra="forbid"):
|
|
244
255
|
)
|
245
256
|
|
246
257
|
|
247
|
-
class OriginSource(
|
258
|
+
class OriginSource(FilterProp, extra="forbid"):
|
248
259
|
"""Matches the origin source id"""
|
249
260
|
|
250
261
|
prop: Literal["origin_source"] = "origin_source"
|
251
262
|
id: Optional[str] = pydantic.Field(default=None, description=("Source ID"))
|
252
263
|
|
253
264
|
|
254
|
-
class OriginCollaborator(
|
265
|
+
class OriginCollaborator(FilterProp, extra="forbid"):
|
255
266
|
"""Matches the origin collaborators"""
|
256
267
|
|
257
268
|
prop: Literal["origin_collaborator"] = "origin_collaborator"
|
258
269
|
collaborator: str = pydantic.Field(description=("Collaborator"))
|
259
270
|
|
260
271
|
|
261
|
-
class Generated(
|
272
|
+
class Generated(FilterProp, extra="forbid"):
|
262
273
|
"""Matches if the field was generated by the given source"""
|
263
274
|
|
264
275
|
prop: Literal["generated"] = "generated"
|
@@ -270,14 +281,14 @@ class Generated(BaseModel, extra="forbid"):
|
|
270
281
|
)
|
271
282
|
|
272
283
|
|
273
|
-
class Kind(
|
284
|
+
class Kind(FilterProp, extra="forbid"):
|
274
285
|
"""Matches paragraphs of a certain kind"""
|
275
286
|
|
276
287
|
prop: Literal["kind"] = "kind"
|
277
288
|
kind: Paragraph.TypeParagraph = pydantic.Field(description="The kind of paragraph to match")
|
278
289
|
|
279
290
|
|
280
|
-
class Status(
|
291
|
+
class Status(FilterProp, extra="forbid"):
|
281
292
|
"""Matches resource in a certain processing status"""
|
282
293
|
|
283
294
|
prop: Literal["status"] = "status"
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
#
|
15
15
|
from enum import Enum
|
16
|
-
from typing import Annotated, Literal, Optional, Union
|
16
|
+
from typing import Annotated, Any, Literal, Optional, Union
|
17
17
|
|
18
18
|
from pydantic import BaseModel, Discriminator, Field, Tag, model_validator
|
19
19
|
from typing_extensions import Self
|
@@ -25,6 +25,16 @@ from nucliadb_models.security import RequestSecurity
|
|
25
25
|
## Models for graph nodes and relations
|
26
26
|
|
27
27
|
|
28
|
+
class GraphProp(BaseModel):
|
29
|
+
prop: Any
|
30
|
+
|
31
|
+
@model_validator(mode="after")
|
32
|
+
def set_discriminator(self) -> Self:
|
33
|
+
# Ensure discriminator is explicitly set so it's always serialized
|
34
|
+
self.prop = self.prop
|
35
|
+
return self
|
36
|
+
|
37
|
+
|
28
38
|
class NodeMatchKindName(str, Enum):
|
29
39
|
EXACT = "exact"
|
30
40
|
FUZZY = "fuzzy"
|
@@ -57,23 +67,23 @@ class GraphRelation(BaseModel, extra="forbid"):
|
|
57
67
|
## Models for query expressions
|
58
68
|
|
59
69
|
|
60
|
-
class AnyNode(GraphNode):
|
70
|
+
class AnyNode(GraphNode, GraphProp):
|
61
71
|
prop: Literal["node"] = "node"
|
62
72
|
|
63
73
|
|
64
|
-
class SourceNode(GraphNode):
|
74
|
+
class SourceNode(GraphNode, GraphProp):
|
65
75
|
prop: Literal["source_node"] = "source_node"
|
66
76
|
|
67
77
|
|
68
|
-
class DestinationNode(GraphNode):
|
78
|
+
class DestinationNode(GraphNode, GraphProp):
|
69
79
|
prop: Literal["destination_node"] = "destination_node"
|
70
80
|
|
71
81
|
|
72
|
-
class Relation(GraphRelation):
|
82
|
+
class Relation(GraphRelation, GraphProp):
|
73
83
|
prop: Literal["relation"] = "relation"
|
74
84
|
|
75
85
|
|
76
|
-
class GraphPath(
|
86
|
+
class GraphPath(GraphProp, extra="forbid"):
|
77
87
|
prop: Literal["path"] = "path"
|
78
88
|
source: Optional[GraphNode] = None
|
79
89
|
relation: Optional[GraphRelation] = None
|
@@ -87,7 +97,7 @@ class Generator(str, Enum):
|
|
87
97
|
USER = "user"
|
88
98
|
|
89
99
|
|
90
|
-
class Generated(
|
100
|
+
class Generated(GraphProp, extra="forbid"):
|
91
101
|
"""Matches if the relation was generated by the given source"""
|
92
102
|
|
93
103
|
prop: Literal["generated"] = "generated"
|
nucliadb_models/metadata.py
CHANGED
@@ -73,7 +73,7 @@ class Relation(BaseModel):
|
|
73
73
|
label: Optional[str] = None
|
74
74
|
metadata: Optional[RelationMetadata] = None
|
75
75
|
|
76
|
-
from_: Optional[RelationEntity] = Field(None, alias="from")
|
76
|
+
from_: Optional[RelationEntity] = Field(default=None, alias="from")
|
77
77
|
to: RelationEntity
|
78
78
|
|
79
79
|
@model_validator(mode="after")
|
nucliadb_models/notifications.py
CHANGED
@@ -13,6 +13,7 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
#
|
15
15
|
from enum import Enum
|
16
|
+
from typing import Any
|
16
17
|
|
17
18
|
from pydantic import BaseModel, Field
|
18
19
|
|
@@ -29,7 +30,7 @@ class Notification(BaseModel):
|
|
29
30
|
title="Notification Type",
|
30
31
|
description="Type of notification.",
|
31
32
|
)
|
32
|
-
data:
|
33
|
+
data: Any = Field(
|
33
34
|
...,
|
34
35
|
title="Notification Data",
|
35
36
|
description="Notification data.",
|
nucliadb_models/search.py
CHANGED
@@ -42,6 +42,8 @@ from nucliadb_models.internal.shards import ( # noqa isort: skip
|
|
42
42
|
ShardReplica,
|
43
43
|
KnowledgeboxShards,
|
44
44
|
)
|
45
|
+
from nuclia_models.common.consumption import Consumption
|
46
|
+
|
45
47
|
from nucliadb_models.filters import CatalogFilterExpression, FilterExpression
|
46
48
|
|
47
49
|
ANSWER_JSON_SCHEMA_EXAMPLE = {
|
@@ -353,6 +355,12 @@ class RankFusionName(str, Enum):
|
|
353
355
|
class _BaseRankFusion(BaseModel):
|
354
356
|
name: str
|
355
357
|
|
358
|
+
@model_validator(mode="after")
|
359
|
+
def set_discriminator(self) -> Self:
|
360
|
+
# Ensure discriminator is explicitly set so it's always serialized
|
361
|
+
self.name = self.name
|
362
|
+
return self
|
363
|
+
|
356
364
|
|
357
365
|
class ReciprocalRankFusionWeights(BaseModel):
|
358
366
|
keyword: float = 1.0
|
@@ -413,6 +421,12 @@ class RerankerName(str, Enum):
|
|
413
421
|
class _BaseReranker(BaseModel):
|
414
422
|
name: str
|
415
423
|
|
424
|
+
@model_validator(mode="after")
|
425
|
+
def set_discriminator(self) -> Self:
|
426
|
+
# Ensure discriminator is explicitly set so it's always serialized
|
427
|
+
self.name = self.name
|
428
|
+
return self
|
429
|
+
|
416
430
|
|
417
431
|
class PredictReranker(_BaseReranker):
|
418
432
|
name: Literal[RerankerName.PREDICT_RERANKER] = RerankerName.PREDICT_RERANKER
|
@@ -706,9 +720,11 @@ class CatalogQueryMatch(str, Enum):
|
|
706
720
|
|
707
721
|
|
708
722
|
class CatalogQuery(BaseModel):
|
709
|
-
field: CatalogQueryField = CatalogQueryField.Title
|
710
|
-
match: CatalogQueryMatch =
|
711
|
-
|
723
|
+
field: CatalogQueryField = Field(default=CatalogQueryField.Title, description="Field to search in")
|
724
|
+
match: CatalogQueryMatch = Field(
|
725
|
+
default=CatalogQueryMatch.Exact, description="Operator to use for matching results"
|
726
|
+
)
|
727
|
+
query: str = Field(min_length=1, description="Text to search for")
|
712
728
|
|
713
729
|
@model_validator(mode="after")
|
714
730
|
def check_match_field(self) -> Self:
|
@@ -1084,11 +1100,23 @@ class ImageRagStrategyName:
|
|
1084
1100
|
|
1085
1101
|
|
1086
1102
|
class RagStrategy(BaseModel):
|
1087
|
-
name:
|
1103
|
+
name: Any
|
1104
|
+
|
1105
|
+
@model_validator(mode="after")
|
1106
|
+
def set_discriminator(self) -> Self:
|
1107
|
+
# Ensure discriminator is explicitly set so it's always serialized
|
1108
|
+
self.name = self.name
|
1109
|
+
return self
|
1088
1110
|
|
1089
1111
|
|
1090
1112
|
class ImageRagStrategy(BaseModel):
|
1091
|
-
name:
|
1113
|
+
name: Any
|
1114
|
+
|
1115
|
+
@model_validator(mode="after")
|
1116
|
+
def set_discriminator(self) -> Self:
|
1117
|
+
# Ensure discriminator is explicitly set so it's always serialized
|
1118
|
+
self.name = self.name
|
1119
|
+
return self
|
1092
1120
|
|
1093
1121
|
|
1094
1122
|
ALLOWED_FIELD_TYPES: dict[str, str] = {
|
@@ -1680,7 +1708,8 @@ Using this feature also disables the `citations` parameter. For maximal accuracy
|
|
1680
1708
|
)
|
1681
1709
|
|
1682
1710
|
search_configuration: Optional[str] = Field(
|
1683
|
-
default=None,
|
1711
|
+
default=None,
|
1712
|
+
description="Load ask parameters from this configuration. Parameters in the request override parameters from the configuration.",
|
1684
1713
|
)
|
1685
1714
|
|
1686
1715
|
@field_validator("rag_strategies", mode="before")
|
@@ -1692,8 +1721,6 @@ Using this feature also disables the `citations` parameter. For maximal accuracy
|
|
1692
1721
|
obj = strategy
|
1693
1722
|
elif isinstance(strategy, BaseModel):
|
1694
1723
|
obj = strategy.model_dump()
|
1695
|
-
# Explicitly mark the name field as set, so it's always included (even with exclude_unset=True)
|
1696
|
-
strategy.name = strategy.name
|
1697
1724
|
else:
|
1698
1725
|
raise ValueError(
|
1699
1726
|
"RAG strategies must be defined using a valid RagStrategy object or a dictionary"
|
@@ -1812,6 +1839,7 @@ class SummarizedResponse(BaseModel):
|
|
1812
1839
|
title="Summary",
|
1813
1840
|
description="Global summary of all resources combined.",
|
1814
1841
|
)
|
1842
|
+
consumption: Optional[Consumption] = None
|
1815
1843
|
|
1816
1844
|
|
1817
1845
|
class KnowledgeGraphEntity(BaseModel):
|
@@ -1855,7 +1883,8 @@ class FindRequest(BaseSearchRequest):
|
|
1855
1883
|
)
|
1856
1884
|
|
1857
1885
|
search_configuration: Optional[str] = Field(
|
1858
|
-
default=None,
|
1886
|
+
default=None,
|
1887
|
+
description="Load find parameters from this configuration. Parameters in the request override parameters from the configuration.",
|
1859
1888
|
)
|
1860
1889
|
generative_model: Optional[str] = Field(
|
1861
1890
|
default=None,
|
@@ -2060,6 +2089,10 @@ class AugmentedTextBlock(BaseModel):
|
|
2060
2089
|
text: str = Field(
|
2061
2090
|
description="The text of the augmented text block. It may include additional metadata to enrich the context"
|
2062
2091
|
)
|
2092
|
+
position: Optional[TextPosition] = Field(
|
2093
|
+
default=None,
|
2094
|
+
description="Metadata about the position of the text block in the original document.",
|
2095
|
+
)
|
2063
2096
|
parent: Optional[str] = Field(
|
2064
2097
|
default=None, description="The parent text block that was augmented for."
|
2065
2098
|
)
|
@@ -2196,6 +2229,14 @@ class SyncAskResponse(BaseModel):
|
|
2196
2229
|
title="Metadata",
|
2197
2230
|
description="Metadata of the query execution. This includes the number of tokens used in the LLM context and answer, and the timings of the generative model.", # noqa: E501
|
2198
2231
|
)
|
2232
|
+
consumption: Optional[Consumption] = Field(
|
2233
|
+
default=None,
|
2234
|
+
title="Consumption",
|
2235
|
+
description=(
|
2236
|
+
"The consumption of the query execution. Return only if"
|
2237
|
+
" 'X-show-consumption' header is set to true in the request."
|
2238
|
+
),
|
2239
|
+
)
|
2199
2240
|
error_details: Optional[str] = Field(
|
2200
2241
|
default=None,
|
2201
2242
|
title="Error details",
|
@@ -2243,6 +2284,18 @@ class MetadataAskResponseItem(BaseModel):
|
|
2243
2284
|
timings: AskTimings
|
2244
2285
|
|
2245
2286
|
|
2287
|
+
class TokensDetail(BaseModel):
|
2288
|
+
input: float
|
2289
|
+
output: float
|
2290
|
+
image: float
|
2291
|
+
|
2292
|
+
|
2293
|
+
class ConsumptionResponseItem(BaseModel):
|
2294
|
+
type: Literal["consumption"] = "consumption"
|
2295
|
+
normalized_tokens: TokensDetail
|
2296
|
+
customer_key_tokens: TokensDetail
|
2297
|
+
|
2298
|
+
|
2246
2299
|
class AugmentedContextResponseItem(BaseModel):
|
2247
2300
|
type: Literal["augmented_context"] = "augmented_context"
|
2248
2301
|
augmented: AugmentedContext = Field(
|
@@ -2293,6 +2346,7 @@ AskResponseItemType = Union[
|
|
2293
2346
|
RelationsAskResponseItem,
|
2294
2347
|
DebugAskResponseItem,
|
2295
2348
|
PrequeriesAskResponseItem,
|
2349
|
+
ConsumptionResponseItem,
|
2296
2350
|
]
|
2297
2351
|
|
2298
2352
|
|
@@ -2324,7 +2378,11 @@ FindRequest.model_rebuild()
|
|
2324
2378
|
|
2325
2379
|
class CatalogFacetsPrefix(BaseModel):
|
2326
2380
|
prefix: str = Field(pattern="^((/[^/]+)*)$")
|
2327
|
-
depth: Optional[int] = Field(
|
2381
|
+
depth: Optional[int] = Field(
|
2382
|
+
default=None,
|
2383
|
+
ge=0,
|
2384
|
+
description="Only include facets up to this depth from the prefix, leave empty to include all depths",
|
2385
|
+
)
|
2328
2386
|
|
2329
2387
|
@model_validator(mode="before")
|
2330
2388
|
@classmethod
|
@@ -2335,7 +2393,9 @@ class CatalogFacetsPrefix(BaseModel):
|
|
2335
2393
|
|
2336
2394
|
|
2337
2395
|
class CatalogFacetsRequest(BaseModel):
|
2338
|
-
prefixes: list[CatalogFacetsPrefix] = Field(
|
2396
|
+
prefixes: list[CatalogFacetsPrefix] = Field(
|
2397
|
+
default=[], description="List of facets prefixes to include (empty to includ everything)"
|
2398
|
+
)
|
2339
2399
|
|
2340
2400
|
|
2341
2401
|
class CatalogFacetsResponse(BaseModel):
|
{nucliadb_models-6.5.1.post4539.dist-info → nucliadb_models-6.6.1.post649.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nucliadb_models
|
3
|
-
Version: 6.
|
3
|
+
Version: 6.6.1.post649
|
4
4
|
Author-email: Nuclia <nucliadb@nuclia.com>
|
5
5
|
License-Expression: Apache-2.0
|
6
6
|
Project-URL: Homepage, https://nuclia.com
|
@@ -15,6 +15,6 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
15
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
16
16
|
Requires-Python: <4,>=3.9
|
17
17
|
Description-Content-Type: text/markdown
|
18
|
-
Requires-Dist: pydantic
|
18
|
+
Requires-Dist: pydantic!=2.11.5,!=2.11.6,>=2.6
|
19
19
|
|
20
20
|
# NucliaDB models
|
@@ -1,22 +1,22 @@
|
|
1
1
|
nucliadb_models/__init__.py,sha256=3y8-htogKuCZcbhaUZdSjTeEjUSeec9aRWyL8AlKCyM,1077
|
2
|
-
nucliadb_models/common.py,sha256=
|
3
|
-
nucliadb_models/configuration.py,sha256=
|
4
|
-
nucliadb_models/content_types.py,sha256=
|
5
|
-
nucliadb_models/conversation.py,sha256=
|
2
|
+
nucliadb_models/common.py,sha256=YW84w1NAQARObs2nXw6YBgdxQJeVCmTZZr5lSqj-IdQ,7904
|
3
|
+
nucliadb_models/configuration.py,sha256=aTV5mBwYFlwiV1_nWyVAXaCh7F6lDVTVh28Xfwy8ox8,2448
|
4
|
+
nucliadb_models/content_types.py,sha256=36Ga-iGf4ivCqgtXC7imFgegrwHB117s9eqP62JtGv0,3456
|
5
|
+
nucliadb_models/conversation.py,sha256=2igXbzF7kfnOd6qjY-b0AZSAjI7O3sLpL0Cp-uSfJvA,3390
|
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
|
9
9
|
nucliadb_models/extracted.py,sha256=Zh79jrOcqedVYc36qM4D5qrOn5RutTuJAHusEeyIDiU,6245
|
10
|
-
nucliadb_models/file.py,sha256=
|
11
|
-
nucliadb_models/filters.py,sha256=
|
10
|
+
nucliadb_models/file.py,sha256=ZfxnXeigmMkoZ5ae22g-JvlYf8UBz4-pkx1t7aOL8Rs,1747
|
11
|
+
nucliadb_models/filters.py,sha256=NQI2-4AFzzJuZy8NeY3jXlTbbU5wxiwMCP-5DrD-7lE,14759
|
12
12
|
nucliadb_models/labels.py,sha256=9zqRgkpZuX3kUPwsTTgCH7JyOWK7dM5pwyuHJR86YdU,3949
|
13
13
|
nucliadb_models/link.py,sha256=cfMOwaKDnaYSMxD5QClBu2Ab1orGfuTurFqNozp3KFk,2010
|
14
|
-
nucliadb_models/metadata.py,sha256=
|
15
|
-
nucliadb_models/notifications.py,sha256=
|
14
|
+
nucliadb_models/metadata.py,sha256=MFVYnpXMBoY4ylMg029o7yDKGxhK7NB0c0FSshzJHm4,8356
|
15
|
+
nucliadb_models/notifications.py,sha256=mna8-AoD_29Wds0Thl0AF0zpERnJmYGLZX1w1fUopMY,4036
|
16
16
|
nucliadb_models/processing.py,sha256=nhKuHQjqCdb9zJVkYGPTLub23tK9e_lwL5OCDVymZjY,719
|
17
17
|
nucliadb_models/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
18
18
|
nucliadb_models/resource.py,sha256=FkhwmbjoqQBGyKQIqa40WK2Vq3wtryZeIVWmJ4b-84g,9003
|
19
|
-
nucliadb_models/search.py,sha256=
|
19
|
+
nucliadb_models/search.py,sha256=UtENf6-osZ6TvV7EzqrBN67GfZtrBhCZEo3qBi15ejs,91648
|
20
20
|
nucliadb_models/security.py,sha256=opxaDLfvk3aU0sjesK0jGrYLx5h4YCwlKKN0moYs_ig,1150
|
21
21
|
nucliadb_models/synonyms.py,sha256=afbaVqSQSxGLwi2PusVaLSRpkOtA5AZmWOKd1f4nl2E,690
|
22
22
|
nucliadb_models/text.py,sha256=kY2ub7AaGm-4vNaLX3Ju2VvRw-eKZ2LRdM9z7XCNaG0,2898
|
@@ -27,12 +27,12 @@ nucliadb_models/vectorsets.py,sha256=XAgg9DfdfLYpfLh9OepJ_KPH0_RqRQNpVZJr74UnNh0
|
|
27
27
|
nucliadb_models/writer.py,sha256=diwrarp6DxjSUoRmdEljZb68z_ghNvpOgPUGZeKg328,8220
|
28
28
|
nucliadb_models/agents/ingestion.py,sha256=W9cJ0dQT_1vPcjeJ4_Fjb8DylnhQ6qqZrY4v8x1RqUs,3093
|
29
29
|
nucliadb_models/graph/__init__.py,sha256=X538kZPZnndmQeEtnzzPv1hYVGUTDe9U1O7UmAqqxXU,645
|
30
|
-
nucliadb_models/graph/requests.py,sha256=
|
30
|
+
nucliadb_models/graph/requests.py,sha256=ppQ7cOnybvrw1wGC7qDps-182PfmicWU6-4vLRfK16w,7169
|
31
31
|
nucliadb_models/graph/responses.py,sha256=Sdq8OgFAL1YT-1lJyLLrkqcScvj7YTEqAUwQ-kFAk9M,1399
|
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.
|
36
|
-
nucliadb_models-6.
|
37
|
-
nucliadb_models-6.
|
38
|
-
nucliadb_models-6.
|
35
|
+
nucliadb_models-6.6.1.post649.dist-info/METADATA,sha256=aQDjfCVzxJCAXnx5A41A_rX9EE3x6jsXzo1MbaBXbBs,793
|
36
|
+
nucliadb_models-6.6.1.post649.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
37
|
+
nucliadb_models-6.6.1.post649.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
|
38
|
+
nucliadb_models-6.6.1.post649.dist-info/RECORD,,
|
File without changes
|
{nucliadb_models-6.5.1.post4539.dist-info → nucliadb_models-6.6.1.post649.dist-info}/top_level.txt
RENAMED
File without changes
|