indexify 0.2.12__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.
Files changed (32) hide show
  1. {indexify-0.2.12 → indexify-0.2.13}/PKG-INFO +3 -3
  2. {indexify-0.2.12 → indexify-0.2.13}/README.md +2 -2
  3. {indexify-0.2.12 → indexify-0.2.13}/indexify/__init__.py +4 -0
  4. {indexify-0.2.12 → indexify-0.2.13}/indexify/cli.py +12 -6
  5. {indexify-0.2.12 → indexify-0.2.13}/indexify/executor/downloader.py +1 -1
  6. {indexify-0.2.12 → indexify-0.2.13}/indexify/functions_sdk/image.py +3 -3
  7. {indexify-0.2.12 → indexify-0.2.13}/indexify/functions_sdk/indexify_functions.py +5 -5
  8. indexify-0.2.13/indexify/functions_sdk/pipeline.py +30 -0
  9. {indexify-0.2.12 → indexify-0.2.13}/indexify/http_client.py +1 -1
  10. indexify-0.2.13/indexify/remote_pipeline.py +24 -0
  11. {indexify-0.2.12 → indexify-0.2.13}/pyproject.toml +1 -1
  12. {indexify-0.2.12 → indexify-0.2.13}/LICENSE.txt +0 -0
  13. {indexify-0.2.12 → indexify-0.2.13}/indexify/data_loaders/__init__.py +0 -0
  14. {indexify-0.2.12 → indexify-0.2.13}/indexify/data_loaders/local_directory_loader.py +0 -0
  15. {indexify-0.2.12 → indexify-0.2.13}/indexify/data_loaders/url_loader.py +0 -0
  16. {indexify-0.2.12 → indexify-0.2.13}/indexify/error.py +0 -0
  17. {indexify-0.2.12 → indexify-0.2.13}/indexify/executor/agent.py +0 -0
  18. {indexify-0.2.12 → indexify-0.2.13}/indexify/executor/api_objects.py +0 -0
  19. {indexify-0.2.12 → indexify-0.2.13}/indexify/executor/executor_tasks.py +0 -0
  20. {indexify-0.2.12 → indexify-0.2.13}/indexify/executor/function_worker.py +0 -0
  21. {indexify-0.2.12 → indexify-0.2.13}/indexify/executor/indexify_executor.py +0 -0
  22. {indexify-0.2.12 → indexify-0.2.13}/indexify/executor/runtime_probes.py +0 -0
  23. {indexify-0.2.12 → indexify-0.2.13}/indexify/executor/task_reporter.py +0 -0
  24. {indexify-0.2.12 → indexify-0.2.13}/indexify/executor/task_store.py +0 -0
  25. {indexify-0.2.12 → indexify-0.2.13}/indexify/functions_sdk/data_objects.py +0 -0
  26. {indexify-0.2.12 → indexify-0.2.13}/indexify/functions_sdk/graph.py +0 -0
  27. {indexify-0.2.12 → indexify-0.2.13}/indexify/functions_sdk/graph_definition.py +0 -0
  28. {indexify-0.2.12 → indexify-0.2.13}/indexify/functions_sdk/graph_validation.py +0 -0
  29. {indexify-0.2.12 → indexify-0.2.13}/indexify/functions_sdk/local_cache.py +0 -0
  30. {indexify-0.2.12 → indexify-0.2.13}/indexify/functions_sdk/object_serializer.py +0 -0
  31. {indexify-0.2.12 → indexify-0.2.13}/indexify/remote_graph.py +0 -0
  32. {indexify-0.2.12 → 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.12
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.
@@ -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(
@@ -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
@@ -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.13"
4
4
  description = "Python Client for Indexify"
5
5
  authors = ["Tensorlake Inc. <support@tensorlake.ai>"]
6
6
  license = "Apache 2.0"
File without changes
File without changes