nucliadb-models 6.5.0.post4426__py3-none-any.whl → 6.5.0.post4484__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.
@@ -116,7 +116,7 @@ class GraphFilterExpression(BaseModel, extra="forbid"):
116
116
 
117
117
 
118
118
  class BaseGraphSearchRequest(BaseModel):
119
- top_k: int = Field(default=50, title="Number of results to retrieve")
119
+ top_k: int = Field(default=50, le=500, title="Number of results to retrieve")
120
120
  filter_expression: Optional[GraphFilterExpression] = Field(
121
121
  default=None,
122
122
  title="Filter resource by an expression",
nucliadb_models/search.py CHANGED
@@ -2035,6 +2035,39 @@ def validate_facets(facets):
2035
2035
  return facets
2036
2036
 
2037
2037
 
2038
+ class TextBlockAugmentationType(str, Enum):
2039
+ NEIGHBOURING_PARAGRAPHS = "neighbouring_paragraphs"
2040
+ CONVERSATION = "conversation"
2041
+ HIERARCHY = "hierarchy"
2042
+ FULL_RESOURCE = "full_resource"
2043
+ FIELD_EXTENSION = "field_extension"
2044
+ METADATA_EXTENSION = "metadata_extension"
2045
+
2046
+
2047
+ class AugmentedTextBlock(BaseModel):
2048
+ id: str = Field(
2049
+ description="The id of the augmented text bloc. It can be a paragraph id or a field id."
2050
+ )
2051
+ text: str = Field(
2052
+ description="The text of the augmented text block. It may include additional metadata to enrich the context"
2053
+ )
2054
+ parent: Optional[str] = Field(
2055
+ default=None, description="The parent text block that was augmented for."
2056
+ )
2057
+ augmentation_type: TextBlockAugmentationType = Field(description="Type of augmentation.")
2058
+
2059
+
2060
+ class AugmentedContext(BaseModel):
2061
+ paragraphs: dict[str, AugmentedTextBlock] = Field(
2062
+ default={},
2063
+ description="Paragraphs added to the context as a result of using the `rag_strategies` parameter, typically the neighbouring_paragraphs or the conversation strategies",
2064
+ )
2065
+ fields: dict[str, AugmentedTextBlock] = Field(
2066
+ default={},
2067
+ description="Field extracted texts added to the context as a result of using the `rag_strategies` parameter, typically the hierarcy or full_resource strategies.",
2068
+ )
2069
+
2070
+
2038
2071
  class AskTokens(BaseModel):
2039
2072
  input: int = Field(
2040
2073
  title="Input tokens",
@@ -2132,6 +2165,13 @@ class SyncAskResponse(BaseModel):
2132
2165
  title="Citations",
2133
2166
  description="The citations of the answer. List of references to the resources used to generate the answer.",
2134
2167
  )
2168
+ augmented_context: Optional[AugmentedContext] = Field(
2169
+ default=None,
2170
+ description=(
2171
+ "Augmented text blocks that were sent to the LLM as part of the RAG strategies "
2172
+ "applied on the retrieval results in the request."
2173
+ ),
2174
+ )
2135
2175
  prompt_context: Optional[list[str]] = Field(
2136
2176
  default=None,
2137
2177
  title="Prompt context",
@@ -2194,6 +2234,16 @@ class MetadataAskResponseItem(BaseModel):
2194
2234
  timings: AskTimings
2195
2235
 
2196
2236
 
2237
+ class AugmentedContextResponseItem(BaseModel):
2238
+ type: Literal["augmented_context"] = "augmented_context"
2239
+ augmented: AugmentedContext = Field(
2240
+ description=(
2241
+ "Augmented text blocks that were sent to the LLM as part of the RAG strategies "
2242
+ "applied on the retrieval results in the request."
2243
+ )
2244
+ )
2245
+
2246
+
2197
2247
  class CitationsAskResponseItem(BaseModel):
2198
2248
  type: Literal["citations"] = "citations"
2199
2249
  citations: dict[str, Any]
@@ -2226,6 +2276,7 @@ AskResponseItemType = Union[
2226
2276
  AnswerAskResponseItem,
2227
2277
  JSONAskResponseItem,
2228
2278
  MetadataAskResponseItem,
2279
+ AugmentedContextResponseItem,
2229
2280
  CitationsAskResponseItem,
2230
2281
  StatusAskResponseItem,
2231
2282
  ErrorAskResponseItem,
@@ -2260,3 +2311,19 @@ def parse_rephrase_prompt(item: AskRequest) -> Optional[str]:
2260
2311
 
2261
2312
  # We need this to avoid issues with pydantic and generic types defined in another module
2262
2313
  FindRequest.model_rebuild()
2314
+
2315
+
2316
+ class CatalogFacetsPrefix(BaseModel):
2317
+ prefix: str = Field(pattern="^((/[^/]+)*)$")
2318
+ depth: Optional[int] = Field(default=None, ge=0)
2319
+
2320
+ @model_validator(mode="before")
2321
+ @classmethod
2322
+ def build_from_string(cls, data: Any) -> Any:
2323
+ if isinstance(data, str):
2324
+ data = {"prefix": data}
2325
+ return data
2326
+
2327
+
2328
+ class CatalogFacetsRequest(BaseModel):
2329
+ prefixes: list[CatalogFacetsPrefix] = Field(default=[])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nucliadb_models
3
- Version: 6.5.0.post4426
3
+ Version: 6.5.0.post4484
4
4
  Author-email: Nuclia <nucliadb@nuclia.com>
5
5
  License-Expression: Apache-2.0
6
6
  Project-URL: Homepage, https://nuclia.com
@@ -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=govZKhri5fohFcSJwUmAvh7AMQeAcm3psA3KcPcCT0c,86700
19
+ nucliadb_models/search.py,sha256=W2dRUUst4ZqWitbCrvR1OV9rptYHXzODMI0seeTUzbs,89147
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=KwdP9xSDu1Td2O-7cRXBv_YFF6DsqAlD6M0-4LKAD60,6506
30
+ nucliadb_models/graph/requests.py,sha256=LgudW-Wg1UW13_CN57k-ek9M2h5zeTWqb13ktdorRaE,6514
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.5.0.post4426.dist-info/METADATA,sha256=btEK0Gfuuo6fh2Ob-WkI2REdxyZBmnoxYYAglvSIvZI,776
36
- nucliadb_models-6.5.0.post4426.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
- nucliadb_models-6.5.0.post4426.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
38
- nucliadb_models-6.5.0.post4426.dist-info/RECORD,,
35
+ nucliadb_models-6.5.0.post4484.dist-info/METADATA,sha256=wLaNzylvsESbAZAeYHJqH6zgEuGSp0gsV5xV3ineLmA,776
36
+ nucliadb_models-6.5.0.post4484.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
37
+ nucliadb_models-6.5.0.post4484.dist-info/top_level.txt,sha256=UrY1I8oeovIRwkXLYplssTrxQdUjhSEFDFbnwaIV3tA,16
38
+ nucliadb_models-6.5.0.post4484.dist-info/RECORD,,