indexify 0.2.12__tar.gz → 0.2.14__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.
Files changed (32) hide show
  1. {indexify-0.2.12 → indexify-0.2.14}/PKG-INFO +6 -5
  2. {indexify-0.2.12 → indexify-0.2.14}/README.md +2 -2
  3. {indexify-0.2.12 → indexify-0.2.14}/indexify/__init__.py +4 -0
  4. {indexify-0.2.12 → indexify-0.2.14}/indexify/cli.py +12 -6
  5. {indexify-0.2.12 → indexify-0.2.14}/indexify/executor/downloader.py +1 -1
  6. {indexify-0.2.12 → indexify-0.2.14}/indexify/functions_sdk/graph.py +5 -3
  7. {indexify-0.2.12 → indexify-0.2.14}/indexify/functions_sdk/image.py +3 -3
  8. {indexify-0.2.12 → indexify-0.2.14}/indexify/functions_sdk/indexify_functions.py +5 -5
  9. indexify-0.2.14/indexify/functions_sdk/pipeline.py +30 -0
  10. {indexify-0.2.12 → indexify-0.2.14}/indexify/http_client.py +2 -2
  11. indexify-0.2.14/indexify/remote_pipeline.py +24 -0
  12. {indexify-0.2.12 → indexify-0.2.14}/pyproject.toml +3 -3
  13. {indexify-0.2.12 → indexify-0.2.14}/LICENSE.txt +0 -0
  14. {indexify-0.2.12 → indexify-0.2.14}/indexify/data_loaders/__init__.py +0 -0
  15. {indexify-0.2.12 → indexify-0.2.14}/indexify/data_loaders/local_directory_loader.py +0 -0
  16. {indexify-0.2.12 → indexify-0.2.14}/indexify/data_loaders/url_loader.py +0 -0
  17. {indexify-0.2.12 → indexify-0.2.14}/indexify/error.py +0 -0
  18. {indexify-0.2.12 → indexify-0.2.14}/indexify/executor/agent.py +0 -0
  19. {indexify-0.2.12 → indexify-0.2.14}/indexify/executor/api_objects.py +0 -0
  20. {indexify-0.2.12 → indexify-0.2.14}/indexify/executor/executor_tasks.py +0 -0
  21. {indexify-0.2.12 → indexify-0.2.14}/indexify/executor/function_worker.py +0 -0
  22. {indexify-0.2.12 → indexify-0.2.14}/indexify/executor/indexify_executor.py +0 -0
  23. {indexify-0.2.12 → indexify-0.2.14}/indexify/executor/runtime_probes.py +0 -0
  24. {indexify-0.2.12 → indexify-0.2.14}/indexify/executor/task_reporter.py +0 -0
  25. {indexify-0.2.12 → indexify-0.2.14}/indexify/executor/task_store.py +0 -0
  26. {indexify-0.2.12 → indexify-0.2.14}/indexify/functions_sdk/data_objects.py +0 -0
  27. {indexify-0.2.12 → indexify-0.2.14}/indexify/functions_sdk/graph_definition.py +0 -0
  28. {indexify-0.2.12 → indexify-0.2.14}/indexify/functions_sdk/graph_validation.py +0 -0
  29. {indexify-0.2.12 → indexify-0.2.14}/indexify/functions_sdk/local_cache.py +0 -0
  30. {indexify-0.2.12 → indexify-0.2.14}/indexify/functions_sdk/object_serializer.py +0 -0
  31. {indexify-0.2.12 → indexify-0.2.14}/indexify/remote_graph.py +0 -0
  32. {indexify-0.2.12 → indexify-0.2.14}/indexify/settings.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: indexify
3
- Version: 0.2.12
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
- Requires-Dist: cloudpickle (>=3,<4)
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](./examples/pdf_document_extraction/workflow.py)**
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](./examples/video_summarization/workflow.py)**
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.
@@ -14,12 +14,12 @@ pip install indexify
14
14
  ```
15
15
 
16
16
  ## Examples
17
- **[PDF Document Extraction](./examples/pdf_document_extraction/workflow.py)**
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](./examples/video_summarization/workflow.py)**
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 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
- 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 name, obj in globals_dict.items():
140
- if type(obj) and isinstance(obj, Image) and obj._image_name in image_names:
141
- _create_image(obj, python_sdk_path)
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=DEFAULT_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"),
@@ -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(
@@ -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.fn_name,
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
- self._run(input, outputs)
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
  )
@@ -25,11 +25,11 @@ 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("3:10")
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:11")
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 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
@@ -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 + " request args: " + str(kwargs)
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
  [tool.poetry]
2
2
  name = "indexify"
3
- version = "0.2.12"
3
+ version = "0.2.14"
4
4
  description = "Python Client for Indexify"
5
5
  authors = ["Tensorlake Inc. <support@tensorlake.ai>"]
6
6
  license = "Apache 2.0"
@@ -16,8 +16,8 @@ python = "^3.9"
16
16
  httpx = { version = "^0", extras = ["http2"] }
17
17
  pyyaml = "^6"
18
18
  pydantic = "^2.9.2"
19
- cloudpickle = "^3"
20
- rich = "^13"
19
+ cloudpickle = "^3.1.0"
20
+ rich = "^13.9.2"
21
21
  nanoid = "^2.0.0"
22
22
  docker = "^7.1.0"
23
23
  msgpack= "^1.1.0"
File without changes
File without changes