nucliadb-models 6.6.1.post4571__py3-none-any.whl → 6.6.1.post4584__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.
@@ -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,7 +32,7 @@ F = TypeVar("F", bound=BaseModel)
31
32
  class And(BaseModel, Generic[F], extra="forbid"):
32
33
  """AND of other expressions"""
33
34
 
34
- operands: list[F] = pydantic.Field(
35
+ operands: Sequence[F] = pydantic.Field(
35
36
  serialization_alias="and", validation_alias=AliasChoices("operands", "and"), min_length=1
36
37
  )
37
38
 
@@ -43,7 +44,7 @@ class And(BaseModel, Generic[F], extra="forbid"):
43
44
  class Or(BaseModel, Generic[F], extra="forbid"):
44
45
  """OR of other expressions"""
45
46
 
46
- operands: list[F] = pydantic.Field(
47
+ operands: Sequence[F] = pydantic.Field(
47
48
  serialization_alias="or", validation_alias=AliasChoices("operands", "or"), min_length=1
48
49
  )
49
50
 
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 = {
@@ -1815,6 +1817,7 @@ class SummarizedResponse(BaseModel):
1815
1817
  title="Summary",
1816
1818
  description="Global summary of all resources combined.",
1817
1819
  )
1820
+ consumption: Optional[Consumption] = None
1818
1821
 
1819
1822
 
1820
1823
  class KnowledgeGraphEntity(BaseModel):
@@ -2200,6 +2203,14 @@ class SyncAskResponse(BaseModel):
2200
2203
  title="Metadata",
2201
2204
  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
2202
2205
  )
2206
+ consumption: Optional[Consumption] = Field(
2207
+ default=None,
2208
+ title="Consumption",
2209
+ description=(
2210
+ "The consumption of the query execution. Return only if"
2211
+ " 'X-show-consumption' header is set to true in the request."
2212
+ ),
2213
+ )
2203
2214
  error_details: Optional[str] = Field(
2204
2215
  default=None,
2205
2216
  title="Error details",
@@ -2247,6 +2258,18 @@ class MetadataAskResponseItem(BaseModel):
2247
2258
  timings: AskTimings
2248
2259
 
2249
2260
 
2261
+ class TokensDetail(BaseModel):
2262
+ input: float
2263
+ output: float
2264
+ image: float
2265
+
2266
+
2267
+ class ConsumptionResponseItem(BaseModel):
2268
+ type: Literal["consumption"] = "consumption"
2269
+ normalized_tokens: TokensDetail
2270
+ customer_key_tokens: TokensDetail
2271
+
2272
+
2250
2273
  class AugmentedContextResponseItem(BaseModel):
2251
2274
  type: Literal["augmented_context"] = "augmented_context"
2252
2275
  augmented: AugmentedContext = Field(
@@ -2297,6 +2320,7 @@ AskResponseItemType = Union[
2297
2320
  RelationsAskResponseItem,
2298
2321
  DebugAskResponseItem,
2299
2322
  PrequeriesAskResponseItem,
2323
+ ConsumptionResponseItem,
2300
2324
  ]
2301
2325
 
2302
2326
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb_models
3
- Version: 6.6.1.post4571
3
+ Version: 6.6.1.post4584
4
4
  Author-email: Nuclia <nucliadb@nuclia.com>
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Homepage, https://nuclia.com
@@ -8,7 +8,7 @@ nucliadb_models/export_import.py,sha256=mNm9IArOLnC6TLupkwqVFhxD5d08mpIVOVFneECv
8
8
  nucliadb_models/external_index_providers.py,sha256=IIKjJjLixWQC1zrbzam2FDcAo5UUxShZfueZSxqZu8Y,1535
9
9
  nucliadb_models/extracted.py,sha256=Zh79jrOcqedVYc36qM4D5qrOn5RutTuJAHusEeyIDiU,6245
10
10
  nucliadb_models/file.py,sha256=U66oSmywTWqE48mpNv9KG4X--XZtNI9i4Kl3EcYSLLM,1740
11
- nucliadb_models/filters.py,sha256=jRIj0nLupOp8KcS8oXTuC2EwheIJFZd_b4Y9jVwyov8,14251
11
+ nucliadb_models/filters.py,sha256=KZwVTcqtY2HoGn_MuK5gBPTJSjL-lwoAXsnsLS6HdCA,14296
12
12
  nucliadb_models/labels.py,sha256=9zqRgkpZuX3kUPwsTTgCH7JyOWK7dM5pwyuHJR86YdU,3949
13
13
  nucliadb_models/link.py,sha256=cfMOwaKDnaYSMxD5QClBu2Ab1orGfuTurFqNozp3KFk,2010
14
14
  nucliadb_models/metadata.py,sha256=7rCIpeWjvqDk4ytIVP3azR9Qmm5PTGVI1BNkNLXfHVo,8348
@@ -16,7 +16,7 @@ nucliadb_models/notifications.py,sha256=3w1HeX9F8nuA7WupHdpXIksX7d0bHO9ofmemYp4R
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=njGUScrDA2Dn1y26lQ9_dVYzHIldkPMVpDgP7zstgXk,90163
19
+ nucliadb_models/search.py,sha256=eV3XKS4XbR8iw0Rnw3S3OTRLvjB_iHgWqezGnDrXIIU,90829
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
@@ -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.6.1.post4571.dist-info/METADATA,sha256=PbCAUMn08ntlTz7Lo3AcHErXM0ALhbc1yX8rrwGbWzk,794
36
- nucliadb_models-6.6.1.post4571.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
- nucliadb_models-6.6.1.post4571.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
38
- nucliadb_models-6.6.1.post4571.dist-info/RECORD,,
35
+ nucliadb_models-6.6.1.post4584.dist-info/METADATA,sha256=fz9kWvEuuAPmk3-JYssjzarXREkuPXXughb3r9D1RKg,794
36
+ nucliadb_models-6.6.1.post4584.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
+ nucliadb_models-6.6.1.post4584.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
38
+ nucliadb_models-6.6.1.post4584.dist-info/RECORD,,