nucliadb-models 6.9.2.post5264__py3-none-any.whl → 6.9.2.post5276__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/search.py CHANGED
@@ -79,8 +79,9 @@ ANSWER_JSON_SCHEMA_EXAMPLE = {
79
79
  class ModelParamDefaults:
80
80
  applied_autofilters = ParamDefault(
81
81
  default=[],
82
- title="Autofilters",
83
- description="List of filters automatically applied to the search query",
82
+ title="Applied autofilters",
83
+ description="[deprecated] list of filters automatically applied to the search query",
84
+ deprecated=True,
84
85
  )
85
86
 
86
87
 
@@ -296,6 +297,8 @@ class KnowledgeboxSearchResults(JsonBaseModel):
296
297
  relations: Optional[Relations] = None
297
298
  nodes: Optional[list[dict[str, str]]] = None
298
299
  shards: Optional[list[str]] = None
300
+
301
+ # TODO: remove on a future major release
299
302
  autofilters: list[str] = ModelParamDefaults.applied_autofilters.to_pydantic_field()
300
303
 
301
304
 
@@ -481,12 +484,6 @@ class SearchParamDefaults:
481
484
  description="The list of facets to calculate. The facets follow the same syntax as filters: https://docs.nuclia.dev/docs/rag/advanced/search-filters", # noqa: E501
482
485
  max_items=50,
483
486
  )
484
- autofilter = ParamDefault(
485
- default=False,
486
- title="Automatic search filtering",
487
- description="[Deprecated] If set to true, the search will automatically add filters to the query. For example, it will filter results containing the entities detected in the query", # noqa: E501
488
- deprecated=True,
489
- )
490
487
  chat_query = ParamDefault(
491
488
  default=...,
492
489
  title="Query",
@@ -877,7 +874,9 @@ class BaseSearchRequest(AuditMetadataBase):
877
874
  vectorset: Optional[str] = SearchParamDefaults.vectorset.to_pydantic_field()
878
875
  with_duplicates: bool = SearchParamDefaults.with_duplicates.to_pydantic_field()
879
876
  with_synonyms: bool = SearchParamDefaults.with_synonyms.to_pydantic_field()
880
- autofilter: bool = SearchParamDefaults.autofilter.to_pydantic_field()
877
+ # autofilter is deprecated and its logic was removed. We're just keeping it in the model definition to
878
+ # avoid breaking changes in the python sdks. Please remove on a future major release.
879
+ autofilter: SkipJsonSchema[bool] = False
881
880
  resource_filters: list[str] = SearchParamDefaults.resource_filters.to_pydantic_field()
882
881
  security: Optional[RequestSecurity] = SearchParamDefaults.security.to_pydantic_field()
883
882
  show_hidden: bool = SearchParamDefaults.show_hidden.to_pydantic_field()
@@ -1171,7 +1170,7 @@ ALLOWED_FIELD_TYPES: dict[str, str] = {
1171
1170
  "t": "text",
1172
1171
  "f": "file",
1173
1172
  "u": "link",
1174
- "d": "datetime",
1173
+ "c": "conversation",
1175
1174
  "a": "generic",
1176
1175
  }
1177
1176
 
@@ -1179,16 +1178,19 @@ ALLOWED_FIELD_TYPES: dict[str, str] = {
1179
1178
  class FieldExtensionStrategy(RagStrategy):
1180
1179
  name: Literal["field_extension"] = "field_extension"
1181
1180
  fields: list[str] = Field(
1181
+ default=[],
1182
1182
  title="Fields",
1183
- description="List of field ids to extend the context with. It will try to extend the retrieval context with the specified fields in the matching resources. The field ids have to be in the format `{field_type}/{field_name}`, like 'a/title', 'a/summary' for title and summary fields or 't/amend' for a text field named 'amend'.", # noqa: E501
1184
- min_length=1,
1183
+ description="List of field ids to extend the context with. It will try to extend the retrieval context with the specified fields in the matching resources. The field ids have to be in the format `{field_type}/{field_name}`, like 'a/title', 'a/summary' for title and summary fields or 't/amend' for a text field named 'amend'.",
1184
+ )
1185
+ data_augmentation_field_prefixes: list[str] = Field(
1186
+ default=[],
1187
+ description="List of prefixes for data augmentation added fields to extend the context with. For example, if the prefix is 'simpson', all fields that are a result of data augmentation with that prefix will be used to extend the context.",
1185
1188
  )
1186
1189
 
1187
- @field_validator("fields", mode="after")
1188
- @classmethod
1189
- def fields_validator(cls, fields) -> Self:
1190
+ @model_validator(mode="after")
1191
+ def field_extension_strategy_validator(self) -> Self:
1190
1192
  # Check that the fields are in the format {field_type}/{field_name}
1191
- for field in fields:
1193
+ for field in self.fields:
1192
1194
  try:
1193
1195
  field_type, _ = field.strip("/").split("/")
1194
1196
  except ValueError:
@@ -1201,8 +1203,7 @@ class FieldExtensionStrategy(RagStrategy):
1201
1203
  f"Field '{field}' does not have a valid field type. "
1202
1204
  f"Valid field types are: {allowed_field_types_part}."
1203
1205
  )
1204
-
1205
- return fields
1206
+ return self
1206
1207
 
1207
1208
 
1208
1209
  class FullResourceApplyTo(BaseModel):
@@ -1620,7 +1621,11 @@ class AskRequest(AuditMetadataBase):
1620
1621
  description="Image that will be used together with the query text for retrieval and then sent to the LLM as part of the context. "
1621
1622
  "If a query image is provided, the `extra_context_images` and `rag_images_strategies` will be disabled.",
1622
1623
  )
1623
- autofilter: bool = SearchParamDefaults.autofilter.to_pydantic_field()
1624
+
1625
+ # autofilter is deprecated and its logic was removed. We're just keeping it in the model definition to
1626
+ # avoid breaking changes in the python sdks. Please remove on a future major release.
1627
+ autofilter: SkipJsonSchema[bool] = False
1628
+
1624
1629
  highlight: bool = SearchParamDefaults.highlight.to_pydantic_field()
1625
1630
  resource_filters: list[str] = SearchParamDefaults.resource_filters.to_pydantic_field()
1626
1631
  prompt: Optional[Union[str, CustomPrompt]] = Field(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb_models
3
- Version: 6.9.2.post5264
3
+ Version: 6.9.2.post5276
4
4
  Author-email: Nuclia <nucliadb@nuclia.com>
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Homepage, https://nuclia.com
@@ -17,7 +17,7 @@ nucliadb_models/notifications.py,sha256=mna8-AoD_29Wds0Thl0AF0zpERnJmYGLZX1w1fUo
17
17
  nucliadb_models/processing.py,sha256=nhKuHQjqCdb9zJVkYGPTLub23tK9e_lwL5OCDVymZjY,719
18
18
  nucliadb_models/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  nucliadb_models/resource.py,sha256=RzCos0QRgSMkaV-p7EoceSmt7UTzt9G9be5BKF-iGrQ,9021
20
- nucliadb_models/search.py,sha256=tUedQpOY1OKnhCybnU-0dae3f6QjoN3rDVhwgDgLj5Y,96008
20
+ nucliadb_models/search.py,sha256=gQEXJ9bXXcxswr7aOzvBeGIQlrq5TgRWIqTxKEbSoCE,96409
21
21
  nucliadb_models/security.py,sha256=opxaDLfvk3aU0sjesK0jGrYLx5h4YCwlKKN0moYs_ig,1150
22
22
  nucliadb_models/synonyms.py,sha256=afbaVqSQSxGLwi2PusVaLSRpkOtA5AZmWOKd1f4nl2E,690
23
23
  nucliadb_models/text.py,sha256=60bxZnOjRHnDdezR8VfR3AZsXTOwePFPs2BKB8wxBak,3414
@@ -33,7 +33,7 @@ nucliadb_models/graph/responses.py,sha256=Sdq8OgFAL1YT-1lJyLLrkqcScvj7YTEqAUwQ-k
33
33
  nucliadb_models/internal/__init__.py,sha256=zG33bUz1rHFPtvqQPWn4rDwBJt3FJodGuQYD45quiQg,583
34
34
  nucliadb_models/internal/predict.py,sha256=Pnx6MmLfK65eExe1XnVxqmSlvMwdowewwks9BOEoqMw,2029
35
35
  nucliadb_models/internal/shards.py,sha256=__y1OZtWGiNcPQEWfSFOj8yw458WGi7mM4vZe0K-L1Y,1691
36
- nucliadb_models-6.9.2.post5264.dist-info/METADATA,sha256=aBDsPQemmUthQ8Qtj5Bb4fFqK__CGokAGLFWWW8zVbk,745
37
- nucliadb_models-6.9.2.post5264.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
- nucliadb_models-6.9.2.post5264.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
39
- nucliadb_models-6.9.2.post5264.dist-info/RECORD,,
36
+ nucliadb_models-6.9.2.post5276.dist-info/METADATA,sha256=-kzs6LaR18FXQmyL87mIkJuOTwmGhctfqrU9Rn1AGuY,745
37
+ nucliadb_models-6.9.2.post5276.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
+ nucliadb_models-6.9.2.post5276.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
39
+ nucliadb_models-6.9.2.post5276.dist-info/RECORD,,