indexify 0.2.11__tar.gz → 0.2.13__tar.gz
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-0.2.11 → indexify-0.2.13}/PKG-INFO +3 -3
- {indexify-0.2.11 → indexify-0.2.13}/README.md +2 -2
- {indexify-0.2.11 → indexify-0.2.13}/indexify/__init__.py +4 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/cli.py +15 -20
- {indexify-0.2.11 → indexify-0.2.13}/indexify/executor/downloader.py +1 -1
- {indexify-0.2.11 → indexify-0.2.13}/indexify/functions_sdk/image.py +11 -3
- {indexify-0.2.11 → indexify-0.2.13}/indexify/functions_sdk/indexify_functions.py +5 -5
- indexify-0.2.13/indexify/functions_sdk/pipeline.py +30 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/http_client.py +1 -1
- indexify-0.2.13/indexify/remote_pipeline.py +24 -0
- {indexify-0.2.11 → indexify-0.2.13}/pyproject.toml +1 -1
- {indexify-0.2.11 → indexify-0.2.13}/LICENSE.txt +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/data_loaders/__init__.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/data_loaders/local_directory_loader.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/data_loaders/url_loader.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/error.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/executor/agent.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/executor/api_objects.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/executor/executor_tasks.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/executor/function_worker.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/executor/indexify_executor.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/executor/runtime_probes.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/executor/task_reporter.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/executor/task_store.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/functions_sdk/data_objects.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/functions_sdk/graph.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/functions_sdk/graph_definition.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/functions_sdk/graph_validation.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/functions_sdk/local_cache.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/functions_sdk/object_serializer.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/remote_graph.py +0 -0
- {indexify-0.2.11 → indexify-0.2.13}/indexify/settings.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: indexify
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.13
|
4
4
|
Summary: Python Client for Indexify
|
5
5
|
Home-page: https://github.com/tensorlakeai/indexify
|
6
6
|
License: Apache 2.0
|
@@ -42,12 +42,12 @@ pip install indexify
|
|
42
42
|
```
|
43
43
|
|
44
44
|
## Examples
|
45
|
-
**[PDF Document Extraction](
|
45
|
+
**[PDF Document Extraction](../examples/pdf_document_extraction/workflow.py)**
|
46
46
|
1. Extracts text, tables and images from an ingested PDF file
|
47
47
|
2. Indexes the text using MiniLM-L6-v2, the images with CLIP
|
48
48
|
3. Writes the results into a vector database.
|
49
49
|
|
50
|
-
**[Youtube Transcription Summarizer](
|
50
|
+
**[Youtube Transcription Summarizer](../examples/video_summarization/workflow.py)**
|
51
51
|
1. Downloads Youtube Video
|
52
52
|
2. Extracts audio from the video and transcribes using `Faster Whisper`
|
53
53
|
3. Uses Llama 3.1 backed by `Llama.cpp` to understand and classify the nature of the video.
|
@@ -14,12 +14,12 @@ pip install indexify
|
|
14
14
|
```
|
15
15
|
|
16
16
|
## Examples
|
17
|
-
**[PDF Document Extraction](
|
17
|
+
**[PDF Document Extraction](../examples/pdf_document_extraction/workflow.py)**
|
18
18
|
1. Extracts text, tables and images from an ingested PDF file
|
19
19
|
2. Indexes the text using MiniLM-L6-v2, the images with CLIP
|
20
20
|
3. Writes the results into a vector database.
|
21
21
|
|
22
|
-
**[Youtube Transcription Summarizer](
|
22
|
+
**[Youtube Transcription Summarizer](../examples/video_summarization/workflow.py)**
|
23
23
|
1. Downloads Youtube Video
|
24
24
|
2. Extracts audio from the video and transcribes using `Faster Whisper`
|
25
25
|
3. Uses Llama 3.1 backed by `Llama.cpp` to understand and classify the nature of the video.
|
@@ -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",
|
@@ -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
|
-
|
127
|
+
image_names: Optional[List[str]] = None,
|
124
128
|
python_sdk_path: Optional[str] = None,
|
125
129
|
):
|
126
130
|
globals_dict = {}
|
@@ -136,25 +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
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
if name == func_name:
|
144
|
-
found_funcs.append(name)
|
145
|
-
_create_image_for_func(
|
146
|
-
func_name=func_name, func_obj=obj, python_sdk_path=python_sdk_path
|
147
|
-
)
|
148
|
-
|
149
|
-
console.print(
|
150
|
-
Text(f"Processed functions: ", style="cyan"),
|
151
|
-
Text(f"{found_funcs}", style="green"),
|
152
|
-
)
|
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)
|
153
147
|
|
154
148
|
|
155
149
|
@app.command(help="Build default image for indexify")
|
156
150
|
def build_default_image():
|
157
|
-
_build_image(image=
|
151
|
+
_build_image(image=DEFAULT_IMAGE_3_10)
|
152
|
+
_build_image(image=DEFAULT_IMAGE_3_11)
|
158
153
|
|
159
154
|
console.print(
|
160
155
|
Text(f"Built default indexify image", style="cyan"),
|
@@ -210,12 +205,12 @@ def executor(
|
|
210
205
|
console.print(Text(f"Exiting gracefully: {ex}", style="bold yellow"))
|
211
206
|
|
212
207
|
|
213
|
-
def
|
208
|
+
def _create_image(image: Image, python_sdk_path):
|
214
209
|
console.print(
|
215
210
|
Text("Creating container for ", style="cyan"),
|
216
|
-
Text(f"`{
|
211
|
+
Text(f"`{image._image_name}`", style="cyan bold"),
|
217
212
|
)
|
218
|
-
_build_image(image=
|
213
|
+
_build_image(image=image, python_sdk_path=python_sdk_path)
|
219
214
|
|
220
215
|
|
221
216
|
def _build_image(image: Image, python_sdk_path: Optional[str] = None):
|
@@ -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(
|
@@ -4,7 +4,7 @@ class Image:
|
|
4
4
|
|
5
5
|
self._tag = "latest"
|
6
6
|
|
7
|
-
self._base_image = "python:3.10
|
7
|
+
self._base_image = "python:3.11.10-slim-bookworm"
|
8
8
|
|
9
9
|
self._run_strs = []
|
10
10
|
|
@@ -25,10 +25,18 @@ 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("
|
32
|
+
.tag("3.10")
|
33
|
+
.run("pip install indexify")
|
34
|
+
)
|
35
|
+
|
36
|
+
DEFAULT_IMAGE_3_11 = (
|
37
|
+
Image()
|
38
|
+
.name("tensorlake/indexify-executor-default")
|
39
|
+
.base_image("python:3.11.10-slim-bookworm")
|
40
|
+
.tag("3.11")
|
33
41
|
.run("pip install indexify")
|
34
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
|
@@ -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)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|