indexify 0.2.12__py3-none-any.whl → 0.2.14__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/__init__.py +4 -0
- indexify/cli.py +12 -6
- indexify/executor/downloader.py +1 -1
- indexify/functions_sdk/graph.py +5 -3
- indexify/functions_sdk/image.py +3 -3
- indexify/functions_sdk/indexify_functions.py +5 -5
- indexify/functions_sdk/pipeline.py +30 -0
- indexify/http_client.py +2 -2
- indexify/remote_pipeline.py +24 -0
- {indexify-0.2.12.dist-info → indexify-0.2.14.dist-info}/METADATA +6 -5
- {indexify-0.2.12.dist-info → indexify-0.2.14.dist-info}/RECORD +14 -12
- {indexify-0.2.12.dist-info → indexify-0.2.14.dist-info}/WHEEL +1 -1
- {indexify-0.2.12.dist-info → indexify-0.2.14.dist-info}/LICENSE.txt +0 -0
- {indexify-0.2.12.dist-info → indexify-0.2.14.dist-info}/entry_points.txt +0 -0
indexify/__init__.py
CHANGED
@@ -5,14 +5,18 @@ from .functions_sdk.indexify_functions import (
|
|
5
5
|
indexify_function,
|
6
6
|
indexify_router,
|
7
7
|
)
|
8
|
+
from .functions_sdk.pipeline import Pipeline
|
8
9
|
from .http_client import IndexifyClient
|
9
10
|
from .remote_graph import RemoteGraph
|
11
|
+
from .remote_pipeline import RemotePipeline
|
10
12
|
from .settings import DEFAULT_SERVICE_URL
|
11
13
|
|
12
14
|
__all__ = [
|
13
15
|
"data_loaders",
|
14
16
|
"Graph",
|
15
17
|
"RemoteGraph",
|
18
|
+
"Pipeline",
|
19
|
+
"RemotePipeline",
|
16
20
|
"Image",
|
17
21
|
"indexify_function",
|
18
22
|
"indexify_router",
|
indexify/cli.py
CHANGED
@@ -18,7 +18,11 @@ from rich.theme import Theme
|
|
18
18
|
|
19
19
|
from indexify.executor.agent import ExtractorAgent
|
20
20
|
from indexify.executor.function_worker import FunctionWorker
|
21
|
-
from indexify.functions_sdk.image import
|
21
|
+
from indexify.functions_sdk.image import (
|
22
|
+
DEFAULT_IMAGE_3_10,
|
23
|
+
DEFAULT_IMAGE_3_11,
|
24
|
+
Image,
|
25
|
+
)
|
22
26
|
|
23
27
|
custom_theme = Theme(
|
24
28
|
{
|
@@ -120,7 +124,7 @@ def server_dev_mode():
|
|
120
124
|
@app.command(help="Build image for function names")
|
121
125
|
def build_image(
|
122
126
|
workflow_file_path: str,
|
123
|
-
image_names: List[str],
|
127
|
+
image_names: Optional[List[str]] = None,
|
124
128
|
python_sdk_path: Optional[str] = None,
|
125
129
|
):
|
126
130
|
globals_dict = {}
|
@@ -136,14 +140,16 @@ def build_image(
|
|
136
140
|
raise Exception(
|
137
141
|
f"Could not find workflow file to execute at: " f"`{workflow_file_path}`"
|
138
142
|
)
|
139
|
-
for
|
140
|
-
if type(obj) and isinstance(obj, Image)
|
141
|
-
|
143
|
+
for _, obj in globals_dict.items():
|
144
|
+
if type(obj) and isinstance(obj, Image):
|
145
|
+
if image_names is None or obj._image_name in image_names:
|
146
|
+
_create_image(obj, python_sdk_path)
|
142
147
|
|
143
148
|
|
144
149
|
@app.command(help="Build default image for indexify")
|
145
150
|
def build_default_image():
|
146
|
-
_build_image(image=
|
151
|
+
_build_image(image=DEFAULT_IMAGE_3_10)
|
152
|
+
_build_image(image=DEFAULT_IMAGE_3_11)
|
147
153
|
|
148
154
|
console.print(
|
149
155
|
Text(f"Built default indexify image", style="cyan"),
|
indexify/executor/downloader.py
CHANGED
@@ -75,7 +75,7 @@ class Downloader:
|
|
75
75
|
|
76
76
|
reducer_url = None
|
77
77
|
if task.reducer_output_id:
|
78
|
-
reducer_url = f"{self.base_url}/namespaces/{task.namespace}/compute_graphs/{task.compute_graph}/invocations/{task.invocation_id}/fn/{task.compute_fn}/{task.reducer_output_id}"
|
78
|
+
reducer_url = f"{self.base_url}/namespaces/{task.namespace}/compute_graphs/{task.compute_graph}/invocations/{task.invocation_id}/fn/{task.compute_fn}/output/{task.reducer_output_id}"
|
79
79
|
|
80
80
|
console.print(
|
81
81
|
Panel(
|
indexify/functions_sdk/graph.py
CHANGED
@@ -153,7 +153,7 @@ class Graph:
|
|
153
153
|
start_node = self.nodes[self._start_node]
|
154
154
|
start_node = FunctionMetadata(
|
155
155
|
name=start_node.name,
|
156
|
-
fn_name=start_node.
|
156
|
+
fn_name=start_node.name,
|
157
157
|
description=start_node.description,
|
158
158
|
reducer=start_node.accumulate is not None,
|
159
159
|
image_name=start_node.image._image_name,
|
@@ -209,13 +209,15 @@ class Graph:
|
|
209
209
|
k: IndexifyData(payload=serializer.serialize(v))
|
210
210
|
}
|
211
211
|
self._results[input.id] = outputs
|
212
|
-
|
212
|
+
enable_cache = kwargs.get('enable_cache', True)
|
213
|
+
self._run(input, outputs,enable_cache)
|
213
214
|
return input.id
|
214
215
|
|
215
216
|
def _run(
|
216
217
|
self,
|
217
218
|
initial_input: IndexifyData,
|
218
219
|
outputs: Dict[str, List[bytes]],
|
220
|
+
enable_cache: bool
|
219
221
|
):
|
220
222
|
accumulator_values = self._accumulator_values[initial_input.id]
|
221
223
|
queue = deque([(self._start_node, initial_input)])
|
@@ -227,7 +229,7 @@ class Graph:
|
|
227
229
|
cached_output_bytes: Optional[bytes] = self._cache.get(
|
228
230
|
self.name, node_name, input_bytes
|
229
231
|
)
|
230
|
-
if cached_output_bytes is not None:
|
232
|
+
if cached_output_bytes is not None and enable_cache:
|
231
233
|
print(
|
232
234
|
f"ran {node_name}: num outputs: {len(cached_output_bytes)} (cache hit)"
|
233
235
|
)
|
indexify/functions_sdk/image.py
CHANGED
@@ -25,11 +25,11 @@ class Image:
|
|
25
25
|
return self
|
26
26
|
|
27
27
|
|
28
|
-
|
28
|
+
DEFAULT_IMAGE_3_10 = (
|
29
29
|
Image()
|
30
30
|
.name("tensorlake/indexify-executor-default")
|
31
31
|
.base_image("python:3.10.15-slim-bookworm")
|
32
|
-
.tag("3
|
32
|
+
.tag("3.10")
|
33
33
|
.run("pip install indexify")
|
34
34
|
)
|
35
35
|
|
@@ -37,6 +37,6 @@ DEFAULT_IMAGE_3_11 = (
|
|
37
37
|
Image()
|
38
38
|
.name("tensorlake/indexify-executor-default")
|
39
39
|
.base_image("python:3.11.10-slim-bookworm")
|
40
|
-
.tag("3
|
40
|
+
.tag("3.11")
|
41
41
|
.run("pip install indexify")
|
42
42
|
)
|
@@ -18,7 +18,7 @@ from pydantic import BaseModel
|
|
18
18
|
from typing_extensions import get_type_hints
|
19
19
|
|
20
20
|
from .data_objects import IndexifyData, RouterOutput
|
21
|
-
from .image import
|
21
|
+
from .image import DEFAULT_IMAGE_3_10, Image
|
22
22
|
from .object_serializer import CloudPickleSerializer, get_serializer
|
23
23
|
|
24
24
|
|
@@ -65,7 +65,7 @@ class PlacementConstraints(BaseModel):
|
|
65
65
|
class IndexifyFunction(ABC):
|
66
66
|
name: str = ""
|
67
67
|
description: str = ""
|
68
|
-
image: Optional[Image] =
|
68
|
+
image: Optional[Image] = DEFAULT_IMAGE_3_10
|
69
69
|
placement_constraints: List[PlacementConstraints] = []
|
70
70
|
accumulate: Optional[Type[Any]] = None
|
71
71
|
payload_encoder: Optional[str] = "cloudpickle"
|
@@ -83,7 +83,7 @@ class IndexifyFunction(ABC):
|
|
83
83
|
class IndexifyRouter(ABC):
|
84
84
|
name: str = ""
|
85
85
|
description: str = ""
|
86
|
-
image: Optional[Image] =
|
86
|
+
image: Optional[Image] = DEFAULT_IMAGE_3_10
|
87
87
|
placement_constraints: List[PlacementConstraints] = []
|
88
88
|
payload_encoder: Optional[str] = "cloudpickle"
|
89
89
|
|
@@ -95,7 +95,7 @@ class IndexifyRouter(ABC):
|
|
95
95
|
def indexify_router(
|
96
96
|
name: Optional[str] = None,
|
97
97
|
description: Optional[str] = "",
|
98
|
-
image: Optional[Image] =
|
98
|
+
image: Optional[Image] = DEFAULT_IMAGE_3_10,
|
99
99
|
placement_constraints: List[PlacementConstraints] = [],
|
100
100
|
payload_encoder: Optional[str] = "cloudpickle",
|
101
101
|
):
|
@@ -129,7 +129,7 @@ def indexify_router(
|
|
129
129
|
def indexify_function(
|
130
130
|
name: Optional[str] = None,
|
131
131
|
description: Optional[str] = "",
|
132
|
-
image: Optional[Image] =
|
132
|
+
image: Optional[Image] = DEFAULT_IMAGE_3_10,
|
133
133
|
accumulate: Optional[Type[BaseModel]] = None,
|
134
134
|
payload_encoder: Optional[str] = "cloudpickle",
|
135
135
|
placement_constraints: List[PlacementConstraints] = [],
|
@@ -0,0 +1,30 @@
|
|
1
|
+
from typing import Union
|
2
|
+
|
3
|
+
from indexify.functions_sdk.indexify_functions import (
|
4
|
+
IndexifyFunction,
|
5
|
+
IndexifyRouter,
|
6
|
+
)
|
7
|
+
|
8
|
+
from .graph import Graph
|
9
|
+
|
10
|
+
|
11
|
+
class Pipeline:
|
12
|
+
def __init__(self, name: str, description: str):
|
13
|
+
self.name = name
|
14
|
+
self.description = description
|
15
|
+
self._graph: Graph = None
|
16
|
+
self._last_step = None
|
17
|
+
|
18
|
+
def add_step(self, function: Union[IndexifyFunction, IndexifyRouter]):
|
19
|
+
if self._graph is None:
|
20
|
+
self._graph = Graph(
|
21
|
+
name=self.name, description=self.description, start_node=function
|
22
|
+
)
|
23
|
+
self._last_step = function
|
24
|
+
return
|
25
|
+
self._graph.add_edge(self._last_step, function)
|
26
|
+
self._last_step = function
|
27
|
+
|
28
|
+
def run(self, **kwargs):
|
29
|
+
invocation_id = self._graph.run(**kwargs)
|
30
|
+
return invocation_id
|
indexify/http_client.py
CHANGED
@@ -79,7 +79,7 @@ class IndexifyClient:
|
|
79
79
|
status_code = str(response.status_code)
|
80
80
|
if status_code.startswith("4"):
|
81
81
|
raise ApiException(
|
82
|
-
"status code: " + status_code + "
|
82
|
+
"status code: " + status_code + " message: " + response.text
|
83
83
|
)
|
84
84
|
if status_code.startswith("5"):
|
85
85
|
raise ApiException(response.text)
|
@@ -300,7 +300,7 @@ class IndexifyClient:
|
|
300
300
|
output_id: str,
|
301
301
|
) -> IndexifyData:
|
302
302
|
response = self._get(
|
303
|
-
f"namespaces/{namespace}/compute_graphs/{graph}/invocations/{invocation_id}/fn/{fn_name}/{output_id}",
|
303
|
+
f"namespaces/{namespace}/compute_graphs/{graph}/invocations/{invocation_id}/fn/{fn_name}/output/{output_id}",
|
304
304
|
)
|
305
305
|
response.raise_for_status()
|
306
306
|
data_dict = msgpack.unpackb(response.content)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
from typing import Optional
|
2
|
+
|
3
|
+
from indexify.functions_sdk.pipeline import Pipeline
|
4
|
+
|
5
|
+
from .http_client import IndexifyClient
|
6
|
+
from .remote_graph import RemoteGraph
|
7
|
+
|
8
|
+
|
9
|
+
class RemotePipeline(RemoteGraph):
|
10
|
+
@classmethod
|
11
|
+
def deploy(
|
12
|
+
cls,
|
13
|
+
p: Pipeline,
|
14
|
+
additional_modules=[],
|
15
|
+
server_url: Optional[str] = "http://localhost:8900",
|
16
|
+
):
|
17
|
+
"""
|
18
|
+
Create a new RemoteGraph from a local Graph object.
|
19
|
+
:param g: The local Graph object.
|
20
|
+
:param server_url: The URL of the server where the graph will be registered.
|
21
|
+
"""
|
22
|
+
client = IndexifyClient(service_url=server_url)
|
23
|
+
client.register_compute_graph(p._graph, additional_modules)
|
24
|
+
return cls(name=p._graph.name, server_url=server_url)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: indexify
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.14
|
4
4
|
Summary: Python Client for Indexify
|
5
5
|
Home-page: https://github.com/tensorlakeai/indexify
|
6
6
|
License: Apache 2.0
|
@@ -13,7 +13,8 @@ Classifier: Programming Language :: Python :: 3.9
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
16
|
-
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
17
|
+
Requires-Dist: cloudpickle (>=3.1.0,<4.0.0)
|
17
18
|
Requires-Dist: docker (>=7.1.0,<8.0.0)
|
18
19
|
Requires-Dist: httpx-sse (>=0.4.0,<0.5.0)
|
19
20
|
Requires-Dist: httpx[http2] (>=0,<1)
|
@@ -21,7 +22,7 @@ Requires-Dist: msgpack (>=1.1.0,<2.0.0)
|
|
21
22
|
Requires-Dist: nanoid (>=2.0.0,<3.0.0)
|
22
23
|
Requires-Dist: pydantic (>=2.9.2,<3.0.0)
|
23
24
|
Requires-Dist: pyyaml (>=6,<7)
|
24
|
-
Requires-Dist: rich (>=13,<14)
|
25
|
+
Requires-Dist: rich (>=13.9.2,<14.0.0)
|
25
26
|
Requires-Dist: typer (>=0.12.5,<0.13.0)
|
26
27
|
Project-URL: Repository, https://github.com/tensorlakeai/indexify
|
27
28
|
Description-Content-Type: text/markdown
|
@@ -42,12 +43,12 @@ pip install indexify
|
|
42
43
|
```
|
43
44
|
|
44
45
|
## Examples
|
45
|
-
**[PDF Document Extraction](
|
46
|
+
**[PDF Document Extraction](../examples/pdf_document_extraction/workflow.py)**
|
46
47
|
1. Extracts text, tables and images from an ingested PDF file
|
47
48
|
2. Indexes the text using MiniLM-L6-v2, the images with CLIP
|
48
49
|
3. Writes the results into a vector database.
|
49
50
|
|
50
|
-
**[Youtube Transcription Summarizer](
|
51
|
+
**[Youtube Transcription Summarizer](../examples/video_summarization/workflow.py)**
|
51
52
|
1. Downloads Youtube Video
|
52
53
|
2. Extracts audio from the video and transcribes using `Faster Whisper`
|
53
54
|
3. Uses Llama 3.1 backed by `Llama.cpp` to understand and classify the nature of the video.
|
@@ -1,12 +1,12 @@
|
|
1
|
-
indexify/__init__.py,sha256=
|
2
|
-
indexify/cli.py,sha256=
|
1
|
+
indexify/__init__.py,sha256=xYjdqZQ9CEtV-s4PJhj_6Vx_dfg_qknWHkLqOSVom8g,623
|
2
|
+
indexify/cli.py,sha256=tfqXvOYlrseZMRUxM70zalRz-O1IGE1cFuO_HiTZ1oU,8244
|
3
3
|
indexify/data_loaders/__init__.py,sha256=Y5NEuseTcYAICRiweYw5wBQ2m2YplbsY21I7df-rdi4,1339
|
4
4
|
indexify/data_loaders/local_directory_loader.py,sha256=fCrgj5drnW71ZUdDDvcB1-VJjIs1w6Q8sEW0HSGSAiA,1247
|
5
5
|
indexify/data_loaders/url_loader.py,sha256=32SERljcq1Xsi4RdLz2dgyk2TER5pQPTtXl3gUzwHbY,1533
|
6
6
|
indexify/error.py,sha256=vjd5SPPNFIEW35GorSIodsqvm9RKHQm9kdp8t9gv-WM,111
|
7
7
|
indexify/executor/agent.py,sha256=I08CiOWeJ_mz8OHr9_iJfp07Ma1VMQirZ2MsDp8lDZw,14723
|
8
8
|
indexify/executor/api_objects.py,sha256=SysjlGYu4JtYdqfexZHHN1IW4TtaDdFUF3hYZ5mpUJU,810
|
9
|
-
indexify/executor/downloader.py,sha256=
|
9
|
+
indexify/executor/downloader.py,sha256=3mEDdluTzspsLGAZtFHZOVuyKOzT3CSema2kIK6Z1yU,4005
|
10
10
|
indexify/executor/executor_tasks.py,sha256=gAZ2pvza1YwGlaR1o_tJW4SXtdCgK7sLJgp4W7rOjR0,1834
|
11
11
|
indexify/executor/function_worker.py,sha256=RQh-lJD2UtUuYXyCDkGohe8rVpHEriJg-AjBKSgD5KI,5436
|
12
12
|
indexify/executor/indexify_executor.py,sha256=2Ut_VX-Su_lm4b4aEROyRJ3gXx-uFHA-V7EN0sWiARE,771
|
@@ -14,18 +14,20 @@ indexify/executor/runtime_probes.py,sha256=L-nB4D2zBZ287xxPwErv5R_gxFOmTEvg61FMe
|
|
14
14
|
indexify/executor/task_reporter.py,sha256=gnnse0v6rjjni8lNzeb-ZYq6iF2DgafKoT7dcGUZhQ4,3716
|
15
15
|
indexify/executor/task_store.py,sha256=q8s2gImsFffWeXQR0mk1Xlo1Aj_2GfclNPjQ2EA_YBo,3984
|
16
16
|
indexify/functions_sdk/data_objects.py,sha256=CQZMzYiV7l6dyzFkYquWQHqdte6JnC7XA3i2ZyvPvgQ,844
|
17
|
-
indexify/functions_sdk/graph.py,sha256=
|
17
|
+
indexify/functions_sdk/graph.py,sha256=3hUZjdCesiAHJ9y1_heQsEFO-WHROR4kRYxBtVnb7Y4,11937
|
18
18
|
indexify/functions_sdk/graph_definition.py,sha256=EJfC0MdKEbFF1CBaU0htrveSlcAQJCH96DLSNfZ02V4,1178
|
19
19
|
indexify/functions_sdk/graph_validation.py,sha256=XLHiC9PAtZungJLysU3hIUOPNDkO5TXUDZ_jiZ0H4hg,2508
|
20
|
-
indexify/functions_sdk/image.py,sha256=
|
21
|
-
indexify/functions_sdk/indexify_functions.py,sha256=
|
20
|
+
indexify/functions_sdk/image.py,sha256=Rsol3LfE15Kca78ruPfDrDPqCkeZPxZx0ULYrFFS5ig,905
|
21
|
+
indexify/functions_sdk/indexify_functions.py,sha256=QnumxE0Ln_ryyyjLMopjCGZQUGSX7N25PRpisIdEEXI,9600
|
22
22
|
indexify/functions_sdk/local_cache.py,sha256=cNWF67zbhbTJe3g86hyLBy3Rqzs6dNvp2SjLazGZWvw,1348
|
23
23
|
indexify/functions_sdk/object_serializer.py,sha256=Zz4GobW3ZamBBtFDF76QxU3TP6oJNdWnhsfKd0OUFoc,1660
|
24
|
-
indexify/
|
24
|
+
indexify/functions_sdk/pipeline.py,sha256=7hDatRK-SCHYvttf2Vj5YFyiJEVU0OOXEZBOIQenSmk,847
|
25
|
+
indexify/http_client.py,sha256=EBzqwT3r90W4w0ADG8oRy8tCh47BHuMPB-vVh-bjUO8,13640
|
25
26
|
indexify/remote_graph.py,sha256=ILg6IY6EFgyvnfz1DSzicBZhqvPkg2-UUwgI6lxp6sA,3094
|
27
|
+
indexify/remote_pipeline.py,sha256=FW7IAv3r24OOpiqlprw3kuFrpdkqi6Ic4_tT26FThjA,761
|
26
28
|
indexify/settings.py,sha256=LSaWZ0ADIVmUv6o6dHWRC3-Ry5uLbCw2sBSg1e_U7UM,99
|
27
|
-
indexify-0.2.
|
28
|
-
indexify-0.2.
|
29
|
-
indexify-0.2.
|
30
|
-
indexify-0.2.
|
31
|
-
indexify-0.2.
|
29
|
+
indexify-0.2.14.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
30
|
+
indexify-0.2.14.dist-info/METADATA,sha256=zMLk24iy5hXk8BGlvSxkAMHenl2JNxSeXQuENZLNsuY,6199
|
31
|
+
indexify-0.2.14.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
32
|
+
indexify-0.2.14.dist-info/entry_points.txt,sha256=Pih7WV-XMpAzI5dEvROcpLr-ybVhd9Y-AtuzBKUdcDs,49
|
33
|
+
indexify-0.2.14.dist-info/RECORD,,
|
File without changes
|
File without changes
|