nucliadb-models 6.3.3.post3626__py3-none-any.whl → 6.3.3.post3628__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.

@@ -19,9 +19,11 @@
19
19
  #
20
20
 
21
21
  import warnings
22
- from typing import Optional
22
+ from typing import Annotated, Literal, Optional, Union
23
23
 
24
- from pydantic import BaseModel
24
+ from pydantic import BaseModel, Field, create_model
25
+
26
+ from .search import AskRequest, FindRequest
25
27
 
26
28
 
27
29
  class KBConfiguration(BaseModel):
@@ -35,3 +37,45 @@ class KBConfiguration(BaseModel):
35
37
  ner_model: Optional[str] = None
36
38
  anonymization_model: Optional[str] = None
37
39
  visual_labeling: Optional[str] = None
40
+
41
+
42
+ #
43
+ # Search configurations
44
+ #
45
+
46
+ # FindConfig is a FindConfig without `search_configuration`
47
+ FindConfig = create_model(
48
+ "FindConfig",
49
+ **{
50
+ name: (field.annotation, field)
51
+ for name, field in FindRequest.model_fields.items()
52
+ if name not in ("search_configuration")
53
+ },
54
+ ) # type: ignore[call-overload]
55
+
56
+
57
+ class FindSearchConfiguration(BaseModel):
58
+ kind: Literal["find"]
59
+ config: FindConfig # type: ignore[valid-type]
60
+
61
+
62
+ # AskConfig is an AskRequest where `query` is not mandatory and without `search_configuration`
63
+ AskConfig = create_model(
64
+ "AskConfig",
65
+ **{
66
+ name: (field.annotation, field)
67
+ for name, field in AskRequest.model_fields.items()
68
+ if name not in ("query", "search_configuration")
69
+ },
70
+ query=(Optional[str], None),
71
+ ) # type: ignore[call-overload]
72
+
73
+
74
+ class AskSearchConfiguration(BaseModel):
75
+ kind: Literal["ask"]
76
+ config: AskConfig # type: ignore[valid-type]
77
+
78
+
79
+ SearchConfiguration = Annotated[
80
+ Union[FindSearchConfiguration, AskSearchConfiguration], Field(discriminator="kind")
81
+ ]
@@ -126,8 +126,6 @@ GraphNodesQuery = Annotated[
126
126
  Annotated[And["GraphNodesQuery"], Tag("and")],
127
127
  Annotated[Or["GraphNodesQuery"], Tag("or")],
128
128
  Annotated[Not["GraphNodesQuery"], Tag("not")],
129
- Annotated[SourceNode, Tag("source_node")],
130
- Annotated[DestinationNode, Tag("destination_node")],
131
129
  Annotated[AnyNode, Tag("node")],
132
130
  ],
133
131
  Discriminator(graph_query_discriminator),
nucliadb_models/search.py CHANGED
@@ -1583,6 +1583,10 @@ Using this feature also disables the `citations` parameter. For maximal accuracy
1583
1583
  description="Whether to generate an answer using the generative model. If set to false, the response will only contain the retrieval results.",
1584
1584
  )
1585
1585
 
1586
+ search_configuration: Optional[str] = Field(
1587
+ default=None, description="Load ask parameters from this configuration"
1588
+ )
1589
+
1586
1590
  @field_validator("rag_strategies", mode="before")
1587
1591
  @classmethod
1588
1592
  def validate_rag_strategies(cls, rag_strategies: list[RagStrategies]) -> list[RagStrategies]:
@@ -1739,6 +1743,10 @@ class FindRequest(BaseSearchRequest):
1739
1743
  ],
1740
1744
  )
1741
1745
 
1746
+ search_configuration: Optional[str] = Field(
1747
+ default=None, description="Load find parameters from this configuration"
1748
+ )
1749
+
1742
1750
  @field_validator("features", mode="after")
1743
1751
  @classmethod
1744
1752
  def fulltext_not_supported(cls, v):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nucliadb_models
3
- Version: 6.3.3.post3626
3
+ Version: 6.3.3.post3628
4
4
  Author-email: Nuclia <nucliadb@nuclia.com>
5
5
  License: AGPL
6
6
  Project-URL: Homepage, https://nuclia.com
@@ -1,6 +1,6 @@
1
1
  nucliadb_models/__init__.py,sha256=qSmhNKACMwdbU1rklMWlmJKmlRaWvrSksTtwEVkiydQ,1331
2
2
  nucliadb_models/common.py,sha256=JEEY7_AxRCBPHUF6J8XptR_QnGEjRBd02Kqm5WOySYc,7828
3
- nucliadb_models/configuration.py,sha256=pKtxS8G_tGaJkvKopVeorZTuOEirlg-VLcpxUEAn2lc,1359
3
+ nucliadb_models/configuration.py,sha256=7iUgSCkmFinu6clCfT54P5tuz5Lvf6eJVmahYjwI7qk,2525
4
4
  nucliadb_models/content_types.py,sha256=2B3TJpPYJqd-9xGiNiHJFngSIrVyNsZlN4PeB-HafIk,3682
5
5
  nucliadb_models/conversation.py,sha256=i9x80US5e2I40zIIxeQg8BtaNri_qmuk1cSb_6VZu6U,3845
6
6
  nucliadb_models/entities.py,sha256=IqsbF0dSCWkp222sd_R2Ste0iG1eoBPNh1Fh6mNVcu0,2608
@@ -16,7 +16,7 @@ nucliadb_models/notifications.py,sha256=jr2J3zncs880jYf2oZHYt0VFcnlZevsbkyX69ovT
16
16
  nucliadb_models/processing.py,sha256=UeU-VxbBlOzkNxviOS3a0X_k7Ye-jYu3UOdGuu21M8M,971
17
17
  nucliadb_models/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  nucliadb_models/resource.py,sha256=cjYloaRuCJFc3lGIxLZcX959oOq_N1f3V9bpPMYv4WA,9255
19
- nucliadb_models/search.py,sha256=xukR-wsHXiXnmYhF3Qo2WBILV8Z1JGyp0y_J2thgDM0,81778
19
+ nucliadb_models/search.py,sha256=gfoJvW1rkPmHCYPWRa-3TMqDJB5ANDyCtjgrD3K0NpQ,82051
20
20
  nucliadb_models/security.py,sha256=RewdzQ55nPZ9V7B0NX9KHeWg6B4Hg_RkeiFv2TQyrjs,1402
21
21
  nucliadb_models/synonyms.py,sha256=qXTPHfspMgw22hCjAOdFOIoUsRZ7Ju3JW-Lw9Nz4VaI,942
22
22
  nucliadb_models/text.py,sha256=RHN55PzQjyC0ghbf0r5GvVjTbFUTWzEDSCCkHkgnfig,3491
@@ -27,12 +27,12 @@ nucliadb_models/vectorsets.py,sha256=avxwO9JPX2k5sCniuNhh2MSsP7aRNvf1eB1-h3-Ju1o
27
27
  nucliadb_models/writer.py,sha256=OLtCGmicpVf56pXi2_myTAvStpnaBKKOVNtZzHkKKtw,8472
28
28
  nucliadb_models/agents/ingestion.py,sha256=mV7gV6VpYg4VNpc59K3275TMUJZbUzeUnp3SZzO5uxY,3137
29
29
  nucliadb_models/graph/__init__.py,sha256=eu_1UK7GlBQRg5IRUqJkxVMcBxkXeqX4SZL6fuvwjDg,897
30
- nucliadb_models/graph/requests.py,sha256=fQUoF89Y8IKFkDVQB0Lhxnv7bw0YSDec0NZ9-6-y-5Q,4507
30
+ nucliadb_models/graph/requests.py,sha256=CHUIpaYs-4Sdt5XktV45nF_mVThapvFb6mPSWL7MEUg,4395
31
31
  nucliadb_models/graph/responses.py,sha256=UXDwFY4va6p6T3kgNJSA4iZ7PrLBR5ibyXw_moQixj0,1614
32
32
  nucliadb_models/internal/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
33
33
  nucliadb_models/internal/predict.py,sha256=5rgUPrH_98gerySOZ-TR2PX_qzCGF1_8VxyOu3bGhis,2281
34
34
  nucliadb_models/internal/shards.py,sha256=uZLsMkYWrJDHq3xy_w7snSeV2X3aDBuht9GC_MG3sKc,1976
35
- nucliadb_models-6.3.3.post3626.dist-info/METADATA,sha256=Hns2Fz9RF2mC19pUR4a-WVz-2fVZ5DW178yu8Ml6jdE,759
36
- nucliadb_models-6.3.3.post3626.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
37
- nucliadb_models-6.3.3.post3626.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
38
- nucliadb_models-6.3.3.post3626.dist-info/RECORD,,
35
+ nucliadb_models-6.3.3.post3628.dist-info/METADATA,sha256=TeOFLxcWFBx5asjqLQltwD35lFPiNEawSKkSFVD-jrs,759
36
+ nucliadb_models-6.3.3.post3628.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
37
+ nucliadb_models-6.3.3.post3628.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
38
+ nucliadb_models-6.3.3.post3628.dist-info/RECORD,,