indexify 0.2.36__py3-none-any.whl → 0.2.37__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.
- indexify/executor/agent.py +1 -1
- indexify/functions_sdk/graph.py +5 -0
- indexify/functions_sdk/indexify_functions.py +56 -9
- indexify/remote_graph.py +3 -3
- {indexify-0.2.36.dist-info → indexify-0.2.37.dist-info}/METADATA +1 -1
- {indexify-0.2.36.dist-info → indexify-0.2.37.dist-info}/RECORD +9 -9
- {indexify-0.2.36.dist-info → indexify-0.2.37.dist-info}/LICENSE.txt +0 -0
- {indexify-0.2.36.dist-info → indexify-0.2.37.dist-info}/WHEEL +0 -0
- {indexify-0.2.36.dist-info → indexify-0.2.37.dist-info}/entry_points.txt +0 -0
indexify/executor/agent.py
CHANGED
@@ -299,7 +299,7 @@ class ExtractorAgent:
|
|
299
299
|
image_version=image_version,
|
300
300
|
labels=runtime_probe.labels,
|
301
301
|
).model_dump()
|
302
|
-
logging.info("registering_executor", executor_id=self._executor_id)
|
302
|
+
logging.info("registering_executor", executor_id=self._executor_id, url=url)
|
303
303
|
try:
|
304
304
|
async with get_httpx_client(self._config_path, True) as client:
|
305
305
|
async with aconnect_sse(
|
indexify/functions_sdk/graph.py
CHANGED
@@ -147,6 +147,11 @@ class Graph:
|
|
147
147
|
from_node: Union[Type[IndexifyFunction], Type[IndexifyRouter]],
|
148
148
|
to_node: List[Union[Type[IndexifyFunction], Type[IndexifyRouter]]],
|
149
149
|
) -> "Graph":
|
150
|
+
if issubclass(from_node, IndexifyRouter):
|
151
|
+
raise ValueError(
|
152
|
+
"Cannot add edges from a router node, use route method instead"
|
153
|
+
)
|
154
|
+
|
150
155
|
self.add_node(from_node)
|
151
156
|
from_node_name = from_node.name
|
152
157
|
for node in to_node:
|
@@ -112,11 +112,32 @@ class IndexifyRouter:
|
|
112
112
|
pass
|
113
113
|
|
114
114
|
|
115
|
-
from inspect import signature
|
115
|
+
from inspect import Parameter, signature
|
116
116
|
|
117
117
|
from typing_extensions import get_type_hints
|
118
118
|
|
119
119
|
|
120
|
+
def _process_dict_arg(dict_arg: dict, sig: inspect.Signature) -> Tuple[list, dict]:
|
121
|
+
new_args = []
|
122
|
+
new_kwargs = {}
|
123
|
+
remaining_kwargs = dict_arg.copy()
|
124
|
+
|
125
|
+
# Match dictionary keys to function parameters
|
126
|
+
for param_name, param in sig.parameters.items():
|
127
|
+
if param_name in dict_arg:
|
128
|
+
new_args.append(dict_arg[param_name])
|
129
|
+
remaining_kwargs.pop(param_name, None)
|
130
|
+
|
131
|
+
if any(v.kind == Parameter.VAR_KEYWORD for v in sig.parameters.values()):
|
132
|
+
# Combine remaining dict items with additional kwargs
|
133
|
+
new_kwargs.update(remaining_kwargs)
|
134
|
+
elif len(remaining_kwargs) > 0:
|
135
|
+
# If there are remaining kwargs, add them as a single dict argument
|
136
|
+
new_args.append(remaining_kwargs)
|
137
|
+
|
138
|
+
return new_args, new_kwargs
|
139
|
+
|
140
|
+
|
120
141
|
def indexify_router(
|
121
142
|
name: Optional[str] = None,
|
122
143
|
description: Optional[str] = "",
|
@@ -132,6 +153,13 @@ def indexify_router(
|
|
132
153
|
|
133
154
|
# Create run method that preserves signature
|
134
155
|
def run(self, *args, **kwargs):
|
156
|
+
# Process dictionary argument mapping it to args or to kwargs.
|
157
|
+
if len(args) == 1 and isinstance(args[0], dict):
|
158
|
+
sig = inspect.signature(fn)
|
159
|
+
dict_arg = args[0]
|
160
|
+
new_args, new_kwargs = _process_dict_arg(dict_arg, sig)
|
161
|
+
return fn(*new_args, **new_kwargs)
|
162
|
+
|
135
163
|
return fn(*args, **kwargs)
|
136
164
|
|
137
165
|
# Apply original signature and annotations to run method
|
@@ -173,6 +201,20 @@ def indexify_function(
|
|
173
201
|
|
174
202
|
# Create run method that preserves signature
|
175
203
|
def run(self, *args, **kwargs):
|
204
|
+
# Process dictionary argument mapping it to args or to kwargs.
|
205
|
+
if self.accumulate and len(args) == 2 and isinstance(args[1], dict):
|
206
|
+
sig = inspect.signature(fn)
|
207
|
+
new_args = [args[0]] # Keep the accumulate argument
|
208
|
+
dict_arg = args[1]
|
209
|
+
new_args_from_dict, new_kwargs = _process_dict_arg(dict_arg, sig)
|
210
|
+
new_args.extend(new_args_from_dict)
|
211
|
+
return fn(*new_args, **new_kwargs)
|
212
|
+
elif len(args) == 1 and isinstance(args[0], dict):
|
213
|
+
sig = inspect.signature(fn)
|
214
|
+
dict_arg = args[0]
|
215
|
+
new_args, new_kwargs = _process_dict_arg(dict_arg, sig)
|
216
|
+
return fn(*new_args, **new_kwargs)
|
217
|
+
|
176
218
|
return fn(*args, **kwargs)
|
177
219
|
|
178
220
|
# Apply original signature and annotations to run method
|
@@ -252,14 +294,15 @@ class IndexifyFunctionWrapper:
|
|
252
294
|
def run_router(
|
253
295
|
self, input: Union[Dict, Type[BaseModel]]
|
254
296
|
) -> Tuple[List[str], Optional[str]]:
|
255
|
-
kwargs = input if isinstance(input, dict) else {"input": input}
|
256
297
|
args = []
|
257
298
|
kwargs = {}
|
258
|
-
if isinstance(input, dict):
|
259
|
-
kwargs = input
|
260
|
-
else:
|
261
|
-
args.append(input)
|
262
299
|
try:
|
300
|
+
# tuple and list are considered positional arguments, list is used for compatibility
|
301
|
+
# with json encoding which won't deserialize in tuple.
|
302
|
+
if isinstance(input, tuple) or isinstance(input, list):
|
303
|
+
args += input
|
304
|
+
else:
|
305
|
+
args.append(input)
|
263
306
|
extracted_data = self.indexify_function.run(*args, **kwargs)
|
264
307
|
except Exception as e:
|
265
308
|
return [], traceback.format_exc()
|
@@ -271,14 +314,18 @@ class IndexifyFunctionWrapper:
|
|
271
314
|
return edges, None
|
272
315
|
|
273
316
|
def run_fn(
|
274
|
-
self, input: Union[Dict, Type[BaseModel]], acc: Type[Any] = None
|
317
|
+
self, input: Union[Dict, Type[BaseModel], List, Tuple], acc: Type[Any] = None
|
275
318
|
) -> Tuple[List[Any], Optional[str]]:
|
276
319
|
args = []
|
277
320
|
kwargs = {}
|
321
|
+
|
278
322
|
if acc is not None:
|
279
323
|
args.append(acc)
|
280
|
-
|
281
|
-
|
324
|
+
|
325
|
+
# tuple and list are considered positional arguments, list is used for compatibility
|
326
|
+
# with json encoding which won't deserialize in tuple.
|
327
|
+
if isinstance(input, tuple) or isinstance(input, list):
|
328
|
+
args += input
|
282
329
|
else:
|
283
330
|
args.append(input)
|
284
331
|
|
indexify/remote_graph.py
CHANGED
@@ -23,7 +23,7 @@ class RemoteGraph:
|
|
23
23
|
:param server_url: The URL of the server where the graph will be registered.
|
24
24
|
Not used if client is provided.
|
25
25
|
:param client: The IndexifyClient used to communicate with the server.
|
26
|
-
|
26
|
+
Preferred over server_url.
|
27
27
|
"""
|
28
28
|
self._name = name
|
29
29
|
if client:
|
@@ -88,7 +88,7 @@ class RemoteGraph:
|
|
88
88
|
:param server_url: The URL of the server where the graph will be registered.
|
89
89
|
Not used if client is provided.
|
90
90
|
:param client: The IndexifyClient used to communicate with the server.
|
91
|
-
|
91
|
+
Preferred over server_url.
|
92
92
|
"""
|
93
93
|
g.validate_graph()
|
94
94
|
if not client:
|
@@ -110,7 +110,7 @@ class RemoteGraph:
|
|
110
110
|
:param server_url: The URL of the server where the graph will be registered.
|
111
111
|
Not used if client is provided.
|
112
112
|
:param client: The IndexifyClient used to communicate with the server.
|
113
|
-
|
113
|
+
Preferred over server_url.
|
114
114
|
:return: A RemoteGraph object.
|
115
115
|
"""
|
116
116
|
return cls(name=name, server_url=server_url, client=client)
|
@@ -5,7 +5,7 @@ indexify/data_loaders/__init__.py,sha256=Y5NEuseTcYAICRiweYw5wBQ2m2YplbsY21I7df-
|
|
5
5
|
indexify/data_loaders/local_directory_loader.py,sha256=fCrgj5drnW71ZUdDDvcB1-VJjIs1w6Q8sEW0HSGSAiA,1247
|
6
6
|
indexify/data_loaders/url_loader.py,sha256=32SERljcq1Xsi4RdLz2dgyk2TER5pQPTtXl3gUzwHbY,1533
|
7
7
|
indexify/error.py,sha256=qAWr8R6AxPkjsxHSzXTc8zqYnNO_AjOqqYEPsQvF1Zs,238
|
8
|
-
indexify/executor/agent.py,sha256=
|
8
|
+
indexify/executor/agent.py,sha256=zWdcroELAA-C8LaChR518ey5UKaUhfTHtkyawpdOkIE,14053
|
9
9
|
indexify/executor/api_objects.py,sha256=mvmwGbK4paJNQGFvbtNHMPpiH_LpVhrlRnCcrqS6HOQ,859
|
10
10
|
indexify/executor/downloader.py,sha256=dHLxoBnX8-Bh4yZtFDYptZNF6rlVtmTk_70JK8Ect5w,4184
|
11
11
|
indexify/executor/executor_tasks.py,sha256=A0UIEZ5VaB6zSkFQG81UmTW0E57MTYhGlaXuAbRV8lQ,1884
|
@@ -16,20 +16,20 @@ indexify/executor/runtime_probes.py,sha256=mjw2_mGQ622wRT_39WPGGgPEZQTgtrf3-ICcU
|
|
16
16
|
indexify/executor/task_reporter.py,sha256=XlEhNf_ScNnzG67zbtVwL7_9Bo8MvPZiHLI5UHymUnM,5305
|
17
17
|
indexify/executor/task_store.py,sha256=JlRlWwAm4YjFRkTNRx-6GsUcmOzcyvzb5Csa5XDpRTI,3982
|
18
18
|
indexify/functions_sdk/data_objects.py,sha256=wXbUa9hjU6rsXmmk19vQ5Kixf3FsI59VBWPNmHasAX0,854
|
19
|
-
indexify/functions_sdk/graph.py,sha256=
|
19
|
+
indexify/functions_sdk/graph.py,sha256=K7ZF8fPhISVWoNzUTkDF8dMfpF-NKw88FSe9dZHISME,13301
|
20
20
|
indexify/functions_sdk/graph_definition.py,sha256=rJmGcy9u5A_Sme6Ol33NsCnSKQVjyUfeN9LnH3bU88Y,1732
|
21
21
|
indexify/functions_sdk/graph_validation.py,sha256=mN2Fcp91GIwFZEQP6z_qGqt4LkLM70SnI7AWBi4CmKQ,2509
|
22
22
|
indexify/functions_sdk/image.py,sha256=QK0H6KxLWriB_z4M0kunKzzHdHxYLWL670RPYgYuf_8,1762
|
23
|
-
indexify/functions_sdk/indexify_functions.py,sha256=
|
23
|
+
indexify/functions_sdk/indexify_functions.py,sha256=kjGmkRYnA_KO5ypkyaIhqrz0-3UJOFTPGldgOrHSRHY,13401
|
24
24
|
indexify/functions_sdk/local_cache.py,sha256=cNWF67zbhbTJe3g86hyLBy3Rqzs6dNvp2SjLazGZWvw,1348
|
25
25
|
indexify/functions_sdk/object_serializer.py,sha256=R58ALsl2Lb87ii6km4D6hBBsqRs_CHNISxhUICE2d9o,1931
|
26
26
|
indexify/functions_sdk/pipeline.py,sha256=KmxZE8eBFAQ4bbEcYURXXR26HSyoAT3O6iu9H38-OXE,974
|
27
27
|
indexify/http_client.py,sha256=iLafZagCFnlTS6uHfOjInogjg0uXW_zXEspIN7ttB5I,15903
|
28
|
-
indexify/remote_graph.py,sha256=
|
28
|
+
indexify/remote_graph.py,sha256=OzBucU4buR5UdTViNJvh1RfnOTmYA34Uel5qXnRsQsA,5006
|
29
29
|
indexify/remote_pipeline.py,sha256=oqx57rSPszNS3DToXO_nf-CKqkCZWptm1u_p3orV_gQ,790
|
30
30
|
indexify/settings.py,sha256=Ny59mzYI4gbXoK8hjx66a_men6ndbd1J1zCTcKOoyzg,50
|
31
|
-
indexify-0.2.
|
32
|
-
indexify-0.2.
|
33
|
-
indexify-0.2.
|
34
|
-
indexify-0.2.
|
35
|
-
indexify-0.2.
|
31
|
+
indexify-0.2.37.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
32
|
+
indexify-0.2.37.dist-info/METADATA,sha256=UXkVvR1kLUGn34f_mxmQtlEFB4XpB078_Ob3Nbu5eGs,6197
|
33
|
+
indexify-0.2.37.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
34
|
+
indexify-0.2.37.dist-info/entry_points.txt,sha256=Pih7WV-XMpAzI5dEvROcpLr-ybVhd9Y-AtuzBKUdcDs,49
|
35
|
+
indexify-0.2.37.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|