sunholo 0.61.7__py3-none-any.whl → 0.61.9__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.
@@ -1 +1 @@
1
- from .data_to_embed_pubsub import data_to_embed_pubsub
1
+ from .data_to_embed_pubsub import data_to_embed_pubsub, direct_file_to_embed
@@ -11,11 +11,36 @@
11
11
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
+ import pathlib
15
+
14
16
  from ..logging import log
15
17
  from ..pubsub import process_pubsub_message
16
18
  from .message_data import handle_gcs_message, handle_google_drive_message, handle_github_message, handle_http_message, handle_json_content_message
17
19
  from .publish import process_docs_chunks_vector_name
20
+ from .splitter import chunk_doc_to_docs
21
+
18
22
  from ..llamaindex.import_files import llamaindex_chunker_check
23
+ from . import loaders
24
+
25
+ def direct_file_to_embed(file_name: pathlib.Path, metadata: dict, vector_name: str):
26
+ """
27
+ Send direct files to chunking embed pipeline
28
+
29
+
30
+
31
+ """
32
+ log.info(f"Sending direct file upload {file_name} to loaders.read_file_to_documents {metadata}")
33
+ docs = loaders.read_file_to_documents(file_name, metadata=metadata)
34
+ if docs is None:
35
+ log.warning(f"loaders.read_file_to_documents docs2 failed to load file {metadata}")
36
+
37
+ return None
38
+
39
+ chunks = chunk_doc_to_docs(docs, file_name.suffix, vector_name=vector_name)
40
+
41
+ return format_chunk_return(chunks, metadata, vector_name)
42
+
43
+
19
44
 
20
45
  def data_to_embed_pubsub(data: dict):
21
46
  """Triggered from a message on a Cloud Pub/Sub topic.
@@ -62,7 +87,11 @@ def process_chunker_data(message_data, metadata, vector_name):
62
87
 
63
88
  else:
64
89
  chunks, metadata = handle_json_content_message(message_data, metadata, vector_name)
90
+
91
+ return format_chunk_return(chunks, metadata, vector_name)
92
+
65
93
 
94
+ def format_chunk_return(chunks, metadata, vector_name):
66
95
  # to be really sure
67
96
  if metadata:
68
97
  metadata["vector_name"] = vector_name
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.61.7
3
+ Version: 0.61.9
4
4
  Summary: Large Language Model DevOps - a package to help deploy LLMs to the Cloud.
5
5
  Home-page: https://github.com/sunholo-data/sunholo-py
6
- Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.61.7.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.61.9.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -21,8 +21,8 @@ sunholo/bots/__init__.py,sha256=EMFd7e2z68l6pzYOnkzHbLd2xJRvxTKFRNCTuhZ8hIw,130
21
21
  sunholo/bots/discord.py,sha256=cCFae5K1BCa6JVkWGLh_iZ9qFO1JpXb6K4eJrlDfEro,2442
22
22
  sunholo/bots/github_webhook.py,sha256=5pQPRLM_wxxcILVaIzUDV8Kt7Arcm2dL1r1kMMHA524,9629
23
23
  sunholo/bots/webapp.py,sha256=EIMxdAJ_xtufwJmvnn7N_Fb_1hZ9DjhJ0Kf_hp02vEU,1926
24
- sunholo/chunker/__init__.py,sha256=UhQBZTKwDfBXm0TPv4LvsGc5pdUGCbYzi3qPTOkU4gw,55
25
- sunholo/chunker/data_to_embed_pubsub.py,sha256=IY9SBRA7IO77QJBEgQuO1FiSCd6Dfm-TMEf1Ey-pLoo,3065
24
+ sunholo/chunker/__init__.py,sha256=yWYwpejyYxDpZv1joTrFMsh2SWAkd0z7a1VKtmOfMhA,77
25
+ sunholo/chunker/data_to_embed_pubsub.py,sha256=h4X373NfRLaZvSMKm8RjrNKsPAmx8kK-91uyXYu3Gx8,3887
26
26
  sunholo/chunker/doc_handling.py,sha256=rIyknpzDyj5A0u_DqSQVD_CXLRNZPOU6TCL4bhCdjOI,8563
27
27
  sunholo/chunker/images.py,sha256=Xmh1vwHrVhoXm5iH2dhCc52O8YgdzE8KrDSdL-pGnp8,1861
28
28
  sunholo/chunker/loaders.py,sha256=xiToUVgPz2ZzcqpUAq7aNP3PTenb_rBUAFzu0JPycIg,10268
@@ -96,9 +96,9 @@ sunholo/utils/parsers.py,sha256=OrHmASqIbI45atVOhiGodgLvnfrzkvVzyHnSvAXD89I,3841
96
96
  sunholo/utils/user_ids.py,sha256=SQd5_H7FE7vcTZp9AQuQDWBXd4FEEd7TeVMQe1H4Ny8,292
97
97
  sunholo/vertex/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
98
98
  sunholo/vertex/init_vertex.py,sha256=JDMUaBRdednzbKF-5p33qqLit2LMsvgvWW-NRz0AqO0,1801
99
- sunholo-0.61.7.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
100
- sunholo-0.61.7.dist-info/METADATA,sha256=49tEfz5t9jCW7XjVFyy-4Ip7_JbDUdTxxZviBqtBVaA,8057
101
- sunholo-0.61.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
102
- sunholo-0.61.7.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
103
- sunholo-0.61.7.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
104
- sunholo-0.61.7.dist-info/RECORD,,
99
+ sunholo-0.61.9.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
100
+ sunholo-0.61.9.dist-info/METADATA,sha256=gjQ1Kx5ibCS76YAO3pDR7KCJd7xlxxAK46k2Ei4AQAY,8057
101
+ sunholo-0.61.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
102
+ sunholo-0.61.9.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
103
+ sunholo-0.61.9.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
104
+ sunholo-0.61.9.dist-info/RECORD,,