indexify 0.2.11__py3-none-any.whl → 0.2.13__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 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 DEFAULT_IMAGE, Image
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
- func_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,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
- found_funcs = []
141
- for name, obj in globals_dict.items():
142
- for func_name in func_names:
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=DEFAULT_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 _create_image_for_func(func_name, func_obj, python_sdk_path):
208
+ def _create_image(image: Image, python_sdk_path):
214
209
  console.print(
215
210
  Text("Creating container for ", style="cyan"),
216
- Text(f"`{func_name}`", style="cyan bold"),
211
+ Text(f"`{image._image_name}`", style="cyan bold"),
217
212
  )
218
- _build_image(image=func_obj.image, python_sdk_path=python_sdk_path)
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.15-slim-bookworm"
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
- DEFAULT_IMAGE = (
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("latest")
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 DEFAULT_IMAGE, Image
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] = DEFAULT_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] = DEFAULT_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] = DEFAULT_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] = DEFAULT_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
@@ -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.11
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](./examples/pdf_document_extraction/workflow.py)**
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](./examples/video_summarization/workflow.py)**
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.
@@ -1,12 +1,12 @@
1
- indexify/__init__.py,sha256=qgMBKVrM_tI-tFeWpE8ktlC5rcExk05nbWyFqxxqeEU,496
2
- indexify/cli.py,sha256=zSJ5dk5mqmRWkXX150v9ziGqPvFd8gmQDf77Gcc3ZYY,8391
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=0MPiKw0AWs3Z7ReC9l2z-3515yqq85ghPzdh485dnuw,3998
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
@@ -17,15 +17,17 @@ indexify/functions_sdk/data_objects.py,sha256=CQZMzYiV7l6dyzFkYquWQHqdte6JnC7XA3
17
17
  indexify/functions_sdk/graph.py,sha256=t35z26jRCBgoz7fncdlAL7MVTOYjeJuoPpz-xI7WjBw,11827
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=RcFhVjmQv83S2wuf7Yn9RMhdpT-WfRqr1-krCF5UjNM,716
21
- indexify/functions_sdk/indexify_functions.py,sha256=oUssAADTt3byhz3Azl_GiYxV1BmhwuGE1CjmN-oiBpg,9575
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/http_client.py,sha256=0nB-2yQPoVfvTRGvRru_pW6SWjqeT8jtXJPm-MC71pg,13636
24
+ indexify/functions_sdk/pipeline.py,sha256=7hDatRK-SCHYvttf2Vj5YFyiJEVU0OOXEZBOIQenSmk,847
25
+ indexify/http_client.py,sha256=x9ABHWc_oQH8_fa5qwFi53D10m9ibhrjvfw_OkTJfhc,13643
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.11.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
28
- indexify-0.2.11.dist-info/METADATA,sha256=FRk9YjzPFT37qHRdRiYOMS-SMvrDH51Fo8aIa_OW10E,6130
29
- indexify-0.2.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
30
- indexify-0.2.11.dist-info/entry_points.txt,sha256=Pih7WV-XMpAzI5dEvROcpLr-ybVhd9Y-AtuzBKUdcDs,49
31
- indexify-0.2.11.dist-info/RECORD,,
29
+ indexify-0.2.13.dist-info/LICENSE.txt,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
30
+ indexify-0.2.13.dist-info/METADATA,sha256=urBxY_dtcmMIfTd_UQvHq0efxq4-LHJahRGEOM0WYhE,6132
31
+ indexify-0.2.13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
32
+ indexify-0.2.13.dist-info/entry_points.txt,sha256=Pih7WV-XMpAzI5dEvROcpLr-ybVhd9Y-AtuzBKUdcDs,49
33
+ indexify-0.2.13.dist-info/RECORD,,