sunholo 0.71.26__py3-none-any.whl → 0.71.28__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.
@@ -508,6 +508,7 @@ def prep_vac(request, vector_name):
508
508
  try:
509
509
  image_uri, mime_type = handle_file_upload(file, vector_name)
510
510
  data["image_uri"] = image_uri
511
+ data["image_url"] = image_uri
511
512
  data["mime"] = mime_type
512
513
  except Exception as e:
513
514
  log.error(f"Error uploading file: {str(e)}")
sunholo/gcs/__init__.py CHANGED
@@ -1 +1 @@
1
- from .download_url import construct_download_link
1
+ from .download_url import construct_download_link, get_bytes_from_gcs
@@ -20,6 +20,46 @@ project_id = None
20
20
  gcs_client = None
21
21
  gcs_bucket_cache = {}
22
22
 
23
+
24
+ def get_bytes_from_gcs(gs_uri):
25
+ """
26
+ Downloads a file from Google Cloud Storage and returns its bytes.
27
+
28
+ Args:
29
+ gs_uri (str): The Google Cloud Storage URI of the file to download (e.g., 'gs://bucket_name/file_name').
30
+
31
+ Returns:
32
+ bytes: The content of the file in bytes, or None if an error occurs.
33
+ """
34
+ if not gs_uri.startswith('gs://'):
35
+ log.error(f"Invalid GCS URI: {gs_uri}")
36
+ return None
37
+
38
+ try:
39
+ storage_client = storage.Client()
40
+ except Exception as err:
41
+ log.error(f"Error creating storage client: {str(err)}")
42
+ return None
43
+
44
+ try:
45
+ # Parse the GCS URI
46
+ path_parts = gs_uri[5:].split('/', 1)
47
+ bucket_name = path_parts[0]
48
+ blob_name = path_parts[1]
49
+
50
+ # Get the bucket and blob
51
+ bucket = storage_client.bucket(bucket_name)
52
+ blob = bucket.blob(blob_name)
53
+
54
+ # Download the blob as bytes
55
+ file_bytes = blob.download_as_bytes()
56
+ return file_bytes
57
+
58
+ except Exception as err:
59
+ log.error(f"Error downloading file from GCS: {str(err)}")
60
+ return None
61
+
62
+
23
63
  if is_running_on_gcp():
24
64
  # Perform a refresh request to get the access token of the current credentials (Else, it's None)
25
65
  gcs_credentials, project_id = google.auth.default()
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.71.26
3
+ Version: 0.71.28
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.71.26.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.71.28.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -13,7 +13,7 @@ sunholo/agents/fastapi/base.py,sha256=clk76cHbUAvU0OYJrRfCWX_5f0ACbhDsIzYBhI3wyo
13
13
  sunholo/agents/fastapi/qna_routes.py,sha256=DgK4Btu5XriOC1JaRQ4G_nWEjJfnQ0J5pyLanF6eF1g,3857
14
14
  sunholo/agents/flask/__init__.py,sha256=uqfHNw2Ru3EJ4dJEcbp86h_lkquBQPMxZbjhV_xe3rs,72
15
15
  sunholo/agents/flask/base.py,sha256=FgSaCODyoTtlstJtsqlLPScdgRUtv9_plxftdzHdVFo,809
16
- sunholo/agents/flask/qna_routes.py,sha256=K7blcozShXIN3qvXSp3fxSa6qXsEA0z2-cM7SwMcRlU,21805
16
+ sunholo/agents/flask/qna_routes.py,sha256=nY0NFgezxw1pEGUq49AIJ5nqIx4lLcUJAMD_FEAOdEA,21855
17
17
  sunholo/agents/flask/vac_routes.py,sha256=l2-w7x437F0Uu3QvwNueEYPtnKuIee6bHJ7LUMt_tkY,19520
18
18
  sunholo/archive/__init__.py,sha256=qNHWm5rGPVOlxZBZCpA1wTYPbalizRT7f8X4rs2t290,31
19
19
  sunholo/archive/archive.py,sha256=C-UhG5x-XtZ8VheQp92IYJqgD0V3NFQjniqlit94t18,1197
@@ -66,9 +66,9 @@ sunholo/discovery_engine/create_new.py,sha256=7oZG78T6lW0EspRzlo7-qRyXFSuFxDn2df
66
66
  sunholo/discovery_engine/discovery_engine_client.py,sha256=YYsFeaW41l8jmWCruQnYxJGKEYBZ7dduTBDhdxI63hQ,17719
67
67
  sunholo/embedder/__init__.py,sha256=sI4N_CqgEVcrMDxXgxKp1FsfsB4FpjoXgPGkl4N_u4I,44
68
68
  sunholo/embedder/embed_chunk.py,sha256=d_dIzeNF630Q0Ar-u1hxos60s0tLIImJccAvuo_LTIw,6814
69
- sunholo/gcs/__init__.py,sha256=DtVw_AZwQn-IguR5BJuIi2XJeF_FQXizhJikzRNrXiE,50
69
+ sunholo/gcs/__init__.py,sha256=NBribFzdXMphwIEABP3YaQrbb54R3Kiz-To6MdVy0Kc,70
70
70
  sunholo/gcs/add_file.py,sha256=Nj75z1MH9fp3fvwd1BVLcHNFm0CVCR2uS4uByThos-o,6924
71
- sunholo/gcs/download_url.py,sha256=8XSEf8byfubqs5CMQeF_tn9wxqwUTq3n9mo5mLNIUTA,4801
71
+ sunholo/gcs/download_url.py,sha256=N-fUmZA6HMCiOkAusY-o04ihs_0fpt1quyifv2c_dYs,5922
72
72
  sunholo/gcs/metadata.py,sha256=C9sMPsHsq1ETetdQCqB3EBs3Kws8b8QHS9L7ei_v5aw,891
73
73
  sunholo/langfuse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
74
  sunholo/langfuse/callback.py,sha256=CTaos8sYcrga949BG6lIZ4I62DiiQSHxwz5re9XjDWQ,1677
@@ -115,9 +115,9 @@ sunholo/vertex/extensions_class.py,sha256=E0ix4YqFQG9EglKeTmp2-zwuZUA2crileGahAh
115
115
  sunholo/vertex/init.py,sha256=-w7b9GKsyJnAJpYHYz6_zBUtmeJeLXlEkgOfwoe4DEI,2715
116
116
  sunholo/vertex/memory_tools.py,sha256=WpedE5yDZcQiFOFBSOtwr-tRCnCXW9G6aZ01rFDfsMo,6862
117
117
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
118
- sunholo-0.71.26.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
119
- sunholo-0.71.26.dist-info/METADATA,sha256=9I9pjclMBvYxgb2pm1J52B6tfRQhAhindw2bIKYJnbE,6767
120
- sunholo-0.71.26.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
121
- sunholo-0.71.26.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
122
- sunholo-0.71.26.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
123
- sunholo-0.71.26.dist-info/RECORD,,
118
+ sunholo-0.71.28.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
119
+ sunholo-0.71.28.dist-info/METADATA,sha256=3W-vWbwG0SH58A2Ozl6T0rUjcli3roM4ExlYp-3519w,6767
120
+ sunholo-0.71.28.dist-info/WHEEL,sha256=y4mX-SOX4fYIkonsAGA5N0Oy-8_gI4FXw5HNI1xqvWg,91
121
+ sunholo-0.71.28.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
122
+ sunholo-0.71.28.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
123
+ sunholo-0.71.28.dist-info/RECORD,,