nucliadb 6.2.1.post3071__py3-none-any.whl → 6.2.1.post3072__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/search/search/chat/query.py +12 -1
- nucliadb/search/search/graph_strategy.py +10 -17
- {nucliadb-6.2.1.post3071.dist-info → nucliadb-6.2.1.post3072.dist-info}/METADATA +5 -5
- {nucliadb-6.2.1.post3071.dist-info → nucliadb-6.2.1.post3072.dist-info}/RECORD +8 -8
- {nucliadb-6.2.1.post3071.dist-info → nucliadb-6.2.1.post3072.dist-info}/WHEEL +0 -0
- {nucliadb-6.2.1.post3071.dist-info → nucliadb-6.2.1.post3072.dist-info}/entry_points.txt +0 -0
- {nucliadb-6.2.1.post3071.dist-info → nucliadb-6.2.1.post3072.dist-info}/top_level.txt +0 -0
- {nucliadb-6.2.1.post3071.dist-info → nucliadb-6.2.1.post3072.dist-info}/zip-safe +0 -0
@@ -50,7 +50,12 @@ from nucliadb_models.search import (
|
|
50
50
|
parse_rephrase_prompt,
|
51
51
|
)
|
52
52
|
from nucliadb_protos import audit_pb2
|
53
|
-
from nucliadb_protos.nodereader_pb2 import
|
53
|
+
from nucliadb_protos.nodereader_pb2 import (
|
54
|
+
EntitiesSubgraphRequest,
|
55
|
+
RelationSearchResponse,
|
56
|
+
SearchRequest,
|
57
|
+
SearchResponse,
|
58
|
+
)
|
54
59
|
from nucliadb_protos.utils_pb2 import RelationNode
|
55
60
|
from nucliadb_telemetry.errors import capture_exception
|
56
61
|
from nucliadb_utils.utilities import get_audit
|
@@ -245,10 +250,16 @@ async def get_relations_results_from_entities(
|
|
245
250
|
timeout: Optional[float] = None,
|
246
251
|
only_with_metadata: bool = False,
|
247
252
|
only_agentic_relations: bool = False,
|
253
|
+
deleted_entities: set[str] = set(),
|
248
254
|
) -> Relations:
|
249
255
|
request = SearchRequest()
|
250
256
|
request.relation_subgraph.entry_points.extend(entities)
|
251
257
|
request.relation_subgraph.depth = 1
|
258
|
+
|
259
|
+
deleted = EntitiesSubgraphRequest.DeletedEntities()
|
260
|
+
deleted.node_values.extend(deleted_entities)
|
261
|
+
request.relation_subgraph.deleted_entities.append(deleted)
|
262
|
+
|
252
263
|
results: list[SearchResponse]
|
253
264
|
(
|
254
265
|
results,
|
@@ -337,7 +337,14 @@ async def get_graph_results(
|
|
337
337
|
or graph_strategy.query_entity_detection == QueryEntityDetection.PREDICT
|
338
338
|
):
|
339
339
|
try:
|
340
|
-
|
340
|
+
# Purposely ignore the entity subtype. This is done so we find all entities that match
|
341
|
+
# the entity by name. e.g: in a query like "2000", predict might detect the number as
|
342
|
+
# a year entity or as a currency entity. We want graph results for both, so we ignore the
|
343
|
+
# subtype just in this case.
|
344
|
+
entities_to_explore = [
|
345
|
+
RelationNode(ntype=r.ntype, value=r.value, subtype="")
|
346
|
+
for r in await predict.detect_entities(kbid, query)
|
347
|
+
]
|
341
348
|
except Exception as e:
|
342
349
|
capture_exception(e)
|
343
350
|
logger.exception("Error in detecting entities for graph strategy")
|
@@ -365,19 +372,14 @@ async def get_graph_results(
|
|
365
372
|
timeout=5.0,
|
366
373
|
only_with_metadata=True,
|
367
374
|
only_agentic_relations=graph_strategy.agentic_graph_only,
|
375
|
+
deleted_entities=explored_entities,
|
368
376
|
)
|
369
377
|
except Exception as e:
|
370
378
|
capture_exception(e)
|
371
379
|
logger.exception("Error in getting query relations for graph strategy")
|
372
380
|
new_relations = Relations(entities={})
|
373
381
|
|
374
|
-
|
375
|
-
# XXX: This could be optimized by implementing a filter in the index
|
376
|
-
# so we don't have to remove them after
|
377
|
-
new_subgraphs = {
|
378
|
-
entity: filter_subgraph(subgraph, explored_entities)
|
379
|
-
for entity, subgraph in new_relations.entities.items()
|
380
|
-
}
|
382
|
+
new_subgraphs = new_relations.entities
|
381
383
|
|
382
384
|
explored_entities.update(new_subgraphs.keys())
|
383
385
|
|
@@ -842,15 +844,6 @@ async def build_graph_response(
|
|
842
844
|
)
|
843
845
|
|
844
846
|
|
845
|
-
def filter_subgraph(subgraph: EntitySubgraph, entities_to_remove: Collection[str]) -> EntitySubgraph:
|
846
|
-
"""
|
847
|
-
Removes the relationships with entities in `entities_to_remove` from the subgraph.
|
848
|
-
"""
|
849
|
-
return EntitySubgraph(
|
850
|
-
related_to=[rel for rel in subgraph.related_to if rel.entity not in entities_to_remove]
|
851
|
-
)
|
852
|
-
|
853
|
-
|
854
847
|
def relations_match_to_text_block_match(
|
855
848
|
paragraph_match: RelationsParagraphMatch,
|
856
849
|
) -> TextBlockMatch:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: nucliadb
|
3
|
-
Version: 6.2.1.
|
3
|
+
Version: 6.2.1.post3072
|
4
4
|
Home-page: https://docs.nuclia.dev/docs/management/nucliadb/intro
|
5
5
|
Author: NucliaDB Community
|
6
6
|
Author-email: nucliadb@nuclia.com
|
@@ -22,10 +22,10 @@ Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Programming Language :: Python :: 3 :: Only
|
23
23
|
Requires-Python: >=3.9, <4
|
24
24
|
Description-Content-Type: text/markdown
|
25
|
-
Requires-Dist: nucliadb-telemetry[all]>=6.2.1.
|
26
|
-
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.2.1.
|
27
|
-
Requires-Dist: nucliadb-protos>=6.2.1.
|
28
|
-
Requires-Dist: nucliadb-models>=6.2.1.
|
25
|
+
Requires-Dist: nucliadb-telemetry[all]>=6.2.1.post3072
|
26
|
+
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.2.1.post3072
|
27
|
+
Requires-Dist: nucliadb-protos>=6.2.1.post3072
|
28
|
+
Requires-Dist: nucliadb-models>=6.2.1.post3072
|
29
29
|
Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
|
30
30
|
Requires-Dist: nuclia-models>=0.24.2
|
31
31
|
Requires-Dist: uvicorn
|
@@ -210,7 +210,7 @@ nucliadb/search/search/fetch.py,sha256=XJHIFnZmXM_8Kb37lb4lg1GYG7cZ1plT-qAIb_Qzi
|
|
210
210
|
nucliadb/search/search/filters.py,sha256=1MkHlJjAQqoRCj7e5cEzK2HvBxGLE17I_omsjiklbtw,6476
|
211
211
|
nucliadb/search/search/find.py,sha256=yQbttt85wQFc4NEaj2RNGgozP7IQx_bjAOhHke3fXY0,9890
|
212
212
|
nucliadb/search/search/find_merge.py,sha256=_R_YpHAZv5BHh3XABQ8MRd1Ci0seclGYf26yJHJ7H0I,17178
|
213
|
-
nucliadb/search/search/graph_strategy.py,sha256=
|
213
|
+
nucliadb/search/search/graph_strategy.py,sha256=Egcq_zn895gTUYmyQTsXj8YaUMa3HBKhcSa1GBvgzAM,31877
|
214
214
|
nucliadb/search/search/hydrator.py,sha256=-R37gCrGxkyaiHQalnTWHNG_FCx11Zucd7qA1vQCxuw,6985
|
215
215
|
nucliadb/search/search/merge.py,sha256=i_PTBFRqC5iTTziOMEltxLIlmokIou5hjjgR4BnoLBE,22635
|
216
216
|
nucliadb/search/search/metrics.py,sha256=81X-tahGW4n2CLvUzCPdNxNClmZqUWZjcVOGCUHoiUM,2872
|
@@ -228,7 +228,7 @@ nucliadb/search/search/chat/ask.py,sha256=K85Size6WAb-q4sCn0u1drrPnqIvqCy6YbfCxQ
|
|
228
228
|
nucliadb/search/search/chat/exceptions.py,sha256=Siy4GXW2L7oPhIR86H3WHBhE9lkV4A4YaAszuGGUf54,1356
|
229
229
|
nucliadb/search/search/chat/images.py,sha256=PA8VWxT5_HUGfW1ULhKTK46UBsVyINtWWqEM1ulzX1E,3095
|
230
230
|
nucliadb/search/search/chat/prompt.py,sha256=r2JTiRWH3YHPdeRAG5w6gD0g0fWVxdTjYIR86qAVa7k,47106
|
231
|
-
nucliadb/search/search/chat/query.py,sha256=
|
231
|
+
nucliadb/search/search/chat/query.py,sha256=rBssR6MPSx8h2DASRMTLODaz9oGE5tNVVVeDncSrEp4,15684
|
232
232
|
nucliadb/search/search/query_parser/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
233
233
|
nucliadb/search/search/query_parser/exceptions.py,sha256=tuzl7ZyvVsRz6u0_3zMe60vx39nd3pi641prs-5nC0E,872
|
234
234
|
nucliadb/search/search/query_parser/models.py,sha256=-VlCDXUCgOroAZw1Leqhj2VMgRv_CD2w40PXXOBLaUM,2332
|
@@ -329,9 +329,9 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
|
|
329
329
|
nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
|
330
330
|
nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
|
331
331
|
nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
|
332
|
-
nucliadb-6.2.1.
|
333
|
-
nucliadb-6.2.1.
|
334
|
-
nucliadb-6.2.1.
|
335
|
-
nucliadb-6.2.1.
|
336
|
-
nucliadb-6.2.1.
|
337
|
-
nucliadb-6.2.1.
|
332
|
+
nucliadb-6.2.1.post3072.dist-info/METADATA,sha256=Spf7lqAgt29pV4iYGRWhP-Gn1yZLgJh1uzhjqOoWSoU,4603
|
333
|
+
nucliadb-6.2.1.post3072.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
334
|
+
nucliadb-6.2.1.post3072.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
|
335
|
+
nucliadb-6.2.1.post3072.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
|
336
|
+
nucliadb-6.2.1.post3072.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
337
|
+
nucliadb-6.2.1.post3072.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|