sunholo 0.81.5__py3-none-any.whl → 0.82.1__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.
sunholo/agents/swagger.py CHANGED
@@ -173,7 +173,7 @@ def generate_swagger(vac_config, agent_config):
173
173
  'description': 'Multivac (Multi-VAC) Cloud. Generate API keys (MULTIVAC_API_KEY) to enable access to private services. See more at https://dev.sunholo.com/',
174
174
  'version': '0.1.0'
175
175
  },
176
- 'host': '"${_ENDPOINTS_HOST}"',
176
+ 'host': '${_ENDPOINTS_HOST}',
177
177
  'basePath': '/v1',
178
178
  'schemes': ['https'],
179
179
  'produces': ['application/json'],
sunholo/gcs/add_file.py CHANGED
@@ -15,6 +15,7 @@ import datetime
15
15
  import os
16
16
  import base64
17
17
  import uuid
18
+ import time
18
19
 
19
20
  try:
20
21
  from google.cloud import storage
@@ -89,6 +90,33 @@ def resolve_bucket(vector_name):
89
90
 
90
91
  return bucket_name
91
92
 
93
+ def add_folder_to_gcs(
94
+ source_folder:str,
95
+ vector_name:str=None,
96
+ bucket_name:str=None,
97
+ metadata:dict=None,
98
+ bucket_folderpath:str=None):
99
+ """Uploads a folder and all its contents to a specified GCS bucket."""
100
+
101
+ uris = []
102
+ for root, dirs, files in os.walk(source_folder):
103
+ for file in files:
104
+ local_path = os.path.join(root, file)
105
+ # Create the relative path in the destination folder
106
+ relative_path = os.path.relpath(local_path, source_folder)
107
+ bucket_filepath = os.path.join(bucket_folderpath, relative_path)
108
+
109
+ uri = add_file_to_gcs(local_path,
110
+ vector_name=vector_name,
111
+ bucket_name=bucket_name,
112
+ metadata=metadata,
113
+ bucket_filepath=bucket_filepath)
114
+ uris.append(uri)
115
+
116
+ log.info(f"uploaded [{len(files)}] to GCS bucket")
117
+
118
+ return uris
119
+
92
120
  def add_file_to_gcs(filename: str,
93
121
  vector_name:str=None,
94
122
  bucket_name: str=None,
@@ -148,7 +176,7 @@ def add_file_to_gcs(filename: str,
148
176
 
149
177
  blob.metadata = the_metadata
150
178
 
151
- import time
179
+
152
180
 
153
181
  max_retries = 5
154
182
  base_delay = 1 # 1 second
@@ -41,7 +41,7 @@ def direct_vac(vac_input: dict, vac_name: str, chat_history=[]):
41
41
  override_endpoint = agent_url or override_endpoint
42
42
 
43
43
  print(f"Using {override_endpoint=}")
44
- log.warning(f'Batch invoke_vac_qa with {vac_input=}')
44
+ log.warning(f'Batch invoke_vac_qa {vac_name} with {vac_input=}')
45
45
  vac_response = send_to_qa(
46
46
  vac_input["user_input"],
47
47
  vector_name=vac_name,
@@ -1,3 +1,3 @@
1
1
  from .pubsub_manager import PubSubManager
2
- from .process_pubsub import process_pubsub_message
2
+ from .process_pubsub import process_pubsub_message, decode_pubsub_message
3
3
 
@@ -16,8 +16,7 @@ from ..custom_logging import log
16
16
  from ..gcs.metadata import get_object_metadata
17
17
 
18
18
 
19
-
20
- def process_pubsub_message(data: dict) -> tuple:
19
+ def decode_pubsub_message(data: dict) -> tuple:
21
20
  """Extracts message data and metadata from a Pub/Sub message.
22
21
 
23
22
  Args:
@@ -26,7 +25,6 @@ def process_pubsub_message(data: dict) -> tuple:
26
25
  Returns:
27
26
  tuple: A tuple containing the message data and attributes as metadata.
28
27
  """
29
- # Decode the message data
30
28
  message_data = base64.b64decode(data['message']['data']).decode('utf-8')
31
29
  attributes = data['message'].get('attributes', {})
32
30
  messageId = data['message'].get('messageId')
@@ -38,6 +36,20 @@ def process_pubsub_message(data: dict) -> tuple:
38
36
  log.info(f"Process Pub/Sub was triggered by messageId {messageId} published at {publishTime}")
39
37
  log.debug(f"Process Pub/Sub data: {message_data}")
40
38
 
39
+ return message_data, attributes, vector_name
40
+
41
+ def process_pubsub_message(data: dict) -> tuple:
42
+ """Extracts message data and metadata from a Pub/Sub message for a Cloud Storage event.
43
+
44
+ Args:
45
+ data (dict): The Pub/Sub message data.
46
+
47
+ Returns:
48
+ tuple: A tuple containing the message data and attributes as metadata.
49
+ """
50
+ # Decode the message data
51
+ message_data, attributes, vector_name = decode_pubsub_message(data)
52
+
41
53
  # Check for a valid GCS event type and payload format
42
54
  if attributes.get("eventType") == "OBJECT_FINALIZE" and attributes.get("payloadFormat") == "JSON_API_V1":
43
55
  objectId = attributes.get("objectId")
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sunholo
3
- Version: 0.81.5
3
+ Version: 0.82.1
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.81.5.tar.gz
6
+ Download-URL: https://github.com/sunholo-data/sunholo-py/archive/refs/tags/v0.82.1.tar.gz
7
7
  Author: Holosun ApS
8
8
  Author-email: multivac@sunholo.com
9
9
  License: Apache License, Version 2.0
@@ -20,9 +20,9 @@ Description-Content-Type: text/markdown
20
20
  License-File: LICENSE.txt
21
21
  Requires-Dist: google-auth
22
22
  Requires-Dist: ruamel.yaml
23
- Requires-Dist: langchain >=0.2.5
23
+ Requires-Dist: langchain >=0.2.12
24
24
  Requires-Dist: langchain-experimental >0.0.60
25
- Requires-Dist: langchain-community
25
+ Requires-Dist: langchain-community >=0.2.11
26
26
  Provides-Extra: all
27
27
  Requires-Dist: asyncpg ; extra == 'all'
28
28
  Requires-Dist: azure-identity ; extra == 'all'
@@ -7,7 +7,7 @@ sunholo/agents/langserve.py,sha256=C46ph2mnygr6bdHijYWYyfQDI9ylAF0_9Kx2PfcCJpU,4
7
7
  sunholo/agents/pubsub.py,sha256=TscZN_6am6DfaQkC-Yl18ZIBOoLE-0nDSiil6GpQEh4,1344
8
8
  sunholo/agents/route.py,sha256=Mo-YOHDsHOiQXfb6VmCH0BPThAD-0jZGIkIKAHxSDdc,2986
9
9
  sunholo/agents/special_commands.py,sha256=YhN8_E4cGZVvagN5_fouaxZiVbxr7PEhSzoFcvTKH54,6501
10
- sunholo/agents/swagger.py,sha256=Z01v5Yk6_nW5FPCuwjYcx3_0ISIXJOlA-kQFCQTtqRA,10673
10
+ sunholo/agents/swagger.py,sha256=2tzGmpveUMmTREykZvVnDj3j295wyOMu7mUFDnXdY3c,10671
11
11
  sunholo/agents/fastapi/__init__.py,sha256=S_pj4_bTUmDGoq_exaREHlOKThi0zTuGT0VZY0YfODQ,88
12
12
  sunholo/agents/fastapi/base.py,sha256=W-cyF8ZDUH40rc-c-Apw3-_8IIi2e4Y9qRtnoVnsc1Q,2521
13
13
  sunholo/agents/fastapi/qna_routes.py,sha256=lKHkXPmwltu9EH3RMwmD153-J6pE7kWQ4BhBlV3to-s,3864
@@ -78,12 +78,12 @@ sunholo/discovery_engine/get_ai_search_chunks.py,sha256=VPzdYoBP_E6Bko0KpX656QiI
78
78
  sunholo/embedder/__init__.py,sha256=sI4N_CqgEVcrMDxXgxKp1FsfsB4FpjoXgPGkl4N_u4I,44
79
79
  sunholo/embedder/embed_chunk.py,sha256=MCbTePWjUbIRVDFFhHJ94BvOZvIom62-mTr0PmfQyt0,6951
80
80
  sunholo/gcs/__init__.py,sha256=SZvbsMFDko40sIRHTHppA37IijvJTae54vrhooEF5-4,90
81
- sunholo/gcs/add_file.py,sha256=wkBQBfnjUbItnRNGiG9oBr7Jf2QfLpZf2nA5zT435ss,7107
81
+ sunholo/gcs/add_file.py,sha256=TRbdEd3j-lFnyC7kqs5IWEPMPlDMFLR68fdTWga06Wo,8096
82
82
  sunholo/gcs/download_folder.py,sha256=ijJTnS595JqZhBH8iHFErQilMbkuKgL-bnTCMLGuvlA,1614
83
83
  sunholo/gcs/download_url.py,sha256=q1NiJSvEhdNrmU5ZJ-sBCMC_J5CxzrajY8LRgdPOV_M,6130
84
84
  sunholo/gcs/metadata.py,sha256=oQLcXi4brsZ74aegWyC1JZmhlaEV270HS5_UWtAYYWE,898
85
85
  sunholo/invoke/__init__.py,sha256=bELcqIjzKvaupcIN5OQmDgGx_8jARtH9T6PCe8UgcvE,99
86
- sunholo/invoke/direct_vac_func.py,sha256=wvrYDZNLoLeO_uQiqRdGUlhwjhLr05dVNBST9TxwwBA,4478
86
+ sunholo/invoke/direct_vac_func.py,sha256=L_Gz7hEbZQqAZn2j5ehB-eIXmCEYmSZ7F95mjbYP9Nw,4489
87
87
  sunholo/invoke/invoke_vac_utils.py,sha256=sJc1edHTHMzMGXjji1N67c3iUaP7BmAL5nj82Qof63M,2053
88
88
  sunholo/langfuse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
89
  sunholo/langfuse/callback.py,sha256=jl0SZsFS53uMW9DGeM9SOL_EsRZsba0wwFGLqKzu9_U,1684
@@ -99,8 +99,8 @@ sunholo/patches/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
99
99
  sunholo/patches/langchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
100
100
  sunholo/patches/langchain/lancedb.py,sha256=KstVpYtI2E1s6_l_kq6js8ruIPJduO6nnvAXbqjoqCc,7507
101
101
  sunholo/patches/langchain/vertexai.py,sha256=kX1IvC2D1kMgM3SaSzP9HEosbD6CUymLJd7w9eXo3eE,17677
102
- sunholo/pubsub/__init__.py,sha256=wgkrtlL3h8uzNpnlWSHdVMOq0l5Q3D7gkxF_Rp1A6Ro,94
103
- sunholo/pubsub/process_pubsub.py,sha256=TH4gSZQI_6hWYTdgUKl-EhFQ0Mm8-HLXQWZuQYzEQQw,2667
102
+ sunholo/pubsub/__init__.py,sha256=DfTEk4zmCfqn6gFxRrqDO0pOrvXTDqH-medpgYO4PGw,117
103
+ sunholo/pubsub/process_pubsub.py,sha256=rN2N4WM6PZkMKDrdT8pnEfTvsXACRyJFqIHJQCbuxLs,3088
104
104
  sunholo/pubsub/pubsub_manager.py,sha256=19w_N0LiG-wgVWvgJ13b8BUeN8ZzgSPXAhPmL1HRRSI,6966
105
105
  sunholo/qna/__init__.py,sha256=F8q1uR_HreoSX0IfmKY1qoSwIgXhO2Q8kuDSxh9_-EE,28
106
106
  sunholo/qna/parsers.py,sha256=Ye3M0CUIIV9sSRU6yqM4p8bdJUh3QyrolSXbGnjMYD8,2153
@@ -134,9 +134,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
134
134
  sunholo/vertex/memory_tools.py,sha256=pgSahVDh7GPEulu3nl-w0jb5lTClb4TCnVxPnMokNZY,7533
135
135
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
136
136
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
137
- sunholo-0.81.5.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
138
- sunholo-0.81.5.dist-info/METADATA,sha256=fXdG0UEL0dbJuJPm85_8gk5POiaZCev7voNR_ypEg2c,7348
139
- sunholo-0.81.5.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
140
- sunholo-0.81.5.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
141
- sunholo-0.81.5.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
142
- sunholo-0.81.5.dist-info/RECORD,,
137
+ sunholo-0.82.1.dist-info/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
138
+ sunholo-0.82.1.dist-info/METADATA,sha256=araDojOf0d7xxwCeVn6OKRDMu6m7LTjP-Ay4631gU2E,7358
139
+ sunholo-0.82.1.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
140
+ sunholo-0.82.1.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
141
+ sunholo-0.82.1.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
142
+ sunholo-0.82.1.dist-info/RECORD,,