nucliadb 6.4.0.post4176__py3-none-any.whl → 6.4.0.post4192__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/common/context/__init__.py +1 -1
- nucliadb/common/nidx.py +20 -15
- nucliadb/ingest/app.py +1 -1
- nucliadb/search/lifecycle.py +1 -1
- nucliadb/search/search/chat/ask.py +7 -3
- {nucliadb-6.4.0.post4176.dist-info → nucliadb-6.4.0.post4192.dist-info}/METADATA +6 -6
- {nucliadb-6.4.0.post4176.dist-info → nucliadb-6.4.0.post4192.dist-info}/RECORD +10 -10
- {nucliadb-6.4.0.post4176.dist-info → nucliadb-6.4.0.post4192.dist-info}/WHEEL +1 -1
- {nucliadb-6.4.0.post4176.dist-info → nucliadb-6.4.0.post4192.dist-info}/entry_points.txt +0 -0
- {nucliadb-6.4.0.post4176.dist-info → nucliadb-6.4.0.post4192.dist-info}/top_level.txt +0 -0
@@ -100,7 +100,7 @@ class ApplicationContext:
|
|
100
100
|
if self.enabled_transaction:
|
101
101
|
self._transaction = await start_transaction_utility(self.service_name)
|
102
102
|
if self.enabled_nidx:
|
103
|
-
self._nidx = await start_nidx_utility()
|
103
|
+
self._nidx = await start_nidx_utility(self.service_name)
|
104
104
|
|
105
105
|
@property
|
106
106
|
def kv_driver(self) -> Driver:
|
nucliadb/common/nidx.py
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
#
|
20
20
|
|
21
21
|
import os
|
22
|
-
from typing import Optional
|
22
|
+
from typing import Optional, Union
|
23
23
|
|
24
24
|
from nidx_protos.nidx_pb2_grpc import NidxApiStub, NidxIndexerStub, NidxSearcherStub
|
25
25
|
from nidx_protos.nodewriter_pb2 import (
|
@@ -89,10 +89,11 @@ def _storage_config(prefix: str, bucket: Optional[str]) -> dict[str, str]:
|
|
89
89
|
class NidxBindingUtility(NidxUtility):
|
90
90
|
"""Implements Nidx utility using the binding"""
|
91
91
|
|
92
|
-
def __init__(self):
|
92
|
+
def __init__(self, service_name: str):
|
93
93
|
if ingest_settings.driver != DriverConfig.PG:
|
94
94
|
raise ValueError("nidx_binding requires DRIVER=pg")
|
95
95
|
|
96
|
+
self.service_name = service_name
|
96
97
|
self.config = {
|
97
98
|
"METADATA__DATABASE_URL": ingest_settings.driver_pg_url,
|
98
99
|
"SEARCHER__METADATA_REFRESH_INTERVAL": str(
|
@@ -107,10 +108,10 @@ class NidxBindingUtility(NidxUtility):
|
|
107
108
|
|
108
109
|
self.binding = nidx_binding.NidxBinding(self.config)
|
109
110
|
self.api_client = NidxApiStub(
|
110
|
-
get_traced_grpc_channel(f"localhost:{self.binding.api_port}",
|
111
|
+
get_traced_grpc_channel(f"localhost:{self.binding.api_port}", self.service_name)
|
111
112
|
)
|
112
113
|
self.searcher_client = NidxSearcherStub(
|
113
|
-
get_traced_grpc_channel(f"localhost:{self.binding.searcher_port}",
|
114
|
+
get_traced_grpc_channel(f"localhost:{self.binding.searcher_port}", self.service_name)
|
114
115
|
)
|
115
116
|
|
116
117
|
async def finalize(self):
|
@@ -124,12 +125,13 @@ class NidxBindingUtility(NidxUtility):
|
|
124
125
|
|
125
126
|
|
126
127
|
class NidxNatsIndexer:
|
127
|
-
def __init__(self):
|
128
|
+
def __init__(self, service_name: str):
|
128
129
|
self.nats_connection_manager = NatsConnectionManager(
|
129
|
-
service_name=
|
130
|
+
service_name=service_name,
|
130
131
|
nats_servers=indexing_settings.index_jetstream_servers,
|
131
132
|
nats_creds=indexing_settings.index_jetstream_auth,
|
132
133
|
)
|
134
|
+
assert indexing_settings.index_nidx_subject is not None
|
133
135
|
self.subject = indexing_settings.index_nidx_subject
|
134
136
|
|
135
137
|
async def initialize(self):
|
@@ -147,11 +149,12 @@ class NidxNatsIndexer:
|
|
147
149
|
|
148
150
|
|
149
151
|
class NidxGrpcIndexer:
|
150
|
-
def __init__(self, address):
|
152
|
+
def __init__(self, address: str, service_name: str):
|
151
153
|
self.address = address
|
154
|
+
self.service_name = service_name
|
152
155
|
|
153
156
|
async def initialize(self):
|
154
|
-
self.client = NidxIndexerStub(get_traced_grpc_channel(self.address,
|
157
|
+
self.client = NidxIndexerStub(get_traced_grpc_channel(self.address, self.service_name))
|
155
158
|
|
156
159
|
async def finalize(self):
|
157
160
|
pass
|
@@ -164,14 +167,16 @@ class NidxGrpcIndexer:
|
|
164
167
|
class NidxServiceUtility(NidxUtility):
|
165
168
|
"""Implements Nidx utility connecting to the network service"""
|
166
169
|
|
167
|
-
|
170
|
+
indexer: Union[NidxNatsIndexer, NidxGrpcIndexer]
|
171
|
+
|
172
|
+
def __init__(self, service_name: str):
|
168
173
|
if not settings.nidx_api_address or not settings.nidx_searcher_address:
|
169
174
|
raise ValueError("NIDX_API_ADDRESS and NIDX_SEARCHER_ADDRESS are required")
|
170
175
|
|
171
176
|
if indexing_settings.index_nidx_subject:
|
172
|
-
self.indexer = NidxNatsIndexer()
|
177
|
+
self.indexer = NidxNatsIndexer(service_name)
|
173
178
|
elif settings.nidx_indexer_address is not None:
|
174
|
-
self.indexer = NidxGrpcIndexer(settings.nidx_indexer_address)
|
179
|
+
self.indexer = NidxGrpcIndexer(settings.nidx_indexer_address, service_name)
|
175
180
|
else:
|
176
181
|
raise ValueError("NIDX_INDEXER_ADDRESS or INDEX_NIDX_SUBJECT are required")
|
177
182
|
|
@@ -189,7 +194,7 @@ class NidxServiceUtility(NidxUtility):
|
|
189
194
|
return await self.indexer.index(writer)
|
190
195
|
|
191
196
|
|
192
|
-
async def start_nidx_utility() -> Optional[NidxUtility]:
|
197
|
+
async def start_nidx_utility(service_name: str = "nucliadb.nidx") -> Optional[NidxUtility]:
|
193
198
|
nidx = get_utility(Utility.NIDX)
|
194
199
|
if nidx:
|
195
200
|
return nidx
|
@@ -202,13 +207,13 @@ async def start_nidx_utility() -> Optional[NidxUtility]:
|
|
202
207
|
and settings.nidx_indexer_address is not None
|
203
208
|
):
|
204
209
|
# Standalone with nidx service (via grpc). This is used in clustered standalone mode
|
205
|
-
nidx_utility = NidxServiceUtility()
|
210
|
+
nidx_utility = NidxServiceUtility(service_name)
|
206
211
|
else:
|
207
212
|
# Normal standalone mode with binding
|
208
|
-
nidx_utility = NidxBindingUtility()
|
213
|
+
nidx_utility = NidxBindingUtility(service_name)
|
209
214
|
else:
|
210
215
|
# Component deploy with nidx service via grpc & nats (cloud)
|
211
|
-
nidx_utility = NidxServiceUtility()
|
216
|
+
nidx_utility = NidxServiceUtility(service_name)
|
212
217
|
|
213
218
|
await nidx_utility.initialize()
|
214
219
|
set_utility(Utility.NIDX, nidx_utility)
|
nucliadb/ingest/app.py
CHANGED
nucliadb/search/lifecycle.py
CHANGED
@@ -649,9 +649,11 @@ def handled_ask_exceptions(func):
|
|
649
649
|
detail=err.detail,
|
650
650
|
)
|
651
651
|
except IncompleteFindResultsError:
|
652
|
+
msg = "Temporary error on information retrieval. Please try again."
|
653
|
+
logger.error(msg)
|
652
654
|
return HTTPClientError(
|
653
|
-
status_code=
|
654
|
-
detail=
|
655
|
+
status_code=530,
|
656
|
+
detail=msg,
|
655
657
|
)
|
656
658
|
except predict.RephraseMissingContextError:
|
657
659
|
return HTTPClientError(
|
@@ -659,9 +661,11 @@ def handled_ask_exceptions(func):
|
|
659
661
|
detail="Unable to rephrase the query with the provided context.",
|
660
662
|
)
|
661
663
|
except predict.RephraseError as err:
|
664
|
+
msg = f"Temporary error while rephrasing the query. Please try again later. Error: {err}"
|
665
|
+
logger.info(msg)
|
662
666
|
return HTTPClientError(
|
663
667
|
status_code=529,
|
664
|
-
detail=
|
668
|
+
detail=msg,
|
665
669
|
)
|
666
670
|
except InvalidQueryError as exc:
|
667
671
|
return HTTPClientError(status_code=412, detail=str(exc))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nucliadb
|
3
|
-
Version: 6.4.0.
|
3
|
+
Version: 6.4.0.post4192
|
4
4
|
Summary: NucliaDB
|
5
5
|
Author-email: Nuclia <nucliadb@nuclia.com>
|
6
6
|
License: AGPL
|
@@ -20,11 +20,11 @@ Classifier: Programming Language :: Python :: 3.12
|
|
20
20
|
Classifier: Programming Language :: Python :: 3 :: Only
|
21
21
|
Requires-Python: <4,>=3.9
|
22
22
|
Description-Content-Type: text/markdown
|
23
|
-
Requires-Dist: nucliadb-telemetry[all]>=6.4.0.
|
24
|
-
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.4.0.
|
25
|
-
Requires-Dist: nucliadb-protos>=6.4.0.
|
26
|
-
Requires-Dist: nucliadb-models>=6.4.0.
|
27
|
-
Requires-Dist: nidx-protos>=6.4.0.
|
23
|
+
Requires-Dist: nucliadb-telemetry[all]>=6.4.0.post4192
|
24
|
+
Requires-Dist: nucliadb-utils[cache,fastapi,storages]>=6.4.0.post4192
|
25
|
+
Requires-Dist: nucliadb-protos>=6.4.0.post4192
|
26
|
+
Requires-Dist: nucliadb-models>=6.4.0.post4192
|
27
|
+
Requires-Dist: nidx-protos>=6.4.0.post4192
|
28
28
|
Requires-Dist: nucliadb-admin-assets>=1.0.0.post1224
|
29
29
|
Requires-Dist: nuclia-models>=0.24.2
|
30
30
|
Requires-Dist: uvicorn[standard]
|
@@ -58,7 +58,7 @@ nucliadb/common/constants.py,sha256=QpigxJh_CtD85Evy0PtV5cVq6x0U_f9xfIcXz1ymkUg,
|
|
58
58
|
nucliadb/common/counters.py,sha256=8lOi3A2HeLDDlcNaS2QT1SfD3350VPBjiY3FkmHH1V8,977
|
59
59
|
nucliadb/common/ids.py,sha256=4QjoIofes_vtKj2HsFWZf8VVIVWXxdkYtLpx1n618Us,8239
|
60
60
|
nucliadb/common/locking.py,sha256=RL0CabZVPzxHZyUjYeUyLvsJTm7W3J9o4fEgsY_ufNc,5896
|
61
|
-
nucliadb/common/nidx.py,sha256=
|
61
|
+
nucliadb/common/nidx.py,sha256=3EeQGjM_gxK0l_Rb54fspFWVNnzUiKF-_GMxTiiDC8Q,9116
|
62
62
|
nucliadb/common/vector_index_config.py,sha256=LqGwhrDCp1q1vBow3scd1Chhr4GLYjYnGL72FKvOYYc,1552
|
63
63
|
nucliadb/common/cluster/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
64
64
|
nucliadb/common/cluster/exceptions.py,sha256=t7v_l93t44l2tQpdQXgO_w-c4YZRcaayOz1A2i0w4RQ,1258
|
@@ -70,7 +70,7 @@ nucliadb/common/cluster/settings.py,sha256=JPwV_0U_i618Tn66GWUq6qCKNjy4TWkGEGld9
|
|
70
70
|
nucliadb/common/cluster/utils.py,sha256=IfW5PA7Ab26xWUYNOc3yBoksWV1GK4BGhTRo1vnHNKg,4662
|
71
71
|
nucliadb/common/cluster/standalone/__init__.py,sha256=itSI7dtTwFP55YMX4iK7JzdMHS5CQVUiB1XzQu4UBh8,833
|
72
72
|
nucliadb/common/cluster/standalone/utils.py,sha256=af3r-x_GF7A6dwIAhZLR-r-SZQEVxsFrDKeMfUTA6G0,1908
|
73
|
-
nucliadb/common/context/__init__.py,sha256=
|
73
|
+
nucliadb/common/context/__init__.py,sha256=IKAHuiCjbOEsqfLozWwJ6mRFzFncsZMyxNC5E_XZ5EM,6016
|
74
74
|
nucliadb/common/context/fastapi.py,sha256=mH_8n5t7quNSPivNM2JS5EQf2sTVJsdzXW6LaY7EHAA,1629
|
75
75
|
nucliadb/common/datamanagers/__init__.py,sha256=jksw4pXyXb05SG3EN-BPBrhc1u1Ge_m21PYqD7NYQEs,2118
|
76
76
|
nucliadb/common/datamanagers/atomic.py,sha256=WihdtBWQIAuElZQjh1xQ--q5dJowwlkovqsW-OB_t2k,3230
|
@@ -117,7 +117,7 @@ nucliadb/export_import/models.py,sha256=dbjScNkiMRv4X3Ktudy1JRliD25bfoDTy3JmEZgQ
|
|
117
117
|
nucliadb/export_import/tasks.py,sha256=DWbdqY97ffoyfipelGXz3Jqz1iam6JCjQSh367Fc3NA,2947
|
118
118
|
nucliadb/export_import/utils.py,sha256=8XOVMYXXw8b4ikojG7RjQ4tKN3Xu7nfu2yCUOqD50sk,23216
|
119
119
|
nucliadb/ingest/__init__.py,sha256=fsw3C38VP50km3R-nHL775LNGPpJ4JxqXJ2Ib1f5SqE,1011
|
120
|
-
nucliadb/ingest/app.py,sha256=
|
120
|
+
nucliadb/ingest/app.py,sha256=KCptzFq1Msq4eHFxvEol4TFwSLdmkG2v1EfQ3C8PhyY,7547
|
121
121
|
nucliadb/ingest/partitions.py,sha256=2NIhMYbNT0TNBL6bX1UMSi7vxFGICstCKEqsB0TXHOE,2410
|
122
122
|
nucliadb/ingest/processing.py,sha256=QmkHq-BU4vub7JRWe9VHvQ2DcAmT6-CzgFXuZxXhcBU,20953
|
123
123
|
nucliadb/ingest/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -198,7 +198,7 @@ nucliadb/reader/reader/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXM
|
|
198
198
|
nucliadb/reader/reader/notifications.py,sha256=6yUsPvvSRqayJ2peOtE0JY0v4657P_S5SAm32th0Y88,7809
|
199
199
|
nucliadb/search/__init__.py,sha256=tnypbqcH4nBHbGpkINudhKgdLKpwXQCvDtPchUlsyY4,1511
|
200
200
|
nucliadb/search/app.py,sha256=-WEX1AZRA8R_9aeOo9ovOTwjXW_7VfwWN7N2ccSoqXg,3387
|
201
|
-
nucliadb/search/lifecycle.py,sha256=
|
201
|
+
nucliadb/search/lifecycle.py,sha256=hiylV-lxsAWkqTCulXBg0EIfMQdejSr8Zar0L_GLFT8,2218
|
202
202
|
nucliadb/search/openapi.py,sha256=t3Wo_4baTrfPftg2BHsyLWNZ1MYn7ZRdW7ht-wFOgRs,1016
|
203
203
|
nucliadb/search/predict.py,sha256=VJr5Itx8FE7CZIGYcP-fRgd2YGxAnP9Qj9NxiwWiwcc,22819
|
204
204
|
nucliadb/search/predict_models.py,sha256=ZAe0dneUsPmV9uBar57cCFADCGOrYDsJHuqKlA5zWag,5937
|
@@ -251,7 +251,7 @@ nucliadb/search/search/shards.py,sha256=mc5DK-MoCv9AFhlXlOFHbPvetcyNDzTFOJ5rimK8
|
|
251
251
|
nucliadb/search/search/summarize.py,sha256=ksmYPubEQvAQgfPdZHfzB_rR19B2ci4IYZ6jLdHxZo8,4996
|
252
252
|
nucliadb/search/search/utils.py,sha256=ajRIXfdTF67dBVahQCXW-rSv6gJpUMPt3QhJrWqArTQ,2175
|
253
253
|
nucliadb/search/search/chat/__init__.py,sha256=cp15ZcFnHvpcu_5-aK2A4uUyvuZVV_MJn4bIXMa20ks,835
|
254
|
-
nucliadb/search/search/chat/ask.py,sha256=
|
254
|
+
nucliadb/search/search/chat/ask.py,sha256=xNdkdH2NzqfONj_qkdGGFvdGlz94PiyxE2ayMVk-MdQ,37471
|
255
255
|
nucliadb/search/search/chat/exceptions.py,sha256=Siy4GXW2L7oPhIR86H3WHBhE9lkV4A4YaAszuGGUf54,1356
|
256
256
|
nucliadb/search/search/chat/images.py,sha256=PA8VWxT5_HUGfW1ULhKTK46UBsVyINtWWqEM1ulzX1E,3095
|
257
257
|
nucliadb/search/search/chat/prompt.py,sha256=Jnja-Ss7skgnnDY8BymVfdeYsFPnIQFL8tEvcRXTKUE,47356
|
@@ -365,8 +365,8 @@ nucliadb/writer/tus/local.py,sha256=7jYa_w9b-N90jWgN2sQKkNcomqn6JMVBOVeDOVYJHto,
|
|
365
365
|
nucliadb/writer/tus/s3.py,sha256=vF0NkFTXiXhXq3bCVXXVV-ED38ECVoUeeYViP8uMqcU,8357
|
366
366
|
nucliadb/writer/tus/storage.py,sha256=ToqwjoYnjI4oIcwzkhha_MPxi-k4Jk3Lt55zRwaC1SM,2903
|
367
367
|
nucliadb/writer/tus/utils.py,sha256=MSdVbRsRSZVdkaum69_0wku7X3p5wlZf4nr6E0GMKbw,2556
|
368
|
-
nucliadb-6.4.0.
|
369
|
-
nucliadb-6.4.0.
|
370
|
-
nucliadb-6.4.0.
|
371
|
-
nucliadb-6.4.0.
|
372
|
-
nucliadb-6.4.0.
|
368
|
+
nucliadb-6.4.0.post4192.dist-info/METADATA,sha256=U5VsHHLt_nINiBGZmirG1AEaniLWqSXM9mIM2I_Bz44,4226
|
369
|
+
nucliadb-6.4.0.post4192.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
370
|
+
nucliadb-6.4.0.post4192.dist-info/entry_points.txt,sha256=XqGfgFDuY3zXQc8ewXM2TRVjTModIq851zOsgrmaXx4,1268
|
371
|
+
nucliadb-6.4.0.post4192.dist-info/top_level.txt,sha256=hwYhTVnX7jkQ9gJCkVrbqEG1M4lT2F_iPQND1fCzF80,20
|
372
|
+
nucliadb-6.4.0.post4192.dist-info/RECORD,,
|
File without changes
|
File without changes
|