nucliadb-models 6.4.0.post4227__py3-none-any.whl → 6.4.0.post4265__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.
@@ -20,14 +20,15 @@
20
20
 
21
21
  from enum import Enum
22
22
  from typing import Any, Generic, Literal, Optional, TypeVar, Union
23
+ from uuid import UUID
23
24
 
24
25
  import pydantic
25
- from pydantic import AliasChoices, BaseModel, Discriminator, Tag, model_validator
26
+ from pydantic import AliasChoices, BaseModel, Discriminator, Tag, field_validator, model_validator
26
27
  from typing_extensions import Annotated, Self
27
28
 
28
29
  from .common import FieldTypeName, Paragraph
29
30
  from .metadata import ResourceProcessingStatus
30
- from .utils import DateTime
31
+ from .utils import DateTime, SlugString
31
32
 
32
33
  F = TypeVar("F", bound=BaseModel)
33
34
 
@@ -72,8 +73,19 @@ class Resource(BaseModel, extra="forbid"):
72
73
  """Matches all fields of a resource given its id or slug"""
73
74
 
74
75
  prop: Literal["resource"] = "resource"
75
- id: Optional[str] = pydantic.Field(default=None, description="ID of the resource to match")
76
- slug: Optional[str] = pydantic.Field(default=None, description="Slug of the resource to match")
76
+ id: Optional[str] = pydantic.Field(default=None, description="UUID of the resource to match")
77
+ slug: Optional[SlugString] = pydantic.Field(
78
+ default=None, description="Slug of the resource to match"
79
+ )
80
+
81
+ @field_validator("id", mode="after")
82
+ def validate_id(cls, v: str) -> str:
83
+ if v is not None:
84
+ try:
85
+ UUID(v)
86
+ except ValueError:
87
+ raise ValueError("Invalid UUID")
88
+ return v
77
89
 
78
90
  @model_validator(mode="after")
79
91
  def single_field(self) -> Self:
nucliadb_models/search.py CHANGED
@@ -1905,6 +1905,15 @@ class KnowledgeboxFindResults(JsonBaseModel):
1905
1905
  title="Best matches",
1906
1906
  description="List of ids of best matching paragraphs. The list is sorted by decreasing relevance (most relevant first).", # noqa: E501
1907
1907
  )
1908
+ metrics: Optional[dict[str, Any]] = Field(
1909
+ default=None,
1910
+ title="Metrics",
1911
+ description=(
1912
+ "Metrics information about the search operation. "
1913
+ "The metadata included in this field is subject to change and should not be used in production. "
1914
+ "This is only available if the `debug` parameter is set to true in the request."
1915
+ ),
1916
+ )
1908
1917
 
1909
1918
 
1910
1919
  class FeedbackTasks(str, Enum):
@@ -2077,7 +2086,11 @@ class SyncAskResponse(BaseModel):
2077
2086
  debug: Optional[dict[str, Any]] = Field(
2078
2087
  default=None,
2079
2088
  title="Debug information",
2080
- description="Debug information about predict",
2089
+ description=(
2090
+ "Debug information about the ask operation. "
2091
+ "The metadata included in this field is subject to change and should not be used in production. "
2092
+ "Note that it is only available if the `debug` parameter is set to true in the request."
2093
+ ),
2081
2094
  )
2082
2095
 
2083
2096
 
@@ -2137,6 +2150,7 @@ class RelationsAskResponseItem(BaseModel):
2137
2150
  class DebugAskResponseItem(BaseModel):
2138
2151
  type: Literal["debug"] = "debug"
2139
2152
  metadata: dict[str, Any]
2153
+ metrics: dict[str, Any]
2140
2154
 
2141
2155
 
2142
2156
  AskResponseItemType = Union[
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb_models
3
- Version: 6.4.0.post4227
3
+ Version: 6.4.0.post4265
4
4
  Author-email: Nuclia <nucliadb@nuclia.com>
5
5
  License: AGPL
6
6
  Project-URL: Homepage, https://nuclia.com
@@ -8,7 +8,7 @@ nucliadb_models/export_import.py,sha256=A1KTjwQCRtyVAWcgabXsdltI78rauXBmZX1ie6Rx
8
8
  nucliadb_models/external_index_providers.py,sha256=aVyj-P4kVqfqPjF13E_lUM0FZsq8-DTbIsh-kHOgt2s,1787
9
9
  nucliadb_models/extracted.py,sha256=CBeC0hUphXq1T79K7Cpohuyg7f1pqTB4WGErb0HGgRs,6497
10
10
  nucliadb_models/file.py,sha256=FKnaYUZPjxCEDUpbyDTudnHHKeSuQLfBnRR2FL6tL2s,1992
11
- nucliadb_models/filters.py,sha256=fVbQLwzidnugeYBSAvc_NN32UwcGg44y2DMsuBFnvoM,14182
11
+ nucliadb_models/filters.py,sha256=xWSs5vHowbEHLfGGh8BTKBCZmFMY_rx6T0FR8Do2iPE,14503
12
12
  nucliadb_models/labels.py,sha256=OUlX-apmFkibEN9bWThRJlbCD84hzJdddN1YYUV2Y3w,4201
13
13
  nucliadb_models/link.py,sha256=x6YainEQ9gx6X1KF8oelA-RTaqjOesoWJNYENihDfgo,2262
14
14
  nucliadb_models/metadata.py,sha256=ppwU__5IWHvBNDUT5EGLZxgpSBTwuA-rEpY-8Ef-Lwo,8600
@@ -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=AviTtBGQZ-zAKYbD-rprzX7yfIjsIh09IW4sDbC9FnU,83666
19
+ nucliadb_models/search.py,sha256=Eq4Q6Xb4Tz_PQHAAKExJ2cdsjKYARWb1c5N_btNXp2I,84340
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=dr-ckEIK0a8c5u-7uO1wpund_8KKb_4T79Au4Lfv-Bo,3150
@@ -32,7 +32,7 @@ nucliadb_models/graph/responses.py,sha256=3aimAHrd3YW1BXHU_ZXRoidlccRtkCcREkfCNo
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=bcnkxF_zViHZfT6WTAMBcWgY3UV-OAV65cVdSqGkcHY,1943
35
- nucliadb_models-6.4.0.post4227.dist-info/METADATA,sha256=gPGn1QjOaiVSqJR0o5teMnWoLK0w_B3lOpYriRRvMlU,759
36
- nucliadb_models-6.4.0.post4227.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
37
- nucliadb_models-6.4.0.post4227.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
38
- nucliadb_models-6.4.0.post4227.dist-info/RECORD,,
35
+ nucliadb_models-6.4.0.post4265.dist-info/METADATA,sha256=t45eYQsz8Y7waNfmXhdtU6A_qCRBBddctYfwugEaOy0,759
36
+ nucliadb_models-6.4.0.post4265.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
37
+ nucliadb_models-6.4.0.post4265.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
38
+ nucliadb_models-6.4.0.post4265.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.3.1)
2
+ Generator: setuptools (80.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5